Merge "Revert^2 "Default from-text stub generation in build"" into main am: 8c4387e478 am: 1a062bab81 am: 32fbd4a02b

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2807659

Change-Id: If91cc1a8e7d00e275392ccbec65d511459fda14e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jihoon Kang 2023-11-10 05:29:32 +00:00 committed by Automerger Merge Worker
commit bb61391aba
4 changed files with 16 additions and 16 deletions

View file

@ -99,7 +99,7 @@ type CmdArgs struct {
UseBazelProxy bool
BuildFromTextStub bool
BuildFromSourceStub bool
EnsureAllowlistIntegrity bool
}
@ -344,9 +344,9 @@ type config struct {
// unix sockets, instead of spawning Bazel as a subprocess.
UseBazelProxy bool
// If buildFromTextStub is true then the Java API stubs are
// built from the signature text files, not the source Java files.
buildFromTextStub bool
// If buildFromSourceStub is true then the Java API stubs are
// built from the source Java files, not the signature text files.
buildFromSourceStub bool
// If ensureAllowlistIntegrity is true, then the presence of any allowlisted
// modules that aren't mixed-built for at least one variant will cause a build
@ -563,7 +563,7 @@ func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error)
MultitreeBuild: cmdArgs.MultitreeBuild,
UseBazelProxy: cmdArgs.UseBazelProxy,
buildFromTextStub: cmdArgs.BuildFromTextStub,
buildFromSourceStub: cmdArgs.BuildFromSourceStub,
}
config.deviceConfig = &deviceConfig{
@ -2082,11 +2082,11 @@ func (c *config) BuildFromTextStub() bool {
// TODO: b/302320354 - Remove the coverage build specific logic once the
// robust solution for handling native properties in from-text stub build
// is implemented.
return c.buildFromTextStub && !c.JavaCoverageEnabled()
return !c.buildFromSourceStub && !c.JavaCoverageEnabled()
}
func (c *config) SetBuildFromTextStub(b bool) {
c.buildFromTextStub = b
c.buildFromSourceStub = !b
c.productVariables.Build_from_text_stub = boolPtr(b)
}

View file

@ -84,7 +84,7 @@ func init() {
flag.BoolVar(&cmdlineArgs.BazelMode, "bazel-mode", false, "use bazel for analysis of certain modules")
flag.BoolVar(&cmdlineArgs.BazelModeStaging, "bazel-mode-staging", false, "use bazel for analysis of certain near-ready modules")
flag.BoolVar(&cmdlineArgs.UseBazelProxy, "use-bazel-proxy", false, "communicate with bazel using unix socket proxy instead of spawning subprocesses")
flag.BoolVar(&cmdlineArgs.BuildFromTextStub, "build-from-text-stub", false, "build Java stubs from API text files instead of source files")
flag.BoolVar(&cmdlineArgs.BuildFromSourceStub, "build-from-source-stub", false, "build Java stubs from source files instead of API text files")
flag.BoolVar(&cmdlineArgs.EnsureAllowlistIntegrity, "ensure-allowlist-integrity", false, "verify that allowlisted modules are mixed-built")
// Flags that probably shouldn't be flags of soong_build, but we haven't found
// the time to remove them yet

View file

@ -86,7 +86,7 @@ type configImpl struct {
searchApiDir bool // Scan the Android.bp files generated in out/api_surfaces
skipMetricsUpload bool
buildStartedTime int64 // For metrics-upload-only - manually specify a build-started time
buildFromTextStub bool
buildFromSourceStub bool
ensureAllowlistIntegrity bool // For CI builds - make sure modules are mixed-built
bazelExitCode int32 // For b runs - necessary for updating NonZeroExit
besId string // For b runs, to identify the BuildEventService logs
@ -820,8 +820,8 @@ func (c *configImpl) parseArgs(ctx Context, args []string) {
} else {
ctx.Fatalf("unknown option for ninja_weight_source: %s", source)
}
} else if arg == "--build-from-text-stub" {
c.buildFromTextStub = true
} else if arg == "--build-from-source-stub" {
c.buildFromSourceStub = true
} else if strings.HasPrefix(arg, "--build-command=") {
buildCmd := strings.TrimPrefix(arg, "--build-command=")
// remove quotations
@ -1156,7 +1156,7 @@ func (c *configImpl) SkipConfig() bool {
}
func (c *configImpl) BuildFromTextStub() bool {
return c.buildFromTextStub
return !c.buildFromSourceStub
}
func (c *configImpl) TargetProduct() string {

View file

@ -193,8 +193,8 @@ func (pb PrimaryBuilderFactory) primaryBuilderInvocation() bootstrap.PrimaryBuil
if pb.config.multitreeBuild {
commonArgs = append(commonArgs, "--multitree-build")
}
if pb.config.buildFromTextStub {
commonArgs = append(commonArgs, "--build-from-text-stub")
if pb.config.buildFromSourceStub {
commonArgs = append(commonArgs, "--build-from-source-stub")
}
commonArgs = append(commonArgs, "-l", filepath.Join(pb.config.FileListDir(), "Android.bp.list"))
@ -310,8 +310,8 @@ func bootstrapBlueprint(ctx Context, config Config) {
if config.MultitreeBuild() {
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--multitree-build")
}
if config.buildFromTextStub {
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--build-from-text-stub")
if config.buildFromSourceStub {
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--build-from-source-stub")
}
if config.ensureAllowlistIntegrity {
mainSoongBuildExtraArgs = append(mainSoongBuildExtraArgs, "--ensure-allowlist-integrity")