diff options
author | 2023-09-20 23:03:01 +0000 | |
---|---|---|
committer | 2023-09-21 21:02:39 +0000 | |
commit | 6be0f00671e39a8b744a10bd1d0c91dc8724d4b2 (patch) | |
tree | fcef0b35e94f8d297e9d9da278b24ce60d751c08 /java/java.go | |
parent | c0f7bd1a152a5f1c431adefc2a2d853716b4bf24 (diff) |
Remove api_files property from java_api_library
java_api_contribution provides api_surface information, but files
directly passed to java_api_library do not possess such information.
Currently, the api surface is assumed via naming convention for api
files passed via api_files property, but this is fragile.
This change removes the api_files property from java_api_library and
enforce all api files to be passed via java_api_contribution
Test: m nothing --build-from-text-stub
Bug: 300964421
Change-Id: If01d9ed978fe469d4ee0d685582a51629ebecc56
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/java/java.go b/java/java.go index 4f31af685..aba4faac0 100644 --- a/java/java.go +++ b/java/java.go @@ -1667,11 +1667,6 @@ type JavaApiLibraryProperties struct { // This is a list of Soong modules Api_contributions []string - // list of api.txt files relative to this directory that contribute to the - // API surface. - // This is a list of relative paths - Api_files []string `android:"path"` - // List of flags to be passed to the javac compiler to generate jar file Javacflags []string @@ -1824,7 +1819,7 @@ func (al *ApiLibrary) DepsMutator(ctx android.BottomUpMutatorContext) { var scopeOrderedSourceFileNames = allApiScopes.Strings( func(s *apiScope) string { return s.apiFilePrefix + "current.txt" }) -func (al *ApiLibrary) sortApiFilesByApiScope(ctx android.ModuleContext, srcFilesInfo []JavaApiImportInfo, apiFiles android.Paths) android.Paths { +func (al *ApiLibrary) sortApiFilesByApiScope(ctx android.ModuleContext, srcFilesInfo []JavaApiImportInfo) android.Paths { var sortedSrcFiles android.Paths for i, apiScope := range allApiScopes { @@ -1833,20 +1828,14 @@ func (al *ApiLibrary) sortApiFilesByApiScope(ctx android.ModuleContext, srcFiles sortedSrcFiles = append(sortedSrcFiles, android.PathForSource(ctx, srcFileInfo.ApiFile.String())) } } - // TODO: b/300964421 - Remove when api_files property is removed - for _, apiFileName := range apiFiles { - if apiFileName.Base() == scopeOrderedSourceFileNames[i] { - sortedSrcFiles = append(sortedSrcFiles, apiFileName) - } - } } - if len(srcFilesInfo)+len(apiFiles) != len(sortedSrcFiles) { + if len(srcFilesInfo) != len(sortedSrcFiles) { var srcFiles android.Paths for _, srcFileInfo := range srcFilesInfo { srcFiles = append(srcFiles, srcFileInfo.ApiFile) } - ctx.ModuleErrorf("Unrecognizable source file found within %s", append(srcFiles, apiFiles...)) + ctx.ModuleErrorf("Unrecognizable source file found within %s", srcFiles) } return sortedSrcFiles @@ -1892,15 +1881,7 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) { } }) - // Add the api_files inputs - // These are api files in the module subdirectory, which are not provided by - // java_api_contribution but provided directly as module property. - var apiFiles android.Paths - for _, api := range al.properties.Api_files { - apiFiles = append(apiFiles, android.PathForModuleSrc(ctx, api)) - } - - srcFiles := al.sortApiFilesByApiScope(ctx, srcFilesInfo, apiFiles) + srcFiles := al.sortApiFilesByApiScope(ctx, srcFilesInfo) if srcFiles == nil && !ctx.Config().AllowMissingDependencies() { ctx.ModuleErrorf("Error: %s has an empty api file.", ctx.ModuleName()) |