Merge "Update java_api_library prop name" am: ba36441424
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2307482 Change-Id: I1fcd6f8165d3f33143cc938979ab1cf45f54af6c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
b69a83a756
2 changed files with 15 additions and 20 deletions
27
java/java.go
27
java/java.go
|
@ -1552,8 +1552,8 @@ type JavaApiLibraryProperties struct {
|
||||||
// name of the API surface
|
// name of the API surface
|
||||||
Api_surface *string
|
Api_surface *string
|
||||||
|
|
||||||
// list of API provider modules that consists this API surface
|
// list of Java API contribution modules that consists this API surface
|
||||||
Api_providers []string
|
Api_contributions []string
|
||||||
|
|
||||||
// List of flags to be passed to the javac compiler to generate jar file
|
// List of flags to be passed to the javac compiler to generate jar file
|
||||||
Javacflags []string
|
Javacflags []string
|
||||||
|
@ -1621,12 +1621,12 @@ func (al *ApiLibrary) stubsFlags(ctx android.ModuleContext, cmd *android.RuleBui
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var javaApiProviderTag = dependencyTag{name: "java-api-provider"}
|
var javaApiContributionTag = dependencyTag{name: "java-api-contribution"}
|
||||||
|
|
||||||
func (al *ApiLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
func (al *ApiLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||||
apiProviders := al.properties.Api_providers
|
apiContributions := al.properties.Api_contributions
|
||||||
for _, apiProviderName := range apiProviders {
|
for _, apiContributionName := range apiContributions {
|
||||||
ctx.AddDependency(ctx.Module(), javaApiProviderTag, apiProviderName)
|
ctx.AddDependency(ctx.Module(), javaApiContributionTag, apiContributionName)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1645,16 +1645,11 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
|
|
||||||
homeDir := android.PathForModuleOut(ctx, "metalava", "home")
|
homeDir := android.PathForModuleOut(ctx, "metalava", "home")
|
||||||
|
|
||||||
apiProviders := al.properties.Api_providers
|
var srcFiles []android.Path
|
||||||
srcFiles := make([]android.Path, len(apiProviders))
|
ctx.VisitDirectDepsWithTag(javaApiContributionTag, func(dep android.Module) {
|
||||||
for i, apiProviderName := range apiProviders {
|
provider := ctx.OtherModuleProvider(dep, JavaApiImportProvider).(JavaApiImportInfo)
|
||||||
apiProvider := ctx.GetDirectDepWithTag(apiProviderName, javaApiProviderTag)
|
srcFiles = append(srcFiles, android.PathForModuleSrc(ctx, provider.ApiFile.String()))
|
||||||
if apiProvider == nil {
|
})
|
||||||
panic(fmt.Errorf("Java API provider module %s not found, called from %s", apiProviderName, al.Name()))
|
|
||||||
}
|
|
||||||
provider := ctx.OtherModuleProvider(apiProvider, JavaApiImportProvider).(JavaApiImportInfo)
|
|
||||||
srcFiles[i] = android.PathForModuleSrc(ctx, provider.ApiFile.String())
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd := metalavaStubCmd(ctx, rule, srcFiles, homeDir)
|
cmd := metalavaStubCmd(ctx, rule, srcFiles, homeDir)
|
||||||
|
|
||||||
|
|
|
@ -1823,13 +1823,13 @@ func TestJavaApiLibraryAndProviderLink(t *testing.T) {
|
||||||
java_api_library {
|
java_api_library {
|
||||||
name: "bar1",
|
name: "bar1",
|
||||||
api_surface: "public",
|
api_surface: "public",
|
||||||
api_providers: ["foo1"],
|
api_contributions: ["foo1"],
|
||||||
}
|
}
|
||||||
|
|
||||||
java_api_library {
|
java_api_library {
|
||||||
name: "bar2",
|
name: "bar2",
|
||||||
api_surface: "system",
|
api_surface: "system",
|
||||||
api_providers: ["foo1", "foo2"],
|
api_contributions: ["foo1", "foo2"],
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
map[string][]byte{
|
map[string][]byte{
|
||||||
|
@ -1876,13 +1876,13 @@ func TestJavaApiLibraryJarGeneration(t *testing.T) {
|
||||||
java_api_library {
|
java_api_library {
|
||||||
name: "bar1",
|
name: "bar1",
|
||||||
api_surface: "public",
|
api_surface: "public",
|
||||||
api_providers: ["foo1"],
|
api_contributions: ["foo1"],
|
||||||
}
|
}
|
||||||
|
|
||||||
java_api_library {
|
java_api_library {
|
||||||
name: "bar2",
|
name: "bar2",
|
||||||
api_surface: "system",
|
api_surface: "system",
|
||||||
api_providers: ["foo1", "foo2"],
|
api_contributions: ["foo1", "foo2"],
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
map[string][]byte{
|
map[string][]byte{
|
||||||
|
|
Loading…
Reference in a new issue