diff options
| author | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
|---|---|---|
| committer | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
| commit | c7bade461dc55726f62997d13a48582f7c4b4655 (patch) | |
| tree | ea0588da76060a2038f54f67efd046ca77634b10 /java/droidstubs.go | |
| parent | 0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff) | |
| parent | 89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff) | |
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits)
Revert "install_symlink: Make symlink target configurable"
Reapply "Clear as much of cc.Module as possible after GenerateBuildActions"
Revert "rust: config: Fix missing CPU variant LD flags in Rust"
Rename build-flag in outdir
Revert^4 "cipd: Default CIPD proxy server to on, add opt-out"
Convert check-vintf-all to phony with actions
Create a partial implementation of check-vintf-all for soong-only
Configure RBE rust pool based on build variant
Revert^3 "Add sdk version check to arr"
Add jdk.internal.invoke to the allowlist
Make droid always depend on symbols zip
Import Device and Odm skus
Don't install gob_gen in Soong
Remove bazel reference from run_integration_tests.sh
Fix bootstrap_test.sh
Don't panic in aconfig libraries when AllowMissingDependencies is set
Avoid returning nil paths from PathForModuleSrc
Revert "Flag controled clang version"
Rework module target dependencies on required deps
Revert^2 "Add sdk version check to arr"
...
Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'java/droidstubs.go')
| -rw-r--r-- | java/droidstubs.go | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/java/droidstubs.go b/java/droidstubs.go index b30c8448a..c2a5c046e 100644 --- a/java/droidstubs.go +++ b/java/droidstubs.go @@ -18,6 +18,7 @@ import ( "fmt" "path/filepath" "regexp" + "slices" "strings" "github.com/google/blueprint" @@ -36,6 +37,7 @@ type StubsInfo struct { } type DroidStubsInfo struct { + AconfigProtoFiles android.Paths CurrentApiTimestamp android.Path EverythingStubsInfo StubsInfo ExportableStubsInfo StubsInfo @@ -437,6 +439,8 @@ func (d *Droidstubs) DepsMutator(ctx android.BottomUpMutatorContext) { if d.properties.Api_levels_module != nil { ctx.AddDependency(ctx.Module(), metalavaAPILevelsModuleTag, proptools.String(d.properties.Api_levels_module)) } + + d.EmbeddableSdkLibraryComponent.setComponentDependencyInfoProvider(ctx) } func (d *Droidstubs) sdkValuesFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, metadataDir android.WritablePath) { @@ -593,6 +597,18 @@ func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *an filename := proptools.StringDefault(d.properties.Api_levels_jar_filename, "android.jar") + // If generating the android API then include android.test.*.jars in the set + // of files passed to Metalava. + filenames := []string{filename} + if filename == "android.jar" { + filenames = append( + filenames, + "android.test.base.jar", + "android.test.mock.jar", + "android.test.runner.jar", + ) + } + // TODO: Avoid the duplication of API surfaces, reuse apiScope. // Add all relevant --android-jar-pattern patterns for Metalava. // When parsing a stub jar for a specific version, Metalava picks the first pattern that defines @@ -648,7 +664,7 @@ func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *an extensions_dir = t.Dir.String() + "/extensions" } cmd.Implicit(dep) - } else if depBase == filename { + } else if slices.Contains(filenames, depBase) { // Check to see if it matches a dessert release for an SDK, e.g. Android, Car, Wear, etc.. cmd.Implicit(dep) } else if depBase == AndroidPlusUpdatableJar && d.properties.Extensions_info_file != nil { @@ -688,7 +704,16 @@ func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *an addPattern(AndroidPlusUpdatableJar) } + // Always add the main jar, e.g. android.jar. This will be overridden by + // android-plus-updatable.jar if a pattern for it was added as that comes + // first and neither has a library placeholder. addPattern(filename) + + // If additional file names were added then they are assumed to be + // libraries so match them using a {library} placeholder. + if len(filenames) > 1 { + addPattern("{library}.jar") + } } if extensions_dir != "" { @@ -1251,7 +1276,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Add options for the other optional tasks: API-lint and check-released. // We generate separate timestamp files for them. - doApiLint := BoolDefault(d.properties.Check_api.Api_lint.Enabled, false) && !ctx.Config().PartialCompileFlags().Disable_api_lint + doApiLint := BoolDefault(d.properties.Check_api.Api_lint.Enabled, false) doCheckReleased := apiCheckEnabled(ctx, d.properties.Check_api.Last_released, "last_released") writeSdkValues := Bool(d.properties.Write_sdk_values) @@ -1380,15 +1405,12 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) { if d.apiLintTimestamp != nil { cmd.Validation(d.apiLintTimestamp) } - if d.checkLastReleasedApiTimestamp != nil { cmd.Validation(d.checkLastReleasedApiTimestamp) } - if d.checkNullabilityWarningsTimestamp != nil { cmd.Validation(d.checkNullabilityWarningsTimestamp) } - rule.Build("metalavaCurrentApiCheck", "check current API") d.updateCurrentApiTimestamp = android.PathForModuleOut(ctx, Everything.String(), "update_current_api.timestamp") @@ -1407,6 +1429,9 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) { Input(d.removedApiFile).Flag(removedApiFile.String()) msg = "failed to update public API" + if ctx.Config().GetBuildFlagBool("RELEASE_SRC_DIR_IS_READ_ONLY") { + msg += ". You may need `BUILD_BROKEN_SRC_DIR_IS_WRITABLE=true`" + } rule.Command(). Text("touch").Output(d.updateCurrentApiTimestamp). @@ -1419,6 +1444,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) { } droidInfo := DroidStubsInfo{ + AconfigProtoFiles: deps.aconfigProtoFiles, CurrentApiTimestamp: d.CurrentApiTimestamp(), EverythingStubsInfo: StubsInfo{}, ExportableStubsInfo: StubsInfo{}, @@ -1593,6 +1619,10 @@ func (d *PrebuiltStubsSources) StubsSrcJar(_ StubsType) (android.Path, error) { return d.stubsSrcJar, nil } +func (p *PrebuiltStubsSources) DepsMutator(ctx android.BottomUpMutatorContext) { + p.EmbeddableSdkLibraryComponent.setComponentDependencyInfoProvider(ctx) +} + func (p *PrebuiltStubsSources) GenerateAndroidBuildActions(ctx android.ModuleContext) { if len(p.properties.Srcs) != 1 { ctx.PropertyErrorf("srcs", "must only specify one directory path or srcjar, contains %d paths", len(p.properties.Srcs)) |
