Loading android/arch.go +2 −43 Original line number Diff line number Diff line Loading @@ -255,7 +255,7 @@ func (os OsType) Bionic() bool { // Linux returns true if the OS uses the Linux kernel, i.e. if the OS is Android or is Linux // with or without the Bionic libc runtime. func (os OsType) Linux() bool { return os == Android || os == Linux || os == LinuxBionic || os == LinuxMusl return os == Android || os == Linux || os == LinuxBionic } // newOsType constructs an OsType and adds it to the global lists. Loading Loading @@ -305,8 +305,6 @@ var ( NoOsType OsType // Linux is the OS for the Linux kernel plus the glibc runtime. Linux = newOsType("linux_glibc", Host, false, X86, X86_64) // LinuxMusl is the OS for the Linux kernel plus the musl runtime. LinuxMusl = newOsType("linux_musl", Host, false, X86, X86_64) // Darwin is the OS for MacOS/Darwin host machines. Darwin = newOsType("darwin", Host, false, X86_64) // LinuxBionic is the OS for the Linux kernel plus the Bionic libc runtime, but without the Loading Loading @@ -865,8 +863,6 @@ func createArchPropTypeDesc(props reflect.Type) []archPropTypeDesc { "Android64", "Android32", "Bionic", "Glibc", "Musl", "Linux", "Not_windows", "Arm_on_x86", Loading Loading @@ -1112,30 +1108,6 @@ func (m *ModuleBase) setOSProperties(ctx BottomUpMutatorContext) { } } if os == Linux { field := "Glibc" prefix := "target.glibc" if bionicProperties, ok := getChildPropertyStruct(ctx, targetProp, field, prefix); ok { mergePropertyStruct(ctx, genProps, bionicProperties) } } if os == LinuxMusl { field := "Musl" prefix := "target.musl" if bionicProperties, ok := getChildPropertyStruct(ctx, targetProp, field, prefix); ok { mergePropertyStruct(ctx, genProps, bionicProperties) } // Special case: to ease the transition from glibc to musl, apply linux_glibc // properties (which has historically mean host linux) to musl variants. field = "Linux_glibc" prefix = "target.linux_glibc" if bionicProperties, ok := getChildPropertyStruct(ctx, targetProp, field, prefix); ok { mergePropertyStruct(ctx, genProps, bionicProperties) } } // Handle target OS properties in the form: // target: { // linux_glibc: { Loading Loading @@ -1338,16 +1310,6 @@ func getArchProperties(ctx BaseMutatorContext, archProperties interface{}, arch if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok { result = append(result, osArchProperties) } if os == LinuxMusl { // Special case: to ease the transition from glibc to musl, apply linux_glibc // properties (which has historically mean host linux) to musl variants. field := "Linux_glibc_" + archType.Name userFriendlyField := "target.linux_glibc_" + archType.Name if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok { result = append(result, osArchProperties) } } } // Handle arm on x86 properties in the form: Loading Loading @@ -1413,14 +1375,11 @@ func (m *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) { } // determineBuildOS stores the OS and architecture used for host targets used during the build into // config based on the runtime OS and architecture determined by Go and the product configuration. // config based on the runtime OS and architecture determined by Go. func determineBuildOS(config *config) { config.BuildOS = func() OsType { switch runtime.GOOS { case "linux": if Bool(config.productVariables.HostMusl) { return LinuxMusl } return Linux case "darwin": return Darwin Loading android/arch_test.go +2 −24 Original line number Diff line number Diff line Loading @@ -508,12 +508,9 @@ func TestArchProperties(t *testing.T) { bionic: { a: ["bionic"] }, host: { a: ["host"] }, android: { a: ["android"] }, glibc: { a: ["glibc"] }, musl: { a: ["musl"] }, linux_bionic: { a: ["linux_bionic"] }, linux: { a: ["linux"] }, linux_glibc: { a: ["linux_glibc"] }, linux_musl: { a: ["linux_musl"] }, windows: { a: ["windows"], enabled: true }, darwin: { a: ["darwin"] }, not_windows: { a: ["not_windows"] }, Loading @@ -525,8 +522,6 @@ func TestArchProperties(t *testing.T) { linux_x86_64: { a: ["linux_x86_64"] }, linux_glibc_x86: { a: ["linux_glibc_x86"] }, linux_glibc_x86_64: { a: ["linux_glibc_x86_64"] }, linux_musl_x86: { a: ["linux_musl_x86"] }, linux_musl_x86_64: { a: ["linux_musl_x86_64"] }, darwin_x86_64: { a: ["darwin_x86_64"] }, windows_x86: { a: ["windows_x86"] }, windows_x86_64: { a: ["windows_x86_64"] }, Loading Loading @@ -568,12 +563,12 @@ func TestArchProperties(t *testing.T) { { module: "foo", variant: "linux_glibc_x86_64", property: []string{"root", "host", "linux", "glibc", "linux_glibc", "not_windows", "x86_64", "lib64", "linux_x86_64", "linux_glibc_x86_64"}, property: []string{"root", "host", "linux", "linux_glibc", "not_windows", "x86_64", "lib64", "linux_x86_64", "linux_glibc_x86_64"}, }, { module: "foo", variant: "linux_glibc_x86", property: []string{"root", "host", "linux", "glibc", "linux_glibc", "not_windows", "x86", "lib32", "linux_x86", "linux_glibc_x86"}, property: []string{"root", "host", "linux", "linux_glibc", "not_windows", "x86", "lib32", "linux_x86", "linux_glibc_x86"}, }, }, }, Loading @@ -599,23 +594,6 @@ func TestArchProperties(t *testing.T) { }, }, }, { name: "linux_musl", goOS: "linux", preparer: FixtureModifyConfig(modifyTestConfigForMusl), results: []result{ { module: "foo", variant: "linux_musl_x86_64", property: []string{"root", "host", "linux", "musl", "linux_glibc", "linux_musl", "not_windows", "x86_64", "lib64", "linux_x86_64", "linux_musl_x86_64", "linux_glibc_x86_64"}, }, { module: "foo", variant: "linux_musl_x86", property: []string{"root", "host", "linux", "musl", "linux_glibc", "linux_musl", "not_windows", "x86", "lib32", "linux_x86", "linux_musl_x86", "linux_glibc_x86"}, }, }, }, { name: "darwin", goOS: "darwin", Loading android/config.go +0 −13 Original line number Diff line number Diff line Loading @@ -362,19 +362,6 @@ func modifyTestConfigToSupportArchMutator(testConfig Config) { config.TestProductVariables.DeviceSecondaryArchVariant = proptools.StringPtr("armv7-a-neon") } func modifyTestConfigForMusl(config Config) { delete(config.Targets, config.BuildOS) config.productVariables.HostMusl = boolPtr(true) determineBuildOS(config.config) config.Targets[config.BuildOS] = []Target{ {config.BuildOS, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", "", false}, {config.BuildOS, Arch{ArchType: X86}, NativeBridgeDisabled, "", "", false}, } config.BuildOSTarget = config.Targets[config.BuildOS][0] config.BuildOSCommonTarget = getCommonTargets(config.Targets[config.BuildOS])[0] } // TestArchConfig returns a Config object suitable for using for tests that // need to run the arch mutator. func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config { Loading android/paths.go +1 −1 Original line number Diff line number Diff line Loading @@ -1667,7 +1667,7 @@ func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string, partionPaths = []string{"target", "product", ctx.Config().DeviceName(), partition} } else { osName := os.String() if os == Linux || os == LinuxMusl { if os == Linux { // instead of linux_glibc osName = "linux" } Loading android/variable.go +0 −1 Original line number Diff line number Diff line Loading @@ -203,7 +203,6 @@ type productVariables struct { HostArch *string `json:",omitempty"` HostSecondaryArch *string `json:",omitempty"` HostMusl *bool `json:",omitempty"` CrossHost *string `json:",omitempty"` CrossHostArch *string `json:",omitempty"` Loading Loading
android/arch.go +2 −43 Original line number Diff line number Diff line Loading @@ -255,7 +255,7 @@ func (os OsType) Bionic() bool { // Linux returns true if the OS uses the Linux kernel, i.e. if the OS is Android or is Linux // with or without the Bionic libc runtime. func (os OsType) Linux() bool { return os == Android || os == Linux || os == LinuxBionic || os == LinuxMusl return os == Android || os == Linux || os == LinuxBionic } // newOsType constructs an OsType and adds it to the global lists. Loading Loading @@ -305,8 +305,6 @@ var ( NoOsType OsType // Linux is the OS for the Linux kernel plus the glibc runtime. Linux = newOsType("linux_glibc", Host, false, X86, X86_64) // LinuxMusl is the OS for the Linux kernel plus the musl runtime. LinuxMusl = newOsType("linux_musl", Host, false, X86, X86_64) // Darwin is the OS for MacOS/Darwin host machines. Darwin = newOsType("darwin", Host, false, X86_64) // LinuxBionic is the OS for the Linux kernel plus the Bionic libc runtime, but without the Loading Loading @@ -865,8 +863,6 @@ func createArchPropTypeDesc(props reflect.Type) []archPropTypeDesc { "Android64", "Android32", "Bionic", "Glibc", "Musl", "Linux", "Not_windows", "Arm_on_x86", Loading Loading @@ -1112,30 +1108,6 @@ func (m *ModuleBase) setOSProperties(ctx BottomUpMutatorContext) { } } if os == Linux { field := "Glibc" prefix := "target.glibc" if bionicProperties, ok := getChildPropertyStruct(ctx, targetProp, field, prefix); ok { mergePropertyStruct(ctx, genProps, bionicProperties) } } if os == LinuxMusl { field := "Musl" prefix := "target.musl" if bionicProperties, ok := getChildPropertyStruct(ctx, targetProp, field, prefix); ok { mergePropertyStruct(ctx, genProps, bionicProperties) } // Special case: to ease the transition from glibc to musl, apply linux_glibc // properties (which has historically mean host linux) to musl variants. field = "Linux_glibc" prefix = "target.linux_glibc" if bionicProperties, ok := getChildPropertyStruct(ctx, targetProp, field, prefix); ok { mergePropertyStruct(ctx, genProps, bionicProperties) } } // Handle target OS properties in the form: // target: { // linux_glibc: { Loading Loading @@ -1338,16 +1310,6 @@ func getArchProperties(ctx BaseMutatorContext, archProperties interface{}, arch if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok { result = append(result, osArchProperties) } if os == LinuxMusl { // Special case: to ease the transition from glibc to musl, apply linux_glibc // properties (which has historically mean host linux) to musl variants. field := "Linux_glibc_" + archType.Name userFriendlyField := "target.linux_glibc_" + archType.Name if osArchProperties, ok := getChildPropertyStruct(ctx, targetProp, field, userFriendlyField); ok { result = append(result, osArchProperties) } } } // Handle arm on x86 properties in the form: Loading Loading @@ -1413,14 +1375,11 @@ func (m *ModuleBase) setArchProperties(ctx BottomUpMutatorContext) { } // determineBuildOS stores the OS and architecture used for host targets used during the build into // config based on the runtime OS and architecture determined by Go and the product configuration. // config based on the runtime OS and architecture determined by Go. func determineBuildOS(config *config) { config.BuildOS = func() OsType { switch runtime.GOOS { case "linux": if Bool(config.productVariables.HostMusl) { return LinuxMusl } return Linux case "darwin": return Darwin Loading
android/arch_test.go +2 −24 Original line number Diff line number Diff line Loading @@ -508,12 +508,9 @@ func TestArchProperties(t *testing.T) { bionic: { a: ["bionic"] }, host: { a: ["host"] }, android: { a: ["android"] }, glibc: { a: ["glibc"] }, musl: { a: ["musl"] }, linux_bionic: { a: ["linux_bionic"] }, linux: { a: ["linux"] }, linux_glibc: { a: ["linux_glibc"] }, linux_musl: { a: ["linux_musl"] }, windows: { a: ["windows"], enabled: true }, darwin: { a: ["darwin"] }, not_windows: { a: ["not_windows"] }, Loading @@ -525,8 +522,6 @@ func TestArchProperties(t *testing.T) { linux_x86_64: { a: ["linux_x86_64"] }, linux_glibc_x86: { a: ["linux_glibc_x86"] }, linux_glibc_x86_64: { a: ["linux_glibc_x86_64"] }, linux_musl_x86: { a: ["linux_musl_x86"] }, linux_musl_x86_64: { a: ["linux_musl_x86_64"] }, darwin_x86_64: { a: ["darwin_x86_64"] }, windows_x86: { a: ["windows_x86"] }, windows_x86_64: { a: ["windows_x86_64"] }, Loading Loading @@ -568,12 +563,12 @@ func TestArchProperties(t *testing.T) { { module: "foo", variant: "linux_glibc_x86_64", property: []string{"root", "host", "linux", "glibc", "linux_glibc", "not_windows", "x86_64", "lib64", "linux_x86_64", "linux_glibc_x86_64"}, property: []string{"root", "host", "linux", "linux_glibc", "not_windows", "x86_64", "lib64", "linux_x86_64", "linux_glibc_x86_64"}, }, { module: "foo", variant: "linux_glibc_x86", property: []string{"root", "host", "linux", "glibc", "linux_glibc", "not_windows", "x86", "lib32", "linux_x86", "linux_glibc_x86"}, property: []string{"root", "host", "linux", "linux_glibc", "not_windows", "x86", "lib32", "linux_x86", "linux_glibc_x86"}, }, }, }, Loading @@ -599,23 +594,6 @@ func TestArchProperties(t *testing.T) { }, }, }, { name: "linux_musl", goOS: "linux", preparer: FixtureModifyConfig(modifyTestConfigForMusl), results: []result{ { module: "foo", variant: "linux_musl_x86_64", property: []string{"root", "host", "linux", "musl", "linux_glibc", "linux_musl", "not_windows", "x86_64", "lib64", "linux_x86_64", "linux_musl_x86_64", "linux_glibc_x86_64"}, }, { module: "foo", variant: "linux_musl_x86", property: []string{"root", "host", "linux", "musl", "linux_glibc", "linux_musl", "not_windows", "x86", "lib32", "linux_x86", "linux_musl_x86", "linux_glibc_x86"}, }, }, }, { name: "darwin", goOS: "darwin", Loading
android/config.go +0 −13 Original line number Diff line number Diff line Loading @@ -362,19 +362,6 @@ func modifyTestConfigToSupportArchMutator(testConfig Config) { config.TestProductVariables.DeviceSecondaryArchVariant = proptools.StringPtr("armv7-a-neon") } func modifyTestConfigForMusl(config Config) { delete(config.Targets, config.BuildOS) config.productVariables.HostMusl = boolPtr(true) determineBuildOS(config.config) config.Targets[config.BuildOS] = []Target{ {config.BuildOS, Arch{ArchType: X86_64}, NativeBridgeDisabled, "", "", false}, {config.BuildOS, Arch{ArchType: X86}, NativeBridgeDisabled, "", "", false}, } config.BuildOSTarget = config.Targets[config.BuildOS][0] config.BuildOSCommonTarget = getCommonTargets(config.Targets[config.BuildOS])[0] } // TestArchConfig returns a Config object suitable for using for tests that // need to run the arch mutator. func TestArchConfig(buildDir string, env map[string]string, bp string, fs map[string][]byte) Config { Loading
android/paths.go +1 −1 Original line number Diff line number Diff line Loading @@ -1667,7 +1667,7 @@ func pathForInstall(ctx PathContext, os OsType, arch ArchType, partition string, partionPaths = []string{"target", "product", ctx.Config().DeviceName(), partition} } else { osName := os.String() if os == Linux || os == LinuxMusl { if os == Linux { // instead of linux_glibc osName = "linux" } Loading
android/variable.go +0 −1 Original line number Diff line number Diff line Loading @@ -203,7 +203,6 @@ type productVariables struct { HostArch *string `json:",omitempty"` HostSecondaryArch *string `json:",omitempty"` HostMusl *bool `json:",omitempty"` CrossHost *string `json:",omitempty"` CrossHostArch *string `json:",omitempty"` Loading