Merge "Use OutputFilesProvider on Import, AARImport and AndroidAppImport" into main
diff --git a/cc/llndk_library.go b/cc/llndk_library.go
index 632c76d..85c3edf 100644
--- a/cc/llndk_library.go
+++ b/cc/llndk_library.go
@@ -184,10 +184,6 @@
return ""
}
-func (txt *llndkLibrariesTxtModule) OutputFiles(tag string) (android.Paths, error) {
- return android.Paths{txt.outputFile}, nil
-}
-
func llndkMutator(mctx android.BottomUpMutatorContext) {
m, ok := mctx.Module().(*Module)
if !ok {
diff --git a/cc/sanitize.go b/cc/sanitize.go
index d72d7d3..d43a096 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -1899,7 +1899,3 @@
func (txt *sanitizerLibrariesTxtModule) SubDir() string {
return ""
}
-
-func (txt *sanitizerLibrariesTxtModule) OutputFiles(tag string) (android.Paths, error) {
- return android.Paths{txt.outputFile}, nil
-}
diff --git a/java/droiddoc_test.go b/java/droiddoc_test.go
index 8d1f591..e584640 100644
--- a/java/droiddoc_test.go
+++ b/java/droiddoc_test.go
@@ -69,11 +69,7 @@
"bar-doc/a.java": nil,
"bar-doc/b.java": nil,
})
- barStubs := ctx.ModuleForTests("bar-stubs", "android_common")
- barStubsOutputs, err := barStubs.Module().(*Droidstubs).OutputFiles("")
- if err != nil {
- t.Errorf("Unexpected error %q retrieving \"bar-stubs\" output file", err)
- }
+ barStubsOutputs := ctx.ModuleForTests("bar-stubs", "android_common").OutputFiles(t, "")
if len(barStubsOutputs) != 1 {
t.Errorf("Expected one output from \"bar-stubs\" got %s", barStubsOutputs)
}
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 0157185..a8e0a22 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -283,66 +283,6 @@
return module
}
-func getStubsTypeAndTag(tag string) (StubsType, string, error) {
- if len(tag) == 0 {
- return Everything, "", nil
- }
- if tag[0] != '.' {
- return Unavailable, "", fmt.Errorf("tag must begin with \".\"")
- }
-
- stubsType := Everything
- // Check if the tag has a stubs type prefix (e.g. ".exportable")
- for st := Everything; st <= Exportable; st++ {
- if strings.HasPrefix(tag, "."+st.String()) {
- stubsType = st
- }
- }
-
- return stubsType, strings.TrimPrefix(tag, "."+stubsType.String()), nil
-}
-
-// Droidstubs' tag supports specifying with the stubs type.
-// While supporting the pre-existing tags, it also supports tags with
-// the stubs type prefix. Some examples are shown below:
-// {.annotations.zip} - pre-existing behavior. Returns the path to the
-// annotation zip.
-// {.exportable} - Returns the path to the exportable stubs src jar.
-// {.exportable.annotations.zip} - Returns the path to the exportable
-// annotations zip file.
-// {.runtime.api_versions.xml} - Runtime stubs does not generate api versions
-// xml file. For unsupported combinations, the default everything output file
-// is returned.
-func (d *Droidstubs) OutputFiles(tag string) (android.Paths, error) {
- stubsType, prefixRemovedTag, err := getStubsTypeAndTag(tag)
- if err != nil {
- return nil, err
- }
- switch prefixRemovedTag {
- case "":
- stubsSrcJar, err := d.StubsSrcJar(stubsType)
- return android.Paths{stubsSrcJar}, err
- case ".docs.zip":
- docZip, err := d.DocZip(stubsType)
- return android.Paths{docZip}, err
- case ".api.txt", android.DefaultDistTag:
- // This is the default dist path for dist properties that have no tag property.
- apiFilePath, err := d.ApiFilePath(stubsType)
- return android.Paths{apiFilePath}, err
- case ".removed-api.txt":
- removedApiFilePath, err := d.RemovedApiFilePath(stubsType)
- return android.Paths{removedApiFilePath}, err
- case ".annotations.zip":
- annotationsZip, err := d.AnnotationsZip(stubsType)
- return android.Paths{annotationsZip}, err
- case ".api_versions.xml":
- apiVersionsXmlFilePath, err := d.ApiVersionsXmlFilePath(stubsType)
- return android.Paths{apiVersionsXmlFilePath}, err
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
func (d *Droidstubs) AnnotationsZip(stubsType StubsType) (ret android.Path, err error) {
switch stubsType {
case Everything:
@@ -1363,6 +1303,46 @@
rule.Build("nullabilityWarningsCheck", "nullability warnings check")
}
+
+ d.setOutputFiles(ctx)
+}
+
+// This method sets the outputFiles property, which is used to set the
+// OutputFilesProvider later.
+// Droidstubs' tag supports specifying with the stubs type.
+// While supporting the pre-existing tags, it also supports tags with
+// the stubs type prefix. Some examples are shown below:
+// {.annotations.zip} - pre-existing behavior. Returns the path to the
+// annotation zip.
+// {.exportable} - Returns the path to the exportable stubs src jar.
+// {.exportable.annotations.zip} - Returns the path to the exportable
+// annotations zip file.
+// {.runtime.api_versions.xml} - Runtime stubs does not generate api versions
+// xml file. For unsupported combinations, the default everything output file
+// is returned.
+func (d *Droidstubs) setOutputFiles(ctx android.ModuleContext) {
+ tagToOutputFileFunc := map[string]func(StubsType) (android.Path, error){
+ "": d.StubsSrcJar,
+ ".docs.zip": d.DocZip,
+ ".api.txt": d.ApiFilePath,
+ android.DefaultDistTag: d.ApiFilePath,
+ ".removed-api.txt": d.RemovedApiFilePath,
+ ".annotations.zip": d.AnnotationsZip,
+ ".api_versions.xml": d.ApiVersionsXmlFilePath,
+ }
+ stubsTypeToPrefix := map[StubsType]string{
+ Everything: "",
+ Exportable: ".exportable",
+ }
+ for _, tag := range android.SortedKeys(tagToOutputFileFunc) {
+ for _, stubType := range android.SortedKeys(stubsTypeToPrefix) {
+ tagWithPrefix := stubsTypeToPrefix[stubType] + tag
+ outputFile, err := tagToOutputFileFunc[tag](stubType)
+ if err == nil {
+ ctx.SetOutputFiles(android.Paths{outputFile}, tagWithPrefix)
+ }
+ }
+ }
}
func (d *Droidstubs) createApiContribution(ctx android.DefaultableHookContext) {
diff --git a/rust/config/darwin_host.go b/rust/config/darwin_host.go
index 03bea82..a4bc187 100644
--- a/rust/config/darwin_host.go
+++ b/rust/config/darwin_host.go
@@ -21,7 +21,7 @@
)
var (
- DarwinRustFlags = []string{}
+ DarwinRustFlags = []string{"-C split-debuginfo=off"}
DarwinRustLinkFlags = []string{
"-B${cc_config.MacToolPath}",
}