bp2build: export some cc toolchain flags into Starlark.
This CL exports common/global/device/host clang/ld/ldd flags from their Ninja variable initialization locations in cc/config/global.go and cc/config/clang.go to make Bazel's cc_toolchain and Soong's cc actions more consistent with each other. This does not handle env-dependent or arch-specific toolchain flags yet (logic in compiler.go and linker.go). Test: TH Bug: 187086342 Bug: 187084737 Bug: 186628704 Bug: 187857770 Change-Id: Ie403d7cd23f35160897b9dd902c799cbf1bd7f0c
This commit is contained in:
@@ -79,9 +79,33 @@ func TestCreateBazelFiles_QueryView_AddsTopLevelFiles(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreateBazelFiles_Bp2Build_CreatesNoFilesWithNoTargets(t *testing.T) {
|
||||
files := CreateBazelFiles(map[string]RuleShim{}, map[string]BazelTargets{}, Bp2Build)
|
||||
if len(files) != 0 {
|
||||
t.Errorf("Expected no files, got %d", len(files))
|
||||
func TestCreateBazelFiles_Bp2Build_CreatesDefaultFiles(t *testing.T) {
|
||||
files := CreateSoongInjectionFiles()
|
||||
|
||||
expectedFilePaths := []bazelFilepath{
|
||||
{
|
||||
dir: "cc_toolchain",
|
||||
basename: "BUILD",
|
||||
},
|
||||
{
|
||||
dir: "cc_toolchain",
|
||||
basename: "constants.bzl",
|
||||
},
|
||||
}
|
||||
|
||||
if len(files) != len(expectedFilePaths) {
|
||||
t.Errorf("Expected %d file, got %d", len(expectedFilePaths), len(files))
|
||||
}
|
||||
|
||||
for i := range files {
|
||||
actualFile, expectedFile := files[i], expectedFilePaths[i]
|
||||
|
||||
if actualFile.Dir != expectedFile.dir || actualFile.Basename != expectedFile.basename {
|
||||
t.Errorf("Did not find expected file %s/%s", actualFile.Dir, actualFile.Basename)
|
||||
}
|
||||
|
||||
if expectedFile.basename != "BUILD" && actualFile.Contents == "" {
|
||||
t.Errorf("Contents of %s unexpected empty.", actualFile)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user