diff options
| -rw-r--r-- | bazel/aquery_test.go | 2 | ||||
| -rw-r--r-- | cc/library.go | 1 | ||||
| -rw-r--r-- | cc/sanitize.go | 8 | ||||
| -rwxr-xr-x | java/app.go | 15 | ||||
| -rw-r--r-- | provenance/provenance_singleton.go | 4 |
5 files changed, 19 insertions, 11 deletions
diff --git a/bazel/aquery_test.go b/bazel/aquery_test.go index cf51b3982..8ba8b5a2e 100644 --- a/bazel/aquery_test.go +++ b/bazel/aquery_test.go @@ -897,7 +897,7 @@ func flattenDepset(depsetHashToFlatten string, allDepsets map[string]AqueryDepse func assertFlattenedDepsets(t *testing.T, actualDepsets []AqueryDepset, expectedDepsetFiles [][]string) { t.Helper() if len(actualDepsets) != len(expectedDepsetFiles) { - t.Errorf("Expected %s depsets, but got %s depsets", expectedDepsetFiles, actualDepsets) + t.Errorf("Expected %d depsets, but got %d depsets", len(expectedDepsetFiles), len(actualDepsets)) } for i, actualDepset := range actualDepsets { actualFlattenedInputs := flattenDepsets([]string{actualDepset.ContentHash}, actualDepsets) diff --git a/cc/library.go b/cc/library.go index 0fa01d78a..c445a42ca 100644 --- a/cc/library.go +++ b/cc/library.go @@ -925,7 +925,6 @@ func (library *libraryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Fla if ctx.Darwin() { f = append(f, "-dynamiclib", - "-single_module", "-install_name @rpath/"+libName+flags.Toolchain.ShlibSuffix(), ) if ctx.Arch().ArchType == android.X86 { diff --git a/cc/sanitize.go b/cc/sanitize.go index e0779c6ea..ff56058b4 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -430,7 +430,7 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) { } // Enable Memtag for all components in the include paths (for Aarch64 only) - if ctx.Arch().ArchType == android.Arm64 { + if ctx.Arch().ArchType == android.Arm64 && ctx.toolchain().Bionic() { if ctx.Config().MemtagHeapSyncEnabledForPath(ctx.ModuleDir()) { if s.Memtag_heap == nil { s.Memtag_heap = proptools.BoolPtr(true) @@ -460,17 +460,17 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) { } // HWASan requires AArch64 hardware feature (top-byte-ignore). - if ctx.Arch().ArchType != android.Arm64 { + if ctx.Arch().ArchType != android.Arm64 || !ctx.toolchain().Bionic() { s.Hwaddress = nil } // SCS is only implemented on AArch64. - if ctx.Arch().ArchType != android.Arm64 { + if ctx.Arch().ArchType != android.Arm64 || !ctx.toolchain().Bionic() { s.Scs = nil } // Memtag_heap is only implemented on AArch64. - if ctx.Arch().ArchType != android.Arm64 { + if ctx.Arch().ArchType != android.Arm64 || !ctx.toolchain().Bionic() { s.Memtag_heap = nil } diff --git a/java/app.go b/java/app.go index c5d88e978..8ff5d91c2 100755 --- a/java/app.go +++ b/java/app.go @@ -583,6 +583,16 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) { a.classLoaderContexts = a.usesLibrary.classLoaderContextForUsesLibDeps(ctx) + var noticeAssetPath android.WritablePath + if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") { + // The rule to create the notice file can't be generated yet, as the final output path + // for the apk isn't known yet. Add the path where the notice file will be generated to the + // aapt rules now before calling aaptBuildActions, the rule to create the notice file will + // be generated later. + noticeAssetPath = android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz") + a.aapt.noticeFile = android.OptionalPathForPath(noticeAssetPath) + } + // Process all building blocks, from AAPT to certificates. a.aaptBuildActions(ctx) @@ -654,7 +664,8 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) { a.extraOutputFiles = append(a.extraOutputFiles, v4SignatureFile) } - if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") { + if a.aapt.noticeFile.Valid() { + // Generating the notice file rule has to be here after a.outputFile is known. noticeFile := android.PathForModuleOut(ctx, "NOTICE.html.gz") android.BuildNoticeHtmlOutputFromLicenseMetadata( ctx, noticeFile, "", "", @@ -663,13 +674,11 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) { android.PathForModuleInstall(ctx).String() + "/", a.outputFile.String(), }) - noticeAssetPath := android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz") builder := android.NewRuleBuilder(pctx, ctx) builder.Command().Text("cp"). Input(noticeFile). Output(noticeAssetPath) builder.Build("notice_dir", "Building notice dir") - a.aapt.noticeFile = android.OptionalPathForPath(noticeAssetPath) } for _, split := range a.aapt.splits { diff --git a/provenance/provenance_singleton.go b/provenance/provenance_singleton.go index d1cbd8f42..fbb6212ff 100644 --- a/provenance/provenance_singleton.go +++ b/provenance/provenance_singleton.go @@ -35,10 +35,10 @@ var ( mergeProvenanceMetaData = pctx.AndroidStaticRule("mergeProvenanceMetaData", blueprint.RuleParams{ - Command: `rm -rf $out $out.temp && ` + + Command: `rm -rf $out && ` + `echo "# proto-file: build/soong/provenance/proto/provenance_metadata.proto" > $out && ` + `echo "# proto-message: ProvenanceMetaDataList" >> $out && ` + - `touch $out.temp && cat $out.temp $in | grep -v "^#.*" >> $out && rm -rf $out.temp`, + `for file in $in; do echo '' >> $out; echo 'metadata {' | cat - $$file | grep -Ev "^#.*|^$$" >> $out; echo '}' >> $out; done`, }) ) |