Loading java/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ bootstrap_go_package { "soong-dexpreopt", "soong-genrule", "soong-java-config", "soong-python", "soong-remoteexec", "soong-tradefed", ], Loading java/java.go +44 −3 Original line number Diff line number Diff line Loading @@ -556,7 +556,20 @@ func (j *Module) XrefJavaFiles() android.Paths { } func InitJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported) { android.InitAndroidArchModule(module, hod, android.MultilibCommon) initJavaModule(module, hod, false) } func InitJavaModuleMultiTargets(module android.DefaultableModule, hod android.HostOrDeviceSupported) { initJavaModule(module, hod, true) } func initJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported, multiTargets bool) { multilib := android.MultilibCommon if multiTargets { android.InitAndroidMultiTargetsArchModule(module, hod, multilib) } else { android.InitAndroidArchModule(module, hod, multilib) } android.InitDefaultableModule(module) } Loading @@ -575,6 +588,7 @@ func IsJniDepTag(depTag blueprint.DependencyTag) bool { } var ( dataNativeBinsTag = dependencyTag{name: "dataNativeBins"} staticLibTag = dependencyTag{name: "staticlib"} libTag = dependencyTag{name: "javalib"} java9LibTag = dependencyTag{name: "java9lib"} Loading Loading @@ -2193,6 +2207,11 @@ type testProperties struct { Test_mainline_modules []string } type hostTestProperties struct { // list of native binary modules that should be installed alongside the test Data_native_bins []string `android:"arch_variant"` } type testHelperLibraryProperties struct { // list of compatibility suites (for example "cts", "vts") that the module should be // installed into. Loading @@ -2218,6 +2237,12 @@ type Test struct { data android.Paths } type TestHost struct { Test testHostProperties hostTestProperties } type TestHelperLibrary struct { Library Loading @@ -2232,11 +2257,26 @@ type JavaTestImport struct { testConfig android.Path } func (j *TestHost) DepsMutator(ctx android.BottomUpMutatorContext) { if len(j.testHostProperties.Data_native_bins) > 0 { for _, target := range ctx.MultiTargets() { ctx.AddVariationDependencies(target.Variations(), dataNativeBinsTag, j.testHostProperties.Data_native_bins...) } } j.deps(ctx) } func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template, j.testProperties.Test_suites, j.testProperties.Auto_gen_config) j.data = android.PathsForModuleSrc(ctx, j.testProperties.Data) ctx.VisitDirectDepsWithTag(dataNativeBinsTag, func(dep android.Module) { j.data = append(j.data, android.OutputFileForModule(ctx, dep, "")) }) j.Library.GenerateAndroidBuildActions(ctx) } Loading Loading @@ -2377,14 +2417,15 @@ func JavaTestImportFactory() android.Module { // A java_test_host has a single variant that produces a `.jar` file containing `.class` files that were // compiled against the host bootclasspath. func TestHostFactory() android.Module { module := &Test{} module := &TestHost{} module.addHostProperties() module.AddProperties(&module.testProperties) module.AddProperties(&module.testHostProperties) module.Module.properties.Installable = proptools.BoolPtr(true) InitJavaModule(module, android.HostSupported) InitJavaModuleMultiTargets(module, android.HostSupported) return module } Loading java/java_test.go +28 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import ( "android/soong/cc" "android/soong/dexpreopt" "android/soong/genrule" "android/soong/python" ) var buildDir string Loading Loading @@ -81,6 +82,7 @@ func testContext() *android.TestContext { ctx.RegisterModuleType("java_plugin", PluginFactory) ctx.RegisterModuleType("filegroup", android.FileGroupFactory) ctx.RegisterModuleType("genrule", genrule.GenRuleFactory) ctx.RegisterModuleType("python_binary_host", python.PythonBinaryHostFactory) RegisterDocsBuildComponents(ctx) RegisterStubsBuildComponents(ctx) RegisterSdkLibraryBuildComponents(ctx) Loading @@ -89,6 +91,7 @@ func testContext() *android.TestContext { RegisterPrebuiltApisBuildComponents(ctx) ctx.PreDepsMutators(python.RegisterPythonPreDepsMutators) ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators) ctx.RegisterPreSingletonType("overlay", android.SingletonFactoryAdaptor(OverlaySingletonFactory)) ctx.RegisterPreSingletonType("sdk_versions", android.SingletonFactoryAdaptor(sdkPreSingletonFactory)) Loading Loading @@ -2008,3 +2011,28 @@ func TestAidlExportIncludeDirsFromImports(t *testing.T) { t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag) } } func TestDataNativeBinaries(t *testing.T) { ctx, config := testJava(t, ` java_test_host { name: "foo", srcs: ["a.java"], data_native_bins: ["bin"] } python_binary_host { name: "bin", srcs: ["bin.py"], } `) buildOS := android.BuildOs.String() test := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost) entries := android.AndroidMkEntriesForTest(t, config, "", test)[0] expected := []string{buildDir + "/.intermediates/bin/" + buildOS + "_x86_64_PY3/bin:bin"} actual := entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"] if !reflect.DeepEqual(expected, actual) { t.Errorf("Unexpected test data - expected: %q, actual: %q", expected, actual) } } java/testing.go +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import ( "android/soong/android" "android/soong/cc" "android/soong/python" "github.com/google/blueprint" ) Loading Loading @@ -85,6 +87,10 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string "prebuilts/sdk/tools/core-lambda-stubs.jar": nil, "prebuilts/sdk/Android.bp": []byte(`prebuilt_apis { name: "sdk", api_dirs: ["14", "28", "30", "current"],}`), "bin.py": nil, python.StubTemplateHost: []byte(`PYTHON_BINARY = '%interpreter%' MAIN_FILE = '%main%'`), // For java_sdk_library "api/module-lib-current.txt": nil, "api/module-lib-removed.txt": nil, Loading python/binary.go +1 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ type IntermPathProvider interface { } var ( stubTemplateHost = "build/soong/python/scripts/stub_template_host.txt" StubTemplateHost = "build/soong/python/scripts/stub_template_host.txt" ) func NewBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator) { Loading Loading
java/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ bootstrap_go_package { "soong-dexpreopt", "soong-genrule", "soong-java-config", "soong-python", "soong-remoteexec", "soong-tradefed", ], Loading
java/java.go +44 −3 Original line number Diff line number Diff line Loading @@ -556,7 +556,20 @@ func (j *Module) XrefJavaFiles() android.Paths { } func InitJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported) { android.InitAndroidArchModule(module, hod, android.MultilibCommon) initJavaModule(module, hod, false) } func InitJavaModuleMultiTargets(module android.DefaultableModule, hod android.HostOrDeviceSupported) { initJavaModule(module, hod, true) } func initJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported, multiTargets bool) { multilib := android.MultilibCommon if multiTargets { android.InitAndroidMultiTargetsArchModule(module, hod, multilib) } else { android.InitAndroidArchModule(module, hod, multilib) } android.InitDefaultableModule(module) } Loading @@ -575,6 +588,7 @@ func IsJniDepTag(depTag blueprint.DependencyTag) bool { } var ( dataNativeBinsTag = dependencyTag{name: "dataNativeBins"} staticLibTag = dependencyTag{name: "staticlib"} libTag = dependencyTag{name: "javalib"} java9LibTag = dependencyTag{name: "java9lib"} Loading Loading @@ -2193,6 +2207,11 @@ type testProperties struct { Test_mainline_modules []string } type hostTestProperties struct { // list of native binary modules that should be installed alongside the test Data_native_bins []string `android:"arch_variant"` } type testHelperLibraryProperties struct { // list of compatibility suites (for example "cts", "vts") that the module should be // installed into. Loading @@ -2218,6 +2237,12 @@ type Test struct { data android.Paths } type TestHost struct { Test testHostProperties hostTestProperties } type TestHelperLibrary struct { Library Loading @@ -2232,11 +2257,26 @@ type JavaTestImport struct { testConfig android.Path } func (j *TestHost) DepsMutator(ctx android.BottomUpMutatorContext) { if len(j.testHostProperties.Data_native_bins) > 0 { for _, target := range ctx.MultiTargets() { ctx.AddVariationDependencies(target.Variations(), dataNativeBinsTag, j.testHostProperties.Data_native_bins...) } } j.deps(ctx) } func (j *Test) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.testConfig = tradefed.AutoGenJavaTestConfig(ctx, j.testProperties.Test_config, j.testProperties.Test_config_template, j.testProperties.Test_suites, j.testProperties.Auto_gen_config) j.data = android.PathsForModuleSrc(ctx, j.testProperties.Data) ctx.VisitDirectDepsWithTag(dataNativeBinsTag, func(dep android.Module) { j.data = append(j.data, android.OutputFileForModule(ctx, dep, "")) }) j.Library.GenerateAndroidBuildActions(ctx) } Loading Loading @@ -2377,14 +2417,15 @@ func JavaTestImportFactory() android.Module { // A java_test_host has a single variant that produces a `.jar` file containing `.class` files that were // compiled against the host bootclasspath. func TestHostFactory() android.Module { module := &Test{} module := &TestHost{} module.addHostProperties() module.AddProperties(&module.testProperties) module.AddProperties(&module.testHostProperties) module.Module.properties.Installable = proptools.BoolPtr(true) InitJavaModule(module, android.HostSupported) InitJavaModuleMultiTargets(module, android.HostSupported) return module } Loading
java/java_test.go +28 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import ( "android/soong/cc" "android/soong/dexpreopt" "android/soong/genrule" "android/soong/python" ) var buildDir string Loading Loading @@ -81,6 +82,7 @@ func testContext() *android.TestContext { ctx.RegisterModuleType("java_plugin", PluginFactory) ctx.RegisterModuleType("filegroup", android.FileGroupFactory) ctx.RegisterModuleType("genrule", genrule.GenRuleFactory) ctx.RegisterModuleType("python_binary_host", python.PythonBinaryHostFactory) RegisterDocsBuildComponents(ctx) RegisterStubsBuildComponents(ctx) RegisterSdkLibraryBuildComponents(ctx) Loading @@ -89,6 +91,7 @@ func testContext() *android.TestContext { RegisterPrebuiltApisBuildComponents(ctx) ctx.PreDepsMutators(python.RegisterPythonPreDepsMutators) ctx.PostDepsMutators(android.RegisterOverridePostDepsMutators) ctx.RegisterPreSingletonType("overlay", android.SingletonFactoryAdaptor(OverlaySingletonFactory)) ctx.RegisterPreSingletonType("sdk_versions", android.SingletonFactoryAdaptor(sdkPreSingletonFactory)) Loading Loading @@ -2008,3 +2011,28 @@ func TestAidlExportIncludeDirsFromImports(t *testing.T) { t.Errorf("aidl command %q does not contain %q", aidlCommand, expectedAidlFlag) } } func TestDataNativeBinaries(t *testing.T) { ctx, config := testJava(t, ` java_test_host { name: "foo", srcs: ["a.java"], data_native_bins: ["bin"] } python_binary_host { name: "bin", srcs: ["bin.py"], } `) buildOS := android.BuildOs.String() test := ctx.ModuleForTests("foo", buildOS+"_common").Module().(*TestHost) entries := android.AndroidMkEntriesForTest(t, config, "", test)[0] expected := []string{buildDir + "/.intermediates/bin/" + buildOS + "_x86_64_PY3/bin:bin"} actual := entries.EntryMap["LOCAL_COMPATIBILITY_SUPPORT_FILES"] if !reflect.DeepEqual(expected, actual) { t.Errorf("Unexpected test data - expected: %q, actual: %q", expected, actual) } }
java/testing.go +6 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,8 @@ import ( "android/soong/android" "android/soong/cc" "android/soong/python" "github.com/google/blueprint" ) Loading Loading @@ -85,6 +87,10 @@ func TestConfig(buildDir string, env map[string]string, bp string, fs map[string "prebuilts/sdk/tools/core-lambda-stubs.jar": nil, "prebuilts/sdk/Android.bp": []byte(`prebuilt_apis { name: "sdk", api_dirs: ["14", "28", "30", "current"],}`), "bin.py": nil, python.StubTemplateHost: []byte(`PYTHON_BINARY = '%interpreter%' MAIN_FILE = '%main%'`), // For java_sdk_library "api/module-lib-current.txt": nil, "api/module-lib-removed.txt": nil, Loading
python/binary.go +1 −1 Original line number Diff line number Diff line Loading @@ -65,7 +65,7 @@ type IntermPathProvider interface { } var ( stubTemplateHost = "build/soong/python/scripts/stub_template_host.txt" StubTemplateHost = "build/soong/python/scripts/stub_template_host.txt" ) func NewBinary(hod android.HostOrDeviceSupported) (*Module, *binaryDecorator) { Loading