Merge "droidstubs depend on the combined last api filegroup modules" into main am: 5a87a9ac1c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3005018 Change-Id: I342be049e38f30cdc4f2245eb0bd84f988848fbd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -158,6 +158,21 @@ func createApiModule(mctx android.LoadHookContext, name string, path string) {
|
|||||||
mctx.CreateModule(genrule.GenRuleFactory, &genruleProps)
|
mctx.CreateModule(genrule.GenRuleFactory, &genruleProps)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func createCombinedApiFilegroupModule(mctx android.LoadHookContext, name string, srcs []string) {
|
||||||
|
filegroupProps := struct {
|
||||||
|
Name *string
|
||||||
|
Srcs []string
|
||||||
|
}{}
|
||||||
|
filegroupProps.Name = proptools.StringPtr(name)
|
||||||
|
|
||||||
|
var transformedSrcs []string
|
||||||
|
for _, src := range srcs {
|
||||||
|
transformedSrcs = append(transformedSrcs, ":"+src)
|
||||||
|
}
|
||||||
|
filegroupProps.Srcs = transformedSrcs
|
||||||
|
mctx.CreateModule(android.FileGroupFactory, &filegroupProps)
|
||||||
|
}
|
||||||
|
|
||||||
func createLatestApiModuleExtensionVersionFile(mctx android.LoadHookContext, name string, version string) {
|
func createLatestApiModuleExtensionVersionFile(mctx android.LoadHookContext, name string, version string) {
|
||||||
genruleProps := struct {
|
genruleProps := struct {
|
||||||
Name *string
|
Name *string
|
||||||
@@ -252,6 +267,10 @@ func PrebuiltApiModuleName(module, scope, version string) string {
|
|||||||
return module + ".api." + scope + "." + version
|
return module + ".api." + scope + "." + version
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PrebuiltApiCombinedModuleName(module, scope, version string) string {
|
||||||
|
return module + ".api.combined." + scope + "." + version
|
||||||
|
}
|
||||||
|
|
||||||
func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) {
|
func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) {
|
||||||
// <apiver>/<scope>/api/<module>.txt
|
// <apiver>/<scope>/api/<module>.txt
|
||||||
apiLevelFiles := globApiDirs(mctx, p, "api/*.txt")
|
apiLevelFiles := globApiDirs(mctx, p, "api/*.txt")
|
||||||
@@ -307,7 +326,9 @@ func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sort the keys in order to make build.ninja stable
|
// Sort the keys in order to make build.ninja stable
|
||||||
for _, k := range android.SortedKeys(latest) {
|
sortedLatestKeys := android.SortedKeys(latest)
|
||||||
|
|
||||||
|
for _, k := range sortedLatestKeys {
|
||||||
info := latest[k]
|
info := latest[k]
|
||||||
name := PrebuiltApiModuleName(info.module, info.scope, "latest")
|
name := PrebuiltApiModuleName(info.module, info.scope, "latest")
|
||||||
latestExtensionVersionModuleName := PrebuiltApiModuleName(info.module, info.scope, "latest.extension_version")
|
latestExtensionVersionModuleName := PrebuiltApiModuleName(info.module, info.scope, "latest.extension_version")
|
||||||
@@ -333,11 +354,25 @@ func prebuiltApiFiles(mctx android.LoadHookContext, p *prebuiltApis) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Create empty incompatibilities files for remaining modules
|
// Create empty incompatibilities files for remaining modules
|
||||||
for _, k := range android.SortedKeys(latest) {
|
// If the incompatibility module has been created, create a corresponding combined module
|
||||||
|
for _, k := range sortedLatestKeys {
|
||||||
if _, ok := incompatibilities[k]; !ok {
|
if _, ok := incompatibilities[k]; !ok {
|
||||||
createEmptyFile(mctx, PrebuiltApiModuleName(latest[k].module+"-incompatibilities", latest[k].scope, "latest"))
|
createEmptyFile(mctx, PrebuiltApiModuleName(latest[k].module+"-incompatibilities", latest[k].scope, "latest"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create combined latest api and removed api files modules.
|
||||||
|
// The combined modules list all api files of the api scope and its subset api scopes.
|
||||||
|
for _, k := range sortedLatestKeys {
|
||||||
|
info := latest[k]
|
||||||
|
name := PrebuiltApiCombinedModuleName(info.module, info.scope, "latest")
|
||||||
|
|
||||||
|
var srcs []string
|
||||||
|
currentApiScope := scopeByName[info.scope]
|
||||||
|
srcs = append(srcs, PrebuiltApiModuleName(info.module, currentApiScope.name, "latest"))
|
||||||
|
|
||||||
|
createCombinedApiFilegroupModule(mctx, name, srcs)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func createPrebuiltApiModules(mctx android.LoadHookContext) {
|
func createPrebuiltApiModules(mctx android.LoadHookContext) {
|
||||||
|
@@ -1672,12 +1672,16 @@ func latestPrebuiltApiModuleName(name string, apiScope *apiScope) string {
|
|||||||
return PrebuiltApiModuleName(name, apiScope.name, "latest")
|
return PrebuiltApiModuleName(name, apiScope.name, "latest")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func latestPrebuiltApiCombinedModuleName(name string, apiScope *apiScope) string {
|
||||||
|
return PrebuiltApiCombinedModuleName(name, apiScope.name, "latest")
|
||||||
|
}
|
||||||
|
|
||||||
func (module *SdkLibrary) latestApiFilegroupName(apiScope *apiScope) string {
|
func (module *SdkLibrary) latestApiFilegroupName(apiScope *apiScope) string {
|
||||||
return ":" + module.latestApiModuleName(apiScope)
|
return ":" + module.latestApiModuleName(apiScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (module *SdkLibrary) latestApiModuleName(apiScope *apiScope) string {
|
func (module *SdkLibrary) latestApiModuleName(apiScope *apiScope) string {
|
||||||
return latestPrebuiltApiModuleName(module.distStem(), apiScope)
|
return latestPrebuiltApiCombinedModuleName(module.distStem(), apiScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (module *SdkLibrary) latestRemovedApiFilegroupName(apiScope *apiScope) string {
|
func (module *SdkLibrary) latestRemovedApiFilegroupName(apiScope *apiScope) string {
|
||||||
@@ -1685,7 +1689,7 @@ func (module *SdkLibrary) latestRemovedApiFilegroupName(apiScope *apiScope) stri
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (module *SdkLibrary) latestRemovedApiModuleName(apiScope *apiScope) string {
|
func (module *SdkLibrary) latestRemovedApiModuleName(apiScope *apiScope) string {
|
||||||
return latestPrebuiltApiModuleName(module.distStem()+"-removed", apiScope)
|
return latestPrebuiltApiCombinedModuleName(module.distStem()+"-removed", apiScope)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (module *SdkLibrary) latestIncompatibilitiesFilegroupName(apiScope *apiScope) string {
|
func (module *SdkLibrary) latestIncompatibilitiesFilegroupName(apiScope *apiScope) string {
|
||||||
|
@@ -139,10 +139,10 @@ func TestJavaSdkLibrary(t *testing.T) {
|
|||||||
|
|
||||||
exportedComponentsInfo, _ := android.SingletonModuleProvider(result, foo.Module(), android.ExportedComponentsInfoProvider)
|
exportedComponentsInfo, _ := android.SingletonModuleProvider(result, foo.Module(), android.ExportedComponentsInfoProvider)
|
||||||
expectedFooExportedComponents := []string{
|
expectedFooExportedComponents := []string{
|
||||||
"foo-removed.api.public.latest",
|
"foo-removed.api.combined.public.latest",
|
||||||
"foo-removed.api.system.latest",
|
"foo-removed.api.combined.system.latest",
|
||||||
"foo.api.public.latest",
|
"foo.api.combined.public.latest",
|
||||||
"foo.api.system.latest",
|
"foo.api.combined.system.latest",
|
||||||
"foo.stubs",
|
"foo.stubs",
|
||||||
"foo.stubs.exportable",
|
"foo.stubs.exportable",
|
||||||
"foo.stubs.exportable.system",
|
"foo.stubs.exportable.system",
|
||||||
@@ -556,8 +556,8 @@ func TestJavaSdkLibrary_Deps(t *testing.T) {
|
|||||||
|
|
||||||
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
||||||
`dex2oatd`,
|
`dex2oatd`,
|
||||||
`sdklib-removed.api.public.latest`,
|
`sdklib-removed.api.combined.public.latest`,
|
||||||
`sdklib.api.public.latest`,
|
`sdklib.api.combined.public.latest`,
|
||||||
`sdklib.impl`,
|
`sdklib.impl`,
|
||||||
`sdklib.stubs`,
|
`sdklib.stubs`,
|
||||||
`sdklib.stubs.exportable`,
|
`sdklib.stubs.exportable`,
|
||||||
@@ -960,8 +960,8 @@ func TestJavaSdkLibraryImport_WithSource(t *testing.T) {
|
|||||||
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
||||||
`dex2oatd`,
|
`dex2oatd`,
|
||||||
`prebuilt_sdklib`,
|
`prebuilt_sdklib`,
|
||||||
`sdklib-removed.api.public.latest`,
|
`sdklib-removed.api.combined.public.latest`,
|
||||||
`sdklib.api.public.latest`,
|
`sdklib.api.combined.public.latest`,
|
||||||
`sdklib.impl`,
|
`sdklib.impl`,
|
||||||
`sdklib.stubs`,
|
`sdklib.stubs`,
|
||||||
`sdklib.stubs.exportable`,
|
`sdklib.stubs.exportable`,
|
||||||
@@ -1039,8 +1039,8 @@ func testJavaSdkLibraryImport_Preferred(t *testing.T, prefer string, preparer an
|
|||||||
|
|
||||||
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
CheckModuleDependencies(t, result.TestContext, "sdklib", "android_common", []string{
|
||||||
`prebuilt_sdklib`,
|
`prebuilt_sdklib`,
|
||||||
`sdklib-removed.api.public.latest`,
|
`sdklib-removed.api.combined.public.latest`,
|
||||||
`sdklib.api.public.latest`,
|
`sdklib.api.combined.public.latest`,
|
||||||
`sdklib.impl`,
|
`sdklib.impl`,
|
||||||
`sdklib.stubs`,
|
`sdklib.stubs`,
|
||||||
`sdklib.stubs.exportable`,
|
`sdklib.stubs.exportable`,
|
||||||
|
Reference in New Issue
Block a user