aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2019-04-09 10:22:43 -0700
committerDan Willemsen <dwillemsen@google.com>2019-04-09 10:23:49 -0700
commit25e6f09c060fb354839531a15c6ade4dc72e7c58 (patch)
tree6c54f6c2952ea866c7c6529e419aca892ecbe19d
parentad459bb8db7c760bcbe0ba4166b90f3a12312c84 (diff)
downloadbuild_soong-25e6f09c060fb354839531a15c6ade4dc72e7c58.tar.gz
build_soong-25e6f09c060fb354839531a15c6ade4dc72e7c58.tar.bz2
build_soong-25e6f09c060fb354839531a15c6ade4dc72e7c58.zip
Add BUILD_BROKEN_USES_NETWORK
Some people apparently still talk to the network during their build. Allow this temporarily with a BUILD_BROKEN_USES_NETWORK check. Bug: 129992021 Test: attempt to talk to the network during the build with and without this flag. Change-Id: Ifb967c656aa24c4599e7232d0f1b5a303b5bac52
-rw-r--r--scripts/build_broken_logs.go4
-rw-r--r--ui/build/config.go9
-rw-r--r--ui/build/dumpvars.go4
-rw-r--r--ui/build/sandbox_linux.go15
4 files changed, 30 insertions, 2 deletions
diff --git a/scripts/build_broken_logs.go b/scripts/build_broken_logs.go
index 73832a65..f081f262 100644
--- a/scripts/build_broken_logs.go
+++ b/scripts/build_broken_logs.go
@@ -90,6 +90,10 @@ var buildBrokenSettings = []struct {
"Changes.md#LOCAL_MODULE_TAGS",
},
},
+ {
+ name: "BUILD_BROKEN_USES_NETWORK",
+ behavior: DefaultDeprecated,
+ },
}
type ProductBranch struct {
diff --git a/ui/build/config.go b/ui/build/config.go
index 64270f89..7eb3a725 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -55,6 +55,7 @@ type configImpl struct {
brokenDupRules bool
brokenPhonyTargets bool
+ brokenUsesNetwork bool
pathReplaced bool
}
@@ -622,6 +623,14 @@ func (c *configImpl) BuildBrokenPhonyTargets() bool {
return c.brokenPhonyTargets
}
+func (c *configImpl) SetBuildBrokenUsesNetwork(val bool) {
+ c.brokenUsesNetwork = val
+}
+
+func (c *configImpl) BuildBrokenUsesNetwork() bool {
+ return c.brokenUsesNetwork
+}
+
func (c *configImpl) SetTargetDeviceDir(dir string) {
c.targetDeviceDir = dir
}
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index 7f0b784d..3e387c1e 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -203,6 +203,9 @@ func runMakeProductConfig(ctx Context, config Config) {
// Used to turn on --werror_ options in Kati
"BUILD_BROKEN_PHONY_TARGETS",
+ // Whether to enable the network during the build
+ "BUILD_BROKEN_USES_NETWORK",
+
// Not used, but useful to be in the soong.log
"BOARD_VNDK_VERSION",
"BUILD_BROKEN_ANDROIDMK_EXPORTS",
@@ -238,4 +241,5 @@ func runMakeProductConfig(ctx Context, config Config) {
config.SetPdkBuild(make_vars["TARGET_BUILD_PDK"] == "true")
config.SetBuildBrokenDupRules(make_vars["BUILD_BROKEN_DUP_RULES"] == "true")
config.SetBuildBrokenPhonyTargets(make_vars["BUILD_BROKEN_PHONY_TARGETS"] == "true")
+ config.SetBuildBrokenUsesNetwork(make_vars["BUILD_BROKEN_USES_NETWORK"] == "true")
}
diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go
index 85c4a9a1..b94db744 100644
--- a/ui/build/sandbox_linux.go
+++ b/ui/build/sandbox_linux.go
@@ -26,6 +26,8 @@ import (
type Sandbox struct {
Enabled bool
DisableWhenUsingGoma bool
+
+ AllowBuildBrokenUsesNetwork bool
}
var (
@@ -40,6 +42,8 @@ var (
ninjaSandbox = Sandbox{
Enabled: true,
DisableWhenUsingGoma: true,
+
+ AllowBuildBrokenUsesNetwork: true,
}
)
@@ -152,10 +156,17 @@ func (c *Cmd) wrapSandbox() {
// Only log important warnings / errors
"-q",
+ }
- // Stop parsing arguments
- "--",
+ if c.Sandbox.AllowBuildBrokenUsesNetwork && c.config.BuildBrokenUsesNetwork() {
+ c.ctx.Printf("AllowBuildBrokenUsesNetwork: %v", c.Sandbox.AllowBuildBrokenUsesNetwork)
+ c.ctx.Printf("BuildBrokenUsesNetwork: %v", c.config.BuildBrokenUsesNetwork())
+ sandboxArgs = append(sandboxArgs, "-N")
}
+
+ // Stop nsjail from parsing arguments
+ sandboxArgs = append(sandboxArgs, "--")
+
c.Args = append(sandboxArgs, c.Args[1:]...)
c.Path = nsjailPath