summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2025-02-07 18:45:26 -0800
committer Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com> 2025-02-07 18:45:26 -0800
commitd378ca087c3a01625d6ee755143c8e28dc87cee3 (patch)
treeb083d4b3859552c99ecdfc9b6c748470d19223f8 /java/java.go
parent4a58eb640502392789a1a9a9163c2e926b3e22ad (diff)
parentd5a846331c73817b78abdf8e3a7f3b5b857ee42f (diff)
Merge "Convert api.xml dist rules to Soong" into main am: d5a846331c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3483791 Change-Id: I985e7a055254f3396b05701128ea4f8f5e56bada Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/java/java.go b/java/java.go
index d32133972..c1ce880d6 100644
--- a/java/java.go
+++ b/java/java.go
@@ -829,6 +829,8 @@ type Library struct {
combinedExportedProguardFlagsFile android.Path
InstallMixin func(ctx android.ModuleContext, installPath android.Path) (extraInstallDeps android.InstallPaths)
+
+ apiXmlFile android.WritablePath
}
var _ android.ApexModule = (*Library)(nil)
@@ -1156,6 +1158,8 @@ func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
j.javaLibraryModuleInfoJSON(ctx)
buildComplianceMetadata(ctx)
+
+ j.createApiXmlFile(ctx)
}
func (j *Library) javaLibraryModuleInfoJSON(ctx android.ModuleContext) *android.ModuleInfoJSON {
@@ -1260,6 +1264,35 @@ func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) {
}
}
+var apiXMLGeneratingApiSurfaces = []android.SdkKind{
+ android.SdkPublic,
+ android.SdkSystem,
+ android.SdkModule,
+ android.SdkSystemServer,
+ android.SdkTest,
+}
+
+func (j *Library) createApiXmlFile(ctx android.ModuleContext) {
+ if kind, ok := android.JavaLibraryNameToSdkKind(ctx.ModuleName()); ok && android.InList(kind, apiXMLGeneratingApiSurfaces) {
+ scopePrefix := AllApiScopes.matchingScopeFromSdkKind(kind).apiFilePrefix
+ j.apiXmlFile = android.PathForModuleOut(ctx, fmt.Sprintf("%sapi.xml", scopePrefix))
+ ctx.Build(pctx, android.BuildParams{
+ Rule: generateApiXMLRule,
+ // LOCAL_SOONG_CLASSES_JAR
+ Input: j.implementationAndResourcesJar,
+ Output: j.apiXmlFile,
+ })
+ }
+}
+
+var _ android.ModuleMakeVarsProvider = (*Library)(nil)
+
+func (j *Library) MakeVars(ctx android.MakeVarsModuleContext) {
+ if j.apiXmlFile != nil {
+ ctx.DistForGoal("dist_files", j.apiXmlFile)
+ }
+}
+
const (
aidlIncludeDir = "aidl"
javaDir = "java"