Replace --sdk-extension-root with --android-jar-pattern
Previously, the only way to specify the location of the SDK extension
jars was to specify the `--sdk-extension-root` directory and then rely
on Metalava's hard-coded pattern to find the jar files. However, it is
now possible to specify the SDK extension jar pattern explicitly as an
`--android-jar-pattern` option.
This change makes use of that new capability to specify patterns for
the SDK extension jars appropriate for the API surface being generated
and removes the `--sdk-extension-root` option altogether.
Bug: 259115852
Test: # Before applying this change run:
tools/metalava/scripts/gather-android-metalava-artifacts.py before
# After applying this change run:
tools/metalava/scripts/gather-android-metalava-artifacts.py after
# Make sure that there are no differences.
meld before after
Change-Id: I4db9d4aa7b1ca3ef35a0778889f70acba491908d
diff --git a/java/droidstubs.go b/java/droidstubs.go
index 63611d6..958db40 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -659,6 +659,10 @@
addPattern(filename)
}
+
+ if extensions_dir != "" {
+ cmd.FlagWithArg("--android-jar-pattern ", fmt.Sprintf("%s/{version:extension}/%s/{module}.jar", extensions_dir, sdkDir))
+ }
}
if d.properties.Extensions_info_file != nil {
@@ -667,7 +671,6 @@
}
info_file := android.PathForModuleSrc(ctx, *d.properties.Extensions_info_file)
cmd.Implicit(info_file)
- cmd.FlagWithArg("--sdk-extensions-root ", extensions_dir)
cmd.FlagWithArg("--sdk-extensions-info ", info_file.String())
}
}