diff options
| -rw-r--r-- | android/apex.go | 33 | ||||
| -rw-r--r-- | android/module_context.go | 5 | ||||
| -rw-r--r-- | android/prebuilt_test.go | 5 | ||||
| -rw-r--r-- | android/rule_builder.go | 1 | ||||
| -rw-r--r-- | android/variable.go | 2 | ||||
| -rw-r--r-- | apex/aconfig_test.go | 3 | ||||
| -rw-r--r-- | apex/apex_test.go | 35 | ||||
| -rw-r--r-- | apex/container_test.go | 6 | ||||
| -rw-r--r-- | cc/binary.go | 2 | ||||
| -rw-r--r-- | cc/cc.go | 5 | ||||
| -rw-r--r-- | cc/image.go | 7 | ||||
| -rw-r--r-- | cc/library.go | 26 | ||||
| -rw-r--r-- | cc/llndk_library.go | 11 | ||||
| -rw-r--r-- | cc/sanitize.go | 3 | ||||
| -rw-r--r-- | cmd/find_input_delta/find_input_delta_lib/internal_state.go | 11 | ||||
| -rw-r--r-- | cmd/find_input_delta/find_input_delta_lib/internal_state_test.go | 22 | ||||
| -rw-r--r-- | filesystem/bootimg.go | 8 | ||||
| -rw-r--r-- | filesystem/filesystem_test.go | 8 | ||||
| -rw-r--r-- | fsgen/Android.bp | 1 | ||||
| -rw-r--r-- | fsgen/boot_imgs.go | 78 | ||||
| -rw-r--r-- | fsgen/filesystem_creator.go | 69 | ||||
| -rw-r--r-- | fsgen/fsgen_mutators.go | 30 | ||||
| -rw-r--r-- | fsgen/vbmeta_partitions.go | 5 | ||||
| -rw-r--r-- | java/base.go | 37 | ||||
| -rw-r--r-- | java/droiddoc.go | 1 | ||||
| -rw-r--r-- | java/droidstubs.go | 4 | ||||
| -rw-r--r-- | java/java_test.go | 1 | ||||
| -rw-r--r-- | java/testing.go | 1 |
28 files changed, 280 insertions, 140 deletions
diff --git a/android/apex.go b/android/apex.go index 9277ff31b..1bfcf04d4 100644 --- a/android/apex.go +++ b/android/apex.go @@ -224,11 +224,8 @@ type ApexModule interface { // run. DirectlyInAnyApex() bool - // NotInPlatform tells whether or not this module is included in an APEX and therefore - // shouldn't be exposed to the platform (i.e. outside of the APEX) directly. A module is - // considered to be included in an APEX either when there actually is an APEX that - // explicitly has the module as its dependency or the module is not available to the - // platform, which indicates that the module belongs to at least one or more other APEXes. + // NotInPlatform returns true if the module is not available to the platform due to + // apex_available being set and not containing "//apex_available:platform". NotInPlatform() bool // Tests if this module could have APEX variants. Even when a module type implements @@ -291,14 +288,6 @@ type ApexProperties struct { // See ApexModule.DirectlyInAnyApex() DirectlyInAnyApex bool `blueprint:"mutated"` - // AnyVariantDirectlyInAnyApex is true in the primary variant of a module if _any_ variant - // of the module is directly in any apex. This includes host, arch, asan, etc. variants. It - // is unused in any variant that is not the primary variant. Ideally this wouldn't be used, - // as it incorrectly mixes arch variants if only one arch is in an apex, but a few places - // depend on it, for example when an ASAN variant is created before the apexMutator. Call - // this after apex.apexMutator is run. - AnyVariantDirectlyInAnyApex bool `blueprint:"mutated"` - // See ApexModule.NotAvailableForPlatform() NotAvailableForPlatform bool `blueprint:"mutated"` @@ -428,7 +417,7 @@ func (m *ApexModuleBase) DirectlyInAnyApex() bool { // Implements ApexModule func (m *ApexModuleBase) NotInPlatform() bool { - return m.ApexProperties.AnyVariantDirectlyInAnyApex || !m.AvailableFor(AvailableToPlatform) + return !m.AvailableFor(AvailableToPlatform) } // Implements ApexModule @@ -802,22 +791,6 @@ func UpdateDirectlyInAnyApex(mctx BottomUpMutatorContext, am ApexModule) { } return false }) - - if base.ApexProperties.DirectlyInAnyApex { - // Variants of a module are always visited sequentially in order, so it is safe to - // write to another variant of this module. For a BottomUpMutator the - // PrimaryModule() is visited first and FinalModule() is visited last. - mctx.FinalModule().(ApexModule).apexModuleBase().ApexProperties.AnyVariantDirectlyInAnyApex = true - } - - // If this is the FinalModule (last visited module) copy - // AnyVariantDirectlyInAnyApex to all the other variants - if mctx.IsFinalModule(am) { - mctx.VisitAllModuleVariants(func(variant Module) { - variant.(ApexModule).apexModuleBase().ApexProperties.AnyVariantDirectlyInAnyApex = - base.ApexProperties.AnyVariantDirectlyInAnyApex - }) - } } // ApexMembership tells how a module became part of an APEX. diff --git a/android/module_context.go b/android/module_context.go index 20149074e..ae7b54f66 100644 --- a/android/module_context.go +++ b/android/module_context.go @@ -831,6 +831,11 @@ func (m *moduleContext) ModuleInfoJSON() *ModuleInfoJSON { } func (m *moduleContext) SetOutputFiles(outputFiles Paths, tag string) { + for _, outputFile := range outputFiles { + if outputFile == nil { + panic("outputfiles cannot be nil") + } + } if tag == "" { if len(m.outputFiles.DefaultOutputFiles) > 0 { m.ModuleErrorf("Module %s default OutputFiles cannot be overwritten", m.ModuleName()) diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go index 5e4af0ba5..b90ef3b1c 100644 --- a/android/prebuilt_test.go +++ b/android/prebuilt_test.go @@ -508,11 +508,10 @@ func (p *prebuiltModule) Name() string { } func (p *prebuiltModule) GenerateAndroidBuildActions(ctx ModuleContext) { - var src Path if len(p.properties.Srcs) >= 1 { - src = p.prebuilt.SingleSourcePath(ctx) + src := p.prebuilt.SingleSourcePath(ctx) + ctx.SetOutputFiles(Paths{src}, "") } - ctx.SetOutputFiles(Paths{src}, "") } func (p *prebuiltModule) Prebuilt() *Prebuilt { diff --git a/android/rule_builder.go b/android/rule_builder.go index 403c18418..a1573868b 100644 --- a/android/rule_builder.go +++ b/android/rule_builder.go @@ -611,6 +611,7 @@ func (r *RuleBuilder) build(name string, desc string, ninjaEscapeCommandString b nsjailCmd.WriteString(" -m none:/tmp:tmpfs:size=1073741824") // 1GB, should be enough nsjailCmd.WriteString(" -D nsjail_build_sandbox") nsjailCmd.WriteString(" --disable_rlimits") + nsjailCmd.WriteString(" --skip_setsid") // ABFS relies on process-groups to track file operations nsjailCmd.WriteString(" -q") nsjailCmd.WriteString(" -- ") nsjailCmd.WriteString("/bin/bash -c ") diff --git a/android/variable.go b/android/variable.go index 2d43c6da4..88cf5a54b 100644 --- a/android/variable.go +++ b/android/variable.go @@ -610,6 +610,7 @@ type PartitionVariables struct { CopyImagesForTargetFilesZip bool `json:",omitempty"` // Boot image stuff + BuildingRamdiskImage bool `json:",omitempty"` ProductBuildBootImage bool `json:",omitempty"` ProductBuildInitBootImage bool `json:",omitempty"` BoardUsesRecoveryAsBoot bool `json:",omitempty"` @@ -618,6 +619,7 @@ type PartitionVariables struct { BoardBootimagePartitionSize string `json:",omitempty"` BoardInitBootimagePartitionSize string `json:",omitempty"` BoardBootHeaderVersion string `json:",omitempty"` + TargetKernelPath string `json:",omitempty"` // Avb (android verified boot) stuff BoardAvbEnable bool `json:",omitempty"` diff --git a/apex/aconfig_test.go b/apex/aconfig_test.go index 76227a9ab..0eb8ef479 100644 --- a/apex/aconfig_test.go +++ b/apex/aconfig_test.go @@ -60,6 +60,7 @@ func TestValidationAcrossContainersExportedPass(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } aconfig_declarations { name: "my_aconfig_declarations_foo", @@ -339,6 +340,7 @@ func TestValidationAcrossContainersNotExportedFail(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } aconfig_declarations { name: "my_aconfig_declarations_foo", @@ -761,6 +763,7 @@ func TestValidationNotPropagateAcrossShared(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } java_library { name: "my_java_library_foo", diff --git a/apex/apex_test.go b/apex/apex_test.go index d0494d67d..5b5fe5ff1 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -495,6 +495,7 @@ func TestBasicApex(t *testing.T) { "//apex_available:platform", "myapex", ], + compile_dex: true, } dex_import { @@ -664,6 +665,7 @@ func TestDefaults(t *testing.T) { sdk_version: "none", system_modules: "none", apex_available: [ "myapex" ], + compile_dex: true, } android_app { @@ -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) { @@ -2584,6 +2587,7 @@ func TestApexMinSdkVersion_ErrorIfIncompatibleVersion(t *testing.T) { "myapex", ], min_sdk_version: "30", + compile_dex: true, } `) @@ -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, } `) @@ -2658,6 +2663,7 @@ func TestApexMinSdkVersion_Okay(t *testing.T) { ], apex_available: ["myapex"], min_sdk_version: "29", + compile_dex: true, } java_library { @@ -2737,6 +2743,7 @@ func TestJavaStableSdkVersion(t *testing.T) { srcs: ["foo/bar/MyClass.java"], sdk_version: "test_current", apex_available: ["myapex"], + compile_dex: true, } `, }, @@ -2761,6 +2768,7 @@ func TestJavaStableSdkVersion(t *testing.T) { sdk_version: "current", apex_available: ["myapex"], min_sdk_version: "29", + compile_dex: true, } `, }, @@ -2784,6 +2792,7 @@ func TestJavaStableSdkVersion(t *testing.T) { srcs: ["foo/bar/MyClass.java"], sdk_version: "test_current", apex_available: ["myapex"], + compile_dex: true, } `, }, @@ -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"), @@ -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", @@ -5913,6 +5924,7 @@ func TestErrorsIfDepsAreNotEnabled(t *testing.T) { system_modules: "none", enabled: false, apex_available: ["myapex"], + compile_dex: true, } `) } @@ -7525,6 +7537,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", + compile_dex: true, } java_library { @@ -7534,6 +7547,7 @@ func TestJavaSDKLibrary_WithinApex(t *testing.T) { apex_available: ["myapex"], sdk_version: "none", system_modules: "none", + compile_dex: true, } prebuilt_apis { @@ -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, @@ -7664,6 +7679,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) { public: { enabled: true, }, + compile_dex: true, } `), "prebuilt/a.jar": nil, @@ -7680,6 +7696,7 @@ func TestJavaSDKLibrary_ImportPreferred(t *testing.T) { public: { jars: ["a.jar"], }, + compile_dex: true, } `), }), withFiles(filesForSdkLibrary), @@ -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. @@ -7997,6 +8015,7 @@ func TestSymlinksFromApexToSystem(t *testing.T) { "//apex_available:platform", ], min_sdk_version: "33", + compile_dex: true, } java_library { @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -9834,6 +9859,7 @@ func TestApexStrictUpdtabilityLint(t *testing.T) { }, sdk_version: "current", min_sdk_version: "29", + compile_dex: true, } ` fs := android.MockFS{ @@ -10268,6 +10294,7 @@ func TestAconfigFilesJavaDeps(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } java_library { @@ -10279,6 +10306,7 @@ func TestAconfigFilesJavaDeps(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } aconfig_declarations { @@ -10365,6 +10393,7 @@ func TestAconfigFilesJavaAndCcDeps(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } cc_library { @@ -10691,6 +10720,7 @@ func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } java_library { @@ -10702,6 +10732,7 @@ func TestAconfigFilesOnlyMatchCurrentApex(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } aconfig_declarations { @@ -10776,6 +10807,7 @@ func TestAconfigFilesRemoveDuplicates(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } java_library { @@ -10787,6 +10819,7 @@ func TestAconfigFilesRemoveDuplicates(t *testing.T) { apex_available: [ "myapex", ], + compile_dex: true, } aconfig_declarations { @@ -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 { @@ -11760,6 +11794,7 @@ func TestSdkLibraryTransitiveClassLoaderContext(t *testing.T) { "com.android.foo30", ], sdk_version: "core_current", + compile_dex: true, } java_library { diff --git a/apex/container_test.go b/apex/container_test.go index d1dfb9cab..395793f61 100644 --- a/apex/container_test.go +++ b/apex/container_test.go @@ -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) { @@ -329,6 +330,7 @@ func TestUpdatableAndNonUpdatableApexesIdenticalMinSdkVersion(t *testing.T) { ], min_sdk_version: "30", sdk_version: "current", + compile_dex: true, } `) diff --git a/cc/binary.go b/cc/binary.go index 2ac9a45bc..4b77bea64 100644 --- a/cc/binary.go +++ b/cc/binary.go @@ -505,7 +505,7 @@ func (binary *binaryDecorator) install(ctx ModuleContext, file android.Path) { // The original path becomes a symlink to the corresponding file in the // runtime APEX. translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled - if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !ctx.Host() && ctx.directlyInAnyApex() && + if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !ctx.Host() && !ctx.isSdkVariant() && !translatedArch && ctx.apexVariationName() == "" && !ctx.inRamdisk() && !ctx.inRecovery() && !ctx.inVendorRamdisk() { @@ -548,7 +548,6 @@ type ModuleContextIntf interface { apexSdkVersion() android.ApiLevel bootstrap() bool nativeCoverage() bool - directlyInAnyApex() bool isPreventInstall() bool isCfiAssemblySupportEnabled() bool getSharedFlags() *SharedFlags @@ -1692,10 +1691,6 @@ func (ctx *moduleContextImpl) nativeCoverage() bool { return ctx.mod.nativeCoverage() } -func (ctx *moduleContextImpl) directlyInAnyApex() bool { - return ctx.mod.DirectlyInAnyApex() -} - func (ctx *moduleContextImpl) isPreventInstall() bool { return ctx.mod.Properties.PreventInstall } diff --git a/cc/image.go b/cc/image.go index ee4048390..9766af3df 100644 --- a/cc/image.go +++ b/cc/image.go @@ -179,9 +179,6 @@ type ImageMutatableModule interface { // SnapshotVersion returns the snapshot version for this module. SnapshotVersion(mctx android.ImageInterfaceContext) string - // SdkVersion returns the SDK version for this module. - SdkVersion() string - // ExtraVariants returns the list of extra variants this module requires. ExtraVariants() []string @@ -370,7 +367,7 @@ func MutateImage(mctx android.ImageInterfaceContext, m ImageMutatableModule) { if m.HasProductVariant() { productVariantNeeded = true } - } else if vendorSpecific && m.SdkVersion() == "" { + } else if vendorSpecific { // This will be available in /vendor (or /odm) only vendorVariantNeeded = true } else { @@ -380,7 +377,7 @@ func MutateImage(mctx android.ImageInterfaceContext, m ImageMutatableModule) { coreVariantNeeded = true } - if coreVariantNeeded && productSpecific && m.SdkVersion() == "" { + if coreVariantNeeded && productSpecific { // The module has "product_specific: true" that does not create core variant. coreVariantNeeded = false productVariantNeeded = true diff --git a/cc/library.go b/cc/library.go index 4ce506e90..23ee9b141 100644 --- a/cc/library.go +++ b/cc/library.go @@ -656,7 +656,7 @@ func (library *libraryDecorator) compileModuleLibApiStubs(ctx ModuleContext, fla // However, having this distinction helps guard accidental // promotion or demotion of API and also helps the API review process b/191371676 var flag string - if ctx.Module().(android.ApexModule).NotInPlatform() { + if ctx.notInPlatform() { flag = "--apex" } else { flag = "--systemapi" @@ -740,6 +740,7 @@ type versionedInterface interface { hasLLNDKStubs() bool hasLLNDKHeaders() bool hasVendorPublicLibrary() bool + isLLNDKMovedToApex() bool } var _ libraryInterface = (*libraryDecorator)(nil) @@ -1750,21 +1751,17 @@ func (library *libraryDecorator) installSymlinkToRuntimeApex(ctx ModuleContext, func (library *libraryDecorator) install(ctx ModuleContext, file android.Path) { if library.shared() { - if library.hasStubsVariants() && !ctx.Host() && ctx.directlyInAnyApex() { + translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled + if library.hasStubsVariants() && !ctx.Host() && !ctx.isSdkVariant() && + InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !library.buildStubs() && + !translatedArch && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() { // Bionic libraries (e.g. libc.so) is installed to the bootstrap subdirectory. // The original path becomes a symlink to the corresponding file in the // runtime APEX. - translatedArch := ctx.Target().NativeBridge == android.NativeBridgeEnabled - if InstallToBootstrap(ctx.baseModuleName(), ctx.Config()) && !library.buildStubs() && - !translatedArch && !ctx.inRamdisk() && !ctx.inVendorRamdisk() && !ctx.inRecovery() { - if ctx.Device() { - library.installSymlinkToRuntimeApex(ctx, file) - } - library.baseInstaller.subDir = "bootstrap" + if ctx.Device() { + library.installSymlinkToRuntimeApex(ctx, file) } - } else if ctx.directlyInAnyApex() && ctx.IsLlndk() && !isBionic(ctx.baseModuleName()) { - // Skip installing LLNDK (non-bionic) libraries moved to APEX. - ctx.Module().HideFromMake() + library.baseInstaller.subDir = "bootstrap" } library.baseInstaller.install(ctx, file) @@ -1848,6 +1845,11 @@ func (library *libraryDecorator) hasLLNDKHeaders() bool { return Bool(library.Properties.Llndk.Llndk_headers) } +// isLLNDKMovedToApex returns true if this cc_library module sets the llndk.moved_to_apex property. +func (library *libraryDecorator) isLLNDKMovedToApex() bool { + return Bool(library.Properties.Llndk.Moved_to_apex) +} + // hasVendorPublicLibrary returns true if this cc_library module has a variant that will build // vendor public library stubs. func (library *libraryDecorator) hasVendorPublicLibrary() bool { diff --git a/cc/llndk_library.go b/cc/llndk_library.go index c7950f9ff..162dd5429 100644 --- a/cc/llndk_library.go +++ b/cc/llndk_library.go @@ -57,17 +57,18 @@ type llndkLibraryProperties struct { // if true, make this module available to provide headers to other modules that set // llndk.symbol_file. Llndk_headers *bool + + // moved_to_apex marks this module has having been distributed through an apex module. + Moved_to_apex *bool } func makeLlndkVars(ctx android.MakeVarsContext) { - // Make uses LLNDK_MOVED_TO_APEX_LIBRARIES to avoid installing libraries on /system if - // they been moved to an apex. + // Make uses LLNDK_MOVED_TO_APEX_LIBRARIES to generate the linker config. movedToApexLlndkLibraries := make(map[string]bool) ctx.VisitAllModules(func(module android.Module) { if library := moduleLibraryInterface(module); library != nil && library.hasLLNDKStubs() { - // Skip bionic libs, they are handled in different manner - name := library.implementationModuleName(module.(*Module).BaseModuleName()) - if module.(android.ApexModule).DirectlyInAnyApex() && !isBionic(name) { + if library.isLLNDKMovedToApex() { + name := library.implementationModuleName(module.(*Module).BaseModuleName()) movedToApexLlndkLibraries[name] = true } } diff --git a/cc/sanitize.go b/cc/sanitize.go index f0d734376..d8d8c7aef 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -1504,9 +1504,6 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) { if Bool(sanProps.Memtag_globals) { sanitizers = append(sanitizers, "memtag-globals") - // TODO(mitchp): For now, enable memtag-heap with memtag-globals because the linker - // isn't new enough (https://reviews.llvm.org/differential/changeset/?ref=4243566). - sanitizers = append(sanitizers, "memtag-heap") } if Bool(sanProps.Fuzzer) { diff --git a/cmd/find_input_delta/find_input_delta_lib/internal_state.go b/cmd/find_input_delta/find_input_delta_lib/internal_state.go index f0242b724..2b8c39527 100644 --- a/cmd/find_input_delta/find_input_delta_lib/internal_state.go +++ b/cmd/find_input_delta/find_input_delta_lib/internal_state.go @@ -18,7 +18,7 @@ import ( "errors" "fmt" "io/fs" - "path/filepath" + "regexp" "slices" fid_proto "android/soong/cmd/find_input_delta/find_input_delta_proto_internal" @@ -73,15 +73,16 @@ func CreateState(inputs []string, inspect_contents bool, fsys StatReadFileFS) (* return ret, nil } +// We ignore any suffix digit caused by sharding. +var InspectExtsZipRegexp = regexp.MustCompile("\\.(jar|apex|apk)[0-9]*$") + // Inspect the file and extract the state of the elements in the archive. // If this is not an archive of some sort, nil is returned. func InspectFileContents(name string) ([]*fid_proto.PartialCompileInput, error) { - switch filepath.Ext(name) { - case ".jar", ".apex", ".apk": + if InspectExtsZipRegexp.Match([]byte(name)) { return inspectZipFileContents(name) - default: - return nil, nil } + return nil, nil } func inspectZipFileContents(name string) ([]*fid_proto.PartialCompileInput, error) { diff --git a/cmd/find_input_delta/find_input_delta_lib/internal_state_test.go b/cmd/find_input_delta/find_input_delta_lib/internal_state_test.go index e69424c54..c168d5a6b 100644 --- a/cmd/find_input_delta/find_input_delta_lib/internal_state_test.go +++ b/cmd/find_input_delta/find_input_delta_lib/internal_state_test.go @@ -259,3 +259,25 @@ func TestCompareInternalState(t *testing.T) { } } } + +func TestCompareInspectExtsZipRegexp(t *testing.T) { + testCases := []struct { + Name string + Expected bool + }{ + {Name: ".jar", Expected: true}, + {Name: ".jar5", Expected: true}, + {Name: ".apex", Expected: true}, + {Name: ".apex9", Expected: true}, + {Name: ".apexx", Expected: false}, + {Name: ".apk", Expected: true}, + {Name: ".apk3", Expected: true}, + {Name: ".go", Expected: false}, + } + for _, tc := range testCases { + actual := InspectExtsZipRegexp.Match([]byte(tc.Name)) + if tc.Expected != actual { + t.Errorf("%s: expected %v, actual %v", tc.Name, tc.Expected, actual) + } + } +} diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go index c9bd61788..226d95cbf 100644 --- a/filesystem/bootimg.go +++ b/filesystem/bootimg.go @@ -26,19 +26,19 @@ import ( ) func init() { - android.RegisterModuleType("bootimg", bootimgFactory) + android.RegisterModuleType("bootimg", BootimgFactory) } type bootimg struct { android.ModuleBase - properties bootimgProperties + properties BootimgProperties output android.Path installDir android.InstallPath } -type bootimgProperties struct { +type BootimgProperties struct { // Set the name of the output. Defaults to <module_name>.img. Stem *string @@ -82,7 +82,7 @@ type bootimgProperties struct { } // bootimg is the image for the boot partition. It consists of header, kernel, ramdisk, and dtb. -func bootimgFactory() android.Module { +func BootimgFactory() android.Module { module := &bootimg{} module.AddProperties(&module.properties) android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst) diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go index f325d96ef..7c342cc8c 100644 --- a/filesystem/filesystem_test.go +++ b/filesystem/filesystem_test.go @@ -666,7 +666,9 @@ func TestUseSharedVariationOfNativeLib(t *testing.T) { partition := result.ModuleForTests("myfilesystem", "android_common") fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList")) - android.AssertDeepEquals(t, "cc_library listed in deps", "lib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo.so\nlib64/libm.so\n", fileList) + android.AssertDeepEquals(t, "cc_library listed in deps", + "lib64/bootstrap/libc.so\nlib64/bootstrap/libdl.so\nlib64/bootstrap/libm.so\nlib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo.so\nlib64/libm.so\n", + fileList) } // binfoo1 overrides binbar. transitive deps of binbar should not be installed. @@ -701,7 +703,9 @@ cc_library { partition := result.ModuleForTests("myfilesystem", "android_common") fileList := android.ContentFromFileRuleForTests(t, result.TestContext, partition.Output("fileList")) - android.AssertDeepEquals(t, "Shared library dep of overridden binary should not be installed", fileList, "bin/binfoo1\nlib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo2.so\nlib64/libm.so\n") + android.AssertDeepEquals(t, "Shared library dep of overridden binary should not be installed", + "bin/binfoo1\nlib64/bootstrap/libc.so\nlib64/bootstrap/libdl.so\nlib64/bootstrap/libm.so\nlib64/libc++.so\nlib64/libc.so\nlib64/libdl.so\nlib64/libfoo2.so\nlib64/libm.so\n", + fileList) } func TestInstallLinkerConfigFile(t *testing.T) { diff --git a/fsgen/Android.bp b/fsgen/Android.bp index 8cd7518cb..a0225811e 100644 --- a/fsgen/Android.bp +++ b/fsgen/Android.bp @@ -13,6 +13,7 @@ bootstrap_go_package { "soong-kernel", ], srcs: [ + "boot_imgs.go", "filesystem_creator.go", "fsgen_mutators.go", "prebuilt_etc_modules_gen.go", diff --git a/fsgen/boot_imgs.go b/fsgen/boot_imgs.go new file mode 100644 index 000000000..66d910750 --- /dev/null +++ b/fsgen/boot_imgs.go @@ -0,0 +1,78 @@ +package fsgen + +import ( + "android/soong/android" + "android/soong/filesystem" + "path/filepath" + + "github.com/google/blueprint/proptools" +) + +func createBootImage(ctx android.LoadHookContext) bool { + partitionVariables := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse + + if partitionVariables.TargetKernelPath == "" { + // There are potentially code paths that don't set TARGET_KERNEL_PATH + return false + } + + kernelDir := filepath.Dir(partitionVariables.TargetKernelPath) + kernelBase := filepath.Base(partitionVariables.TargetKernelPath) + kernelFilegroupName := generatedModuleName(ctx.Config(), "kernel") + + ctx.CreateModuleInDirectory( + android.FileGroupFactory, + kernelDir, + &struct { + Name *string + Srcs []string + Visibility []string + }{ + Name: proptools.StringPtr(kernelFilegroupName), + Srcs: []string{kernelBase}, + Visibility: []string{"//visibility:public"}, + }, + ) + + bootImageName := generatedModuleNameForPartition(ctx.Config(), "boot") + + ctx.CreateModule( + filesystem.BootimgFactory, + &filesystem.BootimgProperties{ + Kernel_prebuilt: proptools.StringPtr(":" + kernelFilegroupName), + Ramdisk_module: proptools.StringPtr(generatedModuleNameForPartition(ctx.Config(), "ramdisk")), + Header_version: proptools.StringPtr(partitionVariables.BoardBootHeaderVersion), + }, + &struct { + Name *string + }{ + Name: proptools.StringPtr(bootImageName), + }, + ) + return true +} + +// Returns the equivalent of the BUILDING_BOOT_IMAGE variable in make. Derived from this logic: +// https://cs.android.com/android/platform/superproject/main/+/main:build/make/core/board_config.mk;l=458;drc=5b55f926830963c02ab1d2d91e46442f04ba3af0 +func buildingBootImage(partitionVars android.PartitionVariables) bool { + if partitionVars.BoardUsesRecoveryAsBoot { + return false + } + + if partitionVars.ProductBuildBootImage { + return true + } + + if len(partitionVars.BoardPrebuiltBootimage) > 0 { + return false + } + + if len(partitionVars.BoardBootimagePartitionSize) > 0 { + return true + } + + // TODO: return true if BOARD_KERNEL_BINARIES is set and has a *_BOOTIMAGE_PARTITION_SIZE + // variable. However, I don't think BOARD_KERNEL_BINARIES is ever set in practice. + + return false +} diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index dca44f013..b1b8f6a56 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -47,6 +47,8 @@ type filesystemCreatorProps struct { Vbmeta_module_names []string `blueprint:"mutated"` Vbmeta_partition_names []string `blueprint:"mutated"` + + Boot_image string `blueprint:"mutated" android:"path_device_first"` } type filesystemCreator struct { @@ -71,6 +73,38 @@ func filesystemCreatorFactory() android.Module { return module } +func generatedPartitions(ctx android.LoadHookContext) []string { + generatedPartitions := []string{"system"} + if ctx.DeviceConfig().SystemExtPath() == "system_ext" { + generatedPartitions = append(generatedPartitions, "system_ext") + } + if ctx.DeviceConfig().BuildingVendorImage() && ctx.DeviceConfig().VendorPath() == "vendor" { + generatedPartitions = append(generatedPartitions, "vendor") + } + if ctx.DeviceConfig().BuildingProductImage() && ctx.DeviceConfig().ProductPath() == "product" { + generatedPartitions = append(generatedPartitions, "product") + } + if ctx.DeviceConfig().BuildingOdmImage() && ctx.DeviceConfig().OdmPath() == "odm" { + generatedPartitions = append(generatedPartitions, "odm") + } + if ctx.DeviceConfig().BuildingUserdataImage() && ctx.DeviceConfig().UserdataPath() == "data" { + generatedPartitions = append(generatedPartitions, "userdata") + } + if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingSystemDlkmImage { + generatedPartitions = append(generatedPartitions, "system_dlkm") + } + if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingVendorDlkmImage { + generatedPartitions = append(generatedPartitions, "vendor_dlkm") + } + if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingOdmDlkmImage { + generatedPartitions = append(generatedPartitions, "odm_dlkm") + } + if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingRamdiskImage { + generatedPartitions = append(generatedPartitions, "ramdisk") + } + return generatedPartitions +} + func (f *filesystemCreator) createInternalModules(ctx android.LoadHookContext) { soongGeneratedPartitions := generatedPartitions(ctx) finalSoongGeneratedPartitions := make([]string, 0, len(soongGeneratedPartitions)) @@ -83,6 +117,14 @@ func (f *filesystemCreator) createInternalModules(ctx android.LoadHookContext) { } } + if buildingBootImage(ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse) { + if createBootImage(ctx) { + f.properties.Boot_image = ":" + generatedModuleNameForPartition(ctx.Config(), "boot") + } else { + f.properties.Unsupported_partition_types = append(f.properties.Unsupported_partition_types, "boot") + } + } + for _, x := range createVbmetaPartitions(ctx, finalSoongGeneratedPartitions) { f.properties.Vbmeta_module_names = append(f.properties.Vbmeta_module_names, x.moduleName) f.properties.Vbmeta_partition_names = append(f.properties.Vbmeta_partition_names, x.partitionName) @@ -176,7 +218,6 @@ func partitionSpecificFsProps(fsProps *filesystem.FilesystemProperties, partitio Name: proptools.StringPtr("system/lib/modules"), }, } - fsProps.Base_dir = proptools.StringPtr("system") case "system_ext": fsProps.Fsverity.Inputs = []string{ "framework/*", @@ -198,7 +239,6 @@ func partitionSpecificFsProps(fsProps *filesystem.FilesystemProperties, partitio Name: proptools.StringPtr("vendor/lib/modules"), }, } - fsProps.Base_dir = proptools.StringPtr("vendor") case "odm": fsProps.Symlinks = []filesystem.SymlinkDefinition{ filesystem.SymlinkDefinition{ @@ -206,7 +246,6 @@ func partitionSpecificFsProps(fsProps *filesystem.FilesystemProperties, partitio Name: proptools.StringPtr("odm/lib/modules"), }, } - fsProps.Base_dir = proptools.StringPtr("odm") case "userdata": fsProps.Base_dir = proptools.StringPtr("data") @@ -546,7 +585,7 @@ func generateFsProps(ctx android.EarlyModuleContext, partitionType string) (*fil return fsProps, true } -func (f *filesystemCreator) createDiffTest(ctx android.ModuleContext, partitionType string) android.Path { +func (f *filesystemCreator) createFileListDiffTest(ctx android.ModuleContext, partitionType string) android.Path { partitionModuleName := generatedModuleNameForPartition(ctx.Config(), partitionType) systemImage := ctx.GetDirectDepWithTag(partitionModuleName, generatedFilesystemDepTag) filesystemInfo, ok := android.OtherModuleProvider(ctx, systemImage, filesystem.FilesystemProvider) @@ -591,13 +630,17 @@ func createVbmetaDiff(ctx android.ModuleContext, vbmetaModuleName string, vbmeta makeVbmetaFile := android.PathForArbitraryOutput(ctx, fmt.Sprintf("target/product/%s/%s.img", ctx.Config().DeviceName(), vbmetaPartitionName)) diffTestResultFile := android.PathForModuleOut(ctx, fmt.Sprintf("diff_test_%s.txt", vbmetaModuleName)) + createDiffTest(ctx, diffTestResultFile, soongVbMetaFile, makeVbmetaFile) + return diffTestResultFile +} + +func createDiffTest(ctx android.ModuleContext, diffTestResultFile android.WritablePath, file1 android.Path, file2 android.Path) { builder := android.NewRuleBuilder(pctx, ctx) builder.Command().Text("diff"). - Input(soongVbMetaFile). - Input(makeVbmetaFile) + Input(file1). + Input(file2) builder.Command().Text("touch").Output(diffTestResultFile) - builder.Build(vbmetaModuleName+" diff test", vbmetaModuleName+" diff test") - return diffTestResultFile + builder.Build("diff test "+diffTestResultFile.String(), "diff test") } type systemImageDepTagType struct { @@ -634,7 +677,7 @@ func (f *filesystemCreator) GenerateAndroidBuildActions(ctx android.ModuleContex var diffTestFiles []android.Path for _, partitionType := range f.properties.Generated_partition_types { - diffTestFile := f.createDiffTest(ctx, partitionType) + diffTestFile := f.createFileListDiffTest(ctx, partitionType) diffTestFiles = append(diffTestFiles, diffTestFile) ctx.Phony(fmt.Sprintf("soong_generated_%s_filesystem_test", partitionType), diffTestFile) } @@ -648,6 +691,14 @@ func (f *filesystemCreator) GenerateAndroidBuildActions(ctx android.ModuleContex diffTestFiles = append(diffTestFiles, diffTestFile) ctx.Phony(fmt.Sprintf("soong_generated_%s_filesystem_test", f.properties.Vbmeta_partition_names[i]), diffTestFile) } + if f.properties.Boot_image != "" { + diffTestFile := android.PathForModuleOut(ctx, "boot_diff_test.txt") + soongBootImg := android.PathForModuleSrc(ctx, f.properties.Boot_image) + makeBootImage := android.PathForArbitraryOutput(ctx, fmt.Sprintf("target/product/%s/boot.img", ctx.Config().DeviceName())) + createDiffTest(ctx, diffTestFile, soongBootImg, makeBootImage) + diffTestFiles = append(diffTestFiles, diffTestFile) + ctx.Phony("soong_generated_boot_filesystem_test", diffTestFile) + } ctx.Phony("soong_generated_filesystem_tests", diffTestFiles...) } diff --git a/fsgen/fsgen_mutators.go b/fsgen/fsgen_mutators.go index 7b3026404..0d18660d5 100644 --- a/fsgen/fsgen_mutators.go +++ b/fsgen/fsgen_mutators.go @@ -84,36 +84,6 @@ func defaultDepCandidateProps(config android.Config) *depCandidateProps { } } -func generatedPartitions(ctx android.LoadHookContext) []string { - generatedPartitions := []string{"system", "ramdisk"} - if ctx.DeviceConfig().SystemExtPath() == "system_ext" { - generatedPartitions = append(generatedPartitions, "system_ext") - } - if ctx.DeviceConfig().BuildingVendorImage() && ctx.DeviceConfig().VendorPath() == "vendor" { - generatedPartitions = append(generatedPartitions, "vendor") - } - if ctx.DeviceConfig().BuildingProductImage() && ctx.DeviceConfig().ProductPath() == "product" { - generatedPartitions = append(generatedPartitions, "product") - } - if ctx.DeviceConfig().BuildingOdmImage() && ctx.DeviceConfig().OdmPath() == "odm" { - generatedPartitions = append(generatedPartitions, "odm") - } - if ctx.DeviceConfig().BuildingUserdataImage() && ctx.DeviceConfig().UserdataPath() == "data" { - generatedPartitions = append(generatedPartitions, "userdata") - } - if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingSystemDlkmImage { - generatedPartitions = append(generatedPartitions, "system_dlkm") - } - if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingVendorDlkmImage { - generatedPartitions = append(generatedPartitions, "vendor_dlkm") - } - if ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.BuildingOdmDlkmImage { - generatedPartitions = append(generatedPartitions, "odm_dlkm") - } - - return generatedPartitions -} - func createFsGenState(ctx android.LoadHookContext, generatedPrebuiltEtcModuleNames []string, avbpubkeyGenerated bool) *FsGenState { return ctx.Config().Once(fsGenStateOnceKey, func() interface{} { partitionVars := ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse diff --git a/fsgen/vbmeta_partitions.go b/fsgen/vbmeta_partitions.go index b7fff687d..11c57590c 100644 --- a/fsgen/vbmeta_partitions.go +++ b/fsgen/vbmeta_partitions.go @@ -19,6 +19,7 @@ import ( "android/soong/filesystem" "slices" "strconv" + "strings" "github.com/google/blueprint/proptools" ) @@ -153,8 +154,10 @@ func createVbmetaPartitions(ctx android.LoadHookContext, generatedPartitionTypes // Already handled by a chained vbmeta partition continue } - if partitionType == "ramdisk" { + if strings.Contains(partitionType, "ramdisk") || strings.Contains(partitionType, "boot") { // ramdisk is never signed with avb information + // boot partitions just have the avb footer, and don't have a corresponding vbmeta + // partition. continue } partitionModules = append(partitionModules, generatedModuleNameForPartition(ctx.Config(), partitionType)) diff --git a/java/base.go b/java/base.go index 8dad2d9ad..3bf2e23d8 100644 --- a/java/base.go +++ b/java/base.go @@ -714,10 +714,10 @@ func (j *Module) provideHiddenAPIPropertyInfo(ctx android.ModuleContext) { // helper method for java modules to set OutputFilesProvider func setOutputFiles(ctx android.ModuleContext, m Module) { - ctx.SetOutputFiles(append(android.Paths{m.outputFile}, m.extraOutputFiles...), "") - ctx.SetOutputFiles(android.Paths{m.outputFile}, android.DefaultDistTag) - ctx.SetOutputFiles(android.Paths{m.implementationAndResourcesJar}, ".jar") - ctx.SetOutputFiles(android.Paths{m.headerJarFile}, ".hjar") + ctx.SetOutputFiles(append(android.PathsIfNonNil(m.outputFile), m.extraOutputFiles...), "") + ctx.SetOutputFiles(android.PathsIfNonNil(m.outputFile), android.DefaultDistTag) + ctx.SetOutputFiles(android.PathsIfNonNil(m.implementationAndResourcesJar), ".jar") + ctx.SetOutputFiles(android.PathsIfNonNil(m.headerJarFile), ".hjar") if m.dexer.proguardDictionary.Valid() { ctx.SetOutputFiles(android.Paths{m.dexer.proguardDictionary.Path()}, ".proguard_map") } @@ -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") { @@ -1735,7 +1736,12 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath completeStaticLibsImplementationJarsToCombine := completeStaticLibsImplementationJars - if j.shouldInstrument(ctx) { + apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) + + // 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) completeStaticLibsImplementationJarsToCombine = depset.New(depset.PREORDER, android.Paths{instrumentedOutputFile}, nil) outputFile = instrumentedOutputFile @@ -1764,19 +1770,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath j.implementationAndResourcesJar = outputFile - // Enable dex compilation for the APEX variants, unless it is disabled explicitly - compileDex := j.dexProperties.Compile_dex - apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider) - if j.DirectlyInAnyApex() && !apexInfo.IsForPlatform() { - if compileDex == nil { - compileDex = proptools.BoolPtr(true) - } - if j.deviceProperties.Hostdex == nil { - j.deviceProperties.Hostdex = proptools.BoolPtr(true) - } - } - - if ctx.Device() && (Bool(j.properties.Installable) || Bool(compileDex)) { + if ctx.Device() && compileDex { if j.hasCode(ctx) { if j.shouldInstrumentStatic(ctx) { j.dexer.extraProguardFlagsFiles = append(j.dexer.extraProguardFlagsFiles, @@ -2328,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 diff --git a/java/droiddoc.go b/java/droiddoc.go index 82713920d..2dda72b0e 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -578,7 +578,6 @@ func (j *Javadoc) GenerateAndroidBuildActions(ctx android.ModuleContext) { rule.Build("javadoc", "javadoc") - ctx.SetOutputFiles(android.Paths{j.stubsSrcJar}, "") ctx.SetOutputFiles(android.Paths{j.docZip}, ".docs.zip") } diff --git a/java/droidstubs.go b/java/droidstubs.go index cf3e21925..bc2652797 100644 --- a/java/droidstubs.go +++ b/java/droidstubs.go @@ -1011,7 +1011,7 @@ func (d *Droidstubs) everythingOptionalCmd(ctx android.ModuleContext, cmd *andro cmd.FlagWithOutput("--update-baseline:api-lint ", updatedBaselineOutput) msg += fmt.Sprintf(``+ - `3. FOR LSC ONLY: You can update the baseline by executing\n` + + `3. FOR LSC ONLY: You can update the baseline by executing\n`+ ` the following command:\n`+ ` (cd $ANDROID_BUILD_TOP && cp \\\n`+ ` "%s" \\\n`+ @@ -1374,7 +1374,7 @@ func (d *Droidstubs) setOutputFiles(ctx android.ModuleContext) { for _, stubType := range android.SortedKeys(stubsTypeToPrefix) { tagWithPrefix := stubsTypeToPrefix[stubType] + tag outputFile, err := tagToOutputFileFunc[tag](stubType) - if err == nil { + if err == nil && outputFile != nil { ctx.SetOutputFiles(android.Paths{outputFile}, tagWithPrefix) } } diff --git a/java/java_test.go b/java/java_test.go index 54eb3e14e..d415679bd 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -3050,6 +3050,7 @@ func TestCoverage(t *testing.T) { java_library { name: "android.car", srcs: ["android.car.java"], + installable: true, } `) diff --git a/java/testing.go b/java/testing.go index 988514dea..cb3245ba7 100644 --- a/java/testing.go +++ b/java/testing.go @@ -190,6 +190,7 @@ var PrepareForTestWithJacocoInstrumentation = android.GroupFixturePreparers( "//apex_available:anyapex", "//apex_available:platform", ], + compile_dex: true, } `)), ) |