Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e89cd9f2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Add android_sdk_repo_host to build platform-tools&build-tools" am: adf2b3e6

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1828170

Change-Id: I2e06ecdde08dc0f813a1775d4612671f7bcc44ab
parents 79961295 adf2b3e6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ toolchain_library {
        },
    },
    notice: ":mingw-libwinpthread-notice",
    licenses: ["winpthreads_license"],
}

kernel_headers {
+1 −0
Original line number Diff line number Diff line
@@ -836,6 +836,7 @@ func translateAndroidModule(ctx SingletonContext, w io.Writer, mod blueprint.Mod
		case "*aidl.aidlApi": // writes non-custom before adding .phony
		case "*aidl.aidlMapping": // writes non-custom before adding .phony
		case "*android.customModule": // appears in tests only
		case "*android_sdk.sdkRepoHost": // doesn't go through base_rules
		case "*apex.apexBundle": // license properties written
		case "*bpf.bpf": // license properties written (both for module and objs)
		case "*genrule.Module": // writes non-custom before adding .phony
+6 −4
Original line number Diff line number Diff line
@@ -2818,11 +2818,13 @@ func (m *moduleContext) PackageFile(installPath InstallPath, name string, srcPat
}

func (m *moduleContext) packageFile(fullInstallPath InstallPath, srcPath Path, executable bool) PackagingSpec {
	licenseFiles := m.Module().EffectiveLicenseFiles()
	spec := PackagingSpec{
		relPathInPackage:      Rel(m, fullInstallPath.PartitionDir(), fullInstallPath.String()),
		srcPath:               srcPath,
		symlinkTarget:         "",
		executable:            executable,
		effectiveLicenseFiles: &licenseFiles,
	}
	m.packagingSpecs = append(m.packagingSpecs, spec)
	return spec
+1 −0
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ func createTrebleRules() []Rule {

func createJavaDeviceForHostRules() []Rule {
	javaDeviceForHostProjectsAllowedList := []string{
		"development/build",
		"external/guava",
		"external/robolectric-shadows",
		"frameworks/layoutlib",
+53 −0
Original line number Diff line number Diff line
@@ -100,3 +100,56 @@ func BuildNoticeOutput(ctx ModuleContext, installPath InstallPath, installFilena
		HtmlGzOutput: OptionalPathForPath(htmlGzOutput),
	}
}

// BuildNotices merges the supplied NOTICE files into a single file that lists notices
// for every key in noticeMap (which would normally be installed files).
func BuildNotices(ctx ModuleContext, noticeMap map[string]Paths) NoticeOutputs {
	// TODO(jungjw): We should just produce a well-formatted NOTICE.html file in a single pass.
	//
	// generate-notice-files.py, which processes the merged NOTICE file, has somewhat strict rules
	// about input NOTICE file paths.
	// 1. Their relative paths to the src root become their NOTICE index titles. We want to use
	// on-device paths as titles, and so output the merged NOTICE file the corresponding location.
	// 2. They must end with .txt extension. Otherwise, they're ignored.

	mergeTool := PathForSource(ctx, "build/soong/scripts/mergenotice.py")
	generateNoticeTool := PathForSource(ctx, "build/soong/scripts/generate-notice-files.py")

	outputDir := PathForModuleOut(ctx, "notices")
	builder := NewRuleBuilder(pctx, ctx).
		Sbox(outputDir, PathForModuleOut(ctx, "notices.sbox.textproto"))
	for _, installPath := range SortedStringKeys(noticeMap) {
		noticePath := outputDir.Join(ctx, installPath+".txt")
		// It would be nice if sbox created directories for temporaries, but until then
		// this is simple enough.
		builder.Command().
			Text("(cd").OutputDir().Text("&&").
			Text("mkdir -p").Text(filepath.Dir(installPath)).Text(")")
		builder.Temporary(noticePath)
		builder.Command().
			Tool(mergeTool).
			Flag("--output").Output(noticePath).
			Inputs(noticeMap[installPath])
	}

	// Transform the merged NOTICE file into a gzipped HTML file.
	txtOutput := outputDir.Join(ctx, "NOTICE.txt")
	htmlOutput := outputDir.Join(ctx, "NOTICE.html")
	htmlGzOutput := outputDir.Join(ctx, "NOTICE.html.gz")
	title := "\"Notices for " + ctx.ModuleName() + "\""
	builder.Command().Tool(generateNoticeTool).
		FlagWithOutput("--text-output ", txtOutput).
		FlagWithOutput("--html-output ", htmlOutput).
		FlagWithArg("-t ", title).
		Flag("-s").OutputDir()
	builder.Command().BuiltTool("minigzip").
		FlagWithInput("-c ", htmlOutput).
		FlagWithOutput("> ", htmlGzOutput)
	builder.Build("build_notices", "generate notice output")

	return NoticeOutputs{
		TxtOutput:    OptionalPathForPath(txtOutput),
		HtmlOutput:   OptionalPathForPath(htmlOutput),
		HtmlGzOutput: OptionalPathForPath(htmlGzOutput),
	}
}
Loading