Merge "Handle symlinks in isPackageBoundary" into main
This commit is contained in:
commit
29af2a470d
1 changed files with 10 additions and 1 deletions
|
@ -16,6 +16,7 @@ package android
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
|
@ -228,10 +229,18 @@ func BazelLabelForSrcPatternExcludes(ctx BazelConversionPathContext, dir, patter
|
|||
// 2. An Android.bp doesn't exist, but a checked-in BUILD/BUILD.bazel file exists, and that file
|
||||
// is allowlisted by the bp2build configuration to be merged into the symlink forest workspace.
|
||||
func isPackageBoundary(config Config, prefix string, components []string, componentIndex int) bool {
|
||||
isSymlink := func(c Config, path string) bool {
|
||||
f, err := c.fs.Lstat(path)
|
||||
if err != nil {
|
||||
// The file does not exist
|
||||
return false
|
||||
}
|
||||
return f.Mode()&os.ModeSymlink == os.ModeSymlink
|
||||
}
|
||||
prefix = filepath.Join(prefix, filepath.Join(components[:componentIndex+1]...))
|
||||
if exists, _, _ := config.fs.Exists(filepath.Join(prefix, "Android.bp")); exists {
|
||||
return true
|
||||
} else if config.Bp2buildPackageConfig.ShouldKeepExistingBuildFileForDir(prefix) {
|
||||
} else if config.Bp2buildPackageConfig.ShouldKeepExistingBuildFileForDir(prefix) || isSymlink(config, prefix) {
|
||||
if exists, _, _ := config.fs.Exists(filepath.Join(prefix, "BUILD")); exists {
|
||||
return true
|
||||
} else if exists, _, _ := config.fs.Exists(filepath.Join(prefix, "BUILD.bazel")); exists {
|
||||
|
|
Loading…
Reference in a new issue