Merge "Require prebuilt_bootclasspath_fragment to provide hidden API files"
This commit is contained in:
@@ -4667,6 +4667,13 @@ func TestPrebuiltApexNameWithPlatformBootclasspath(t *testing.T) {
|
|||||||
prebuilt_bootclasspath_fragment {
|
prebuilt_bootclasspath_fragment {
|
||||||
name: "art-bootclasspath-fragment",
|
name: "art-bootclasspath-fragment",
|
||||||
contents: ["core-oj"],
|
contents: ["core-oj"],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
|
||||||
|
metadata: "my-bootclasspath-fragment/metadata.csv",
|
||||||
|
index: "my-bootclasspath-fragment/index.csv",
|
||||||
|
stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
|
||||||
|
all_flags: "my-bootclasspath-fragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
@@ -4932,6 +4939,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
name: "my-bootclasspath-fragment",
|
name: "my-bootclasspath-fragment",
|
||||||
contents: ["libfoo", "libbar"],
|
contents: ["libfoo", "libbar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
|
||||||
|
metadata: "my-bootclasspath-fragment/metadata.csv",
|
||||||
|
index: "my-bootclasspath-fragment/index.csv",
|
||||||
|
stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
|
||||||
|
all_flags: "my-bootclasspath-fragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
@@ -4955,11 +4969,9 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")
|
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")
|
||||||
|
|
||||||
// Verify the correct module jars contribute to the hiddenapi index file.
|
// Verify the correct module jars contribute to the hiddenapi index file.
|
||||||
checkHiddenAPIIndexFromClassesInputs(t, ctx, `
|
checkHiddenAPIIndexFromClassesInputs(t, ctx, ``)
|
||||||
out/soong/.intermediates/libbar.stubs/android_common/combined/libbar.stubs.jar
|
|
||||||
out/soong/.intermediates/libfoo/android_common_myapex/combined/libfoo.jar
|
|
||||||
`)
|
|
||||||
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
||||||
|
my-bootclasspath-fragment/index.csv
|
||||||
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
@@ -4976,6 +4988,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
name: "my-bootclasspath-fragment",
|
name: "my-bootclasspath-fragment",
|
||||||
contents: ["libfoo", "libbar"],
|
contents: ["libfoo", "libbar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
|
||||||
|
metadata: "my-bootclasspath-fragment/metadata.csv",
|
||||||
|
index: "my-bootclasspath-fragment/index.csv",
|
||||||
|
stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
|
||||||
|
all_flags: "my-bootclasspath-fragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
@@ -4999,11 +5018,9 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")
|
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")
|
||||||
|
|
||||||
// Verify the correct module jars contribute to the hiddenapi index file.
|
// Verify the correct module jars contribute to the hiddenapi index file.
|
||||||
checkHiddenAPIIndexFromClassesInputs(t, ctx, `
|
checkHiddenAPIIndexFromClassesInputs(t, ctx, ``)
|
||||||
out/soong/.intermediates/libbar.stubs/android_common/combined/libbar.stubs.jar
|
|
||||||
out/soong/.intermediates/libfoo/android_common_myapex/combined/libfoo.jar
|
|
||||||
`)
|
|
||||||
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
||||||
|
my-bootclasspath-fragment/index.csv
|
||||||
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
@@ -5027,6 +5044,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
name: "my-bootclasspath-fragment",
|
name: "my-bootclasspath-fragment",
|
||||||
contents: ["libfoo", "libbar"],
|
contents: ["libfoo", "libbar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
|
||||||
|
metadata: "my-bootclasspath-fragment/metadata.csv",
|
||||||
|
index: "my-bootclasspath-fragment/index.csv",
|
||||||
|
stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
|
||||||
|
all_flags: "my-bootclasspath-fragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
@@ -5085,6 +5109,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
name: "my-bootclasspath-fragment",
|
name: "my-bootclasspath-fragment",
|
||||||
contents: ["libfoo", "libbar"],
|
contents: ["libfoo", "libbar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
|
||||||
|
metadata: "my-bootclasspath-fragment/metadata.csv",
|
||||||
|
index: "my-bootclasspath-fragment/index.csv",
|
||||||
|
stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
|
||||||
|
all_flags: "my-bootclasspath-fragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
@@ -5123,11 +5154,9 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")
|
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")
|
||||||
|
|
||||||
// Verify the correct module jars contribute to the hiddenapi index file.
|
// Verify the correct module jars contribute to the hiddenapi index file.
|
||||||
checkHiddenAPIIndexFromClassesInputs(t, ctx, `
|
checkHiddenAPIIndexFromClassesInputs(t, ctx, ``)
|
||||||
out/soong/.intermediates/prebuilt_libbar.stubs/android_common/combined/libbar.stubs.jar
|
|
||||||
out/soong/.intermediates/prebuilt_libfoo/android_common_myapex/combined/libfoo.jar
|
|
||||||
`)
|
|
||||||
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
||||||
|
my-bootclasspath-fragment/index.csv
|
||||||
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
@@ -5164,6 +5193,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
name: "my-bootclasspath-fragment",
|
name: "my-bootclasspath-fragment",
|
||||||
contents: ["libfoo", "libbar"],
|
contents: ["libfoo", "libbar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
|
||||||
|
metadata: "my-bootclasspath-fragment/metadata.csv",
|
||||||
|
index: "my-bootclasspath-fragment/index.csv",
|
||||||
|
stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
|
||||||
|
all_flags: "my-bootclasspath-fragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
@@ -5200,11 +5236,9 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/libbar/android_common_myapex/hiddenapi/libbar.jar")
|
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/libbar/android_common_myapex/hiddenapi/libbar.jar")
|
||||||
|
|
||||||
// Verify the correct module jars contribute to the hiddenapi index file.
|
// Verify the correct module jars contribute to the hiddenapi index file.
|
||||||
checkHiddenAPIIndexFromClassesInputs(t, ctx, `
|
checkHiddenAPIIndexFromClassesInputs(t, ctx, ``)
|
||||||
out/soong/.intermediates/libbar/android_common_myapex/javac/libbar.jar
|
|
||||||
out/soong/.intermediates/libfoo/android_common_apex10000/javac/libfoo.jar
|
|
||||||
`)
|
|
||||||
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
||||||
|
my-bootclasspath-fragment/index.csv
|
||||||
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
@@ -5241,6 +5275,13 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
name: "my-bootclasspath-fragment",
|
name: "my-bootclasspath-fragment",
|
||||||
contents: ["libfoo", "libbar"],
|
contents: ["libfoo", "libbar"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
|
||||||
|
metadata: "my-bootclasspath-fragment/metadata.csv",
|
||||||
|
index: "my-bootclasspath-fragment/index.csv",
|
||||||
|
stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
|
||||||
|
all_flags: "my-bootclasspath-fragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
@@ -5279,11 +5320,9 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
|
|||||||
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")
|
checkBootDexJarPath(t, ctx, "libbar", "out/soong/.intermediates/myapex.deapexer/android_common/deapexer/javalib/libbar.jar")
|
||||||
|
|
||||||
// Verify the correct module jars contribute to the hiddenapi index file.
|
// Verify the correct module jars contribute to the hiddenapi index file.
|
||||||
checkHiddenAPIIndexFromClassesInputs(t, ctx, `
|
checkHiddenAPIIndexFromClassesInputs(t, ctx, ``)
|
||||||
out/soong/.intermediates/prebuilt_libbar.stubs/android_common/combined/libbar.stubs.jar
|
|
||||||
out/soong/.intermediates/prebuilt_libfoo/android_common_myapex/combined/libfoo.jar
|
|
||||||
`)
|
|
||||||
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
checkHiddenAPIIndexFromFlagsInputs(t, ctx, `
|
||||||
|
my-bootclasspath-fragment/index.csv
|
||||||
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
@@ -7207,6 +7246,13 @@ func TestDexpreoptAccessDexFilesFromPrebuiltApex(t *testing.T) {
|
|||||||
name: "my-bootclasspath-fragment",
|
name: "my-bootclasspath-fragment",
|
||||||
contents: ["libfoo"],
|
contents: ["libfoo"],
|
||||||
apex_available: ["myapex"],
|
apex_available: ["myapex"],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "my-bootclasspath-fragment/annotation-flags.csv",
|
||||||
|
metadata: "my-bootclasspath-fragment/metadata.csv",
|
||||||
|
index: "my-bootclasspath-fragment/index.csv",
|
||||||
|
stub_flags: "my-bootclasspath-fragment/stub-flags.csv",
|
||||||
|
all_flags: "my-bootclasspath-fragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
java_import {
|
java_import {
|
||||||
|
@@ -383,6 +383,13 @@ func TestBootclasspathFragmentInArtApex(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"com.android.art",
|
"com.android.art",
|
||||||
],
|
],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "mybootclasspathfragment/annotation-flags.csv",
|
||||||
|
metadata: "mybootclasspathfragment/metadata.csv",
|
||||||
|
index: "mybootclasspathfragment/index.csv",
|
||||||
|
stub_flags: "mybootclasspathfragment/stub-flags.csv",
|
||||||
|
all_flags: "mybootclasspathfragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
`, contentsInsert(contents), prefer)
|
`, contentsInsert(contents), prefer)
|
||||||
return android.FixtureAddTextFile("prebuilts/module_sdk/art/Android.bp", text)
|
return android.FixtureAddTextFile("prebuilts/module_sdk/art/Android.bp", text)
|
||||||
@@ -582,6 +589,13 @@ func TestBootclasspathFragmentInPrebuiltArtApex(t *testing.T) {
|
|||||||
apex_available: [
|
apex_available: [
|
||||||
"com.android.art",
|
"com.android.art",
|
||||||
],
|
],
|
||||||
|
hidden_api: {
|
||||||
|
annotation_flags: "mybootclasspathfragment/annotation-flags.csv",
|
||||||
|
metadata: "mybootclasspathfragment/metadata.csv",
|
||||||
|
index: "mybootclasspathfragment/index.csv",
|
||||||
|
stub_flags: "mybootclasspathfragment/stub-flags.csv",
|
||||||
|
all_flags: "mybootclasspathfragment/all-flags.csv",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
|
@@ -599,7 +599,7 @@ func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.
|
|||||||
|
|
||||||
// The monolithic hidden API processing also needs access to all the output files produced by
|
// The monolithic hidden API processing also needs access to all the output files produced by
|
||||||
// hidden API processing of this fragment.
|
// hidden API processing of this fragment.
|
||||||
hiddenAPIInfo.HiddenAPIFlagOutput = (*output).HiddenAPIFlagOutput
|
hiddenAPIInfo.HiddenAPIFlagOutput = output.HiddenAPIFlagOutput
|
||||||
|
|
||||||
// Provide it for use by other modules.
|
// Provide it for use by other modules.
|
||||||
ctx.SetProvider(HiddenAPIInfoProvider, hiddenAPIInfo)
|
ctx.SetProvider(HiddenAPIInfoProvider, hiddenAPIInfo)
|
||||||
@@ -896,10 +896,10 @@ func (module *prebuiltBootclasspathFragmentModule) Name() string {
|
|||||||
|
|
||||||
// produceHiddenAPIOutput returns a path to the prebuilt all-flags.csv or nil if none is specified.
|
// produceHiddenAPIOutput returns a path to the prebuilt all-flags.csv or nil if none is specified.
|
||||||
func (module *prebuiltBootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput {
|
func (module *prebuiltBootclasspathFragmentModule) produceHiddenAPIOutput(ctx android.ModuleContext, contents []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput {
|
||||||
pathForOptionalSrc := func(src *string) android.Path {
|
pathForSrc := func(property string, src *string) android.Path {
|
||||||
if src == nil {
|
if src == nil {
|
||||||
// TODO(b/179354495): Fail if this is not provided once prebuilts have been updated.
|
ctx.PropertyErrorf(property, "is required but was not specified")
|
||||||
return nil
|
return android.PathForModuleSrc(ctx, "missing", property)
|
||||||
}
|
}
|
||||||
return android.PathForModuleSrc(ctx, *src)
|
return android.PathForModuleSrc(ctx, *src)
|
||||||
}
|
}
|
||||||
@@ -910,11 +910,11 @@ func (module *prebuiltBootclasspathFragmentModule) produceHiddenAPIOutput(ctx an
|
|||||||
|
|
||||||
output := HiddenAPIOutput{
|
output := HiddenAPIOutput{
|
||||||
HiddenAPIFlagOutput: HiddenAPIFlagOutput{
|
HiddenAPIFlagOutput: HiddenAPIFlagOutput{
|
||||||
StubFlagsPath: pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Stub_flags),
|
AnnotationFlagsPath: pathForSrc("hidden_api.annotation_flags", module.prebuiltProperties.Hidden_api.Annotation_flags),
|
||||||
AnnotationFlagsPath: pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Annotation_flags),
|
MetadataPath: pathForSrc("hidden_api.metadata", module.prebuiltProperties.Hidden_api.Metadata),
|
||||||
MetadataPath: pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Metadata),
|
IndexPath: pathForSrc("hidden_api.index", module.prebuiltProperties.Hidden_api.Index),
|
||||||
IndexPath: pathForOptionalSrc(module.prebuiltProperties.Hidden_api.Index),
|
StubFlagsPath: pathForSrc("hidden_api.stub_flags", module.prebuiltProperties.Hidden_api.Stub_flags),
|
||||||
AllFlagsPath: pathForOptionalSrc(module.prebuiltProperties.Hidden_api.All_flags),
|
AllFlagsPath: pathForSrc("hidden_api.all_flags", module.prebuiltProperties.Hidden_api.All_flags),
|
||||||
},
|
},
|
||||||
EncodedBootDexFilesByModule: encodedBootDexJarsByModule,
|
EncodedBootDexFilesByModule: encodedBootDexJarsByModule,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user