Include license texts and kinds for VNDK snapshot
VNDK snapshot must include the information of the license texts and kinds. Include them when packaging the snapshot prebuilt files. This will be used to generate the VNDK snapshot files. Bug: 270625053 Bug: 277317599 Test: development/vndk/snapshot/build.sh --build-artifacts Change-Id: I0a39ff598efbb80faaf63807cdf5ce685fa074cc
This commit is contained in:
@@ -550,6 +550,7 @@ type Module interface {
|
||||
ExportedToMake() bool
|
||||
InitRc() Paths
|
||||
VintfFragments() Paths
|
||||
EffectiveLicenseKinds() []string
|
||||
EffectiveLicenseFiles() Paths
|
||||
|
||||
AddProperties(props ...interface{})
|
||||
@@ -2024,6 +2025,10 @@ func (m *ModuleBase) ExportedToMake() bool {
|
||||
return m.commonProperties.NamespaceExportedToMake
|
||||
}
|
||||
|
||||
func (m *ModuleBase) EffectiveLicenseKinds() []string {
|
||||
return m.commonProperties.Effective_license_kinds
|
||||
}
|
||||
|
||||
func (m *ModuleBase) EffectiveLicenseFiles() Paths {
|
||||
result := make(Paths, 0, len(m.commonProperties.Effective_license_text))
|
||||
for _, p := range m.commonProperties.Effective_license_text {
|
||||
|
50
cc/vndk.go
50
cc/vndk.go
@@ -674,8 +674,12 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
||||
snapshotArchDir := filepath.Join(snapshotDir, ctx.DeviceConfig().DeviceArch())
|
||||
|
||||
configsDir := filepath.Join(snapshotArchDir, "configs")
|
||||
noticeDir := filepath.Join(snapshotArchDir, "NOTICE_FILES")
|
||||
includeDir := filepath.Join(snapshotArchDir, "include")
|
||||
|
||||
// set of notice files copied.
|
||||
noticeBuilt := make(map[string]bool)
|
||||
|
||||
// paths of VNDK modules for GPL license checking
|
||||
modulePaths := make(map[string]string)
|
||||
|
||||
@@ -700,28 +704,36 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
||||
snapshotLibOut := filepath.Join(snapshotArchDir, targetArch, "shared", vndkType, libPath.Base())
|
||||
ret = append(ret, snapshot.CopyFileRule(pctx, ctx, libPath, snapshotLibOut))
|
||||
|
||||
// json struct to export snapshot information
|
||||
prop := struct {
|
||||
LicenseKinds []string `json:",omitempty"`
|
||||
LicenseTexts []string `json:",omitempty"`
|
||||
ExportedDirs []string `json:",omitempty"`
|
||||
ExportedSystemDirs []string `json:",omitempty"`
|
||||
ExportedFlags []string `json:",omitempty"`
|
||||
RelativeInstallPath string `json:",omitempty"`
|
||||
}{}
|
||||
|
||||
prop.LicenseKinds = m.EffectiveLicenseKinds()
|
||||
prop.LicenseTexts = m.EffectiveLicenseFiles().Strings()
|
||||
|
||||
if ctx.Config().VndkSnapshotBuildArtifacts() {
|
||||
prop := struct {
|
||||
ExportedDirs []string `json:",omitempty"`
|
||||
ExportedSystemDirs []string `json:",omitempty"`
|
||||
ExportedFlags []string `json:",omitempty"`
|
||||
RelativeInstallPath string `json:",omitempty"`
|
||||
}{}
|
||||
exportedInfo := ctx.ModuleProvider(m, FlagExporterInfoProvider).(FlagExporterInfo)
|
||||
prop.ExportedFlags = exportedInfo.Flags
|
||||
prop.ExportedDirs = exportedInfo.IncludeDirs.Strings()
|
||||
prop.ExportedSystemDirs = exportedInfo.SystemIncludeDirs.Strings()
|
||||
prop.RelativeInstallPath = m.RelativeInstallPath()
|
||||
|
||||
propOut := snapshotLibOut + ".json"
|
||||
|
||||
j, err := json.Marshal(prop)
|
||||
if err != nil {
|
||||
ctx.Errorf("json marshal to %q failed: %#v", propOut, err)
|
||||
return nil, false
|
||||
}
|
||||
ret = append(ret, snapshot.WriteStringToFileRule(ctx, string(j), propOut))
|
||||
}
|
||||
|
||||
propOut := snapshotLibOut + ".json"
|
||||
|
||||
j, err := json.Marshal(prop)
|
||||
if err != nil {
|
||||
ctx.Errorf("json marshal to %q failed: %#v", propOut, err)
|
||||
return nil, false
|
||||
}
|
||||
ret = append(ret, snapshot.WriteStringToFileRule(ctx, string(j), propOut))
|
||||
|
||||
return ret, true
|
||||
}
|
||||
|
||||
@@ -761,6 +773,14 @@ func (c *vndkSnapshotSingleton) GenerateBuildActions(ctx android.SingletonContex
|
||||
moduleNames[stem] = ctx.ModuleName(m)
|
||||
modulePaths[stem] = ctx.ModuleDir(m)
|
||||
|
||||
for _, notice := range m.EffectiveLicenseFiles() {
|
||||
if _, ok := noticeBuilt[notice.String()]; !ok {
|
||||
noticeBuilt[notice.String()] = true
|
||||
snapshotOutputs = append(snapshotOutputs, snapshot.CopyFileRule(
|
||||
pctx, ctx, notice, filepath.Join(noticeDir, notice.String())))
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.Config().VndkSnapshotBuildArtifacts() {
|
||||
headers = append(headers, m.SnapshotHeaders()...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user