Merge "Deny rust warnings by default."
diff --git a/android/androidmk.go b/android/androidmk.go
index 589f046..9071347 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -96,6 +96,13 @@
a.EntryMap[name] = []string{value}
}
+func (a *AndroidMkEntries) SetPath(name string, path Path) {
+ if _, ok := a.EntryMap[name]; !ok {
+ a.entryOrder = append(a.entryOrder, name)
+ }
+ a.EntryMap[name] = []string{path.String()}
+}
+
func (a *AndroidMkEntries) SetBoolIfTrue(name string, flag bool) {
if flag {
if _, ok := a.EntryMap[name]; !ok {
@@ -105,6 +112,17 @@
}
}
+func (a *AndroidMkEntries) SetBool(name string, flag bool) {
+ if _, ok := a.EntryMap[name]; !ok {
+ a.entryOrder = append(a.entryOrder, name)
+ }
+ if flag {
+ a.EntryMap[name] = []string{"true"}
+ } else {
+ a.EntryMap[name] = []string{"false"}
+ }
+}
+
func (a *AndroidMkEntries) AddStrings(name string, value ...string) {
if len(value) == 0 {
return
diff --git a/build_kzip.bash b/build_kzip.bash
index 607654b..1e0d48f 100755
--- a/build_kzip.bash
+++ b/build_kzip.bash
@@ -1,33 +1,27 @@
-# /bin/bash -uv
+#! /bin/bash -uv
#
# Build kzip files (source files for the indexing pipeline) for the given configuration,
# merge them and place the resulting all.kzip into $DIST_DIR.
# It is assumed that the current directory is the top of the source tree.
# The following environment variables affect the result:
-# TARGET_PRODUCT target device name, e.g., 'aosp_blueline'
-# TARGET_BUILD_VARIANT variant, e.g., `userdebug`
-# OUT_DIR absolute path where the build is happening ($PWD/out if not specified})
-# DIST_DIR where the resulting all.kzip will be placed
-# XREF_CORPUS source code repository URI, e.g., 'android.googlesource.com/platform/superproject'
# BUILD_NUMBER build number, used to generate unique ID (will use UUID if not set)
+# DIST_DIR where the resulting all.kzip will be placed
+# OUT_DIR output directory (out if not specified})
+# TARGET_BUILD_VARIANT variant, e.g., `userdebug`
+# TARGET_PRODUCT target device name, e.g., 'aosp_blueline'
+# XREF_CORPUS source code repository URI, e.g., 'android.googlesource.com/platform/superproject'
-# If OUT_DIR is not set, the build will use out/ as output directory, which is
-# a relative path. Make it absolute, otherwise the indexer will not know that it
-# contains only generated files.
-: ${OUT_DIR:=$PWD/out}
-[[ "$OUT_DIR" =~ ^/ ]] || { echo "$OUT_DIR is not an absolute path"; exit 1; }
: ${BUILD_NUMBER:=$(uuidgen)}
-# The extraction might fail for some source files, so run with -k
-OUT_DIR=$OUT_DIR build/soong/soong_ui.bash --build-mode --all-modules --dir=$PWD -k merge_zips xref_cxx xref_java
-
-# We build with -k, so check that we have generated at least 100K files
-# (the actual number is 180K+)
-declare -r kzip_count=$(find $OUT_DIR -name '*.kzip' | wc -l)
+# The extraction might fail for some source files, so run with -k and then check that
+# sufficiently many files were generated.
+build/soong/soong_ui.bash --build-mode --all-modules --dir=$PWD -k merge_zips xref_cxx xref_java
+declare -r out="${OUT_DIR:-out}"
+declare -r kzip_count=$(find "$out" -name '*.kzip' | wc -l)
(($kzip_count>100000)) || { printf "Too few kzip files were generated: %d\n" $kzip_count; exit 1; }
# Pack
# TODO(asmundak): this should be done by soong.
declare -r allkzip="$BUILD_NUMBER.kzip"
-"$OUT_DIR/soong/host/linux-x86/bin/merge_zips" "$DIST_DIR/$allkzip" @<(find $OUT_DIR -name '*.kzip')
+"$out/soong/host/linux-x86/bin/merge_zips" "$DIST_DIR/$allkzip" @<(find "$out" -name '*.kzip')
diff --git a/cc/builder.go b/cc/builder.go
index b353814..c4f65da 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -224,12 +224,13 @@
_ = pctx.SourcePathVariable("cxxExtractor",
"prebuilts/clang-tools/${config.HostPrebuiltTag}/bin/cxx_extractor")
+ _ = pctx.SourcePathVariable("kytheVnames", "build/soong/vnames.json")
_ = pctx.VariableFunc("kytheCorpus",
func(ctx android.PackageVarContext) string { return ctx.Config().XrefCorpusName() })
kytheExtract = pctx.StaticRule("kythe",
blueprint.RuleParams{
- Command: "rm -f $out && KYTHE_CORPUS=${kytheCorpus} KYTHE_OUTPUT_FILE=$out $cxxExtractor $cFlags $in ",
- CommandDeps: []string{"$cxxExtractor"},
+ Command: "rm -f $out && KYTHE_CORPUS=${kytheCorpus} KYTHE_OUTPUT_FILE=$out KYTHE_VNAMES=$kytheVnames $cxxExtractor $cFlags $in ",
+ CommandDeps: []string{"$cxxExtractor", "$kytheVnames"},
},
"cFlags")
)
diff --git a/cc/object.go b/cc/object.go
index f619c79..1f1ac8e 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -52,8 +52,9 @@
// input to a cc_genrule module.
func ObjectFactory() android.Module {
module := newBaseModule(android.HostAndDeviceSupported, android.MultilibBoth)
+ module.sanitize = &sanitize{}
module.linker = &objectLinker{
- baseLinker: NewBaseLinker(nil),
+ baseLinker: NewBaseLinker(module.sanitize),
}
module.compiler = NewBaseCompiler()
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 415518c..c0a7c63 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -674,7 +674,7 @@
func isSanitizableDependencyTag(tag blueprint.DependencyTag) bool {
t, ok := tag.(dependencyTag)
- return ok && t.library || t == reuseObjTag
+ return ok && t.library || t == reuseObjTag || t == objDepTag
}
// Propagate sanitizer requirements down from binaries
diff --git a/java/androidmk.go b/java/androidmk.go
index 246de58..032dc6a 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -80,17 +80,17 @@
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
}
if library.dexJarFile != nil {
- entries.SetString("LOCAL_SOONG_DEX_JAR", library.dexJarFile.String())
+ entries.SetPath("LOCAL_SOONG_DEX_JAR", library.dexJarFile)
}
if len(library.dexpreopter.builtInstalled) > 0 {
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", library.dexpreopter.builtInstalled)
}
entries.SetString("LOCAL_SDK_VERSION", library.sdkVersion())
- entries.SetString("LOCAL_SOONG_CLASSES_JAR", library.implementationAndResourcesJar.String())
- entries.SetString("LOCAL_SOONG_HEADER_JAR", library.headerJarFile.String())
+ entries.SetPath("LOCAL_SOONG_CLASSES_JAR", library.implementationAndResourcesJar)
+ entries.SetPath("LOCAL_SOONG_HEADER_JAR", library.headerJarFile)
if library.jacocoReportClassesFile != nil {
- entries.SetString("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", library.jacocoReportClassesFile.String())
+ entries.SetPath("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", library.jacocoReportClassesFile)
}
entries.AddStrings("LOCAL_EXPORT_SDK_LIBRARIES", library.exportedSdkLibs...)
@@ -100,7 +100,7 @@
}
if library.proguardDictionary != nil {
- entries.SetString("LOCAL_SOONG_PROGUARD_DICT", library.proguardDictionary.String())
+ entries.SetPath("LOCAL_SOONG_PROGUARD_DICT", library.proguardDictionary)
}
},
},
@@ -127,7 +127,7 @@
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
testSuiteComponent(entries, j.testProperties.Test_suites)
if j.testConfig != nil {
- entries.SetString("LOCAL_FULL_TEST_CONFIG", j.testConfig.String())
+ entries.SetPath("LOCAL_FULL_TEST_CONFIG", j.testConfig)
}
androidMkWriteTestData(j.data, entries)
})
@@ -144,114 +144,114 @@
return entries
}
-func (prebuilt *Import) AndroidMk() android.AndroidMkData {
+func (prebuilt *Import) AndroidMkEntries() android.AndroidMkEntries {
if !prebuilt.IsForPlatform() || !prebuilt.ContainingSdk().IsCurrentVersion() {
- return android.AndroidMkData{
+ return android.AndroidMkEntries{
Disabled: true,
}
}
- return android.AndroidMkData{
+ return android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(prebuilt.combinedClasspathFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
- Extra: []android.AndroidMkExtraFunc{
- func(w io.Writer, outputFile android.Path) {
- fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := ", !Bool(prebuilt.properties.Installable))
- fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.combinedClasspathFile.String())
- fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", prebuilt.combinedClasspathFile.String())
- fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.sdkVersion())
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
+ entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", !Bool(prebuilt.properties.Installable))
+ entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.combinedClasspathFile)
+ entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.combinedClasspathFile)
+ entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion())
},
},
}
}
-func (prebuilt *DexImport) AndroidMk() android.AndroidMkData {
+func (prebuilt *DexImport) AndroidMkEntries() android.AndroidMkEntries {
if !prebuilt.IsForPlatform() {
- return android.AndroidMkData{
+ return android.AndroidMkEntries{
Disabled: true,
}
}
- return android.AndroidMkData{
+ return android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(prebuilt.maybeStrippedDexJarFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
- Extra: []android.AndroidMkExtraFunc{
- func(w io.Writer, outputFile android.Path) {
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
if prebuilt.dexJarFile != nil {
- fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", prebuilt.dexJarFile.String())
+ entries.SetPath("LOCAL_SOONG_DEX_JAR", prebuilt.dexJarFile)
// TODO(b/125517186): export the dex jar as a classes jar to match some mis-uses in Make until
// boot_jars_package_check.mk can check dex jars.
- fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.dexJarFile.String())
- fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", prebuilt.dexJarFile.String())
+ entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.dexJarFile)
+ entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.dexJarFile)
}
if len(prebuilt.dexpreopter.builtInstalled) > 0 {
- fmt.Fprintln(w, "LOCAL_SOONG_BUILT_INSTALLED :=", prebuilt.dexpreopter.builtInstalled)
+ entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", prebuilt.dexpreopter.builtInstalled)
}
},
},
}
}
-func (prebuilt *AARImport) AndroidMk() android.AndroidMkData {
- return android.AndroidMkData{
+func (prebuilt *AARImport) AndroidMkEntries() android.AndroidMkEntries {
+ return android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(prebuilt.classpathFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
- Extra: []android.AndroidMkExtraFunc{
- func(w io.Writer, outputFile android.Path) {
- fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
- fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.classpathFile.String())
- fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", prebuilt.classpathFile.String())
- fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", prebuilt.exportPackage.String())
- fmt.Fprintln(w, "LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=", prebuilt.proguardFlags.String())
- fmt.Fprintln(w, "LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES :=", prebuilt.extraAaptPackagesFile.String())
- fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", prebuilt.manifest.String())
- fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.sdkVersion())
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
+ entries.SetBool("LOCAL_UNINSTALLABLE_MODULE", true)
+ entries.SetPath("LOCAL_SOONG_HEADER_JAR", prebuilt.classpathFile)
+ entries.SetPath("LOCAL_SOONG_CLASSES_JAR", prebuilt.classpathFile)
+ entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", prebuilt.exportPackage)
+ entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", prebuilt.proguardFlags)
+ entries.SetPath("LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES", prebuilt.extraAaptPackagesFile)
+ entries.SetPath("LOCAL_FULL_MANIFEST_FILE", prebuilt.manifest)
+ entries.SetString("LOCAL_SDK_VERSION", prebuilt.sdkVersion())
},
},
}
}
-func (binary *Binary) AndroidMk() android.AndroidMkData {
+func (binary *Binary) AndroidMkEntries() android.AndroidMkEntries {
if !binary.isWrapperVariant {
- return android.AndroidMkData{
+ return android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(binary.outputFile),
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
- Extra: []android.AndroidMkExtraFunc{
- func(w io.Writer, outputFile android.Path) {
- fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", binary.headerJarFile.String())
- fmt.Fprintln(w, "LOCAL_SOONG_CLASSES_JAR :=", binary.implementationAndResourcesJar.String())
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
+ entries.SetPath("LOCAL_SOONG_HEADER_JAR", binary.headerJarFile)
+ entries.SetPath("LOCAL_SOONG_CLASSES_JAR", binary.implementationAndResourcesJar)
if binary.dexJarFile != nil {
- fmt.Fprintln(w, "LOCAL_SOONG_DEX_JAR :=", binary.dexJarFile.String())
+ entries.SetPath("LOCAL_SOONG_DEX_JAR", binary.dexJarFile)
}
if len(binary.dexpreopter.builtInstalled) > 0 {
- fmt.Fprintln(w, "LOCAL_SOONG_BUILT_INSTALLED :=", binary.dexpreopter.builtInstalled)
+ entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", binary.dexpreopter.builtInstalled)
}
},
},
- Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
- android.WriteAndroidMkData(w, data)
-
- fmt.Fprintln(w, "jar_installed_module := $(LOCAL_INSTALLED_MODULE)")
+ ExtraFooters: []android.AndroidMkExtraFootersFunc{
+ func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
+ fmt.Fprintln(w, "jar_installed_module := $(LOCAL_INSTALLED_MODULE)")
+ },
},
}
} else {
- return android.AndroidMkData{
+ return android.AndroidMkEntries{
Class: "EXECUTABLES",
OutputFile: android.OptionalPathForPath(binary.wrapperFile),
- Extra: []android.AndroidMkExtraFunc{
- func(w io.Writer, outputFile android.Path) {
- fmt.Fprintln(w, "LOCAL_STRIP_MODULE := false")
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
+ entries.SetBool("LOCAL_STRIP_MODULE", false)
},
},
- Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
- android.WriteAndroidMkData(w, data)
-
- // Ensure that the wrapper script timestamp is always updated when the jar is updated
- fmt.Fprintln(w, "$(LOCAL_INSTALLED_MODULE): $(jar_installed_module)")
- fmt.Fprintln(w, "jar_installed_module :=")
+ ExtraFooters: []android.AndroidMkExtraFootersFunc{
+ func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
+ // Ensure that the wrapper script timestamp is always updated when the jar is updated
+ fmt.Fprintln(w, "$(LOCAL_INSTALLED_MODULE): $(jar_installed_module)")
+ fmt.Fprintln(w, "jar_installed_module :=")
+ },
},
}
}
@@ -266,24 +266,24 @@
func(entries *android.AndroidMkEntries) {
// App module names can be overridden.
entries.SetString("LOCAL_MODULE", app.installApkName)
- entries.SetString("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", app.exportPackage.String())
+ entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", app.exportPackage)
if app.dexJarFile != nil {
- entries.SetString("LOCAL_SOONG_DEX_JAR", app.dexJarFile.String())
+ entries.SetPath("LOCAL_SOONG_DEX_JAR", app.dexJarFile)
}
if app.implementationAndResourcesJar != nil {
- entries.SetString("LOCAL_SOONG_CLASSES_JAR", app.implementationAndResourcesJar.String())
+ entries.SetPath("LOCAL_SOONG_CLASSES_JAR", app.implementationAndResourcesJar)
}
if app.headerJarFile != nil {
- entries.SetString("LOCAL_SOONG_HEADER_JAR", app.headerJarFile.String())
+ entries.SetPath("LOCAL_SOONG_HEADER_JAR", app.headerJarFile)
}
if app.bundleFile != nil {
- entries.SetString("LOCAL_SOONG_BUNDLE", app.bundleFile.String())
+ entries.SetPath("LOCAL_SOONG_BUNDLE", app.bundleFile)
}
if app.jacocoReportClassesFile != nil {
- entries.SetString("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", app.jacocoReportClassesFile.String())
+ entries.SetPath("LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR", app.jacocoReportClassesFile)
}
if app.proguardDictionary != nil {
- entries.SetString("LOCAL_SOONG_PROGUARD_DICT", app.proguardDictionary.String())
+ entries.SetPath("LOCAL_SOONG_PROGUARD_DICT", app.proguardDictionary)
}
if app.Name() == "framework-res" {
@@ -315,11 +315,11 @@
entries.SetBoolIfTrue("LOCAL_EXPORT_PACKAGE_RESOURCES", Bool(app.appProperties.Export_package_resources))
- entries.SetString("LOCAL_FULL_MANIFEST_FILE", app.manifestPath.String())
+ entries.SetPath("LOCAL_FULL_MANIFEST_FILE", app.manifestPath)
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", Bool(app.appProperties.Privileged))
- entries.SetString("LOCAL_CERTIFICATE", app.certificate.Pem.String())
+ entries.SetPath("LOCAL_CERTIFICATE", app.certificate.Pem)
entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", app.getOverriddenPackages()...)
for _, jniLib := range app.installJniLibs {
@@ -369,7 +369,7 @@
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
testSuiteComponent(entries, a.testProperties.Test_suites)
if a.testConfig != nil {
- entries.SetString("LOCAL_FULL_TEST_CONFIG", a.testConfig.String())
+ entries.SetPath("LOCAL_FULL_TEST_CONFIG", a.testConfig)
}
androidMkWriteTestData(a.data, entries)
})
@@ -391,7 +391,7 @@
entries.ExtraEntries = append(entries.ExtraEntries, func(entries *android.AndroidMkEntries) {
if a.aarFile != nil {
- entries.SetString("LOCAL_SOONG_AAR", a.aarFile.String())
+ entries.SetPath("LOCAL_SOONG_AAR", a.aarFile)
}
if a.Name() == "framework-res" {
@@ -401,9 +401,9 @@
entries.SetBoolIfTrue("LOCAL_NO_STANDARD_LIBRARIES", true)
}
- entries.SetString("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", a.exportPackage.String())
- entries.SetString("LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES", a.extraAaptPackagesFile.String())
- entries.SetString("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile.String())
+ entries.SetPath("LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE", a.exportPackage)
+ entries.SetPath("LOCAL_SOONG_STATIC_LIBRARY_EXTRA_PACKAGES", a.extraAaptPackagesFile)
+ entries.SetPath("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile)
entries.AddStrings("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.exportedProguardFlagFiles.Strings()...)
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
})
@@ -411,37 +411,69 @@
return entries
}
-func (jd *Javadoc) AndroidMk() android.AndroidMkData {
- return android.AndroidMkData{
+func (jd *Javadoc) AndroidMkEntries() android.AndroidMkEntries {
+ return android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(jd.stubsSrcJar),
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
- Extra: []android.AndroidMkExtraFunc{
- func(w io.Writer, outputFile android.Path) {
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
if BoolDefault(jd.properties.Installable, true) {
- fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", jd.docZip.String())
+ entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", jd.docZip)
}
if jd.stubsSrcJar != nil {
- fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", jd.stubsSrcJar.String())
+ entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", jd.stubsSrcJar)
}
},
},
}
}
-func (ddoc *Droiddoc) AndroidMk() android.AndroidMkData {
- return android.AndroidMkData{
+func (ddoc *Droiddoc) AndroidMkEntries() android.AndroidMkEntries {
+ return android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(ddoc.stubsSrcJar),
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
- Extra: []android.AndroidMkExtraFunc{
- func(w io.Writer, outputFile android.Path) {
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
if BoolDefault(ddoc.Javadoc.properties.Installable, true) && ddoc.Javadoc.docZip != nil {
- fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", ddoc.Javadoc.docZip.String())
+ entries.SetPath("LOCAL_DROIDDOC_DOC_ZIP", ddoc.Javadoc.docZip)
}
if ddoc.Javadoc.stubsSrcJar != nil {
- fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", ddoc.Javadoc.stubsSrcJar.String())
+ entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", ddoc.Javadoc.stubsSrcJar)
}
+ apiFilePrefix := "INTERNAL_PLATFORM_"
+ if String(ddoc.properties.Api_tag_name) != "" {
+ apiFilePrefix += String(ddoc.properties.Api_tag_name) + "_"
+ }
+ if ddoc.apiFile != nil {
+ entries.SetPath(apiFilePrefix+"API_FILE", ddoc.apiFile)
+ }
+ if ddoc.dexApiFile != nil {
+ entries.SetPath(apiFilePrefix+"DEX_API_FILE", ddoc.dexApiFile)
+ }
+ if ddoc.privateApiFile != nil {
+ entries.SetPath(apiFilePrefix+"PRIVATE_API_FILE", ddoc.privateApiFile)
+ }
+ if ddoc.privateDexApiFile != nil {
+ entries.SetPath(apiFilePrefix+"PRIVATE_DEX_API_FILE", ddoc.privateDexApiFile)
+ }
+ if ddoc.removedApiFile != nil {
+ entries.SetPath(apiFilePrefix+"REMOVED_API_FILE", ddoc.removedApiFile)
+ }
+ if ddoc.removedDexApiFile != nil {
+ entries.SetPath(apiFilePrefix+"REMOVED_DEX_API_FILE", ddoc.removedDexApiFile)
+ }
+ if ddoc.exactApiFile != nil {
+ entries.SetPath(apiFilePrefix+"EXACT_API_FILE", ddoc.exactApiFile)
+ }
+ if ddoc.proguardFile != nil {
+ entries.SetPath(apiFilePrefix+"PROGUARD_FILE", ddoc.proguardFile)
+ }
+ },
+ },
+ ExtraFooters: []android.AndroidMkExtraFootersFunc{
+ func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
if ddoc.checkCurrentApiTimestamp != nil {
fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-check-current-api")
fmt.Fprintln(w, ddoc.Name()+"-check-current-api:",
@@ -477,58 +509,59 @@
fmt.Fprintln(w, "droidcore: checkapi")
}
}
- apiFilePrefix := "INTERNAL_PLATFORM_"
- if String(ddoc.properties.Api_tag_name) != "" {
- apiFilePrefix += String(ddoc.properties.Api_tag_name) + "_"
- }
- if ddoc.apiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"API_FILE := ", ddoc.apiFile.String())
- }
- if ddoc.dexApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"DEX_API_FILE := ", ddoc.dexApiFile.String())
- }
- if ddoc.privateApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"PRIVATE_API_FILE := ", ddoc.privateApiFile.String())
- }
- if ddoc.privateDexApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"PRIVATE_DEX_API_FILE := ", ddoc.privateDexApiFile.String())
- }
- if ddoc.removedApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"REMOVED_API_FILE := ", ddoc.removedApiFile.String())
- }
- if ddoc.removedDexApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"REMOVED_DEX_API_FILE := ", ddoc.removedDexApiFile.String())
- }
- if ddoc.exactApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"EXACT_API_FILE := ", ddoc.exactApiFile.String())
- }
- if ddoc.proguardFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"PROGUARD_FILE := ", ddoc.proguardFile.String())
- }
},
},
}
}
-func (dstubs *Droidstubs) AndroidMk() android.AndroidMkData {
- return android.AndroidMkData{
+func (dstubs *Droidstubs) AndroidMkEntries() android.AndroidMkEntries {
+ return android.AndroidMkEntries{
Class: "JAVA_LIBRARIES",
OutputFile: android.OptionalPathForPath(dstubs.stubsSrcJar),
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
- Extra: []android.AndroidMkExtraFunc{
- func(w io.Writer, outputFile android.Path) {
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
if dstubs.Javadoc.stubsSrcJar != nil {
- fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", dstubs.Javadoc.stubsSrcJar.String())
+ entries.SetPath("LOCAL_DROIDDOC_STUBS_SRCJAR", dstubs.Javadoc.stubsSrcJar)
}
if dstubs.apiVersionsXml != nil {
- fmt.Fprintln(w, "LOCAL_DROIDDOC_API_VERSIONS_XML := ", dstubs.apiVersionsXml.String())
+ entries.SetPath("LOCAL_DROIDDOC_API_VERSIONS_XML", dstubs.apiVersionsXml)
}
if dstubs.annotationsZip != nil {
- fmt.Fprintln(w, "LOCAL_DROIDDOC_ANNOTATIONS_ZIP := ", dstubs.annotationsZip.String())
+ entries.SetPath("LOCAL_DROIDDOC_ANNOTATIONS_ZIP", dstubs.annotationsZip)
}
if dstubs.jdiffDocZip != nil {
- fmt.Fprintln(w, "LOCAL_DROIDDOC_JDIFF_DOC_ZIP := ", dstubs.jdiffDocZip.String())
+ entries.SetPath("LOCAL_DROIDDOC_JDIFF_DOC_ZIP", dstubs.jdiffDocZip)
}
+ apiFilePrefix := "INTERNAL_PLATFORM_"
+ if String(dstubs.properties.Api_tag_name) != "" {
+ apiFilePrefix += String(dstubs.properties.Api_tag_name) + "_"
+ }
+ if dstubs.apiFile != nil {
+ entries.SetPath(apiFilePrefix+"API_FILE", dstubs.apiFile)
+ }
+ if dstubs.dexApiFile != nil {
+ entries.SetPath(apiFilePrefix+"DEX_API_FILE", dstubs.dexApiFile)
+ }
+ if dstubs.privateApiFile != nil {
+ entries.SetPath(apiFilePrefix+"PRIVATE_API_FILE", dstubs.privateApiFile)
+ }
+ if dstubs.privateDexApiFile != nil {
+ entries.SetPath(apiFilePrefix+"PRIVATE_DEX_API_FILE", dstubs.privateDexApiFile)
+ }
+ if dstubs.removedApiFile != nil {
+ entries.SetPath(apiFilePrefix+"REMOVED_API_FILE", dstubs.removedApiFile)
+ }
+ if dstubs.removedDexApiFile != nil {
+ entries.SetPath(apiFilePrefix+"REMOVED_DEX_API_FILE", dstubs.removedDexApiFile)
+ }
+ if dstubs.exactApiFile != nil {
+ entries.SetPath(apiFilePrefix+"EXACT_API_FILE", dstubs.exactApiFile)
+ }
+ },
+ },
+ ExtraFooters: []android.AndroidMkExtraFootersFunc{
+ func(w io.Writer, name, prefix, moduleDir string, entries *android.AndroidMkEntries) {
if dstubs.checkCurrentApiTimestamp != nil {
fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-current-api")
fmt.Fprintln(w, dstubs.Name()+"-check-current-api:",
@@ -572,31 +605,6 @@
fmt.Fprintln(w, ".PHONY:", "droidcore")
fmt.Fprintln(w, "droidcore: ", dstubs.Name()+"-check-nullability-warnings")
}
- apiFilePrefix := "INTERNAL_PLATFORM_"
- if String(dstubs.properties.Api_tag_name) != "" {
- apiFilePrefix += String(dstubs.properties.Api_tag_name) + "_"
- }
- if dstubs.apiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"API_FILE := ", dstubs.apiFile.String())
- }
- if dstubs.dexApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"DEX_API_FILE := ", dstubs.dexApiFile.String())
- }
- if dstubs.privateApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"PRIVATE_API_FILE := ", dstubs.privateApiFile.String())
- }
- if dstubs.privateDexApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"PRIVATE_DEX_API_FILE := ", dstubs.privateDexApiFile.String())
- }
- if dstubs.removedApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"REMOVED_API_FILE := ", dstubs.removedApiFile.String())
- }
- if dstubs.removedDexApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"REMOVED_DEX_API_FILE := ", dstubs.removedDexApiFile.String())
- }
- if dstubs.exactApiFile != nil {
- fmt.Fprintln(w, apiFilePrefix+"EXACT_API_FILE := ", dstubs.exactApiFile.String())
- }
},
},
}
@@ -611,7 +619,7 @@
func(entries *android.AndroidMkEntries) {
entries.SetBoolIfTrue("LOCAL_PRIVILEGED_MODULE", Bool(a.properties.Privileged))
if a.certificate != nil {
- entries.SetString("LOCAL_CERTIFICATE", a.certificate.Pem.String())
+ entries.SetPath("LOCAL_CERTIFICATE", a.certificate.Pem)
} else {
entries.SetString("LOCAL_CERTIFICATE", "PRESIGNED")
}
diff --git a/java/builder.go b/java/builder.go
index 9e068fa..0a5c79b 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -64,6 +64,7 @@
_ = pctx.VariableFunc("kytheCorpus",
func(ctx android.PackageVarContext) string { return ctx.Config().XrefCorpusName() })
+ _ = pctx.SourcePathVariable("kytheVnames", "build/soong/vnames.json")
// Run it with -add-opens=java.base/java.nio=ALL-UNNAMED to avoid JDK9's warning about
// "Illegal reflective access by com.google.protobuf.Utf8$UnsafeProcessor ...
// to field java.nio.Buffer.address"
@@ -74,6 +75,7 @@
`( [ ! -s $srcJarDir/list -a ! -s $out.rsp ] || ` +
`KYTHE_ROOT_DIRECTORY=. KYTHE_OUTPUT_FILE=$out ` +
`KYTHE_CORPUS=${kytheCorpus} ` +
+ `KYTHE_VNAMES=${kytheVnames} ` +
`${config.SoongJavacWrapper} ${config.JavaCmd} ` +
`--add-opens=java.base/java.nio=ALL-UNNAMED ` +
`-jar ${config.JavaKytheExtractorJar} ` +
@@ -84,6 +86,7 @@
CommandDeps: []string{
"${config.JavaCmd}",
"${config.JavaKytheExtractorJar}",
+ "${kytheVnames}",
"${config.ZipSyncCmd}",
},
CommandOrderOnly: []string{"${config.SoongJavacWrapper}"},
diff --git a/vnames.json b/vnames.json
new file mode 100644
index 0000000..7b34c52
--- /dev/null
+++ b/vnames.json
@@ -0,0 +1,18 @@
+[
+ {
+ "pattern": "out/(.*)",
+ "vname": {
+ "corpus": "CORPUS",
+ "root": "out",
+ "path": "@1@"
+ }
+ },
+ {
+ "pattern": "(.*)",
+ "vname": {
+ "corpus": "CORPUS",
+ "path": "@1@"
+ }
+ }
+]
+