Loading apex/apex.go +13 −11 Original line number Diff line number Diff line Loading @@ -394,8 +394,6 @@ type apexBundle struct { container_certificate_file android.Path container_private_key_file android.Path mergedNoticeFile android.WritablePath // list of files to be included in this apex filesInfo []apexFile Loading Loading @@ -828,8 +826,6 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.installDir = android.PathForModuleInstall(ctx, "apex") a.filesInfo = filesInfo a.buildNoticeFile(ctx) if a.apexTypes.zip() { a.buildUnflattenedApex(ctx, zipApex) } Loading @@ -843,7 +839,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { } } func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext) { func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext, apexFileName string) android.OptionalPath { noticeFiles := []android.Path{} for _, f := range a.filesInfo { if f.module != nil { Loading @@ -858,10 +854,12 @@ func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext) { noticeFiles = append(noticeFiles, a.NoticeFile().Path()) } if len(noticeFiles) > 0 { a.mergedNoticeFile = android.PathForModuleOut(ctx, "NOTICE") android.MergeNotices(ctx, a.mergedNoticeFile, noticeFiles) if len(noticeFiles) == 0 { return android.OptionalPath{} } return android.OptionalPathForPath( android.BuildNoticeOutput(ctx, a.installDir, apexFileName, android.FirstUniquePaths(noticeFiles))) } func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, apexType apexPackaging) { Loading Loading @@ -986,6 +984,13 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, apexType ap } optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion) noticeFile := a.buildNoticeFile(ctx, ctx.ModuleName()+suffix) if noticeFile.Valid() { // If there's a NOTICE file, embed it as an asset file in the APEX. implicitInputs = append(implicitInputs, noticeFile.Path()) optFlags = append(optFlags, "--assets_dir "+filepath.Dir(noticeFile.String())) } ctx.Build(pctx, android.BuildParams{ Rule: apexRule, Implicits: implicitInputs, Loading Loading @@ -1232,9 +1237,6 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", a.installDir.RelPathString())) fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", name+apexType.suffix()) fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable()) if a.installable() && a.mergedNoticeFile != nil { fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", a.mergedNoticeFile.String()) } if len(moduleNames) > 0 { fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(moduleNames, " ")) } Loading apex/apex_test.go +8 −3 Original line number Diff line number Diff line Loading @@ -27,8 +27,11 @@ import ( "android/soong/java" ) var buildDir string func testApex(t *testing.T, bp string) *android.TestContext { config, buildDir := setup(t) var config android.Config config, buildDir = setup(t) defer teardown(buildDir) ctx := android.NewTestArchContext() Loading Loading @@ -310,6 +313,8 @@ func TestBasicApex(t *testing.T) { optFlags := apexRule.Args["opt_flags"] ensureContains(t, optFlags, "--pubkey vendor/foo/devkeys/testkey.avbpubkey") // Ensure that the NOTICE output is being packaged as an asset. ensureContains(t, optFlags, "--assets_dir "+buildDir+"/.intermediates/myapex/android_common_myapex/NOTICE") copyCmds := apexRule.Args["copy_commands"] Loading Loading @@ -349,8 +354,8 @@ func TestBasicApex(t *testing.T) { mergeNoticesRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("mergeNoticesRule") noticeInputs := mergeNoticesRule.Inputs.Strings() if len(noticeInputs) != 4 { t.Errorf("number of input notice files: expected = 4, actual = %q", len(noticeInputs)) if len(noticeInputs) != 2 { t.Errorf("number of input notice files: expected = 2, actual = %q", len(noticeInputs)) } ensureListContains(t, noticeInputs, "NOTICE") ensureListContains(t, noticeInputs, "custom_notice") Loading Loading
apex/apex.go +13 −11 Original line number Diff line number Diff line Loading @@ -394,8 +394,6 @@ type apexBundle struct { container_certificate_file android.Path container_private_key_file android.Path mergedNoticeFile android.WritablePath // list of files to be included in this apex filesInfo []apexFile Loading Loading @@ -828,8 +826,6 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { a.installDir = android.PathForModuleInstall(ctx, "apex") a.filesInfo = filesInfo a.buildNoticeFile(ctx) if a.apexTypes.zip() { a.buildUnflattenedApex(ctx, zipApex) } Loading @@ -843,7 +839,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) { } } func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext) { func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext, apexFileName string) android.OptionalPath { noticeFiles := []android.Path{} for _, f := range a.filesInfo { if f.module != nil { Loading @@ -858,10 +854,12 @@ func (a *apexBundle) buildNoticeFile(ctx android.ModuleContext) { noticeFiles = append(noticeFiles, a.NoticeFile().Path()) } if len(noticeFiles) > 0 { a.mergedNoticeFile = android.PathForModuleOut(ctx, "NOTICE") android.MergeNotices(ctx, a.mergedNoticeFile, noticeFiles) if len(noticeFiles) == 0 { return android.OptionalPath{} } return android.OptionalPathForPath( android.BuildNoticeOutput(ctx, a.installDir, apexFileName, android.FirstUniquePaths(noticeFiles))) } func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, apexType apexPackaging) { Loading Loading @@ -986,6 +984,13 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext, apexType ap } optFlags = append(optFlags, "--target_sdk_version "+targetSdkVersion) noticeFile := a.buildNoticeFile(ctx, ctx.ModuleName()+suffix) if noticeFile.Valid() { // If there's a NOTICE file, embed it as an asset file in the APEX. implicitInputs = append(implicitInputs, noticeFile.Path()) optFlags = append(optFlags, "--assets_dir "+filepath.Dir(noticeFile.String())) } ctx.Build(pctx, android.BuildParams{ Rule: apexRule, Implicits: implicitInputs, Loading Loading @@ -1232,9 +1237,6 @@ func (a *apexBundle) androidMkForType(apexType apexPackaging) android.AndroidMkD fmt.Fprintln(w, "LOCAL_MODULE_PATH :=", filepath.Join("$(OUT_DIR)", a.installDir.RelPathString())) fmt.Fprintln(w, "LOCAL_MODULE_STEM :=", name+apexType.suffix()) fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE :=", !a.installable()) if a.installable() && a.mergedNoticeFile != nil { fmt.Fprintln(w, "LOCAL_NOTICE_FILE :=", a.mergedNoticeFile.String()) } if len(moduleNames) > 0 { fmt.Fprintln(w, "LOCAL_REQUIRED_MODULES +=", strings.Join(moduleNames, " ")) } Loading
apex/apex_test.go +8 −3 Original line number Diff line number Diff line Loading @@ -27,8 +27,11 @@ import ( "android/soong/java" ) var buildDir string func testApex(t *testing.T, bp string) *android.TestContext { config, buildDir := setup(t) var config android.Config config, buildDir = setup(t) defer teardown(buildDir) ctx := android.NewTestArchContext() Loading Loading @@ -310,6 +313,8 @@ func TestBasicApex(t *testing.T) { optFlags := apexRule.Args["opt_flags"] ensureContains(t, optFlags, "--pubkey vendor/foo/devkeys/testkey.avbpubkey") // Ensure that the NOTICE output is being packaged as an asset. ensureContains(t, optFlags, "--assets_dir "+buildDir+"/.intermediates/myapex/android_common_myapex/NOTICE") copyCmds := apexRule.Args["copy_commands"] Loading Loading @@ -349,8 +354,8 @@ func TestBasicApex(t *testing.T) { mergeNoticesRule := ctx.ModuleForTests("myapex", "android_common_myapex").Rule("mergeNoticesRule") noticeInputs := mergeNoticesRule.Inputs.Strings() if len(noticeInputs) != 4 { t.Errorf("number of input notice files: expected = 4, actual = %q", len(noticeInputs)) if len(noticeInputs) != 2 { t.Errorf("number of input notice files: expected = 2, actual = %q", len(noticeInputs)) } ensureListContains(t, noticeInputs, "NOTICE") ensureListContains(t, noticeInputs, "custom_notice") Loading