Merge "rust: fully disable all lints when no_lint is set"
diff --git a/android/Android.bp b/android/Android.bp
index ff14a70..a1b5159 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -41,6 +41,7 @@
"paths.go",
"phony.go",
"prebuilt.go",
+ "prebuilt_build_tool.go",
"proto.go",
"register.go",
"rule_builder.go",
diff --git a/android/androidmk.go b/android/androidmk.go
index 7e86140..fafbfd6 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -183,12 +183,15 @@
name := amod.BaseModuleName()
var ret []string
+ var availableTaggedDists TaggedDistFiles
- availableTaggedDists := TaggedDistFiles{}
if a.DistFiles != nil {
availableTaggedDists = a.DistFiles
} else if a.OutputFile.Valid() {
availableTaggedDists = MakeDefaultDistFiles(a.OutputFile.Path())
+ } else {
+ // Nothing dist-able for this module.
+ return nil
}
// Iterate over this module's dist structs, merged from the dist and dists properties.
diff --git a/android/apex.go b/android/apex.go
index cd84f8a..8c06b63 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -296,7 +296,10 @@
for i, mod := range modules {
platformVariation := i == 0
if platformVariation && !mctx.Host() && !mod.(ApexModule).AvailableFor(AvailableToPlatform) {
- mod.SkipInstall()
+ // Do not install the module for platform, but still allow it to output
+ // uninstallable AndroidMk entries in certain cases when they have
+ // side effects.
+ mod.MakeUninstallable()
}
if !platformVariation {
mod.(ApexModule).apexModuleBase().ApexProperties.Info = m.apexVariations[i-1]
diff --git a/android/config.go b/android/config.go
index 92a21a7..a6284f0 100644
--- a/android/config.go
+++ b/android/config.go
@@ -722,7 +722,7 @@
return Bool(c.productVariables.Allow_missing_dependencies)
}
-// Returns true if building without full platform sources.
+// Returns true if a full platform source tree cannot be assumed.
func (c *config) UnbundledBuild() bool {
return Bool(c.productVariables.Unbundled_build)
}
@@ -733,8 +733,9 @@
return Bool(c.productVariables.Unbundled_build_apps)
}
-func (c *config) UnbundledBuildUsePrebuiltSdks() bool {
- return Bool(c.productVariables.Unbundled_build) && !Bool(c.productVariables.Unbundled_build_sdks_from_source)
+// Returns true if building modules against prebuilt SDKs.
+func (c *config) AlwaysUsePrebuiltSdks() bool {
+ return Bool(c.productVariables.Always_use_prebuilt_sdks)
}
func (c *config) Fuchsia() bool {
@@ -1248,6 +1249,10 @@
return c.config.productVariables.BoardKernelBinaries
}
+func (c *deviceConfig) BoardKernelModuleInterfaceVersions() []string {
+ return c.config.productVariables.BoardKernelModuleInterfaceVersions
+}
+
// The ConfiguredJarList struct provides methods for handling a list of (apex, jar) pairs.
// Such lists are used in the build system for things like bootclasspath jars or system server jars.
// The apex part is either an apex name, or a special names "platform" or "system_ext". Jar is a
diff --git a/android/defs.go b/android/defs.go
index 4552224..83daa03 100644
--- a/android/defs.go
+++ b/android/defs.go
@@ -69,7 +69,7 @@
// A symlink rule.
Symlink = pctx.AndroidStaticRule("Symlink",
blueprint.RuleParams{
- Command: "ln -f -s $fromPath $out",
+ Command: "rm -f $out && ln -f -s $fromPath $out",
Description: "symlink $out",
},
"fromPath")
diff --git a/android/module.go b/android/module.go
index 8605954..6956167 100644
--- a/android/module.go
+++ b/android/module.go
@@ -256,6 +256,7 @@
InstallForceOS() *OsType
SkipInstall()
IsSkipInstall() bool
+ MakeUninstallable()
ExportedToMake() bool
InitRc() Paths
VintfFragments() Paths
@@ -568,6 +569,12 @@
type TaggedDistFiles map[string]Paths
func MakeDefaultDistFiles(paths ...Path) TaggedDistFiles {
+ for _, path := range paths {
+ if path == nil {
+ panic("The path to a dist file cannot be nil.")
+ }
+ }
+
// The default OutputFile tag is the empty "" string.
return TaggedDistFiles{"": paths}
}
@@ -1046,6 +1053,15 @@
return m.commonProperties.SkipInstall == true
}
+// Similar to SkipInstall, but if the AndroidMk entry would set
+// LOCAL_UNINSTALLABLE_MODULE then this variant may still output that entry
+// rather than leaving it out altogether. That happens in cases where it would
+// have other side effects, in particular when it adds a NOTICE file target,
+// which other install targets might depend on.
+func (m *ModuleBase) MakeUninstallable() {
+ m.SkipInstall()
+}
+
func (m *ModuleBase) ExportedToMake() bool {
return m.commonProperties.NamespaceExportedToMake
}
diff --git a/android/prebuilt_build_tool.go b/android/prebuilt_build_tool.go
new file mode 100644
index 0000000..1dcf199
--- /dev/null
+++ b/android/prebuilt_build_tool.go
@@ -0,0 +1,94 @@
+// Copyright 2020 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package android
+
+func init() {
+ RegisterModuleType("prebuilt_build_tool", prebuiltBuildToolFactory)
+}
+
+type prebuiltBuildToolProperties struct {
+ // Source file to be executed for this build tool
+ Src *string `android:"path,arch_variant"`
+
+ // Extra files that should trigger rules using this tool to rebuild
+ Deps []string `android:"path,arch_variant"`
+
+ // Create a make variable with the specified name that contains the path to
+ // this prebuilt built tool, relative to the root of the source tree.
+ Export_to_make_var *string
+}
+
+type prebuiltBuildTool struct {
+ ModuleBase
+ prebuilt Prebuilt
+
+ properties prebuiltBuildToolProperties
+
+ toolPath OptionalPath
+}
+
+func (t *prebuiltBuildTool) Name() string {
+ return t.prebuilt.Name(t.ModuleBase.Name())
+}
+
+func (t *prebuiltBuildTool) Prebuilt() *Prebuilt {
+ return &t.prebuilt
+}
+
+func (t *prebuiltBuildTool) DepsMutator(ctx BottomUpMutatorContext) {
+ if t.properties.Src == nil {
+ ctx.PropertyErrorf("src", "missing prebuilt source file")
+ }
+}
+
+func (t *prebuiltBuildTool) GenerateAndroidBuildActions(ctx ModuleContext) {
+ sourcePath := t.prebuilt.SingleSourcePath(ctx)
+ installedPath := PathForModuleOut(ctx, t.ModuleBase.Name())
+ deps := PathsForModuleSrc(ctx, t.properties.Deps)
+
+ ctx.Build(pctx, BuildParams{
+ Rule: Symlink,
+ Output: installedPath,
+ Input: sourcePath,
+ Implicits: deps,
+ Args: map[string]string{
+ "fromPath": "$$PWD/" + sourcePath.String(),
+ },
+ })
+
+ t.toolPath = OptionalPathForPath(installedPath)
+}
+
+func (t *prebuiltBuildTool) MakeVars(ctx MakeVarsModuleContext) {
+ if makeVar := String(t.properties.Export_to_make_var); makeVar != "" {
+ ctx.StrictRaw(makeVar, t.toolPath.String())
+ }
+}
+
+func (t *prebuiltBuildTool) HostToolPath() OptionalPath {
+ return t.toolPath
+}
+
+var _ HostToolProvider = &prebuiltBuildTool{}
+
+// prebuilt_build_tool is to declare prebuilts to be used during the build, particularly for use
+// in genrules with the "tools" property.
+func prebuiltBuildToolFactory() Module {
+ module := &prebuiltBuildTool{}
+ module.AddProperties(&module.properties)
+ InitSingleSourcePrebuiltModule(module, &module.properties, "Src")
+ InitAndroidArchModule(module, HostSupportedNoCross, MultilibFirst)
+ return module
+}
diff --git a/android/variable.go b/android/variable.go
index c1e1b42..9fb8577 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -214,30 +214,30 @@
AppsDefaultVersionName *string `json:",omitempty"`
- Allow_missing_dependencies *bool `json:",omitempty"`
- Unbundled_build *bool `json:",omitempty"`
- Unbundled_build_apps *bool `json:",omitempty"`
- Unbundled_build_sdks_from_source *bool `json:",omitempty"`
- Malloc_not_svelte *bool `json:",omitempty"`
- Malloc_zero_contents *bool `json:",omitempty"`
- Malloc_pattern_fill_contents *bool `json:",omitempty"`
- Safestack *bool `json:",omitempty"`
- HostStaticBinaries *bool `json:",omitempty"`
- Binder32bit *bool `json:",omitempty"`
- UseGoma *bool `json:",omitempty"`
- UseRBE *bool `json:",omitempty"`
- UseRBEJAVAC *bool `json:",omitempty"`
- UseRBER8 *bool `json:",omitempty"`
- UseRBED8 *bool `json:",omitempty"`
- Debuggable *bool `json:",omitempty"`
- Eng *bool `json:",omitempty"`
- Treble_linker_namespaces *bool `json:",omitempty"`
- Enforce_vintf_manifest *bool `json:",omitempty"`
- Pdk *bool `json:",omitempty"`
- Uml *bool `json:",omitempty"`
- Use_lmkd_stats_log *bool `json:",omitempty"`
- Arc *bool `json:",omitempty"`
- MinimizeJavaDebugInfo *bool `json:",omitempty"`
+ Allow_missing_dependencies *bool `json:",omitempty"`
+ Unbundled_build *bool `json:",omitempty"`
+ Unbundled_build_apps *bool `json:",omitempty"`
+ Always_use_prebuilt_sdks *bool `json:",omitempty"`
+ Malloc_not_svelte *bool `json:",omitempty"`
+ Malloc_zero_contents *bool `json:",omitempty"`
+ Malloc_pattern_fill_contents *bool `json:",omitempty"`
+ Safestack *bool `json:",omitempty"`
+ HostStaticBinaries *bool `json:",omitempty"`
+ Binder32bit *bool `json:",omitempty"`
+ UseGoma *bool `json:",omitempty"`
+ UseRBE *bool `json:",omitempty"`
+ UseRBEJAVAC *bool `json:",omitempty"`
+ UseRBER8 *bool `json:",omitempty"`
+ UseRBED8 *bool `json:",omitempty"`
+ Debuggable *bool `json:",omitempty"`
+ Eng *bool `json:",omitempty"`
+ Treble_linker_namespaces *bool `json:",omitempty"`
+ Enforce_vintf_manifest *bool `json:",omitempty"`
+ Pdk *bool `json:",omitempty"`
+ Uml *bool `json:",omitempty"`
+ Use_lmkd_stats_log *bool `json:",omitempty"`
+ Arc *bool `json:",omitempty"`
+ MinimizeJavaDebugInfo *bool `json:",omitempty"`
Check_elf_files *bool `json:",omitempty"`
@@ -345,7 +345,8 @@
BoardUsesRecoveryAsBoot *bool `json:",omitempty"`
- BoardKernelBinaries []string `json:",omitempty"`
+ BoardKernelBinaries []string `json:",omitempty"`
+ BoardKernelModuleInterfaceVersions []string `json:",omitempty"`
}
func boolPtr(v bool) *bool {
diff --git a/cc/androidmk.go b/cc/androidmk.go
index d106c0b..7c747c8 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -286,10 +286,8 @@
entries.SubName = "." + library.stubsVersion()
}
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
- // Note library.skipInstall() has a special case to get here for static
- // libraries that otherwise would have skipped installation and hence not
- // have executed AndroidMkEntries at all. The reason is to ensure they get
- // a NOTICE file make target which other libraries might depend on.
+ // library.makeUninstallable() depends on this to bypass SkipInstall() for
+ // static libraries.
entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
if library.buildStubs() {
entries.SetBool("LOCAL_NO_NOTICE_FILE", true)
diff --git a/cc/cc.go b/cc/cc.go
index 4b36218..6f1a06d 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -418,7 +418,7 @@
inSanitizerDir() bool
hostToolPath() android.OptionalPath
relativeInstallPath() string
- skipInstall(mod *Module)
+ makeUninstallable(mod *Module)
}
type xref interface {
@@ -2730,12 +2730,12 @@
return c.InRecovery()
}
-func (c *Module) SkipInstall() {
+func (c *Module) MakeUninstallable() {
if c.installer == nil {
- c.ModuleBase.SkipInstall()
+ c.ModuleBase.MakeUninstallable()
return
}
- c.installer.skipInstall(c)
+ c.installer.makeUninstallable(c)
}
func (c *Module) HostToolPath() android.OptionalPath {
diff --git a/cc/genrule_test.go b/cc/genrule_test.go
index d38cf27..a366f76 100644
--- a/cc/genrule_test.go
+++ b/cc/genrule_test.go
@@ -76,3 +76,42 @@
t.Errorf(`want arm64 inputs %v, got %v`, expected, gen.Inputs.Strings())
}
}
+
+func TestLibraryGenruleCmd(t *testing.T) {
+ bp := `
+ cc_library {
+ name: "libboth",
+ }
+
+ cc_library_shared {
+ name: "libshared",
+ }
+
+ cc_library_static {
+ name: "libstatic",
+ }
+
+ cc_genrule {
+ name: "gen",
+ tool_files: ["tool"],
+ srcs: [
+ ":libboth",
+ ":libshared",
+ ":libstatic",
+ ],
+ cmd: "$(location tool) $(in) $(out)",
+ out: ["out"],
+ }
+ `
+ ctx := testCc(t, bp)
+
+ gen := ctx.ModuleForTests("gen", "android_arm_armv7-a-neon").Output("out")
+ expected := []string{"libboth.so", "libshared.so", "libstatic.a"}
+ var got []string
+ for _, input := range gen.Inputs {
+ got = append(got, input.Base())
+ }
+ if !reflect.DeepEqual(expected, got) {
+ t.Errorf(`want inputs %v, got %v`, expected, got)
+ }
+}
diff --git a/cc/installer.go b/cc/installer.go
index 0b4a68c..e551c63 100644
--- a/cc/installer.go
+++ b/cc/installer.go
@@ -107,6 +107,6 @@
return String(installer.Properties.Relative_install_path)
}
-func (installer *baseInstaller) skipInstall(mod *Module) {
- mod.ModuleBase.SkipInstall()
+func (installer *baseInstaller) makeUninstallable(mod *Module) {
+ mod.ModuleBase.MakeUninstallable()
}
diff --git a/cc/library.go b/cc/library.go
index 2a329ac..89f480f 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -28,7 +28,6 @@
"android/soong/android"
"android/soong/cc/config"
- "android/soong/genrule"
)
type LibraryProperties struct {
@@ -1365,16 +1364,15 @@
return android.CheckAvailableForApex(what, list)
}
-func (library *libraryDecorator) skipInstall(mod *Module) {
+func (library *libraryDecorator) makeUninstallable(mod *Module) {
if library.static() && library.buildStatic() && !library.buildStubs() {
- // If we're asked to skip installation of a static library (in particular
- // when it's not //apex_available:platform) we still want an AndroidMk entry
- // for it to ensure we get the relevant NOTICE file targets (cf.
- // notice_files.mk) that other libraries might depend on. AndroidMkEntries
- // always sets LOCAL_UNINSTALLABLE_MODULE for these entries.
+ // If we're asked to make a static library uninstallable we don't do
+ // anything since AndroidMkEntries always sets LOCAL_UNINSTALLABLE_MODULE
+ // for these entries. This is done to still get the make targets for NOTICE
+ // files from notice_files.mk, which other libraries might depend on.
return
}
- mod.ModuleBase.SkipInstall()
+ mod.ModuleBase.MakeUninstallable()
}
var versioningMacroNamesListKey = android.NewOnceKey("versioningMacroNamesList")
@@ -1470,6 +1468,12 @@
static.linker.(prebuiltLibraryInterface).setStatic()
shared.linker.(prebuiltLibraryInterface).setShared()
+ if library.buildShared() {
+ mctx.AliasVariation("shared")
+ } else if library.buildStatic() {
+ mctx.AliasVariation("static")
+ }
+
if !library.buildStatic() {
static.linker.(prebuiltLibraryInterface).disablePrebuilt()
}
@@ -1501,18 +1505,22 @@
if _, ok := library.(*Module); ok {
reuseStaticLibrary(mctx, static.(*Module), shared.(*Module))
}
+ mctx.AliasVariation("shared")
} else if library.BuildStaticVariant() {
variations := append([]string{"static"}, variations...)
modules := mctx.CreateLocalVariations(variations...)
modules[0].(LinkableInterface).SetStatic()
+ mctx.AliasVariation("static")
} else if library.BuildSharedVariant() {
variations := append([]string{"shared"}, variations...)
modules := mctx.CreateLocalVariations(variations...)
modules[0].(LinkableInterface).SetShared()
+ mctx.AliasVariation("shared")
} else if len(variations) > 0 {
mctx.CreateLocalVariations(variations...)
+ mctx.AliasVariation(variations[0])
}
}
}
@@ -1559,13 +1567,14 @@
// "" is for the non-stubs variant
versions = append([]string{""}, versions...)
- modules := mctx.CreateVariations(versions...)
+ modules := mctx.CreateLocalVariations(versions...)
for i, m := range modules {
if versions[i] != "" {
m.(LinkableInterface).SetBuildStubs()
m.(LinkableInterface).SetStubsVersions(versions[i])
}
}
+ mctx.AliasVariation("")
}
func VersionVariantAvailable(module interface {
@@ -1600,7 +1609,7 @@
if c, ok := library.(*Module); ok && c.IsStubs() {
stubsVersionsLock.Lock()
defer stubsVersionsLock.Unlock()
- // For LLNDK llndk_library, we borrow vstubs.ersions from its implementation library.
+ // For LLNDK llndk_library, we borrow stubs.versions from its implementation library.
// Since llndk_library has dependency to its implementation library,
// we can safely access stubsVersionsFor() with its baseModuleName.
versions := stubsVersionsFor(mctx.Config())[c.BaseModuleName()]
@@ -1611,17 +1620,10 @@
return
}
- mctx.CreateVariations("")
+ mctx.CreateLocalVariations("")
+ mctx.AliasVariation("")
return
}
- if genrule, ok := mctx.Module().(*genrule.Module); ok {
- if _, ok := genrule.Extra.(*GenruleExtraProperties); ok {
- if VersionVariantAvailable(genrule) {
- mctx.CreateVariations("")
- return
- }
- }
- }
}
// maybeInjectBoringSSLHash adds a rule to run bssl_inject_hash on the output file if the module has the
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index 653b43e..baf43ce 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -199,10 +199,6 @@
p.properties.Srcs = nil
}
-func (p *prebuiltLibraryLinker) skipInstall(mod *Module) {
- mod.ModuleBase.SkipInstall()
-}
-
func NewPrebuiltLibrary(hod android.HostOrDeviceSupported) (*Module, *libraryDecorator) {
module, library := NewLibrary(hod)
module.compiler = nil
@@ -211,7 +207,6 @@
libraryDecorator: library,
}
module.linker = prebuilt
- module.installer = prebuilt
module.AddProperties(&prebuilt.properties)
diff --git a/cc/rs.go b/cc/rs.go
index 9149e17..de3e64b 100644
--- a/cc/rs.go
+++ b/cc/rs.go
@@ -25,7 +25,7 @@
func init() {
pctx.VariableFunc("rsCmd", func(ctx android.PackageVarContext) string {
- if ctx.Config().UnbundledBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
// Use RenderScript prebuilts for unbundled builds but not PDK builds
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin/llvm-rs-cc")
} else {
diff --git a/java/aar.go b/java/aar.go
index ad9b5e7..778e1cd 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -625,7 +625,7 @@
}
func (a *AARImport) DepsMutator(ctx android.BottomUpMutatorContext) {
- if !ctx.Config().UnbundledBuildUsePrebuiltSdks() {
+ if !ctx.Config().AlwaysUsePrebuiltSdks() {
sdkDep := decodeSdkDep(ctx, sdkContext(a))
if sdkDep.useModule && sdkDep.frameworkResModule != "" {
ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
@@ -641,9 +641,11 @@
var unzipAAR = pctx.AndroidStaticRule("unzipAAR",
blueprint.RuleParams{
Command: `rm -rf $outDir && mkdir -p $outDir && ` +
- `unzip -qoDD -d $outDir $in && rm -rf $outDir/res && touch $out`,
+ `unzip -qoDD -d $outDir $in && rm -rf $outDir/res && touch $out && ` +
+ `${config.MergeZipsCmd} $combinedClassesJar $$(ls $outDir/classes.jar 2> /dev/null) $$(ls $outDir/libs/*.jar 2> /dev/null)`,
+ CommandDeps: []string{"${config.MergeZipsCmd}"},
},
- "outDir")
+ "outDir", "combinedClassesJar")
func (a *AARImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(a.properties.Aars) != 1 {
@@ -661,7 +663,7 @@
}
extractedAARDir := android.PathForModuleOut(ctx, "aar")
- a.classpathFile = extractedAARDir.Join(ctx, "classes.jar")
+ a.classpathFile = extractedAARDir.Join(ctx, "classes-combined.jar")
a.proguardFlags = extractedAARDir.Join(ctx, "proguard.txt")
a.manifest = extractedAARDir.Join(ctx, "AndroidManifest.xml")
@@ -671,7 +673,8 @@
Outputs: android.WritablePaths{a.classpathFile, a.proguardFlags, a.manifest},
Description: "unzip AAR",
Args: map[string]string{
- "outDir": extractedAARDir.String(),
+ "outDir": extractedAARDir.String(),
+ "combinedClassesJar": a.classpathFile.String(),
},
})
diff --git a/java/androidmk.go b/java/androidmk.go
index 650d126..bc327cf 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -559,15 +559,21 @@
// are created in make if only the api txt file is being generated. This is
// needed because an invalid output file would prevent the make entries from
// being written.
+ //
+ // Note that dstubs.apiFile can be also be nil if WITHOUT_CHECKS_API is true.
// TODO(b/146727827): Revert when we do not need to generate stubs and API separately.
- distFile := dstubs.apiFile
+
+ var distFiles android.TaggedDistFiles
+ if dstubs.apiFile != nil {
+ distFiles = android.MakeDefaultDistFiles(dstubs.apiFile)
+ }
outputFile := android.OptionalPathForPath(dstubs.stubsSrcJar)
if !outputFile.Valid() {
- outputFile = android.OptionalPathForPath(distFile)
+ outputFile = android.OptionalPathForPath(dstubs.apiFile)
}
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
- DistFiles: android.MakeDefaultDistFiles(distFile),
+ DistFiles: distFiles,
OutputFile: outputFile,
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
diff --git a/java/app_test.go b/java/app_test.go
index efb4fd2..f50aa3a 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -2866,6 +2866,7 @@
config := testAppConfig(nil, bp, nil)
if unbundled {
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
+ config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
}
ctx := testContext()
diff --git a/java/config/config.go b/java/config/config.go
index d2f4513..d0296ff 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -128,7 +128,7 @@
pctx.HostBinToolVariable("ExtractApksCmd", "extract_apks")
pctx.VariableFunc("TurbineJar", func(ctx android.PackageVarContext) string {
turbine := "turbine.jar"
- if ctx.Config().UnbundledBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
return "prebuilts/build-tools/common/framework/" + turbine
} else {
return ctx.Config().HostJavaToolPath(ctx, turbine).String()
@@ -178,7 +178,7 @@
func hostBinToolVariableWithSdkToolsPrebuilt(name, tool string) {
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
- if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
return filepath.Join("prebuilts/sdk/tools", runtime.GOOS, "bin", tool)
} else {
return ctx.Config().HostToolPath(ctx, tool).String()
@@ -188,7 +188,7 @@
func hostJavaToolVariableWithSdkToolsPrebuilt(name, tool string) {
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
- if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
return filepath.Join("prebuilts/sdk/tools/lib", tool+".jar")
} else {
return ctx.Config().HostJavaToolPath(ctx, tool+".jar").String()
@@ -198,7 +198,7 @@
func hostJNIToolVariableWithSdkToolsPrebuilt(name, tool string) {
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
- if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
ext := ".so"
if runtime.GOOS == "darwin" {
ext = ".dylib"
@@ -212,7 +212,7 @@
func hostBinToolVariableWithBuildToolsPrebuilt(name, tool string) {
pctx.VariableFunc(name, func(ctx android.PackageVarContext) string {
- if ctx.Config().UnbundledBuild() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
return filepath.Join("prebuilts/build-tools", ctx.Config().PrebuiltOS(), "bin", tool)
} else {
return ctx.Config().HostToolPath(ctx, tool).String()
diff --git a/java/hiddenapi_singleton.go b/java/hiddenapi_singleton.go
index 1e6becb..de4a90f 100644
--- a/java/hiddenapi_singleton.go
+++ b/java/hiddenapi_singleton.go
@@ -100,7 +100,7 @@
// Add the android.test.base to the set of stubs only if the android.test.base module is on
// the boot jars list as the runtime will only enforce hiddenapi access against modules on
// that list.
- if inList("android.test.base", ctx.Config().BootJars()) && !ctx.Config().UnbundledBuildUsePrebuiltSdks() {
+ if inList("android.test.base", ctx.Config().BootJars()) && !ctx.Config().AlwaysUsePrebuiltSdks() {
publicStubModules = append(publicStubModules, "android.test.base.stubs")
}
diff --git a/java/lint.go b/java/lint.go
index 1bf7f69..f2091db 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -309,7 +309,7 @@
rule.Command().Text("mkdir -p").Flag(cacheDir.String()).Flag(homeDir.String())
var annotationsZipPath, apiVersionsXMLPath android.Path
- if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
annotationsZipPath = android.PathForSource(ctx, "prebuilts/sdk/current/public/data/annotations.zip")
apiVersionsXMLPath = android.PathForSource(ctx, "prebuilts/sdk/current/public/data/api-versions.xml")
} else {
@@ -395,7 +395,7 @@
}
func (l *lintSingleton) copyLintDependencies(ctx android.SingletonContext) {
- if ctx.Config().UnbundledBuildUsePrebuiltSdks() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() {
return
}
diff --git a/java/robolectric.go b/java/robolectric.go
index 4d68fd9..3fe6626 100644
--- a/java/robolectric.go
+++ b/java/robolectric.go
@@ -357,7 +357,7 @@
var _ android.TestSuiteModule = (*robolectricRuntimes)(nil)
func (r *robolectricRuntimes) DepsMutator(ctx android.BottomUpMutatorContext) {
- if !ctx.Config().UnbundledBuildUsePrebuiltSdks() && r.props.Lib != nil {
+ if !ctx.Config().AlwaysUsePrebuiltSdks() && r.props.Lib != nil {
ctx.AddVariationDependencies(nil, libTag, String(r.props.Lib))
}
}
@@ -371,8 +371,16 @@
r.runtimes = append(r.runtimes, installedRuntime)
}
- if !ctx.Config().UnbundledBuildUsePrebuiltSdks() && r.props.Lib != nil {
+ if !ctx.Config().AlwaysUsePrebuiltSdks() && r.props.Lib != nil {
runtimeFromSourceModule := ctx.GetDirectDepWithTag(String(r.props.Lib), libTag)
+ if runtimeFromSourceModule == nil {
+ if ctx.Config().AllowMissingDependencies() {
+ ctx.AddMissingDependencies([]string{String(r.props.Lib)})
+ } else {
+ ctx.PropertyErrorf("lib", "missing dependency %q", String(r.props.Lib))
+ }
+ return
+ }
runtimeFromSourceJar := android.OutputFileForModule(ctx, runtimeFromSourceModule, "")
runtimeName := fmt.Sprintf("android-all-%s-robolectric-r0.jar",
diff --git a/java/sdk.go b/java/sdk.go
index 5d79d1d..fa4c053 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -53,7 +53,7 @@
func UseApiFingerprint(ctx android.BaseModuleContext) bool {
if ctx.Config().UnbundledBuild() &&
- !ctx.Config().UnbundledBuildUsePrebuiltSdks() &&
+ !ctx.Config().AlwaysUsePrebuiltSdks() &&
ctx.Config().IsEnvTrue("UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT") {
return true
}
@@ -212,7 +212,7 @@
func (s sdkSpec) usePrebuilt(ctx android.EarlyModuleContext) bool {
if s.version.isCurrent() {
// "current" can be built from source and be from prebuilt SDK
- return ctx.Config().UnbundledBuildUsePrebuiltSdks()
+ return ctx.Config().AlwaysUsePrebuiltSdks()
} else if s.version.isNumbered() {
// validation check
if s.kind != sdkPublic && s.kind != sdkSystem && s.kind != sdkTest {
@@ -511,7 +511,7 @@
type sdkSingleton struct{}
func (sdkSingleton) GenerateBuildActions(ctx android.SingletonContext) {
- if ctx.Config().UnbundledBuildUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
return
}
@@ -634,7 +634,7 @@
} else if ctx.Config().IsPdkBuild() {
// TODO: get this from the PDK artifacts?
cmd.Text("echo PDK >").Output(out)
- } else if !ctx.Config().UnbundledBuildUsePrebuiltSdks() {
+ } else if !ctx.Config().AlwaysUsePrebuiltSdks() {
in, err := ctx.GlobWithDeps("frameworks/base/api/*current.txt", nil)
if err != nil {
ctx.Errorf("error globbing API files: %s", err)
@@ -663,7 +663,7 @@
}
func sdkMakeVars(ctx android.MakeVarsContext) {
- if ctx.Config().UnbundledBuildUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
+ if ctx.Config().AlwaysUsePrebuiltSdks() || ctx.Config().IsPdkBuild() {
return
}
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 0379a31..0ed8394 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1799,7 +1799,7 @@
func (module *SdkLibraryImport) createInternalModules(mctx android.DefaultableHookContext) {
// If the build is configured to use prebuilts then force this to be preferred.
- if mctx.Config().UnbundledBuildUsePrebuiltSdks() {
+ if mctx.Config().AlwaysUsePrebuiltSdks() {
module.prebuilt.ForcePrefer()
}
diff --git a/java/sdk_test.go b/java/sdk_test.go
index 395da79..13fc915 100644
--- a/java/sdk_test.go
+++ b/java/sdk_test.go
@@ -384,6 +384,7 @@
config := testConfig(nil, bpJava8, nil)
if testcase.unbundled {
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
+ config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
}
if testcase.pdk {
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
@@ -407,6 +408,7 @@
config := testConfig(nil, bp, nil)
if testcase.unbundled {
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
+ config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
}
if testcase.pdk {
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
@@ -433,6 +435,7 @@
if testcase.unbundled {
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
+ config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
}
if testcase.pdk {
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
@@ -451,6 +454,7 @@
if testcase.unbundled {
config.TestProductVariables.Unbundled_build = proptools.BoolPtr(true)
+ config.TestProductVariables.Always_use_prebuilt_sdks = proptools.BoolPtr(true)
}
if testcase.pdk {
config.TestProductVariables.Pdk = proptools.BoolPtr(true)
diff --git a/rust/config/allowed_list.go b/rust/config/allowed_list.go
index 9c9a136..22a0e63 100644
--- a/rust/config/allowed_list.go
+++ b/rust/config/allowed_list.go
@@ -7,6 +7,7 @@
"external/crosvm",
"external/adhd",
"prebuilts/rust",
+ "system/extras/profcollectd",
"system/security",
}
diff --git a/rust/rust.go b/rust/rust.go
index edfa5d8..113b0b2 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -807,8 +807,8 @@
directSrcProvidersDeps = append(directSrcProvidersDeps, rustDep)
}
- //Append the dependencies exportedDirs
- if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok {
+ //Append the dependencies exportedDirs, except for proc-macros which target a different arch/OS
+ if lib, ok := rustDep.compiler.(exportedFlagsProducer); ok && depTag != procMacroDepTag {
depPaths.linkDirs = append(depPaths.linkDirs, lib.exportedLinkDirs()...)
depPaths.depFlags = append(depPaths.depFlags, lib.exportedDepFlags()...)
}
diff --git a/third_party/zip/android.go b/third_party/zip/android.go
index 8d387cc..f8e45c5 100644
--- a/third_party/zip/android.go
+++ b/third_party/zip/android.go
@@ -43,6 +43,15 @@
offset: uint64(w.cw.count),
}
w.dir = append(w.dir, h)
+ if !fh.isZip64() {
+ // Some writers will generate 64 bit sizes and set 32 bit fields to
+ // uint32max even if the actual size fits in 32 bit. So we should
+ // make sure CompressedSize contains the correct value in such
+ // cases. With out the two lines below we would be writing invalid(-1)
+ // sizes in such case.
+ fh.CompressedSize = uint32(fh.CompressedSize64)
+ fh.UncompressedSize = uint32(fh.UncompressedSize64)
+ }
if err := writeHeader(w.cw, fh); err != nil {
return err
diff --git a/ui/metrics/metrics.go b/ui/metrics/metrics.go
index 2b5c4c3..12f74dd 100644
--- a/ui/metrics/metrics.go
+++ b/ui/metrics/metrics.go
@@ -17,6 +17,7 @@
import (
"io/ioutil"
"os"
+ "runtime"
"time"
"github.com/golang/protobuf/proto"
@@ -98,8 +99,6 @@
m.metrics.HostArch = m.getArch(v)
case "HOST_2ND_ARCH":
m.metrics.Host_2NdArch = m.getArch(v)
- case "HOST_OS":
- m.metrics.HostOs = proto.String(v)
case "HOST_OS_EXTRA":
m.metrics.HostOsExtra = proto.String(v)
case "HOST_CROSS_OS":
@@ -137,6 +136,7 @@
// exports the output to the file at outputPath
func (m *Metrics) Dump(outputPath string) (err error) {
+ m.metrics.HostOs = proto.String(runtime.GOOS)
return writeMessageToFile(&m.metrics, outputPath)
}