Merge "Add package module to sdk snapshot that contains licenses"
diff --git a/android/bazel.go b/android/bazel.go
index 6c476a7..0af4aa0 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -207,7 +207,6 @@
"libc_jemalloc_wrapper", // http://b/187012490, cc_library_static, depends on //external/jemalloc_new:libjemalloc5 (http://b/186828626)
"libc_ndk", // http://b/187013218, cc_library_static, depends on //bionic/libm:libm (http://b/183064661)
"libc", // http://b/183064430, cc_library, depends on //external/jemalloc_new:libjemalloc5 (http://b/186828626)
- "libc_tzcode", // http://b/186822591, cc_library_static, localtime.c:84:46: error: expected expression
"libc_bionic_ndk", // http://b/186822256, cc_library_static, signal.cpp:186:52: error: ISO C++ requires field designators to be specified in declaration order
"libc_malloc_hooks", // http://b/187016307, cc_library, ld.lld: error: undefined symbol: __malloc_hook
"libm", // http://b/183064661, cc_library, math.h:25:16: error: unexpected token in argument list
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 4598995..8cddbb2 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -347,7 +347,10 @@
bazelCmd := exec.Command(paths.bazelPath, cmdFlags...)
bazelCmd.Dir = absolutePath(paths.syntheticWorkspaceDir())
- bazelCmd.Env = append(os.Environ(), "HOME="+paths.homeDir, pwdPrefix(),
+ bazelCmd.Env = append(os.Environ(),
+ "HOME="+paths.homeDir,
+ pwdPrefix(),
+ "BUILD_DIR="+absolutePath(paths.buildDir),
// Disables local host detection of gcc; toolchain information is defined
// explicitly in BUILD files.
"BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1")
@@ -583,8 +586,9 @@
var err error
soongInjectionPath := absolutePath(context.paths.injectedFilesDir())
- if _, err := os.Stat(soongInjectionPath); os.IsNotExist(err) {
- err = os.Mkdir(soongInjectionPath, 0777)
+ mixedBuildsPath := filepath.Join(soongInjectionPath, "mixed_builds")
+ if _, err := os.Stat(mixedBuildsPath); os.IsNotExist(err) {
+ err = os.MkdirAll(mixedBuildsPath, 0777)
}
if err != nil {
return err
@@ -596,14 +600,14 @@
}
err = ioutil.WriteFile(
- filepath.Join(soongInjectionPath, "main.bzl"),
+ filepath.Join(mixedBuildsPath, "main.bzl"),
context.mainBzlFileContents(), 0666)
if err != nil {
return err
}
err = ioutil.WriteFile(
- filepath.Join(soongInjectionPath, "BUILD.bazel"),
+ filepath.Join(mixedBuildsPath, "BUILD.bazel"),
context.mainBuildFileContents(), 0666)
if err != nil {
return err
@@ -615,7 +619,7 @@
if err != nil {
return err
}
- buildrootLabel := "@soong_injection//:buildroot"
+ buildrootLabel := "@soong_injection//mixed_builds:buildroot"
cqueryOutput, cqueryErr, err = context.issueBazelCommand(
context.paths,
bazel.CqueryBuildRootRunName,
@@ -676,7 +680,7 @@
_, _, err = context.issueBazelCommand(
context.paths,
bazel.BazelBuildPhonyRootRunName,
- bazelCommand{"build", "@soong_injection//:phonyroot"})
+ bazelCommand{"build", "@soong_injection//mixed_builds:phonyroot"})
if err != nil {
return err
diff --git a/android/bazel_handler_test.go b/android/bazel_handler_test.go
index cb25fee..f1fabec 100644
--- a/android/bazel_handler_test.go
+++ b/android/bazel_handler_test.go
@@ -11,7 +11,7 @@
label := "//foo:bar"
arch := Arm64
bazelContext, _ := testBazelContext(t, map[bazelCommand]string{
- bazelCommand{command: "cquery", expression: "kind(rule, deps(@soong_injection//:buildroot))"}: `//foo:bar|arm64>>out/foo/bar.txt`,
+ bazelCommand{command: "cquery", expression: "kind(rule, deps(@soong_injection//mixed_builds:buildroot))"}: `//foo:bar|arm64>>out/foo/bar.txt`,
})
g, ok := bazelContext.GetOutputFiles(label, arch)
if ok {
@@ -35,13 +35,13 @@
if err != nil {
t.Fatalf("Did not expect error invoking Bazel, but got %s", err)
}
- if _, err := os.Stat(filepath.Join(baseDir, "soong_injection", "main.bzl")); os.IsNotExist(err) {
+ if _, err := os.Stat(filepath.Join(baseDir, "soong_injection", "mixed_builds", "main.bzl")); os.IsNotExist(err) {
t.Errorf("Expected main.bzl to exist, but it does not")
} else if err != nil {
t.Errorf("Unexpected error stating main.bzl %s", err)
}
- if _, err := os.Stat(filepath.Join(baseDir, "soong_injection", "BUILD.bazel")); os.IsNotExist(err) {
+ if _, err := os.Stat(filepath.Join(baseDir, "soong_injection", "mixed_builds", "BUILD.bazel")); os.IsNotExist(err) {
t.Errorf("Expected BUILD.bazel to exist, but it does not")
} else if err != nil {
t.Errorf("Unexpected error stating BUILD.bazel %s", err)
@@ -56,7 +56,7 @@
func TestInvokeBazelPopulatesBuildStatements(t *testing.T) {
bazelContext, _ := testBazelContext(t, map[bazelCommand]string{
- bazelCommand{command: "aquery", expression: "deps(@soong_injection//:buildroot)"}: `
+ bazelCommand{command: "aquery", expression: "deps(@soong_injection//mixed_builds:buildroot)"}: `
{
"artifacts": [{
"id": 1,
@@ -105,7 +105,7 @@
outputBase: "outputbase",
workspaceDir: "workspace_dir",
}
- aqueryCommand := bazelCommand{command: "aquery", expression: "deps(@soong_injection//:buildroot)"}
+ aqueryCommand := bazelCommand{command: "aquery", expression: "deps(@soong_injection//mixed_builds:buildroot)"}
if _, exists := bazelCommandResults[aqueryCommand]; !exists {
bazelCommandResults[aqueryCommand] = "{}\n"
}
diff --git a/android/config.go b/android/config.go
index 3db7980..79917ad 100644
--- a/android/config.go
+++ b/android/config.go
@@ -1564,6 +1564,15 @@
return false
}
+// ApexOfJar returns the apex component of the first pair with the given jar name on the list, or
+// an empty string if not found.
+func (l *ConfiguredJarList) ApexOfJar(jar string) string {
+ if idx := IndexList(jar, l.jars); idx != -1 {
+ return l.Apex(IndexList(jar, l.jars))
+ }
+ return ""
+}
+
// IndexOfJar returns the first pair with the given jar name on the list, or -1
// if not found.
func (l *ConfiguredJarList) IndexOfJar(jar string) int {
diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go
index f0f51bf..5316d7b 100644
--- a/androidmk/androidmk/android.go
+++ b/androidmk/androidmk/android.go
@@ -216,6 +216,8 @@
"LOCAL_JETIFIER_ENABLED": "jetifier",
"LOCAL_IS_UNIT_TEST": "unit_test",
+
+ "LOCAL_ENFORCE_USES_LIBRARIES": "enforce_uses_libs",
})
}
diff --git a/androidmk/androidmk/androidmk_test.go b/androidmk/androidmk/androidmk_test.go
index f32ff2a..439f45d 100644
--- a/androidmk/androidmk/androidmk_test.go
+++ b/androidmk/androidmk/androidmk_test.go
@@ -1446,6 +1446,23 @@
}
`,
},
+ {
+ desc: "LOCAL_ENFORCE_USES_LIBRARIES",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo
+LOCAL_ENFORCE_USES_LIBRARIES := false
+LOCAL_ENFORCE_USES_LIBRARIES := true
+include $(BUILD_PACKAGE)
+`,
+ expected: `
+android_app {
+ name: "foo",
+ enforce_uses_libs: false,
+ enforce_uses_libs: true,
+}
+`,
+ },
}
func TestEndToEnd(t *testing.T) {
diff --git a/apex/apex.go b/apex/apex.go
index d26c06d..2c0df27 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2102,6 +2102,11 @@
}
}
+ // Add classpaths.proto config.
+ classpathProtoOutput := bootclasspathFragmentInfo.ClasspathFragmentProtoOutput
+ classpathProto := newApexFile(ctx, classpathProtoOutput, classpathProtoOutput.Base(), bootclasspathFragmentInfo.ClasspathFragmentProtoInstallDir.Rel(), etc, nil)
+ filesToAdd = append(filesToAdd, classpathProto)
+
return filesToAdd
}
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index e2b320c..7bb3ff6 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -279,6 +279,7 @@
).RunTest(t)
ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.android.art_image", []string{
+ "etc/classpaths/mybootclasspathfragment.pb",
"javalib/arm/boot.art",
"javalib/arm/boot.oat",
"javalib/arm/boot.vdex",
@@ -481,6 +482,7 @@
ensureExactContents(t, result.TestContext, "myapex", "android_common_myapex_image", []string{
// This does not include art, oat or vdex files as they are only included for the art boot
// image.
+ "etc/classpaths/mybootclasspathfragment.pb",
"javalib/bar.jar",
"javalib/foo.jar",
})
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 407073a..8f060c0 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -445,6 +445,32 @@
srcs = ["c.cpp"],
)`},
},
+ {
+ description: "cc_library spaces in copts",
+ moduleTypeUnderTest: "cc_library",
+ moduleTypeUnderTestFactory: cc.LibraryFactory,
+ moduleTypeUnderTestBp2BuildMutator: cc.CcLibraryBp2Build,
+ depsMutators: []android.RegisterMutatorFunc{cc.RegisterDepsBp2Build},
+ dir: "foo/bar",
+ filesystem: map[string]string{
+ "foo/bar/Android.bp": `
+cc_library {
+ name: "a",
+ cflags: ["-include header.h",],
+ bazel_module: { bp2build_available: true },
+}
+`,
+ },
+ bp: soongCcLibraryPreamble,
+ expectedBazelTargets: []string{`cc_library(
+ name = "a",
+ copts = [
+ "-include",
+ "header.h",
+ "-Ifoo/bar",
+ ],
+)`},
+ },
}
dir := "."
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 7d01986..4c01de5 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -17,6 +17,7 @@
"android/soong/android"
"android/soong/bazel"
"path/filepath"
+ "strings"
)
// bp2build functions and helpers for converting cc_* modules to Bazel.
@@ -188,7 +189,13 @@
// Parse the list of copts.
parseCopts := func(baseCompilerProps *BaseCompilerProperties) []string {
- copts := append([]string{}, baseCompilerProps.Cflags...)
+ var copts []string
+ for _, flag := range baseCompilerProps.Cflags {
+ // Soong's cflags can contain spaces, like `-include header.h`. For
+ // Bazel's copts, split them up to be compatible with the
+ // no_copts_tokenization feature.
+ copts = append(copts, strings.Split(flag, " ")...)
+ }
for _, dir := range parseLocalIncludeDirs(baseCompilerProps) {
copts = append(copts, includeFlag(dir))
}
diff --git a/cc/linker.go b/cc/linker.go
index 73fc4f0..a9930ad 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -421,9 +421,13 @@
if !BoolDefault(linker.Properties.Pack_relocations, true) {
flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=none")
} else if ctx.Device() {
- // The SHT_RELR relocations is only supported by API level >= 28.
- // Do not turn this on if older version NDK is used.
- if !ctx.useSdk() || CheckSdkVersionAtLeast(ctx, 28) {
+ // SHT_RELR relocations are only supported at API level >= 30.
+ // ANDROID_RELR relocations were supported at API level >= 28.
+ // Relocation packer was supported at API level >= 23.
+ // Do the best we can...
+ if !ctx.useSdk() || CheckSdkVersionAtLeast(ctx, 30) {
+ flags.Global.LdFlags = append(flags.Global.LdFlags, "-Wl,--pack-dyn-relocs=android+relr")
+ } else if CheckSdkVersionAtLeast(ctx, 28) {
flags.Global.LdFlags = append(flags.Global.LdFlags,
"-Wl,--pack-dyn-relocs=android+relr",
"-Wl,--use-android-relr-tags")
diff --git a/cmd/soong_build/writedocs.go b/cmd/soong_build/writedocs.go
index a69de6a..b7c260c 100644
--- a/cmd/soong_build/writedocs.go
+++ b/cmd/soong_build/writedocs.go
@@ -114,7 +114,10 @@
err = ioutil.WriteFile(filename, buf.Bytes(), 0666)
}
- // Now, produce per-package module lists with detailed information.
+ // Now, produce per-package module lists with detailed information, and a list
+ // of keywords.
+ keywordsTmpl := template.Must(template.New("file").Parse(keywordsTemplate))
+ keywordsBuf := &bytes.Buffer{}
for _, pkg := range packages {
// We need a module name getter/setter function because I couldn't
// find a way to keep it in a variable defined within the template.
@@ -141,7 +144,17 @@
if err != nil {
return err
}
+ err = keywordsTmpl.Execute(keywordsBuf, data)
+ if err != nil {
+ return err
+ }
}
+
+ // Write out list of keywords. This includes all module and property names, which is useful for
+ // building syntax highlighters.
+ keywordsFilename := filepath.Join(filepath.Dir(filename), "keywords.txt")
+ err = ioutil.WriteFile(keywordsFilename, keywordsBuf.Bytes(), 0666)
+
return err
}
@@ -413,4 +426,9 @@
</script>
{{end}}
`
+
+ keywordsTemplate = `
+{{range $moduleType := .Modules}}{{$moduleType.Name}}:{{range $property := $moduleType.Properties}}{{$property.Name}},{{end}}
+{{end}}
+`
)
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index 6270b5b..bed629d 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -109,6 +109,8 @@
android.ModuleBase
android.ApexModuleBase
android.SdkBase
+ ClasspathFragmentBase
+
properties bootclasspathFragmentProperties
}
@@ -117,6 +119,7 @@
m.AddProperties(&m.properties)
android.InitApexModule(m)
android.InitSdkAwareModule(m)
+ initClasspathFragment(m, BOOTCLASSPATH)
android.InitAndroidArchModule(m, android.HostAndDeviceSupported, android.MultilibCommon)
android.AddLoadHook(m, func(ctx android.LoadHookContext) {
@@ -242,6 +245,22 @@
// BootclasspathFragmentApexContentInfo contains the bootclasspath_fragments contributions to the
// apex contents.
type BootclasspathFragmentApexContentInfo struct {
+ // ClasspathFragmentProtoOutput is an output path for the generated classpaths.proto config of this module.
+ //
+ // The file should be copied to a relevant place on device, see ClasspathFragmentProtoInstallDir
+ // for more details.
+ ClasspathFragmentProtoOutput android.OutputPath
+
+ // ClasspathFragmentProtoInstallDir contains information about on device location for the generated classpaths.proto file.
+ //
+ // The path encodes expected sub-location within partitions, i.e. etc/classpaths/<proto-file>,
+ // for ClasspathFragmentProtoOutput. To get sub-location, instead of the full output / make path
+ // use android.InstallPath#Rel().
+ //
+ // This is only relevant for APEX modules as they perform their own installation; while regular
+ // system files are installed via ClasspathFragmentBase#androidMkEntries().
+ ClasspathFragmentProtoInstallDir android.InstallPath
+
// The image config, internal to this module (and the dex_bootjars singleton).
//
// Will be nil if the BootclasspathFragmentApexContentInfo has not been provided for a specific module. That can occur
@@ -339,30 +358,47 @@
b.bootclasspathImageNameContentsConsistencyCheck(ctx)
}
+ // Generate classpaths.proto config
+ b.generateClasspathProtoBuildActions(ctx)
+
// Perform hidden API processing.
b.generateHiddenAPIBuildActions(ctx)
- // Nothing to do if skipping the dexpreopt of boot image jars.
- if SkipDexpreoptBootJars(ctx) {
- return
- }
-
- // Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars
- // GenerateSingletonBuildActions method as it cannot create it for itself.
- dexpreopt.GetGlobalSoongConfig(ctx)
-
- imageConfig := b.getImageConfig(ctx)
- if imageConfig == nil {
- return
- }
-
// Construct the boot image info from the config.
- info := BootclasspathFragmentApexContentInfo{imageConfig: imageConfig}
+ info := BootclasspathFragmentApexContentInfo{
+ ClasspathFragmentProtoInstallDir: b.classpathFragmentBase().installDirPath,
+ ClasspathFragmentProtoOutput: b.classpathFragmentBase().outputFilepath,
+ imageConfig: nil,
+ }
+
+ if !SkipDexpreoptBootJars(ctx) {
+ // Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars
+ // GenerateSingletonBuildActions method as it cannot create it for itself.
+ dexpreopt.GetGlobalSoongConfig(ctx)
+ info.imageConfig = b.getImageConfig(ctx)
+ }
// Make it available for other modules.
ctx.SetProvider(BootclasspathFragmentApexContentInfoProvider, info)
}
+// generateClasspathProtoBuildActions generates all required build actions for classpath.proto config
+func (b *BootclasspathFragmentModule) generateClasspathProtoBuildActions(ctx android.ModuleContext) {
+ var classpathJars []classpathJar
+ if "art" == proptools.String(b.properties.Image_name) {
+ // ART and platform boot jars must have a corresponding entry in DEX2OATBOOTCLASSPATH
+ classpathJars = configuredJarListToClasspathJars(ctx, b.ClasspathFragmentToConfiguredJarList(ctx), BOOTCLASSPATH, DEX2OATBOOTCLASSPATH)
+ } else {
+ classpathJars = configuredJarListToClasspathJars(ctx, b.ClasspathFragmentToConfiguredJarList(ctx), b.classpathType)
+ }
+ b.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, classpathJars)
+}
+
+func (b *BootclasspathFragmentModule) ClasspathFragmentToConfiguredJarList(ctx android.ModuleContext) android.ConfiguredJarList {
+ // TODO(satayev): populate with actual content
+ return android.EmptyConfiguredJarList()
+}
+
func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {
// Get a map of the image configs that are supported.
imageConfigs := genBootImageConfigs(ctx)
diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go
index 2e05823..7422fa2 100644
--- a/java/classpath_fragment.go
+++ b/java/classpath_fragment.go
@@ -143,6 +143,8 @@
android.WriteFileRule(ctx, output, content.String())
}
+// Returns AndroidMkEntries objects to install generated classpath.proto.
+// Do not use this to install into APEXes as the injection of the generated files happen separately for APEXes.
func (c *ClasspathFragmentBase) androidMkEntries() []android.AndroidMkEntries {
return []android.AndroidMkEntries{{
Class: "ETC",
diff --git a/java/java.go b/java/java.go
index d74bf68..9a5fbfc 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1222,6 +1222,13 @@
return LintDepSets{}
}
+func (j *Import) getStrictUpdatabilityLinting() bool {
+ return false
+}
+
+func (j *Import) setStrictUpdatabilityLinting(bool) {
+}
+
func (j *Import) DepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
@@ -1545,6 +1552,13 @@
return true
}
+func (j *DexImport) getStrictUpdatabilityLinting() bool {
+ return false
+}
+
+func (j *DexImport) setStrictUpdatabilityLinting(bool) {
+}
+
func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(j.properties.Jars) != 1 {
ctx.PropertyErrorf("jars", "exactly one jar must be provided")
diff --git a/java/lint.go b/java/lint.go
index 5e39274..9f769df 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -103,6 +103,10 @@
type lintDepSetsIntf interface {
LintDepSets() LintDepSets
+
+ // Methods used to propagate strict_updatability_linting values.
+ getStrictUpdatabilityLinting() bool
+ setStrictUpdatabilityLinting(bool)
}
type LintDepSets struct {
@@ -153,6 +157,14 @@
return l.outputs.depSets
}
+func (l *linter) getStrictUpdatabilityLinting() bool {
+ return BoolDefault(l.properties.Lint.Strict_updatability_linting, false)
+}
+
+func (l *linter) setStrictUpdatabilityLinting(strictLinting bool) {
+ l.properties.Lint.Strict_updatability_linting = &strictLinting
+}
+
var _ lintDepSetsIntf = (*linter)(nil)
var _ lintOutputsIntf = (*linter)(nil)
@@ -260,7 +272,7 @@
cmd.FlagForEachArg("--error_check ", l.properties.Lint.Error_checks)
cmd.FlagForEachArg("--fatal_check ", l.properties.Lint.Fatal_checks)
- if BoolDefault(l.properties.Lint.Strict_updatability_linting, false) {
+ if l.getStrictUpdatabilityLinting() {
// Verify the module does not baseline issues that endanger safe updatability.
if baselinePath := l.getBaselineFilepath(ctx); baselinePath.Valid() {
cmd.FlagWithInput("--baseline ", baselinePath.Path())
@@ -586,6 +598,14 @@
func init() {
android.RegisterSingletonType("lint",
func() android.Singleton { return &lintSingleton{} })
+
+ registerLintBuildComponents(android.InitRegistrationContext)
+}
+
+func registerLintBuildComponents(ctx android.RegistrationContext) {
+ ctx.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
+ ctx.TopDown("enforce_strict_updatability_linting", enforceStrictUpdatabilityLintingMutator).Parallel()
+ })
}
func lintZip(ctx android.BuilderContext, paths android.Paths, outputPath android.WritablePath) {
@@ -604,3 +624,15 @@
rule.Build(outputPath.Base(), outputPath.Base())
}
+
+// Enforce the strict updatability linting to all applicable transitive dependencies.
+func enforceStrictUpdatabilityLintingMutator(ctx android.TopDownMutatorContext) {
+ m := ctx.Module()
+ if d, ok := m.(lintDepSetsIntf); ok && d.getStrictUpdatabilityLinting() {
+ ctx.VisitDirectDepsWithTag(staticLibTag, func(d android.Module) {
+ if a, ok := d.(lintDepSetsIntf); ok {
+ a.setStrictUpdatabilityLinting(true)
+ }
+ })
+ }
+}
diff --git a/java/lint_test.go b/java/lint_test.go
index a253df9..6d64de7 100644
--- a/java/lint_test.go
+++ b/java/lint_test.go
@@ -181,12 +181,22 @@
srcs: [
"a.java",
],
+ static_libs: ["bar"],
min_sdk_version: "29",
sdk_version: "current",
lint: {
strict_updatability_linting: true,
},
}
+
+ java_library {
+ name: "bar",
+ srcs: [
+ "a.java",
+ ],
+ min_sdk_version: "29",
+ sdk_version: "current",
+ }
`
fs := android.MockFS{
"lint-baseline.xml": nil,
@@ -201,4 +211,11 @@
"--baseline lint-baseline.xml --disallowed_issues NewApi") {
t.Error("did not restrict baselining NewApi")
}
+
+ bar := result.ModuleForTests("bar", "android_common")
+ sboxProto = android.RuleBuilderSboxProtoForTests(t, bar.Output("lint.sbox.textproto"))
+ if !strings.Contains(*sboxProto.Commands[0].Command,
+ "--baseline lint-baseline.xml --disallowed_issues NewApi") {
+ t.Error("did not restrict baselining NewApi")
+ }
}
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 1caffe4..c787e47 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -203,6 +203,7 @@
func (b *platformBootclasspathModule) generateClasspathProtoBuildActions(ctx android.ModuleContext) {
// ART and platform boot jars must have a corresponding entry in DEX2OATBOOTCLASSPATH
classpathJars := configuredJarListToClasspathJars(ctx, b.ClasspathFragmentToConfiguredJarList(ctx), BOOTCLASSPATH, DEX2OATBOOTCLASSPATH)
+
// TODO(satayev): remove updatable boot jars once each apex has its own fragment
global := dexpreopt.GetGlobalConfig(ctx)
classpathJars = append(classpathJars, configuredJarListToClasspathJars(ctx, global.UpdatableBootJars, BOOTCLASSPATH)...)
diff --git a/java/sdk_library.go b/java/sdk_library.go
index aff4539..800e93b 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -2195,6 +2195,20 @@
}
}
+func (module *SdkLibraryImport) getStrictUpdatabilityLinting() bool {
+ if module.implLibraryModule == nil {
+ return false
+ } else {
+ return module.implLibraryModule.getStrictUpdatabilityLinting()
+ }
+}
+
+func (module *SdkLibraryImport) setStrictUpdatabilityLinting(strictLinting bool) {
+ if module.implLibraryModule != nil {
+ module.implLibraryModule.setStrictUpdatabilityLinting(strictLinting)
+ }
+}
+
// to satisfy apex.javaDependency interface
func (module *SdkLibraryImport) Stem() string {
return module.BaseModuleName()
diff --git a/java/testing.go b/java/testing.go
index 37e63f5..387d595 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -245,6 +245,7 @@
RegisterStubsBuildComponents(ctx)
RegisterSystemModulesBuildComponents(ctx)
registerSystemserverClasspathBuildComponents(ctx)
+ registerLintBuildComponents(ctx)
}
// gatherRequiredDepsForTest gathers the module definitions used by
diff --git a/scripts/Android.bp b/scripts/Android.bp
index b0a8669..1c02bd0 100644
--- a/scripts/Android.bp
+++ b/scripts/Android.bp
@@ -265,22 +265,3 @@
"linker_config_proto",
],
}
-
-python_binary_host {
- name: "conv_classpaths_proto",
- srcs: [
- "conv_classpaths_proto.py",
- ],
- version: {
- py2: {
- enabled: false,
- },
- py3: {
- enabled: true,
- embedded_launcher: true,
- },
- },
- libs: [
- "classpaths_proto_python",
- ],
-}
diff --git a/scripts/conv_classpaths_proto.py b/scripts/conv_classpaths_proto.py
deleted file mode 100644
index f49fbbb..0000000
--- a/scripts/conv_classpaths_proto.py
+++ /dev/null
@@ -1,76 +0,0 @@
-# Copyright (C) 2021 The Android Open Source Project
-#
-# 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.
-
-import argparse
-
-import classpaths_pb2
-
-import google.protobuf.json_format as json_format
-import google.protobuf.text_format as text_format
-
-
-def encode(args):
- pb = classpaths_pb2.ExportedClasspathsJars()
- if args.format == 'json':
- json_format.Parse(args.input.read(), pb)
- else:
- text_format.Parse(args.input.read(), pb)
- args.output.write(pb.SerializeToString())
- args.input.close()
- args.output.close()
-
-
-def decode(args):
- pb = classpaths_pb2.ExportedClasspathsJars()
- pb.ParseFromString(args.input.read())
- if args.format == 'json':
- args.output.write(json_format.MessageToJson(pb))
- else:
- args.output.write(text_format.MessageToString(pb).encode('utf_8'))
- args.input.close()
- args.output.close()
-
-
-def main():
- parser = argparse.ArgumentParser('Convert classpaths.proto messages between binary and '
- 'human-readable formats.')
- parser.add_argument('-f', '--format', default='textproto',
- help='human-readable format, either json or text(proto), '
- 'defaults to textproto')
- parser.add_argument('-i', '--input',
- nargs='?', type=argparse.FileType('rb'), default=sys.stdin.buffer)
- parser.add_argument('-o', '--output',
- nargs='?', type=argparse.FileType('wb'),
- default=sys.stdout.buffer)
-
- subparsers = parser.add_subparsers()
-
- parser_encode = subparsers.add_parser('encode',
- help='convert classpaths protobuf message from '
- 'JSON to binary format',
- parents=[parser], add_help=False)
-
- parser_encode.set_defaults(func=encode)
-
- parser_decode = subparsers.add_parser('decode',
- help='print classpaths config in JSON format',
- parents=[parser], add_help=False)
- parser_decode.set_defaults(func=decode)
-
- args = parser.parse_args()
- args.func(args)
-
-
-if __name__ == '__main__':
- main()