summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/app_import.go4
-rw-r--r--java/bootclasspath_fragment_test.go2
-rw-r--r--java/hiddenapi_modular.go30
3 files changed, 34 insertions, 2 deletions
diff --git a/java/app_import.go b/java/app_import.go
index 5a87b074b..b5a608412 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -410,6 +410,10 @@ func (a *AndroidAppImport) MinSdkVersion(ctx android.EarlyModuleContext) android
return android.SdkSpecPrivate
}
+func (a *AndroidAppImport) LintDepSets() LintDepSets {
+ return LintDepSets{}
+}
+
var _ android.ApexModule = (*AndroidAppImport)(nil)
// Implements android.ApexModule
diff --git a/java/bootclasspath_fragment_test.go b/java/bootclasspath_fragment_test.go
index 3d0e1558f..d3de675d8 100644
--- a/java/bootclasspath_fragment_test.go
+++ b/java/bootclasspath_fragment_test.go
@@ -164,6 +164,7 @@ func TestBootclasspathFragment_Coverage(t *testing.T) {
prepareForTestWithBootclasspathFragment,
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("mysdklibrary", "mycoveragestubs"),
+ FixtureConfigureApexBootJars("someapex:mybootlib"),
prepareWithBp,
)
@@ -186,6 +187,7 @@ func TestBootclasspathFragment_StubLibs(t *testing.T) {
prepareForTestWithBootclasspathFragment,
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("mysdklibrary", "myothersdklibrary", "mycoreplatform"),
+ FixtureConfigureApexBootJars("someapex:mysdklibrary"),
).RunTestWithBp(t, `
bootclasspath_fragment {
name: "myfragment",
diff --git a/java/hiddenapi_modular.go b/java/hiddenapi_modular.go
index 8a06a9969..8e39f408e 100644
--- a/java/hiddenapi_modular.go
+++ b/java/hiddenapi_modular.go
@@ -948,6 +948,22 @@ func buildRuleSignaturePatternsFile(ctx android.ModuleContext, flagsPath android
return patternsFile
}
+// buildRuleRemoveBlockedFlag creates a rule that will remove entries from the input path which
+// only have blocked flags. It will not remove entries that have blocked as well as other flags,
+// e.g. blocked,core-platform-api.
+func buildRuleRemoveBlockedFlag(ctx android.BuilderContext, name string, desc string, inputPath android.Path, filteredPath android.WritablePath) {
+ rule := android.NewRuleBuilder(pctx, ctx)
+ rule.Command().
+ Text(`grep -vE "^[^,]+,blocked$"`).Input(inputPath).Text(">").Output(filteredPath).
+ // Grep's exit code depends on whether it finds anything. It is 0 (build success) when it finds
+ // something and 1 (build failure) when it does not and 2 (when it encounters an error).
+ // However, while it is unlikely it is not an error if this does not find any matches. The
+ // following will only run if the grep does not find something and in that case it will treat
+ // an exit code of 1 as success and anything else as failure.
+ Text("|| test $? -eq 1")
+ rule.Build(name, desc)
+}
+
// buildRuleValidateOverlappingCsvFiles checks that the modular CSV files, i.e. the files generated
// by the individual bootclasspath_fragment modules are subsets of the monolithic CSV file.
func buildRuleValidateOverlappingCsvFiles(ctx android.BuilderContext, name string, desc string, monolithicFilePath android.WritablePath, csvSubsets SignatureCsvSubsets) android.WritablePath {
@@ -1036,14 +1052,24 @@ func hiddenAPIRulesForBootclasspathFragment(ctx android.ModuleContext, contents
encodedBootDexJarsByModule[name] = encodedDex
}
+ // Generate the filtered-stub-flags.csv file which contains the filtered stub flags that will be
+ // compared against the monolithic stub flags.
+ filteredStubFlagsCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "filtered-stub-flags.csv")
+ buildRuleRemoveBlockedFlag(ctx, "modularHiddenApiFilteredStubFlags", "modular hiddenapi filtered stub flags", stubFlagsCSV, filteredStubFlagsCSV)
+
+ // Generate the filtered-flags.csv file which contains the filtered flags that will be compared
+ // against the monolithic flags.
+ filteredFlagsCSV := android.PathForModuleOut(ctx, hiddenApiSubDir, "filtered-flags.csv")
+ buildRuleRemoveBlockedFlag(ctx, "modularHiddenApiFilteredFlags", "modular hiddenapi filtered flags", allFlagsCSV, filteredFlagsCSV)
+
// Store the paths in the info for use by other modules and sdk snapshot generation.
output := HiddenAPIOutput{
HiddenAPIFlagOutput: HiddenAPIFlagOutput{
- StubFlagsPath: stubFlagsCSV,
+ StubFlagsPath: filteredStubFlagsCSV,
AnnotationFlagsPath: annotationFlagsCSV,
MetadataPath: metadataCSV,
IndexPath: indexCSV,
- AllFlagsPath: allFlagsCSV,
+ AllFlagsPath: filteredFlagsCSV,
},
EncodedBootDexFilesByModule: encodedBootDexJarsByModule,
}