Merge "bp2build: add support for soong_config_module_type."
diff --git a/android/config.go b/android/config.go
index bc5ecc3..bd13c45 100644
--- a/android/config.go
+++ b/android/config.go
@@ -565,11 +565,18 @@
// BlueprintToolLocation returns the directory containing build system tools
// from Blueprint, like soong_zip and merge_zips.
func (c *config) HostToolDir() string {
- return filepath.Join(c.soongOutDir, "host", c.PrebuiltOS(), "bin")
+ if c.KatiEnabled() {
+ return filepath.Join(c.outDir, "host", c.PrebuiltOS(), "bin")
+ } else {
+ return filepath.Join(c.soongOutDir, "host", c.PrebuiltOS(), "bin")
+ }
}
func (c *config) HostToolPath(ctx PathContext, tool string) Path {
path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool)
+ if ctx.Config().KatiEnabled() {
+ path = path.ToMakePath()
+ }
return path
}
@@ -579,6 +586,9 @@
ext = ".dylib"
}
path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "lib64", false, lib+ext)
+ if ctx.Config().KatiEnabled() {
+ path = path.ToMakePath()
+ }
return path
}
@@ -586,6 +596,11 @@
return PathForOutput(ctx, "host", c.PrebuiltOS(), "framework", path)
}
+func (c *config) HostJavaBinToolPath(ctx PathContext, tool string) Path {
+ path := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false, tool)
+ return path
+}
+
// PrebuiltOS returns the name of the host OS used in prebuilts directories.
func (c *config) PrebuiltOS() string {
switch runtime.GOOS {
diff --git a/android/package_ctx.go b/android/package_ctx.go
index c19debb..abd0c29 100644
--- a/android/package_ctx.go
+++ b/android/package_ctx.go
@@ -177,6 +177,16 @@
})
}
+// HostJavaBinToolVariable returns a Variable whose value is the path to a host java tool
+// in the bin directory for host java targets. It may only be called during a Go
+// package's initialization - either from the init() function or as part of a
+// package-scoped variable's initialization.
+func (p PackageContext) HostJavaBinToolVariable(name, path string) blueprint.Variable {
+ return p.VariableFunc(name, func(ctx PackageVarContext) string {
+ return ctx.Config().HostJavaBinToolPath(ctx, path).String()
+ })
+}
+
// HostJNIToolVariable returns a Variable whose value is the path to a host tool
// in the lib directory for host targets. It may only be called during a Go
// package's initialization - either from the init() function or as part of a
diff --git a/android/paths.go b/android/paths.go
index 69ab5f7..82c8a24 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -465,6 +465,9 @@
// PathForGoBinary returns the path to the installed location of a bootstrap_go_binary module.
func PathForGoBinary(ctx PathContext, goBinary bootstrap.GoBinaryTool) Path {
goBinaryInstallDir := pathForInstall(ctx, ctx.Config().BuildOS, ctx.Config().BuildArch, "bin", false)
+ if ctx.Config().KatiEnabled() {
+ goBinaryInstallDir = goBinaryInstallDir.ToMakePath()
+ }
rel := Rel(ctx, goBinaryInstallDir.String(), goBinary.InstallPath())
return goBinaryInstallDir.Join(ctx, rel)
}
diff --git a/android/rule_builder.go b/android/rule_builder.go
index 1c6b1c0..f8de5fb 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -839,6 +839,14 @@
// The tool is in the Soong output directory, it will be copied to __SBOX_OUT_DIR__/tools/out
return filepath.Join(sboxToolsSubDir, "out", relOutSoong)
}
+ if ctx.Config().KatiEnabled() {
+ toolDir = toolDir.ToMakePath()
+ relOut, isRelOut, _ := maybeRelErr(toolDir.String(), path.String())
+ if isRelOut {
+ // The tool is in the Make output directory, it will be copied to __SBOX_OUT_DIR__/tools/out
+ return filepath.Join(sboxToolsSubDir, "out", relOut)
+ }
+ }
// The tool is in the source directory, it will be copied to __SBOX_OUT_DIR__/tools/src
return filepath.Join(sboxToolsSubDir, "src", path.String())
}
diff --git a/build_kzip.bash b/build_kzip.bash
index 5655067..aff2d6d 100755
--- a/build_kzip.bash
+++ b/build_kzip.bash
@@ -61,5 +61,5 @@
# Pack
# TODO(asmundak): this should be done by soong.
declare -r allkzip="$KZIP_NAME.kzip"
-"$out/soong/host/linux-x86/bin/merge_zips" "$DIST_DIR/$allkzip" @<(find "$out" -name '*.kzip')
+"$out/host/linux-x86/bin/merge_zips" "$DIST_DIR/$allkzip" @<(find "$out" -name '*.kzip')
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 93283d0..5c4ef17 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -450,11 +450,6 @@
if installer.path == (android.InstallPath{}) {
return
}
- // Soong installation is only supported for host modules. Have Make
- // installation trigger Soong installation.
- if ctx.Target().Os.Class == android.Host {
- entries.OutputFile = android.OptionalPathForPath(installer.path)
- }
entries.ExtraEntries = append(entries.ExtraEntries, func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
path, file := filepath.Split(installer.path.ToMakePath().String())
diff --git a/cc/cc.go b/cc/cc.go
index 32652c1..8915d6f 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1365,6 +1365,8 @@
return c.installer != nil && c.installer.installInRoot()
}
+func (c *Module) InstallBypassMake() bool { return true }
+
type baseModuleContext struct {
android.BaseModuleContext
moduleContextImpl
diff --git a/cuj/run_cuj_tests.sh b/cuj/run_cuj_tests.sh
index b4f9f88..a746bd5 100755
--- a/cuj/run_cuj_tests.sh
+++ b/cuj/run_cuj_tests.sh
@@ -18,11 +18,10 @@
cd "$ANDROID_TOP"
export OUT_DIR="${OUT_DIR:-out}"
-readonly SOONG_OUT="${OUT_DIR}/soong"
-build/soong/soong_ui.bash --make-mode "${SOONG_OUT}/host/${OS}-x86/bin/cuj_tests"
+build/soong/soong_ui.bash --make-mode "${OUT_DIR}/host/${OS}-x86/bin/cuj_tests"
-"${SOONG_OUT}/host/${OS}-x86/bin/cuj_tests" || true
+"${OUT_DIR}/host/${OS}-x86/bin/cuj_tests" || true
if [ -n "${DIST_DIR}" ]; then
cp -r "${OUT_DIR}/cuj_tests/logs" "${DIST_DIR}"
diff --git a/java/config/config.go b/java/config/config.go
index 30c6f91..92d49a6 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -124,8 +124,8 @@
pctx.HostBinToolVariable("Zip2ZipCmd", "zip2zip")
pctx.HostBinToolVariable("ZipSyncCmd", "zipsync")
pctx.HostBinToolVariable("ApiCheckCmd", "apicheck")
- pctx.HostBinToolVariable("D8Cmd", "d8")
- pctx.HostBinToolVariable("R8Cmd", "r8-compat-proguard")
+ pctx.HostJavaBinToolVariable("D8Cmd", "d8")
+ pctx.HostJavaBinToolVariable("R8Cmd", "r8-compat-proguard")
pctx.HostBinToolVariable("HiddenAPICmd", "hiddenapi")
pctx.HostBinToolVariable("ExtractApksCmd", "extract_apks")
pctx.VariableFunc("TurbineJar", func(ctx android.PackageVarContext) string {
diff --git a/mk2rbc/cmd/mk2rbc.go b/mk2rbc/cmd/mk2rbc.go
index b089f91..25507d2 100644
--- a/mk2rbc/cmd/mk2rbc.go
+++ b/mk2rbc/cmd/mk2rbc.go
@@ -53,10 +53,12 @@
// TODO(asmundak): this option is for debugging
allInSource = flag.Bool("all", false, "convert all product config makefiles in the tree under //")
outputTop = flag.String("outdir", "", "write output files into this directory hierarchy")
- launcher = flag.String("launcher", "", "generated launcher path. If set, the non-flag argument is _product_name_")
+ launcher = flag.String("launcher", "", "generated launcher path.")
+ boardlauncher = flag.String("boardlauncher", "", "generated board configuration launcher path.")
printProductConfigMap = flag.Bool("print_product_config_map", false, "print product config map and exit")
cpuProfile = flag.String("cpu_profile", "", "write cpu profile to file")
traceCalls = flag.Bool("trace_calls", false, "trace function calls")
+ inputVariables = flag.String("input_variables", "", "starlark file containing product config and global variables")
)
func init() {
@@ -87,8 +89,7 @@
flag.Usage = func() {
cmd := filepath.Base(os.Args[0])
fmt.Fprintf(flag.CommandLine.Output(),
- "Usage: %[1]s flags file...\n"+
- "or: %[1]s flags --launcher=PATH PRODUCT\n", cmd)
+ "Usage: %[1]s flags file...\n", cmd)
flag.PrintDefaults()
}
flag.Parse()
@@ -177,14 +178,31 @@
versionDefaultsPath := outputFilePath(versionDefaultsMk)
err = writeGenerated(versionDefaultsPath, versionDefaults)
if err != nil {
- fmt.Fprintf(os.Stderr, "%s:%s", files[0], err)
+ fmt.Fprintf(os.Stderr, "%s: %s", files[0], err)
ok = false
}
err = writeGenerated(*launcher, mk2rbc.Launcher(outputFilePath(files[0]), versionDefaultsPath,
mk2rbc.MakePath2ModuleName(files[0])))
if err != nil {
- fmt.Fprintf(os.Stderr, "%s:%s", files[0], err)
+ fmt.Fprintf(os.Stderr, "%s: %s", files[0], err)
+ ok = false
+ }
+ }
+ if *boardlauncher != "" {
+ if len(files) != 1 {
+ quit(fmt.Errorf("a launcher can be generated only for a single product"))
+ }
+ if *inputVariables == "" {
+ quit(fmt.Errorf("the board launcher requires an input variables file"))
+ }
+ if !convertOne(*inputVariables) {
+ quit(fmt.Errorf("the board launcher input variables file failed to convert"))
+ }
+ err := writeGenerated(*boardlauncher, mk2rbc.BoardLauncher(
+ outputFilePath(files[0]), outputFilePath(*inputVariables)))
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "%s: %s", files[0], err)
ok = false
}
}
diff --git a/mk2rbc/mk2rbc.go b/mk2rbc/mk2rbc.go
index 6227164..2aac40e 100644
--- a/mk2rbc/mk2rbc.go
+++ b/mk2rbc/mk2rbc.go
@@ -52,7 +52,9 @@
// And here are the functions and variables:
cfnGetCfg = baseName + ".cfg"
cfnMain = baseName + ".product_configuration"
+ cfnBoardMain = baseName + ".board_configuration"
cfnPrintVars = baseName + ".printvars"
+ cfnPrintGlobals = baseName + ".printglobals"
cfnWarning = baseName + ".warning"
cfnLocalAppend = baseName + ".local_append"
cfnLocalSetDefault = baseName + ".local_set_default"
@@ -1167,10 +1169,12 @@
return ctx.newBadExpr(directive,
fmt.Sprintf("the result of %s can be compared only to empty", x.name)), true
}
+ // if the expression is ifneq (,$(call is-vendor-board-platform,...)), negate==true,
+ // so we should set inExpr.isNot to false
return &inExpr{
expr: &variableRefExpr{ctx.addVariable("TARGET_BOARD_PLATFORM"), false},
list: &variableRefExpr{ctx.addVariable("QCOM_BOARD_PLATFORMS"), true},
- isNot: negate,
+ isNot: !negate,
}, true
default:
return ctx.newBadExpr(directive, "Unknown function in ifeq: %s", x.name), true
@@ -1702,6 +1706,17 @@
return buf.String()
}
+func BoardLauncher(mainModuleUri string, inputVariablesUri string) string {
+ var buf bytes.Buffer
+ fmt.Fprintf(&buf, "load(%q, %q)\n", baseUri, baseName)
+ fmt.Fprintf(&buf, "load(%q, \"init\")\n", mainModuleUri)
+ fmt.Fprintf(&buf, "load(%q, input_variables_init = \"init\")\n", inputVariablesUri)
+ fmt.Fprintf(&buf, "globals, cfg, globals_base = %s(init, input_variables_init)\n", cfnBoardMain)
+ fmt.Fprintf(&buf, "# TODO: Some product config variables need to be printed, but most are readonly so we can't just print cfg here.\n")
+ fmt.Fprintf(&buf, "%s(globals, globals_base)\n", cfnPrintGlobals)
+ return buf.String()
+}
+
func MakePath2ModuleName(mkPath string) string {
return strings.TrimSuffix(mkPath, filepath.Ext(mkPath))
}
diff --git a/mk2rbc/mk2rbc_test.go b/mk2rbc/mk2rbc_test.go
index 511bb0f..083d0bc 100644
--- a/mk2rbc/mk2rbc_test.go
+++ b/mk2rbc/mk2rbc_test.go
@@ -579,7 +579,7 @@
pass
elif not rblf.board_platform_is(g, "copper"):
pass
- elif g.get("TARGET_BOARD_PLATFORM", "") not in g["QCOM_BOARD_PLATFORMS"]:
+ elif g.get("TARGET_BOARD_PLATFORM", "") in g["QCOM_BOARD_PLATFORMS"]:
pass
`,
},
diff --git a/rust/config/allowed_list.go b/rust/config/allowed_list.go
index 8182c32..d66db14 100644
--- a/rust/config/allowed_list.go
+++ b/rust/config/allowed_list.go
@@ -17,11 +17,11 @@
"external/vm_tools/p9",
"frameworks/native/libs/binder/rust",
"frameworks/proto_logging/stats",
+ "packages/modules/Bluetooth",
"packages/modules/DnsResolver",
"packages/modules/Uwb",
"packages/modules/Virtualization",
"prebuilts/rust",
- "system/bt",
"system/core/libstats/pull_rust",
"system/extras/profcollectd",
"system/extras/simpleperf",
diff --git a/scripts/diff_build_graphs.sh b/scripts/diff_build_graphs.sh
index 81010f3..8d01124 100755
--- a/scripts/diff_build_graphs.sh
+++ b/scripts/diff_build_graphs.sh
@@ -98,7 +98,7 @@
# or in case it is affected by some of the changes we're testing
make blueprint_tools
# find multiproduct_kati and have it build the ninja files for each product
- builder="$(echo $OUT_DIR/soong/host/*/bin/multiproduct_kati)"
+ builder="$(echo $OUT_DIR/host/*/bin/multiproduct_kati)"
BUILD_NUMBER=sample "$builder" $PRODUCTS_ARG --keep --out "$OUT_DIR_TEMP" || true
echo
}
diff --git a/scripts/rbc-run b/scripts/rbc-run
index ecc6edd..235da75 100755
--- a/scripts/rbc-run
+++ b/scripts/rbc-run
@@ -8,9 +8,9 @@
declare -r output_root="${OUT_DIR:-out}"
declare -r runner="${output_root}/soong/rbcrun"
declare -r converter="${output_root}/soong/mk2rbc"
-declare -r launcher="${output_root}/launchers/run.rbc"
+declare -r launcher="${output_root}/rbc/launcher.rbc"
declare -r makefile="$1"
shift
-"${converter}" -mode=write -r --outdir "${output_root}" --launcher="${launcher}" "${makefile}"
+"${converter}" -mode=write -r --outdir "${output_root}/rbc" --launcher="${launcher}" "${makefile}"
"${runner}" RBC_OUT="make,global" RBC_DEBUG="${RBC_DEBUG:-}" $@ "${launcher}"
diff --git a/ui/build/config.go b/ui/build/config.go
index e0fa503..c306633 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -786,7 +786,11 @@
}
func (c *configImpl) HostToolDir() string {
- return filepath.Join(c.SoongOutDir(), "host", c.PrebuiltOS(), "bin")
+ if c.SkipKatiNinja() {
+ return filepath.Join(c.SoongOutDir(), "host", c.PrebuiltOS(), "bin")
+ } else {
+ return filepath.Join(c.OutDir(), "host", c.PrebuiltOS(), "bin")
+ }
}
func (c *configImpl) NamedGlobFile(name string) string {