Merge "Modify LOCAL_DROIDDOC_* to export the exportable artifacts" into main am: 7dacb0e872 am: 094cc9a9aa
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2944801
Change-Id: I2be2e1c397d312876fdfd9f3f5c02005540cd244
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/java/androidmk.go b/java/androidmk.go
index b523594..b7df9bf 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -549,8 +549,8 @@
if BoolDefault(jd.properties.Installable, true) {
entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", jd.docZip)
}
- if jd.stubsSrcJar != nil {
- entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", jd.stubsSrcJar)
+ if jd.exportableStubsSrcJar != nil {
+ entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", jd.exportableStubsSrcJar)
}
},
},
@@ -596,17 +596,17 @@
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
- if dstubs.Javadoc.stubsSrcJar != nil {
- entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.stubsSrcJar)
+ if dstubs.Javadoc.exportableStubsSrcJar != nil {
+ entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.exportableStubsSrcJar)
}
if dstubs.everythingArtifacts.apiVersionsXml != nil {
- entries.SetPath("LOCAL_DROIDDOC_API_VERSIONS_XML", dstubs.everythingArtifacts.apiVersionsXml)
+ entries.SetPath("LOCAL_DROIDDOC_API_VERSIONS_XML", dstubs.exportableArtifacts.apiVersionsXml)
}
if dstubs.everythingArtifacts.annotationsZip != nil {
- entries.SetPath("LOCAL_DROIDDOC_ANNOTATIONS_ZIP", dstubs.everythingArtifacts.annotationsZip)
+ entries.SetPath("LOCAL_DROIDDOC_ANNOTATIONS_ZIP", dstubs.exportableArtifacts.annotationsZip)
}
if dstubs.everythingArtifacts.metadataZip != nil {
- entries.SetPath("LOCAL_DROIDDOC_METADATA_ZIP", dstubs.everythingArtifacts.metadataZip)
+ entries.SetPath("LOCAL_DROIDDOC_METADATA_ZIP", dstubs.exportableArtifacts.metadataZip)
}
},
},
diff --git a/java/droidstubs.go b/java/droidstubs.go
index dc3a0ec..4267545 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -333,66 +333,89 @@
}
}
-func (d *Droidstubs) AnnotationsZip(stubsType StubsType) (android.Path, error) {
+func (d *Droidstubs) AnnotationsZip(stubsType StubsType) (ret android.Path, err error) {
switch stubsType {
case Everything:
- return d.everythingArtifacts.annotationsZip, nil
+ ret, err = d.everythingArtifacts.annotationsZip, nil
case Exportable:
- return d.exportableArtifacts.annotationsZip, nil
+ ret, err = d.exportableArtifacts.annotationsZip, nil
default:
- return nil, fmt.Errorf("annotations zip not supported for the stub type %s", stubsType.String())
+ ret, err = nil, fmt.Errorf("annotations zip not supported for the stub type %s", stubsType.String())
}
+ return ret, err
}
-func (d *Droidstubs) ApiFilePath(stubsType StubsType) (android.Path, error) {
+func (d *Droidstubs) ApiFilePath(stubsType StubsType) (ret android.Path, err error) {
switch stubsType {
case Everything:
- return d.apiFile, nil
+ ret, err = d.apiFile, nil
case Exportable:
- return d.exportableApiFile, nil
+ ret, err = d.exportableApiFile, nil
default:
- return nil, fmt.Errorf("api file path not supported for the stub type %s", stubsType.String())
+ ret, err = nil, fmt.Errorf("api file path not supported for the stub type %s", stubsType.String())
}
+ if ret == nil && err == nil {
+ err = fmt.Errorf("stubs srcjar is null for the stub type %s", stubsType.String())
+ }
+ return ret, err
}
-func (d *Droidstubs) ApiVersionsXmlFilePath(stubsType StubsType) (android.Path, error) {
+func (d *Droidstubs) ApiVersionsXmlFilePath(stubsType StubsType) (ret android.Path, err error) {
switch stubsType {
case Everything:
- return d.everythingArtifacts.apiVersionsXml, nil
- default:
- return nil, fmt.Errorf("api versions xml file path not supported for the stub type %s", stubsType.String())
- }
-}
-
-func (d *Droidstubs) DocZip(stubsType StubsType) (android.Path, error) {
- switch stubsType {
- case Everything:
- return d.docZip, nil
- default:
- return nil, fmt.Errorf("docs zip not supported for the stub type %s", stubsType.String())
- }
-}
-
-func (d *Droidstubs) RemovedApiFilePath(stubsType StubsType) (android.Path, error) {
- switch stubsType {
- case Everything:
- return d.removedApiFile, nil
+ ret, err = d.everythingArtifacts.apiVersionsXml, nil
case Exportable:
- return d.exportableRemovedApiFile, nil
+ ret, err = d.exportableArtifacts.apiVersionsXml, nil
default:
- return nil, fmt.Errorf("removed api file path not supported for the stub type %s", stubsType.String())
+ ret, err = nil, fmt.Errorf("api versions xml file path not supported for the stub type %s", stubsType.String())
}
+ if ret == nil && err == nil {
+ err = fmt.Errorf("api versions xml file is null for the stub type %s", stubsType.String())
+ }
+ return ret, err
}
-func (d *Droidstubs) StubsSrcJar(stubsType StubsType) (android.Path, error) {
+func (d *Droidstubs) DocZip(stubsType StubsType) (ret android.Path, err error) {
switch stubsType {
case Everything:
- return d.stubsSrcJar, nil
- case Exportable:
- return d.exportableStubsSrcJar, nil
+ ret, err = d.docZip, nil
default:
- return nil, fmt.Errorf("stubs srcjar not supported for the stub type %s", stubsType.String())
+ ret, err = nil, fmt.Errorf("docs zip not supported for the stub type %s", stubsType.String())
}
+ if ret == nil && err == nil {
+ err = fmt.Errorf("docs zip is null for the stub type %s", stubsType.String())
+ }
+ return ret, err
+}
+
+func (d *Droidstubs) RemovedApiFilePath(stubsType StubsType) (ret android.Path, err error) {
+ switch stubsType {
+ case Everything:
+ ret, err = d.removedApiFile, nil
+ case Exportable:
+ ret, err = d.exportableRemovedApiFile, nil
+ default:
+ ret, err = nil, fmt.Errorf("removed api file path not supported for the stub type %s", stubsType.String())
+ }
+ if ret == nil && err == nil {
+ err = fmt.Errorf("removed api file is null for the stub type %s", stubsType.String())
+ }
+ return ret, err
+}
+
+func (d *Droidstubs) StubsSrcJar(stubsType StubsType) (ret android.Path, err error) {
+ switch stubsType {
+ case Everything:
+ ret, err = d.stubsSrcJar, nil
+ case Exportable:
+ ret, err = d.exportableStubsSrcJar, nil
+ default:
+ ret, err = nil, fmt.Errorf("stubs srcjar not supported for the stub type %s", stubsType.String())
+ }
+ if ret == nil && err == nil {
+ err = fmt.Errorf("stubs srcjar is null for the stub type %s", stubsType.String())
+ }
+ return ret, err
}
func (d *Droidstubs) CurrentApiTimestamp() android.Path {
@@ -982,8 +1005,11 @@
stubConfig: params,
}
- d.Javadoc.exportableStubsSrcJar = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"-"+"stubs.srcjar")
- optionalCmdParams.stubsSrcJar = d.Javadoc.exportableStubsSrcJar
+ if params.generateStubs {
+ d.Javadoc.exportableStubsSrcJar = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"-"+"stubs.srcjar")
+ optionalCmdParams.stubsSrcJar = d.Javadoc.exportableStubsSrcJar
+ }
+
if params.writeSdkValues {
d.exportableArtifacts.metadataZip = android.PathForModuleOut(ctx, params.stubsType.String(), ctx.ModuleName()+"-metadata.zip")
d.exportableArtifacts.metadataDir = android.PathForModuleOut(ctx, params.stubsType.String(), "metadata")