Merge "Generate SBOM of products in Soong." into main
This commit is contained in:
@@ -15,14 +15,16 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"android/soong/ui/metrics"
|
||||
"android/soong/ui/status"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"android/soong/ui/metrics"
|
||||
"android/soong/ui/status"
|
||||
)
|
||||
|
||||
// Checks for files in the out directory that have a rule that depends on them but no rule to
|
||||
@@ -84,6 +86,10 @@ func testForDanglingRules(ctx Context, config Config) {
|
||||
// before running soong and ninja.
|
||||
releaseConfigDir := filepath.Join(outDir, "soong", "release-config")
|
||||
|
||||
// out/target/product/<xxxxx>/build_fingerprint.txt is a source file created in sysprop.mk
|
||||
// ^out/target/product/[^/]+/build_fingerprint.txt$
|
||||
buildFingerPrintFilePattern := regexp.MustCompile("^" + filepath.Join(outDir, "target", "product") + "/[^/]+/build_fingerprint.txt$")
|
||||
|
||||
danglingRules := make(map[string]bool)
|
||||
|
||||
scanner := bufio.NewScanner(stdout)
|
||||
@@ -100,7 +106,8 @@ func testForDanglingRules(ctx Context, config Config) {
|
||||
line == dexpreoptConfigFilePath ||
|
||||
line == buildDatetimeFilePath ||
|
||||
line == bpglob ||
|
||||
strings.HasPrefix(line, releaseConfigDir) {
|
||||
strings.HasPrefix(line, releaseConfigDir) ||
|
||||
buildFingerPrintFilePattern.MatchString(line) {
|
||||
// Leaf node is in one of Soong's bootstrap directories, which do not have
|
||||
// full build rules in the primary build.ninja file.
|
||||
continue
|
||||
|
Reference in New Issue
Block a user