Skip to content

Commit

Permalink
not assemble darwin universal binary (elastic#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersonQ authored Mar 24, 2022
1 parent a568ca5 commit 0696c10
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
9 changes: 5 additions & 4 deletions dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/pkg/errors"

"github.com/elastic/beats/v7/libbeat/common/file"

"github.com/elastic/elastic-agent/dev-tools/mage/gotool"
)

Expand Down Expand Up @@ -182,10 +183,10 @@ func CrossBuild(options ...CrossBuildOption) error {
// Each build runs in parallel.
Parallel(deps...)

// It needs to run after all the builds, as it needs the darwin binaries.
if err := assembleDarwinUniversal(params); err != nil {
return err
}
// // It needs to run after all the builds, as it needs the darwin binaries.
// if err := assembleDarwinUniversal(params); err != nil {
// return err
// }

return nil
}
Expand Down
3 changes: 2 additions & 1 deletion dev-tools/mage/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ func Package() error {
"UseCommunityBeatPackaging, UseElasticBeatPackaging or USeElasticBeatWithoutXPackPackaging first.")
}

platforms := updateWithDarwinUniversal(Platforms)
// platforms := updateWithDarwinUniversal(Platforms)
platforms := Platforms

var tasks []interface{}
for _, target := range platforms {
Expand Down
48 changes: 24 additions & 24 deletions dev-tools/mage/pkgtypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ var OSArchNames = map[string]map[PackageType]map[string]string{
},
"darwin": map[PackageType]map[string]string{
TarGz: map[string]string{
"386": "x86",
"amd64": "x86_64",
"arm64": "aarch64",
"universal": "universal",
"386": "x86",
"amd64": "x86_64",
"arm64": "aarch64",
// "universal": "universal",
},
},
"linux": map[PackageType]map[string]string{
Expand Down Expand Up @@ -579,26 +579,26 @@ func PackageTarGz(spec PackageSpec) error {
w := tar.NewWriter(buf)
baseDir := spec.rootDir()

// Replace the darwin-universal by darwin-x86_64 and darwin-arm64. Also
// keep the other files.
if spec.Name == "elastic-agent" && spec.OS == "darwin" && spec.Arch == "universal" {
newFiles := map[string]PackageFile{}
for filename, pkgFile := range spec.Files {
if strings.Contains(pkgFile.Target, "darwin-universal") &&
strings.Contains(pkgFile.Target, "downloads") {

amdFilename, amdpkgFile := replaceFileArch(filename, pkgFile, "x86_64")
armFilename, armpkgFile := replaceFileArch(filename, pkgFile, "aarch64")

newFiles[amdFilename] = amdpkgFile
newFiles[armFilename] = armpkgFile
} else {
newFiles[filename] = pkgFile
}
}

spec.Files = newFiles
}
// // Replace the darwin-universal by darwin-x86_64 and darwin-arm64. Also
// // keep the other files.
// if spec.Name == "elastic-agent" && spec.OS == "darwin" && spec.Arch == "universal" {
// newFiles := map[string]PackageFile{}
// for filename, pkgFile := range spec.Files {
// if strings.Contains(pkgFile.Target, "darwin-universal") &&
// strings.Contains(pkgFile.Target, "downloads") {
//
// amdFilename, amdpkgFile := replaceFileArch(filename, pkgFile, "x86_64")
// armFilename, armpkgFile := replaceFileArch(filename, pkgFile, "aarch64")
//
// newFiles[amdFilename] = amdpkgFile
// newFiles[armFilename] = armpkgFile
// } else {
// newFiles[filename] = pkgFile
// }
// }
//
// spec.Files = newFiles
// }

// Add files to tar.
for _, pkgFile := range spec.Files {
Expand Down

0 comments on commit 0696c10

Please sign in to comment.