Fix bug: allow multiple gen_notice modules. am: a5ea2479d3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2098696 Change-Id: I3d62df0c4606f65ef635e085e0fae86707b88c5d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
d9771dedbb
6 changed files with 15 additions and 14 deletions
|
@ -67,7 +67,7 @@ func (s *genNoticeBuildRules) GenerateBuildActions(ctx SingletonContext) {
|
|||
if ctx.Failed() {
|
||||
return
|
||||
}
|
||||
out(ctx, gm.output, proptools.StringDefault(gm.properties.ArtifactName, defaultName), "", modules...)
|
||||
out(ctx, gm.output, ctx.ModuleName(gm), proptools.StringDefault(gm.properties.ArtifactName, defaultName), "", modules...)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -47,14 +47,14 @@ func modulesLicenseMetadata(ctx BuilderContext, modules ...Module) Paths {
|
|||
}
|
||||
|
||||
// buildNoticeOutputFromLicenseMetadata writes out a notice file.
|
||||
func buildNoticeOutputFromLicenseMetadata(ctx BuilderContext, tool, name string, outputFile WritablePath, libraryName, stripPrefix string, modules ...Module) {
|
||||
func buildNoticeOutputFromLicenseMetadata(ctx BuilderContext, tool, ruleName string, outputFile WritablePath, libraryName, stripPrefix string, modules ...Module) {
|
||||
depsFile := outputFile.ReplaceExtension(ctx, strings.TrimPrefix(outputFile.Ext()+".d", "."))
|
||||
rule := NewRuleBuilder(pctx, ctx)
|
||||
if len(modules) == 0 {
|
||||
if mctx, ok := ctx.(ModuleContext); ok {
|
||||
modules = []Module{mctx.Module()}
|
||||
} else {
|
||||
panic(fmt.Errorf("%s %q needs a module to generate the notice for", name, libraryName))
|
||||
panic(fmt.Errorf("%s %q needs a module to generate the notice for", ruleName, libraryName))
|
||||
}
|
||||
}
|
||||
if libraryName == "" {
|
||||
|
@ -75,26 +75,26 @@ func buildNoticeOutputFromLicenseMetadata(ctx BuilderContext, tool, name string,
|
|||
cmd = cmd.FlagWithArg("--product ", libraryName)
|
||||
}
|
||||
cmd = cmd.Inputs(modulesLicenseMetadata(ctx, modules...))
|
||||
rule.Build(name, "container notice file")
|
||||
rule.Build(ruleName, "container notice file")
|
||||
}
|
||||
|
||||
// BuildNoticeTextOutputFromLicenseMetadata writes out a notice text file based
|
||||
// on the license metadata files for the input `modules` defaulting to the
|
||||
// current context module if none given.
|
||||
func BuildNoticeTextOutputFromLicenseMetadata(ctx BuilderContext, outputFile WritablePath, libraryName, stripPrefix string, modules ...Module) {
|
||||
buildNoticeOutputFromLicenseMetadata(ctx, "textnotice", "text_notice", outputFile, libraryName, stripPrefix, modules...)
|
||||
func BuildNoticeTextOutputFromLicenseMetadata(ctx BuilderContext, outputFile WritablePath, ruleName, libraryName, stripPrefix string, modules ...Module) {
|
||||
buildNoticeOutputFromLicenseMetadata(ctx, "textnotice", "text_notice_"+ruleName, outputFile, libraryName, stripPrefix, modules...)
|
||||
}
|
||||
|
||||
// BuildNoticeHtmlOutputFromLicenseMetadata writes out a notice text file based
|
||||
// on the license metadata files for the input `modules` defaulting to the
|
||||
// current context module if none given.
|
||||
func BuildNoticeHtmlOutputFromLicenseMetadata(ctx BuilderContext, outputFile WritablePath, libraryName, stripPrefix string, modules ...Module) {
|
||||
buildNoticeOutputFromLicenseMetadata(ctx, "htmlnotice", "html_notice", outputFile, libraryName, stripPrefix, modules...)
|
||||
func BuildNoticeHtmlOutputFromLicenseMetadata(ctx BuilderContext, outputFile WritablePath, ruleName, libraryName, stripPrefix string, modules ...Module) {
|
||||
buildNoticeOutputFromLicenseMetadata(ctx, "htmlnotice", "html_notice_"+ruleName, outputFile, libraryName, stripPrefix, modules...)
|
||||
}
|
||||
|
||||
// BuildNoticeXmlOutputFromLicenseMetadata writes out a notice text file based
|
||||
// on the license metadata files for the input `modules` defaulting to the
|
||||
// current context module if none given.
|
||||
func BuildNoticeXmlOutputFromLicenseMetadata(ctx BuilderContext, outputFile WritablePath, libraryName, stripPrefix string, modules ...Module) {
|
||||
buildNoticeOutputFromLicenseMetadata(ctx, "xmlnotice", "xml_notice", outputFile, libraryName, stripPrefix, modules...)
|
||||
func BuildNoticeXmlOutputFromLicenseMetadata(ctx BuilderContext, outputFile WritablePath, ruleName, libraryName, stripPrefix string, modules ...Module) {
|
||||
buildNoticeOutputFromLicenseMetadata(ctx, "xmlnotice", "xml_notice_"+ruleName, outputFile, libraryName, stripPrefix, modules...)
|
||||
}
|
||||
|
|
|
@ -272,7 +272,8 @@ func (s *singletonContextAdaptor) ModuleVariantsFromName(referer Module, name st
|
|||
if depQualified.pkg != qualified.pkg {
|
||||
rule := effectiveVisibilityRules(s.Config(), depQualified)
|
||||
if !rule.matches(qualified) {
|
||||
s.ModuleErrorf(referer, "references %s which is not visible to this module\nYou may need to add %q to its visibility", depQualified, "//"+s.ModuleDir(m))
|
||||
s.ModuleErrorf(referer, "module %q references %q which is not visible to this module\nYou may need to add %q to its visibility",
|
||||
referer.Name(), depQualified, "//"+s.ModuleDir(referer))
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ func (s *sdkRepoHost) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
s.CopySpecsToDir(ctx, builder, packageSpecs, dir)
|
||||
|
||||
noticeFile := android.PathForModuleOut(ctx, "NOTICES.txt")
|
||||
android.BuildNoticeTextOutputFromLicenseMetadata(ctx, noticeFile, "", outputZipFile.String())
|
||||
android.BuildNoticeTextOutputFromLicenseMetadata(ctx, noticeFile, "", "", outputZipFile.String())
|
||||
builder.Command().Text("cp").
|
||||
Input(noticeFile).
|
||||
Text(filepath.Join(dir.String(), "NOTICE.txt"))
|
||||
|
|
|
@ -618,7 +618,7 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||
|
||||
// Create a NOTICE file, and embed it as an asset file in the APEX.
|
||||
a.htmlGzNotice = android.PathForModuleOut(ctx, "NOTICE.html.gz")
|
||||
android.BuildNoticeHtmlOutputFromLicenseMetadata(ctx, a.htmlGzNotice, "", unsignedOutputFile.String())
|
||||
android.BuildNoticeHtmlOutputFromLicenseMetadata(ctx, a.htmlGzNotice, "", "", unsignedOutputFile.String())
|
||||
noticeAssetPath := android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
|
||||
builder := android.NewRuleBuilder(pctx, ctx)
|
||||
builder.Command().Text("cp").
|
||||
|
|
|
@ -656,7 +656,7 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
|
|||
|
||||
if Bool(a.appProperties.Embed_notices) || ctx.Config().IsEnvTrue("ALWAYS_EMBED_NOTICES") {
|
||||
noticeFile := android.PathForModuleOut(ctx, "NOTICE.html.gz")
|
||||
android.BuildNoticeHtmlOutputFromLicenseMetadata(ctx, noticeFile, "", a.outputFile.String())
|
||||
android.BuildNoticeHtmlOutputFromLicenseMetadata(ctx, noticeFile, "", "", a.outputFile.String())
|
||||
noticeAssetPath := android.PathForModuleOut(ctx, "NOTICE", "NOTICE.html.gz")
|
||||
builder := android.NewRuleBuilder(pctx, ctx)
|
||||
builder.Command().Text("cp").
|
||||
|
|
Loading…
Reference in a new issue