Loading apex/aconfig_test.go +3 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ func TestValidationAcrossContainersExportedPass(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { name: "my_aconfig_declarations_foo", Loading Loading @@ -339,6 +340,7 @@ func TestValidationAcrossContainersNotExportedFail(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { name: "my_aconfig_declarations_foo", Loading Loading @@ -761,6 +763,7 @@ func TestValidationNotPropagateAcrossShared(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } java_library { name: "my_java_library_foo", Loading apex/apex_test.go +35 −0 Original line number Diff line number Diff line Loading @@ -495,6 +495,7 @@ func TestBasicApex(t *testing.T) { "//apex_available:platform", "myapex", ], compile_dex: true, } dex_import { Loading Loading @@ -664,6 +665,7 @@ func TestDefaults(t *testing.T) { sdk_version: "none", system_modules: "none", apex_available: [ "myapex" ], compile_dex: true, } android_app { Loading Loading @@ -2035,6 +2037,7 @@ func TestApexMinSdkVersion_SupportsCodeNames_JavaLibs(t *testing.T) { apex_available: [ "myapex" ], sdk_version: "current", min_sdk_version: "S", // should be okay compile_dex: true, } `, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { Loading Loading @@ -2584,6 +2587,7 @@ func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) { "myapex", ], min_sdk_version: "30", compile_dex: true, } `) Loading Loading @@ -2611,6 +2615,7 @@ func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) { // Compile against core API surface sdk_version: "core_current", min_sdk_version: "30", compile_dex: true, } `) Loading Loading @@ -2658,6 +2663,7 @@ func TestApexMinSdkVersion_Okay(t *testing.T) { ], apex_available: ["myapex"], min_sdk_version: "29", compile_dex: true, } java_library { Loading Loading @@ -2737,6 +2743,7 @@ func TestJavaStableSdkVersion(t *testing.T) { srcs: ["foo/bar/MyClass.java"], sdk_version: "test_current", apex_available: ["myapex"], compile_dex: true, } `, }, Loading @@ -2761,6 +2768,7 @@ func TestJavaStableSdkVersion(t *testing.T) { sdk_version: "current", apex_available: ["myapex"], min_sdk_version: "29", compile_dex: true, } `, }, Loading @@ -2784,6 +2792,7 @@ func TestJavaStableSdkVersion(t *testing.T) { srcs: ["foo/bar/MyClass.java"], sdk_version: "test_current", apex_available: ["myapex"], compile_dex: true, } `, }, Loading @@ -2807,6 +2816,7 @@ func TestJavaStableSdkVersion(t *testing.T) { srcs: ["foo/bar/MyClass.java"], sdk_version: "core_platform", apex_available: ["myapex"], compile_dex: true, } `, preparer: java.FixtureUseLegacyCorePlatformApi("myjar-uses-legacy"), Loading Loading @@ -2835,6 +2845,7 @@ func TestJavaStableSdkVersion(t *testing.T) { sdk_version: "current", apex_available: ["myapex"], static_libs: ["transitive-jar"], compile_dex: true, } java_library { name: "transitive-jar", Loading Loading @@ -5913,6 +5924,7 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) { system_modules: "none", enabled: false, apex_available: ["myapex"], compile_dex: true, } `) } Loading Loading @@ -7525,6 +7537,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", compile_dex: true, } java_library { Loading @@ -7534,6 +7547,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", compile_dex: true, } prebuilt_apis { Loading Loading @@ -7643,6 +7657,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", compile_dex: true, } `), "source/a.java": nil, Loading @@ -7664,6 +7679,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) { public: { enabled: true, }, compile_dex: true, } `), "prebuilt/a.jar": nil, Loading @@ -7680,6 +7696,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) { public: { jars: ["a.jar"], }, compile_dex: true, } `), }), withFiles(filesForSdkLibrary), Loading Loading @@ -7758,6 +7775,7 @@ func TestCompatConfig(t *testing.T) { sdk_version: "none", system_modules: "none", apex_available: [ "myapex" ], compile_dex: true, } // Make sure that a preferred prebuilt does not affect the apex contents. Loading Loading @@ -7997,6 +8015,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) { "//apex_available:platform", ], min_sdk_version: "33", compile_dex: true, } java_library { Loading Loading @@ -8605,6 +8624,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", compile_dex: true, } java_library { name: "nonbcp_lib2", Loading @@ -8613,6 +8633,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { permitted_packages: ["a.b"], sdk_version: "none", system_modules: "none", compile_dex: true, } apex { name: "myapex", Loading @@ -8638,6 +8659,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { permitted_packages: ["foo.bar"], sdk_version: "none", system_modules: "none", compile_dex: true, } java_library { name: "bcp_lib2", Loading @@ -8646,6 +8668,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { permitted_packages: ["foo.bar", "bar.baz"], sdk_version: "none", system_modules: "none", compile_dex: true, } apex { name: "myapex", Loading Loading @@ -8676,6 +8699,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { sdk_version: "none", min_sdk_version: "29", system_modules: "none", compile_dex: true, } java_library { name: "bcp_lib_unrestricted", Loading @@ -8685,6 +8709,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { sdk_version: "none", min_sdk_version: "29", system_modules: "none", compile_dex: true, } apex { name: "myapex", Loading Loading @@ -9834,6 +9859,7 @@ func TestApexStrictUpdtabilityLint(t *testing.T) { }, sdk_version: "current", min_sdk_version: "29", compile_dex: true, } ` fs := android.MockFS{ Loading Loading @@ -10268,6 +10294,7 @@ func TestAconfigFilesJavaDeps(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } java_library { Loading @@ -10279,6 +10306,7 @@ func TestAconfigFilesJavaDeps(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { Loading Loading @@ -10365,6 +10393,7 @@ func TestAconfigFilesJavaAndCcDeps(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } cc_library { Loading Loading @@ -10691,6 +10720,7 @@ func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } java_library { Loading @@ -10702,6 +10732,7 @@ func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { Loading Loading @@ -10776,6 +10807,7 @@ func TestAconfigFilesRemoveDuplicates(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } java_library { Loading @@ -10787,6 +10819,7 @@ func TestAconfigFilesRemoveDuplicates(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { Loading Loading @@ -11469,6 +11502,7 @@ func TestApexMinSdkVersionOverride(t *testing.T) { apex_available: ["com.android.apex30"], min_sdk_version: "30", sdk_version: "current", compile_dex: true, } override_apex { Loading Loading @@ -11760,6 +11794,7 @@ func TestSdkLibraryTransitiveClassLoaderContext(t *testing.T) { "com.android.foo30", ], sdk_version: "core_current", compile_dex: true, } java_library { Loading apex/container_test.go +4 −2 Original line number Diff line number Diff line Loading @@ -15,10 +15,11 @@ package apex import ( "android/soong/android" "android/soong/java" "fmt" "testing" "android/soong/android" "android/soong/java" ) var checkContainerMatch = func(t *testing.T, name string, container string, expected bool, actual bool) { Loading Loading @@ -329,6 +330,7 @@ func TestUpdatableAndNonUpdatableApexesIdenticalMinSdkVersion(t *testing.T) { ], min_sdk_version: "30", sdk_version: "current", compile_dex: true, } `) Loading java/base.go +9 −15 Original line number Diff line number Diff line Loading @@ -766,7 +766,8 @@ func (j *Module) shouldInstrumentInApex(ctx android.BaseModuleContext) bool { apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) isJacocoAgent := ctx.ModuleName() == "jacocoagent" if j.DirectlyInAnyApex() && !isJacocoAgent && !apexInfo.IsForPlatform() { compileDex := Bool(j.dexProperties.Compile_dex) || Bool(j.properties.Installable) if compileDex && !isJacocoAgent && !apexInfo.IsForPlatform() { if !inList(ctx.ModuleName(), config.InstrumentFrameworkModules) { return true } else if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") { Loading Loading @@ -1735,20 +1736,10 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath completeStaticLibsImplementationJarsToCombine := completeStaticLibsImplementationJars // Enable dex compilation for the APEX variants, unless it is disabled explicitly compileDex := Bool(j.dexProperties.Compile_dex) apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) if j.DirectlyInAnyApex() && !apexInfo.IsForPlatform() { if j.dexProperties.Compile_dex == nil { compileDex = true } if j.deviceProperties.Hostdex == nil { j.deviceProperties.Hostdex = proptools.BoolPtr(true) } } if Bool(j.properties.Installable) { compileDex = true } // Enable dex compilation for the APEX variants, unless it is disabled explicitly compileDex := Bool(j.dexProperties.Compile_dex) || Bool(j.properties.Installable) if j.shouldInstrument(ctx) && (!ctx.Device() || compileDex) { instrumentedOutputFile := j.instrument(ctx, flags, outputFile, jarName, specs) Loading Loading @@ -2331,7 +2322,10 @@ func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret "stable.core.platform.api.stubs", "stub-annotations", "private-stub-annotations-jar", "core-lambda-stubs", "core-generated-annotation-stubs": "core-generated-annotation-stubs", // jacocoagent only uses core APIs, but has to specify a non-core sdk_version so it can use // a prebuilt SDK to avoid circular dependencies when it statically included in the bootclasspath. "jacocoagent": return javaCore, true case android.SdkPublic.DefaultJavaLibraryName(): return javaSdk, true Loading java/testing.go +1 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ var PrepareForTestWithJacocoInstrumentation = android.GroupFixturePreparers( "//apex_available:anyapex", "//apex_available:platform", ], compile_dex: true, } `)), ) Loading Loading
apex/aconfig_test.go +3 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,7 @@ func TestValidationAcrossContainersExportedPass(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { name: "my_aconfig_declarations_foo", Loading Loading @@ -339,6 +340,7 @@ func TestValidationAcrossContainersNotExportedFail(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { name: "my_aconfig_declarations_foo", Loading Loading @@ -761,6 +763,7 @@ func TestValidationNotPropagateAcrossShared(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } java_library { name: "my_java_library_foo", Loading
apex/apex_test.go +35 −0 Original line number Diff line number Diff line Loading @@ -495,6 +495,7 @@ func TestBasicApex(t *testing.T) { "//apex_available:platform", "myapex", ], compile_dex: true, } dex_import { Loading Loading @@ -664,6 +665,7 @@ func TestDefaults(t *testing.T) { sdk_version: "none", system_modules: "none", apex_available: [ "myapex" ], compile_dex: true, } android_app { Loading Loading @@ -2035,6 +2037,7 @@ func TestApexMinSdkVersion_SupportsCodeNames_JavaLibs(t *testing.T) { apex_available: [ "myapex" ], sdk_version: "current", min_sdk_version: "S", // should be okay compile_dex: true, } `, android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) { Loading Loading @@ -2584,6 +2587,7 @@ func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) { "myapex", ], min_sdk_version: "30", compile_dex: true, } `) Loading Loading @@ -2611,6 +2615,7 @@ func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) { // Compile against core API surface sdk_version: "core_current", min_sdk_version: "30", compile_dex: true, } `) Loading Loading @@ -2658,6 +2663,7 @@ func TestApexMinSdkVersion_Okay(t *testing.T) { ], apex_available: ["myapex"], min_sdk_version: "29", compile_dex: true, } java_library { Loading Loading @@ -2737,6 +2743,7 @@ func TestJavaStableSdkVersion(t *testing.T) { srcs: ["foo/bar/MyClass.java"], sdk_version: "test_current", apex_available: ["myapex"], compile_dex: true, } `, }, Loading @@ -2761,6 +2768,7 @@ func TestJavaStableSdkVersion(t *testing.T) { sdk_version: "current", apex_available: ["myapex"], min_sdk_version: "29", compile_dex: true, } `, }, Loading @@ -2784,6 +2792,7 @@ func TestJavaStableSdkVersion(t *testing.T) { srcs: ["foo/bar/MyClass.java"], sdk_version: "test_current", apex_available: ["myapex"], compile_dex: true, } `, }, Loading @@ -2807,6 +2816,7 @@ func TestJavaStableSdkVersion(t *testing.T) { srcs: ["foo/bar/MyClass.java"], sdk_version: "core_platform", apex_available: ["myapex"], compile_dex: true, } `, preparer: java.FixtureUseLegacyCorePlatformApi("myjar-uses-legacy"), Loading Loading @@ -2835,6 +2845,7 @@ func TestJavaStableSdkVersion(t *testing.T) { sdk_version: "current", apex_available: ["myapex"], static_libs: ["transitive-jar"], compile_dex: true, } java_library { name: "transitive-jar", Loading Loading @@ -5913,6 +5924,7 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) { system_modules: "none", enabled: false, apex_available: ["myapex"], compile_dex: true, } `) } Loading Loading @@ -7525,6 +7537,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", compile_dex: true, } java_library { Loading @@ -7534,6 +7547,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", compile_dex: true, } prebuilt_apis { Loading Loading @@ -7643,6 +7657,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", compile_dex: true, } `), "source/a.java": nil, Loading @@ -7664,6 +7679,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) { public: { enabled: true, }, compile_dex: true, } `), "prebuilt/a.jar": nil, Loading @@ -7680,6 +7696,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) { public: { jars: ["a.jar"], }, compile_dex: true, } `), }), withFiles(filesForSdkLibrary), Loading Loading @@ -7758,6 +7775,7 @@ func TestCompatConfig(t *testing.T) { sdk_version: "none", system_modules: "none", apex_available: [ "myapex" ], compile_dex: true, } // Make sure that a preferred prebuilt does not affect the apex contents. Loading Loading @@ -7997,6 +8015,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) { "//apex_available:platform", ], min_sdk_version: "33", compile_dex: true, } java_library { Loading Loading @@ -8605,6 +8624,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", compile_dex: true, } java_library { name: "nonbcp_lib2", Loading @@ -8613,6 +8633,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { permitted_packages: ["a.b"], sdk_version: "none", system_modules: "none", compile_dex: true, } apex { name: "myapex", Loading @@ -8638,6 +8659,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { permitted_packages: ["foo.bar"], sdk_version: "none", system_modules: "none", compile_dex: true, } java_library { name: "bcp_lib2", Loading @@ -8646,6 +8668,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { permitted_packages: ["foo.bar", "bar.baz"], sdk_version: "none", system_modules: "none", compile_dex: true, } apex { name: "myapex", Loading Loading @@ -8676,6 +8699,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { sdk_version: "none", min_sdk_version: "29", system_modules: "none", compile_dex: true, } java_library { name: "bcp_lib_unrestricted", Loading @@ -8685,6 +8709,7 @@ func TestApexPermittedPackagesRules(t *testing.T) { sdk_version: "none", min_sdk_version: "29", system_modules: "none", compile_dex: true, } apex { name: "myapex", Loading Loading @@ -9834,6 +9859,7 @@ func TestApexStrictUpdtabilityLint(t *testing.T) { }, sdk_version: "current", min_sdk_version: "29", compile_dex: true, } ` fs := android.MockFS{ Loading Loading @@ -10268,6 +10294,7 @@ func TestAconfigFilesJavaDeps(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } java_library { Loading @@ -10279,6 +10306,7 @@ func TestAconfigFilesJavaDeps(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { Loading Loading @@ -10365,6 +10393,7 @@ func TestAconfigFilesJavaAndCcDeps(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } cc_library { Loading Loading @@ -10691,6 +10720,7 @@ func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } java_library { Loading @@ -10702,6 +10732,7 @@ func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { Loading Loading @@ -10776,6 +10807,7 @@ func TestAconfigFilesRemoveDuplicates(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } java_library { Loading @@ -10787,6 +10819,7 @@ func TestAconfigFilesRemoveDuplicates(t *testing.T) { apex_available: [ "myapex", ], compile_dex: true, } aconfig_declarations { Loading Loading @@ -11469,6 +11502,7 @@ func TestApexMinSdkVersionOverride(t *testing.T) { apex_available: ["com.android.apex30"], min_sdk_version: "30", sdk_version: "current", compile_dex: true, } override_apex { Loading Loading @@ -11760,6 +11794,7 @@ func TestSdkLibraryTransitiveClassLoaderContext(t *testing.T) { "com.android.foo30", ], sdk_version: "core_current", compile_dex: true, } java_library { Loading
apex/container_test.go +4 −2 Original line number Diff line number Diff line Loading @@ -15,10 +15,11 @@ package apex import ( "android/soong/android" "android/soong/java" "fmt" "testing" "android/soong/android" "android/soong/java" ) var checkContainerMatch = func(t *testing.T, name string, container string, expected bool, actual bool) { Loading Loading @@ -329,6 +330,7 @@ func TestUpdatableAndNonUpdatableApexesIdenticalMinSdkVersion(t *testing.T) { ], min_sdk_version: "30", sdk_version: "current", compile_dex: true, } `) Loading
java/base.go +9 −15 Original line number Diff line number Diff line Loading @@ -766,7 +766,8 @@ func (j *Module) shouldInstrumentInApex(ctx android.BaseModuleContext) bool { apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) isJacocoAgent := ctx.ModuleName() == "jacocoagent" if j.DirectlyInAnyApex() && !isJacocoAgent && !apexInfo.IsForPlatform() { compileDex := Bool(j.dexProperties.Compile_dex) || Bool(j.properties.Installable) if compileDex && !isJacocoAgent && !apexInfo.IsForPlatform() { if !inList(ctx.ModuleName(), config.InstrumentFrameworkModules) { return true } else if ctx.Config().IsEnvTrue("EMMA_INSTRUMENT_FRAMEWORK") { Loading Loading @@ -1735,20 +1736,10 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath completeStaticLibsImplementationJarsToCombine := completeStaticLibsImplementationJars // Enable dex compilation for the APEX variants, unless it is disabled explicitly compileDex := Bool(j.dexProperties.Compile_dex) apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) if j.DirectlyInAnyApex() && !apexInfo.IsForPlatform() { if j.dexProperties.Compile_dex == nil { compileDex = true } if j.deviceProperties.Hostdex == nil { j.deviceProperties.Hostdex = proptools.BoolPtr(true) } } if Bool(j.properties.Installable) { compileDex = true } // Enable dex compilation for the APEX variants, unless it is disabled explicitly compileDex := Bool(j.dexProperties.Compile_dex) || Bool(j.properties.Installable) if j.shouldInstrument(ctx) && (!ctx.Device() || compileDex) { instrumentedOutputFile := j.instrument(ctx, flags, outputFile, jarName, specs) Loading Loading @@ -2331,7 +2322,10 @@ func (m *Module) getSdkLinkType(ctx android.BaseModuleContext, name string) (ret "stable.core.platform.api.stubs", "stub-annotations", "private-stub-annotations-jar", "core-lambda-stubs", "core-generated-annotation-stubs": "core-generated-annotation-stubs", // jacocoagent only uses core APIs, but has to specify a non-core sdk_version so it can use // a prebuilt SDK to avoid circular dependencies when it statically included in the bootclasspath. "jacocoagent": return javaCore, true case android.SdkPublic.DefaultJavaLibraryName(): return javaSdk, true Loading
java/testing.go +1 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ var PrepareForTestWithJacocoInstrumentation = android.GroupFixturePreparers( "//apex_available:anyapex", "//apex_available:platform", ], compile_dex: true, } `)), ) Loading