aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2019-07-29 23:39:30 -0700
committerMichael Bestas <mkbestas@lineageos.org>2019-12-11 19:03:32 +0200
commit0697a5efd8e47e1ff50911a40eea01e00c35cb9e (patch)
tree9b1f3fbe56a9920d9e4d082a3182dde6cd1a7ac0
parentc8277f2630734f27e7c594de29ab9c4dba2279e2 (diff)
downloadbuild_soong-0697a5efd8e47e1ff50911a40eea01e00c35cb9e.tar.gz
build_soong-0697a5efd8e47e1ff50911a40eea01e00c35cb9e.tar.bz2
build_soong-0697a5efd8e47e1ff50911a40eea01e00c35cb9e.zip
Remove support for ONE_SHOT_MAKEFILE
Test: treehugger Change-Id: Icdbe62bcb7bc4717228c5d974962b939d8eafee6
-rw-r--r--cmd/soong_ui/main.go68
-rw-r--r--ui/build/config.go24
-rw-r--r--ui/build/config_test.go510
-rw-r--r--ui/build/kati.go3
4 files changed, 189 insertions, 416 deletions
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index 6bd08dd4..1659b24d 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -349,42 +349,36 @@ func buildActionConfig(ctx build.Context, args ...string) build.Config {
}
buildActionFlags := []struct {
- name string
- description string
- action build.BuildAction
- buildDependencies bool
- set bool
+ name string
+ description string
+ action build.BuildAction
+ set bool
}{{
- name: "all-modules",
- description: "Build action: build from the top of the source tree.",
- action: build.BUILD_MODULES,
- buildDependencies: true,
+ name: "all-modules",
+ description: "Build action: build from the top of the source tree.",
+ action: build.BUILD_MODULES,
}, {
- // buildDependencies is set to true as mm is being deprecated. This is redirecting to mma build
- // command behaviour. Once it has soaked for a while, the build command is deleted from here once
- // it has been removed from the envsetup.sh.
- name: "modules-in-a-dir-no-deps",
- description: "Build action: builds all of the modules in the current directory without their dependencies.",
- action: build.BUILD_MODULES_IN_A_DIRECTORY,
- buildDependencies: true,
+ // This is redirecting to mma build command behaviour. Once it has soaked for a
+ // while, the build command is deleted from here once it has been removed from the
+ // envsetup.sh.
+ name: "modules-in-a-dir-no-deps",
+ description: "Build action: builds all of the modules in the current directory without their dependencies.",
+ action: build.BUILD_MODULES_IN_A_DIRECTORY,
}, {
- // buildDependencies is set to true as mmm is being deprecated. This is redirecting to mmma build
- // command behaviour. Once it has soaked for a while, the build command is deleted from here once
- // it has been removed from the envsetup.sh.
- name: "modules-in-dirs-no-deps",
- description: "Build action: builds all of the modules in the supplied directories without their dependencies.",
- action: build.BUILD_MODULES_IN_DIRECTORIES,
- buildDependencies: true,
+ // This is redirecting to mmma build command behaviour. Once it has soaked for a
+ // while, the build command is deleted from here once it has been removed from the
+ // envsetup.sh.
+ name: "modules-in-dirs-no-deps",
+ description: "Build action: builds all of the modules in the supplied directories without their dependencies.",
+ action: build.BUILD_MODULES_IN_DIRECTORIES,
}, {
- name: "modules-in-a-dir",
- description: "Build action: builds all of the modules in the current directory and their dependencies.",
- action: build.BUILD_MODULES_IN_A_DIRECTORY,
- buildDependencies: true,
+ name: "modules-in-a-dir",
+ description: "Build action: builds all of the modules in the current directory and their dependencies.",
+ action: build.BUILD_MODULES_IN_A_DIRECTORY,
}, {
- name: "modules-in-dirs",
- description: "Build action: builds all of the modules in the supplied directories and their dependencies.",
- action: build.BUILD_MODULES_IN_DIRECTORIES,
- buildDependencies: true,
+ name: "modules-in-dirs",
+ description: "Build action: builds all of the modules in the supplied directories and their dependencies.",
+ action: build.BUILD_MODULES_IN_DIRECTORIES,
}}
for i, flag := range buildActionFlags {
flags.BoolVar(&buildActionFlags[i].set, flag.name, false, flag.description)
@@ -404,12 +398,10 @@ func buildActionConfig(ctx build.Context, args ...string) build.Config {
// is specified.
buildActionCount := 0
var buildAction build.BuildAction
- buildDependency := false
for _, flag := range buildActionFlags {
if flag.set {
buildActionCount++
buildAction = flag.action
- buildDependency = flag.buildDependencies
}
}
if buildActionCount != 1 {
@@ -421,7 +413,7 @@ func buildActionConfig(ctx build.Context, args ...string) build.Config {
// Remove the build action flags from the args as they are not recognized by the config.
args = args[numBuildActionFlags:]
- return build.NewBuildActionConfig(buildAction, *dir, buildDependency, ctx, args...)
+ return build.NewBuildActionConfig(buildAction, *dir, ctx, args...)
}
func make(ctx build.Context, config build.Config, _ []string, logsDir string) {
@@ -443,17 +435,13 @@ func make(ctx build.Context, config build.Config, _ []string, logsDir string) {
if _, ok := config.Environment().Get("ONE_SHOT_MAKEFILE"); ok {
writer := ctx.Writer
- fmt.Fprintln(writer, "! The variable `ONE_SHOT_MAKEFILE` is deprecated, and will be removed shortly.")
+ fmt.Fprintln(writer, "! The variable `ONE_SHOT_MAKEFILE` is obsolete.")
fmt.Fprintln(writer, "!")
fmt.Fprintln(writer, "! If you're using `mm`, you'll need to run `source build/envsetup.sh` to update.")
fmt.Fprintln(writer, "!")
fmt.Fprintln(writer, "! Otherwise, either specify a module name with m, or use mma / MODULES-IN-...")
fmt.Fprintln(writer, "")
- select {
- case <-time.After(30 * time.Second):
- case <-ctx.Done():
- return
- }
+ ctx.Fatal("done")
}
toBuild := build.BuildAll
diff --git a/ui/build/config.go b/ui/build/config.go
index 5440f7e8..720235e8 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -254,13 +254,13 @@ func NewConfig(ctx Context, args ...string) Config {
// NewBuildActionConfig returns a build configuration based on the build action. The arguments are
// processed based on the build action and extracts any arguments that belongs to the build action.
-func NewBuildActionConfig(action BuildAction, dir string, buildDependencies bool, ctx Context, args ...string) Config {
- return NewConfig(ctx, getConfigArgs(action, dir, buildDependencies, ctx, args)...)
+func NewBuildActionConfig(action BuildAction, dir string, ctx Context, args ...string) Config {
+ return NewConfig(ctx, getConfigArgs(action, dir, ctx, args)...)
}
// getConfigArgs processes the command arguments based on the build action and creates a set of new
// arguments to be accepted by Config.
-func getConfigArgs(action BuildAction, dir string, buildDependencies bool, ctx Context, args []string) []string {
+func getConfigArgs(action BuildAction, dir string, ctx Context, args []string) []string {
// The next block of code verifies that the current directory is the root directory of the source
// tree. It then finds the relative path of dir based on the root directory of the source tree
// and verify that dir is inside of the source tree.
@@ -296,7 +296,6 @@ func getConfigArgs(action BuildAction, dir string, buildDependencies bool, ctx C
configArgs = removeFromList("GET-INSTALL-PATH", configArgs)
}
- var buildFiles []string
var targets []string
switch action {
@@ -313,20 +312,11 @@ func getConfigArgs(action BuildAction, dir string, buildDependencies bool, ctx C
if buildFile == "" {
ctx.Fatalf("Build file not found for %s directory", relDir)
}
- buildFiles = []string{buildFile}
targets = []string{convertToTarget(filepath.Dir(buildFile), targetNamePrefix)}
case BUILD_MODULES_IN_DIRECTORIES:
newConfigArgs, dirs := splitArgs(configArgs)
configArgs = newConfigArgs
- targets, buildFiles = getTargetsFromDirs(ctx, relDir, dirs, targetNamePrefix)
- }
-
- // This is to support building modules without building their dependencies. Soon, this will be
- // deprecated.
- if !buildDependencies && len(buildFiles) > 0 {
- if err := os.Setenv("ONE_SHOT_MAKEFILE", strings.Join(buildFiles, " ")); err != nil {
- ctx.Fatalf("Unable to set ONE_SHOT_MAKEFILE environment variable: %v", err)
- }
+ targets = getTargetsFromDirs(ctx, relDir, dirs, targetNamePrefix)
}
// Tidy only override all other specified targets.
@@ -436,7 +426,7 @@ func splitArgs(args []string) (newArgs []string, dirs []string) {
// directory from the dirs list does not exist, a fatal error is raised. relDir is related to the
// source root tree where the build action command was invoked. Each directory is validated if the
// build file can be found and follows the format "dir1:target1,target2,...". Target is optional.
-func getTargetsFromDirs(ctx Context, relDir string, dirs []string, targetNamePrefix string) (targets []string, buildFiles []string) {
+func getTargetsFromDirs(ctx Context, relDir string, dirs []string, targetNamePrefix string) (targets []string) {
for _, dir := range dirs {
// The directory may have specified specific modules to build. ":" is the separator to separate
// the directory and the list of modules.
@@ -467,20 +457,18 @@ func getTargetsFromDirs(ctx Context, relDir string, dirs []string, targetNamePre
if !hasBuildFile(ctx, dir) {
ctx.Fatalf("Couldn't locate a build file from %s directory", dir)
}
- buildFiles = append(buildFiles, filepath.Join(dir, "Android.mk"))
} else {
buildFile := findBuildFile(ctx, dir)
if buildFile == "" {
ctx.Fatalf("Build file not found for %s directory", dir)
}
newTargets = []string{convertToTarget(filepath.Dir(buildFile), targetNamePrefix)}
- buildFiles = append(buildFiles, buildFile)
}
targets = append(targets, newTargets...)
}
- return targets, buildFiles
+ return targets
}
func (c *configImpl) parseArgs(ctx Context, args []string) {
diff --git a/ui/build/config_test.go b/ui/build/config_test.go
index 463405a3..df618c4e 100644
--- a/ui/build/config_test.go
+++ b/ui/build/config_test.go
@@ -363,19 +363,15 @@ func TestConfigGetTargets(t *testing.T) {
// Expected targets from the function.
expectedTargets []string
- // Expected build from the build system.
- expectedBuildFiles []string
-
// Expecting error from running test case.
errStr string
}{{
- description: "one target dir specified",
- dirsInTrees: []string{"0/1/2/3"},
- buildFiles: []string{"0/1/2/3/Android.bp"},
- dirs: []string{"1/2/3"},
- curDir: "0",
- expectedTargets: []string{"MODULES-IN-0-1-2-3"},
- expectedBuildFiles: []string{"0/1/2/3/Android.mk"},
+ description: "one target dir specified",
+ dirsInTrees: []string{"0/1/2/3"},
+ buildFiles: []string{"0/1/2/3/Android.bp"},
+ dirs: []string{"1/2/3"},
+ curDir: "0",
+ expectedTargets: []string{"MODULES-IN-0-1-2-3"},
}, {
description: "one target dir specified, build file does not exist",
dirsInTrees: []string{"0/1/2/3"},
@@ -391,21 +387,19 @@ func TestConfigGetTargets(t *testing.T) {
curDir: "0",
errStr: "1/2/3:t1:t2 not in proper directory:target1,target2,... format (\":\" was specified more than once)",
}, {
- description: "one target dir specified, no targets specified but has colon",
- dirsInTrees: []string{"0/1/2/3"},
- buildFiles: []string{"0/1/2/3/Android.bp"},
- dirs: []string{"1/2/3:"},
- curDir: "0",
- expectedTargets: []string{"MODULES-IN-0-1-2-3"},
- expectedBuildFiles: []string{"0/1/2/3/Android.mk"},
+ description: "one target dir specified, no targets specified but has colon",
+ dirsInTrees: []string{"0/1/2/3"},
+ buildFiles: []string{"0/1/2/3/Android.bp"},
+ dirs: []string{"1/2/3:"},
+ curDir: "0",
+ expectedTargets: []string{"MODULES-IN-0-1-2-3"},
}, {
- description: "one target dir specified, two targets specified",
- dirsInTrees: []string{"0/1/2/3"},
- buildFiles: []string{"0/1/2/3/Android.bp"},
- dirs: []string{"1/2/3:t1,t2"},
- curDir: "0",
- expectedTargets: []string{"t1", "t2"},
- expectedBuildFiles: []string{"0/1/2/3/Android.mk"},
+ description: "one target dir specified, two targets specified",
+ dirsInTrees: []string{"0/1/2/3"},
+ buildFiles: []string{"0/1/2/3/Android.bp"},
+ dirs: []string{"1/2/3:t1,t2"},
+ curDir: "0",
+ expectedTargets: []string{"t1", "t2"},
}, {
description: "one target dir specified, no targets and has a comma",
dirsInTrees: []string{"0/1/2/3"},
@@ -428,13 +422,12 @@ func TestConfigGetTargets(t *testing.T) {
curDir: "0",
errStr: "0/1/2/3 not in proper directory:target1,target2,... format",
}, {
- description: "one target dir specified, many targets specified",
- dirsInTrees: []string{"0/1/2/3"},
- buildFiles: []string{"0/1/2/3/Android.bp"},
- dirs: []string{"1/2/3:t1,t2,t3,t4,t5,t6,t7,t8,t9,t10"},
- curDir: "0",
- expectedTargets: []string{"t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "t10"},
- expectedBuildFiles: []string{"0/1/2/3/Android.mk"},
+ description: "one target dir specified, many targets specified",
+ dirsInTrees: []string{"0/1/2/3"},
+ buildFiles: []string{"0/1/2/3/Android.bp"},
+ dirs: []string{"1/2/3:t1,t2,t3,t4,t5,t6,t7,t8,t9,t10"},
+ curDir: "0",
+ expectedTargets: []string{"t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9", "t10"},
}, {
description: "one target dir specified, one target specified, build file does not exist",
dirsInTrees: []string{"0/1/2/3"},
@@ -450,29 +443,26 @@ func TestConfigGetTargets(t *testing.T) {
curDir: "0",
errStr: "Couldn't locate a build file from 0/1/2/3 directory",
}, {
- description: "one target dir specified, build file not in target dir",
- dirsInTrees: []string{"0/1/2/3"},
- buildFiles: []string{"0/1/2/Android.mk"},
- dirs: []string{"1/2/3"},
- curDir: "0",
- expectedTargets: []string{"MODULES-IN-0-1-2"},
- expectedBuildFiles: []string{"0/1/2/Android.mk"},
- }, {
- description: "multiple targets dir specified, targets specified",
- dirsInTrees: []string{"0/1/2/3", "0/3/4"},
- buildFiles: []string{"0/1/2/3/Android.bp", "0/3/4/Android.mk"},
- dirs: []string{"1/2/3:t1,t2", "3/4:t3,t4,t5"},
- curDir: "0",
- expectedTargets: []string{"t1", "t2", "t3", "t4", "t5"},
- expectedBuildFiles: []string{"0/1/2/3/Android.mk", "0/3/4/Android.mk"},
- }, {
- description: "multiple targets dir specified, one directory has targets specified",
- dirsInTrees: []string{"0/1/2/3", "0/3/4"},
- buildFiles: []string{"0/1/2/3/Android.bp", "0/3/4/Android.mk"},
- dirs: []string{"1/2/3:t1,t2", "3/4"},
- curDir: "0",
- expectedTargets: []string{"t1", "t2", "MODULES-IN-0-3-4"},
- expectedBuildFiles: []string{"0/1/2/3/Android.mk", "0/3/4/Android.mk"},
+ description: "one target dir specified, build file not in target dir",
+ dirsInTrees: []string{"0/1/2/3"},
+ buildFiles: []string{"0/1/2/Android.mk"},
+ dirs: []string{"1/2/3"},
+ curDir: "0",
+ expectedTargets: []string{"MODULES-IN-0-1-2"},
+ }, {
+ description: "multiple targets dir specified, targets specified",
+ dirsInTrees: []string{"0/1/2/3", "0/3/4"},
+ buildFiles: []string{"0/1/2/3/Android.bp", "0/3/4/Android.mk"},
+ dirs: []string{"1/2/3:t1,t2", "3/4:t3,t4,t5"},
+ curDir: "0",
+ expectedTargets: []string{"t1", "t2", "t3", "t4", "t5"},
+ }, {
+ description: "multiple targets dir specified, one directory has targets specified",
+ dirsInTrees: []string{"0/1/2/3", "0/3/4"},
+ buildFiles: []string{"0/1/2/3/Android.bp", "0/3/4/Android.mk"},
+ dirs: []string{"1/2/3:t1,t2", "3/4"},
+ curDir: "0",
+ expectedTargets: []string{"t1", "t2", "MODULES-IN-0-3-4"},
}, {
description: "two dirs specified, only one dir exist",
dirsInTrees: []string{"0/1/2/3"},
@@ -481,13 +471,12 @@ func TestConfigGetTargets(t *testing.T) {
curDir: "0",
errStr: "couldn't find directory 0/3/4",
}, {
- description: "multiple targets dirs specified at root source tree",
- dirsInTrees: []string{"0/1/2/3", "0/3/4"},
- buildFiles: []string{"0/1/2/3/Android.bp", "0/3/4/Android.mk"},
- dirs: []string{"0/1/2/3:t1,t2", "0/3/4"},
- curDir: ".",
- expectedTargets: []string{"t1", "t2", "MODULES-IN-0-3-4"},
- expectedBuildFiles: []string{"0/1/2/3/Android.mk", "0/3/4/Android.mk"},
+ description: "multiple targets dirs specified at root source tree",
+ dirsInTrees: []string{"0/1/2/3", "0/3/4"},
+ buildFiles: []string{"0/1/2/3/Android.bp", "0/3/4/Android.mk"},
+ dirs: []string{"0/1/2/3:t1,t2", "0/3/4"},
+ curDir: ".",
+ expectedTargets: []string{"t1", "t2", "MODULES-IN-0-3-4"},
}, {
description: "no directories specified",
dirsInTrees: []string{"0/1/2/3", "0/3/4"},
@@ -518,13 +507,10 @@ func TestConfigGetTargets(t *testing.T) {
r := setTop(t, topDir)
defer r()
- targets, buildFiles := getTargetsFromDirs(ctx, tt.curDir, tt.dirs, "MODULES-IN-")
+ targets := getTargetsFromDirs(ctx, tt.curDir, tt.dirs, "MODULES-IN-")
if !reflect.DeepEqual(targets, tt.expectedTargets) {
t.Errorf("expected %v, got %v for targets", tt.expectedTargets, targets)
}
- if !reflect.DeepEqual(buildFiles, tt.expectedBuildFiles) {
- t.Errorf("expected %v, got %v for build files", tt.expectedBuildFiles, buildFiles)
- }
// If the execution reached here and there was an expected error code, the unit test case failed.
if tt.errStr != "" {
@@ -732,14 +718,11 @@ type buildActionTestCase struct {
// Expected arguments to be in Config instance.
expectedArgs []string
- // Expected environment variables to be set.
- expectedEnvVars []envVar
-
// Expecting error from running test case.
expectedErrStr string
}
-func testGetConfigArgs(t *testing.T, tt buildActionTestCase, action BuildAction, buildDependencies bool) {
+func testGetConfigArgs(t *testing.T, tt buildActionTestCase, action BuildAction) {
ctx := testContext()
defer logger.Recover(func(err error) {
@@ -753,7 +736,6 @@ func testGetConfigArgs(t *testing.T, tt buildActionTestCase, action BuildAction,
// Environment variables to set it to blank on every test case run.
resetEnvVars := []string{
- "ONE_SHOT_MAKEFILE",
"WITH_TIDY_ONLY",
}
@@ -807,17 +789,11 @@ func testGetConfigArgs(t *testing.T, tt buildActionTestCase, action BuildAction,
t.Fatalf("failed to create %s file: %v", srcDirFileCheck, err)
}
- args := getConfigArgs(action, tt.curDir, buildDependencies, ctx, tt.args)
+ args := getConfigArgs(action, tt.curDir, ctx, tt.args)
if !reflect.DeepEqual(tt.expectedArgs, args) {
t.Fatalf("expected %v, got %v for config arguments", tt.expectedArgs, args)
}
- for _, env := range tt.expectedEnvVars {
- if val := os.Getenv(env.name); val != env.value {
- t.Errorf("expecting %s, got %s for environment variable %s", env.value, val, env.name)
- }
- }
-
// If the execution reached here and there was an expected error code, the unit test case failed.
if tt.expectedErrStr != "" {
t.Errorf("expecting error %s", tt.expectedErrStr)
@@ -826,299 +802,143 @@ func testGetConfigArgs(t *testing.T, tt buildActionTestCase, action BuildAction,
func TestGetConfigArgsBuildModules(t *testing.T) {
tests := []buildActionTestCase{{
- description: "normal execution from the root source tree directory",
- dirsInTrees: []string{"0/1/2", "0/2", "0/3"},
- buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp", "0/3/Android.mk"},
- args: []string{"-j", "fake_module", "fake_module2"},
- curDir: ".",
- tidyOnly: "",
- expectedArgs: []string{"-j", "fake_module", "fake_module2"},
- expectedEnvVars: []envVar{},
+ description: "normal execution from the root source tree directory",
+ dirsInTrees: []string{"0/1/2", "0/2", "0/3"},
+ buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp", "0/3/Android.mk"},
+ args: []string{"-j", "fake_module", "fake_module2"},
+ curDir: ".",
+ tidyOnly: "",
+ expectedArgs: []string{"-j", "fake_module", "fake_module2"},
}, {
- description: "normal execution in deep directory",
- dirsInTrees: []string{"0/1/2", "0/2", "0/3", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6"},
- buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6/Android.mk"},
- args: []string{"-j", "fake_module", "fake_module2", "-k"},
- curDir: "1/2/3/4/5/6/7/8/9",
- tidyOnly: "",
- expectedArgs: []string{"-j", "fake_module", "fake_module2", "-k"},
- expectedEnvVars: []envVar{},
+ description: "normal execution in deep directory",
+ dirsInTrees: []string{"0/1/2", "0/2", "0/3", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6"},
+ buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6/Android.mk"},
+ args: []string{"-j", "fake_module", "fake_module2", "-k"},
+ curDir: "1/2/3/4/5/6/7/8/9",
+ tidyOnly: "",
+ expectedArgs: []string{"-j", "fake_module", "fake_module2", "-k"},
}, {
- description: "normal execution in deep directory, no targets",
- dirsInTrees: []string{"0/1/2", "0/2", "0/3", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6"},
- buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6/Android.mk"},
- args: []string{"-j", "-k"},
- curDir: "1/2/3/4/5/6/7/8/9",
- tidyOnly: "",
- expectedArgs: []string{"-j", "-k"},
- expectedEnvVars: []envVar{},
+ description: "normal execution in deep directory, no targets",
+ dirsInTrees: []string{"0/1/2", "0/2", "0/3", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6"},
+ buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp", "1/2/3/4/5/6/7/8/9/1/2/3/4/5/6/Android.mk"},
+ args: []string{"-j", "-k"},
+ curDir: "1/2/3/4/5/6/7/8/9",
+ tidyOnly: "",
+ expectedArgs: []string{"-j", "-k"},
}, {
- description: "normal execution in root source tree, no args",
- dirsInTrees: []string{"0/1/2", "0/2", "0/3"},
- buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp"},
- args: []string{},
- curDir: "0/2",
- tidyOnly: "",
- expectedArgs: []string{},
- expectedEnvVars: []envVar{},
+ description: "normal execution in root source tree, no args",
+ dirsInTrees: []string{"0/1/2", "0/2", "0/3"},
+ buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp"},
+ args: []string{},
+ curDir: "0/2",
+ tidyOnly: "",
+ expectedArgs: []string{},
}, {
- description: "normal execution in symlink root source tree, no args",
- dirsInTrees: []string{"0/1/2", "0/2", "0/3"},
- buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp"},
- rootSymlink: true,
- args: []string{},
- curDir: "0/2",
- tidyOnly: "",
- expectedArgs: []string{},
- expectedEnvVars: []envVar{},
+ description: "normal execution in symlink root source tree, no args",
+ dirsInTrees: []string{"0/1/2", "0/2", "0/3"},
+ buildFiles: []string{"0/1/2/Android.mk", "0/2/Android.bp"},
+ rootSymlink: true,
+ args: []string{},
+ curDir: "0/2",
+ tidyOnly: "",
+ expectedArgs: []string{},
}}
for _, tt := range tests {
t.Run("build action BUILD_MODULES with dependencies, "+tt.description, func(t *testing.T) {
- testGetConfigArgs(t, tt, BUILD_MODULES, true)
+ testGetConfigArgs(t, tt, BUILD_MODULES)
})
}
}
-// TODO: Remove this test case once mm shell build command has been deprecated.
-func TestGetConfigArgsBuildModulesInDirecotoryNoDeps(t *testing.T) {
+func TestGetConfigArgsBuildModulesInDirectory(t *testing.T) {
tests := []buildActionTestCase{{
description: "normal execution in a directory",
dirsInTrees: []string{"0/1/2"},
buildFiles: []string{"0/1/2/Android.mk"},
- args: []string{"-j", "-k", "showcommands", "fake-module"},
+ args: []string{"fake-module"},
curDir: "0/1/2",
tidyOnly: "",
- expectedArgs: []string{"-j", "-k", "showcommands", "fake-module", "MODULES-IN-0-1-2"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: "0/1/2/Android.mk"}},
+ expectedArgs: []string{"fake-module", "MODULES-IN-0-1-2"},
}, {
- description: "makefile in parent directory",
+ description: "build file in parent directory",
dirsInTrees: []string{"0/1/2"},
buildFiles: []string{"0/1/Android.mk"},
args: []string{},
curDir: "0/1/2",
tidyOnly: "",
expectedArgs: []string{"MODULES-IN-0-1"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: "0/1/Android.mk"}},
- }, {
- description: "build file not found",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{},
- args: []string{},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"MODULES-IN-0-1-2"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: "0/1/2/Android.mk"}},
- expectedErrStr: "Build file not found for 0/1/2 directory",
- }, {
- description: "build action executed at root directory",
- dirsInTrees: []string{},
- buildFiles: []string{},
- args: []string{},
- curDir: ".",
- tidyOnly: "",
- expectedArgs: []string{},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: ""}},
- }, {
- description: "GET-INSTALL-PATH specified,",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{"0/1/Android.mk"},
- args: []string{"GET-INSTALL-PATH"},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"GET-INSTALL-PATH-IN-0-1"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: "0/1/Android.mk"}},
- }, {
- description: "tidy only environment variable specified,",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{"0/1/Android.mk"},
- args: []string{"GET-INSTALL-PATH"},
- curDir: "0/1/2",
- tidyOnly: "true",
- expectedArgs: []string{"tidy_only"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: "0/1/Android.mk"}},
- }}
- for _, tt := range tests {
- t.Run("build action BUILD_MODULES_IN_DIR without their dependencies, "+tt.description, func(t *testing.T) {
- testGetConfigArgs(t, tt, BUILD_MODULES_IN_A_DIRECTORY, false)
- })
- }
-}
-
-func TestGetConfigArgsBuildModulesInDirectory(t *testing.T) {
- tests := []buildActionTestCase{{
- description: "normal execution in a directory",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{"0/1/2/Android.mk"},
- args: []string{"fake-module"},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"fake-module", "MODULES-IN-0-1-2"},
- expectedEnvVars: []envVar{},
- }, {
- description: "build file in parent directory",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{"0/1/Android.mk"},
- args: []string{},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"MODULES-IN-0-1"},
- expectedEnvVars: []envVar{},
},
{
- description: "build file in parent directory, multiple module names passed in",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{"0/1/Android.mk"},
- args: []string{"fake-module1", "fake-module2", "fake-module3"},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"fake-module1", "fake-module2", "fake-module3", "MODULES-IN-0-1"},
- expectedEnvVars: []envVar{},
+ description: "build file in parent directory, multiple module names passed in",
+ dirsInTrees: []string{"0/1/2"},
+ buildFiles: []string{"0/1/Android.mk"},
+ args: []string{"fake-module1", "fake-module2", "fake-module3"},
+ curDir: "0/1/2",
+ tidyOnly: "",
+ expectedArgs: []string{"fake-module1", "fake-module2", "fake-module3", "MODULES-IN-0-1"},
}, {
- description: "build file in 2nd level parent directory",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{"0/Android.bp"},
- args: []string{},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"MODULES-IN-0"},
- expectedEnvVars: []envVar{},
+ description: "build file in 2nd level parent directory",
+ dirsInTrees: []string{"0/1/2"},
+ buildFiles: []string{"0/Android.bp"},
+ args: []string{},
+ curDir: "0/1/2",
+ tidyOnly: "",
+ expectedArgs: []string{"MODULES-IN-0"},
}, {
- description: "build action executed at root directory",
- dirsInTrees: []string{},
- buildFiles: []string{},
- rootSymlink: false,
- args: []string{},
- curDir: ".",
- tidyOnly: "",
- expectedArgs: []string{},
- expectedEnvVars: []envVar{},
+ description: "build action executed at root directory",
+ dirsInTrees: []string{},
+ buildFiles: []string{},
+ rootSymlink: false,
+ args: []string{},
+ curDir: ".",
+ tidyOnly: "",
+ expectedArgs: []string{},
}, {
- description: "build action executed at root directory in symlink",
- dirsInTrees: []string{},
- buildFiles: []string{},
- rootSymlink: true,
- args: []string{},
- curDir: ".",
- tidyOnly: "",
- expectedArgs: []string{},
- expectedEnvVars: []envVar{},
+ description: "build action executed at root directory in symlink",
+ dirsInTrees: []string{},
+ buildFiles: []string{},
+ rootSymlink: true,
+ args: []string{},
+ curDir: ".",
+ tidyOnly: "",
+ expectedArgs: []string{},
}, {
- description: "build file not found",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{},
- args: []string{},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"MODULES-IN-0-1-2"},
- expectedEnvVars: []envVar{},
- expectedErrStr: "Build file not found for 0/1/2 directory",
+ description: "build file not found",
+ dirsInTrees: []string{"0/1/2"},
+ buildFiles: []string{},
+ args: []string{},
+ curDir: "0/1/2",
+ tidyOnly: "",
+ expectedArgs: []string{"MODULES-IN-0-1-2"},
+ expectedErrStr: "Build file not found for 0/1/2 directory",
}, {
- description: "GET-INSTALL-PATH specified,",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{"0/1/Android.mk"},
- args: []string{"GET-INSTALL-PATH", "-j", "-k", "GET-INSTALL-PATH"},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"-j", "-k", "GET-INSTALL-PATH-IN-0-1"},
- expectedEnvVars: []envVar{},
+ description: "GET-INSTALL-PATH specified,",
+ dirsInTrees: []string{"0/1/2"},
+ buildFiles: []string{"0/1/Android.mk"},
+ args: []string{"GET-INSTALL-PATH", "-j", "-k", "GET-INSTALL-PATH"},
+ curDir: "0/1/2",
+ tidyOnly: "",
+ expectedArgs: []string{"-j", "-k", "GET-INSTALL-PATH-IN-0-1"},
}, {
- description: "tidy only environment variable specified,",
- dirsInTrees: []string{"0/1/2"},
- buildFiles: []string{"0/1/Android.mk"},
- args: []string{"GET-INSTALL-PATH"},
- curDir: "0/1/2",
- tidyOnly: "true",
- expectedArgs: []string{"tidy_only"},
- expectedEnvVars: []envVar{},
+ description: "tidy only environment variable specified,",
+ dirsInTrees: []string{"0/1/2"},
+ buildFiles: []string{"0/1/Android.mk"},
+ args: []string{"GET-INSTALL-PATH"},
+ curDir: "0/1/2",
+ tidyOnly: "true",
+ expectedArgs: []string{"tidy_only"},
}, {
- description: "normal execution in root directory with args",
- dirsInTrees: []string{},
- buildFiles: []string{},
- args: []string{"-j", "-k", "fake_module"},
- curDir: "",
- tidyOnly: "",
- expectedArgs: []string{"-j", "-k", "fake_module"},
- expectedEnvVars: []envVar{},
+ description: "normal execution in root directory with args",
+ dirsInTrees: []string{},
+ buildFiles: []string{},
+ args: []string{"-j", "-k", "fake_module"},
+ curDir: "",
+ tidyOnly: "",
+ expectedArgs: []string{"-j", "-k", "fake_module"},
}}
for _, tt := range tests {
t.Run("build action BUILD_MODULES_IN_DIR, "+tt.description, func(t *testing.T) {
- testGetConfigArgs(t, tt, BUILD_MODULES_IN_A_DIRECTORY, true)
- })
- }
-}
-
-// TODO: Remove this test case once mmm shell build command has been deprecated.
-func TestGetConfigArgsBuildModulesInDirectoriesNoDeps(t *testing.T) {
- tests := []buildActionTestCase{{
- description: "normal execution in a directory",
- dirsInTrees: []string{"0/1/2/3.1", "0/1/2/3.2", "0/1/2/3.3"},
- buildFiles: []string{"0/1/2/3.1/Android.bp", "0/1/2/3.2/Android.bp", "0/1/2/3.3/Android.bp"},
- args: []string{"3.1/:t1,t2", "3.2/:t3,t4", "3.3/:t5,t6"},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"t1", "t2", "t3", "t4", "t5", "t6"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: "0/1/2/3.1/Android.mk 0/1/2/3.2/Android.mk 0/1/2/3.3/Android.mk"}},
- }, {
- description: "GET-INSTALL-PATH specified",
- dirsInTrees: []string{"0/1/2/3.1", "0/1/2/3.2", "0/1/2/3.3"},
- buildFiles: []string{"0/1/2/3.1/Android.bp", "0/1/2/3.2/Android.bp", "0/1/2/3.3/Android.bp"},
- args: []string{"GET-INSTALL-PATH", "3.1/", "3.2/", "3.3/:t6"},
- curDir: "0/1/2",
- tidyOnly: "",
- expectedArgs: []string{"GET-INSTALL-PATH-IN-0-1-2-3.1", "GET-INSTALL-PATH-IN-0-1-2-3.2", "t6"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: "0/1/2/3.1/Android.mk 0/1/2/3.2/Android.mk 0/1/2/3.3/Android.mk"}},
- }, {
- description: "tidy only environment variable specified",
- dirsInTrees: []string{"0/1/2/3.1", "0/1/2/3.2", "0/1/2/3.3"},
- buildFiles: []string{"0/1/2/3.1/Android.bp", "0/1/2/3.2/Android.bp", "0/1/2/3.3/Android.bp"},
- args: []string{"GET-INSTALL-PATH", "3.1/", "3.2/", "3.3/:t6"},
- curDir: "0/1/2",
- tidyOnly: "1",
- expectedArgs: []string{"tidy_only"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: "0/1/2/3.1/Android.mk 0/1/2/3.2/Android.mk 0/1/2/3.3/Android.mk"}},
- }, {
- description: "normal execution from top dir directory",
- dirsInTrees: []string{"0/1/2/3.1", "0/1/2/3.2", "0/1/2/3.3"},
- buildFiles: []string{"0/1/2/3.1/Android.bp", "0/1/2/3.2/Android.bp", "0/1/2/3.3/Android.bp"},
- args: []string{"0/1/2/3.1", "0/1/2/3.2/:t3,t4", "0/1/2/3.3/:t5,t6"},
- curDir: ".",
- tidyOnly: "",
- expectedArgs: []string{"MODULES-IN-0-1-2-3.1", "t3", "t4", "t5", "t6"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: "0/1/2/3.1/Android.mk 0/1/2/3.2/Android.mk 0/1/2/3.3/Android.mk"}},
- }}
- for _, tt := range tests {
- t.Run("build action BUILD_MODULES_IN_DIRS_NO_DEPS, "+tt.description, func(t *testing.T) {
- testGetConfigArgs(t, tt, BUILD_MODULES_IN_DIRECTORIES, false)
+ testGetConfigArgs(t, tt, BUILD_MODULES_IN_A_DIRECTORY)
})
}
}
@@ -1132,10 +952,6 @@ func TestGetConfigArgsBuildModulesInDirectories(t *testing.T) {
curDir: "0/1/2",
tidyOnly: "",
expectedArgs: []string{"MODULES-IN-0-1-2-3.1", "MODULES-IN-0-1-2-3.2", "MODULES-IN-0-1-2-3.3"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: ""}},
}, {
description: "GET-INSTALL-PATH specified",
dirsInTrees: []string{"0/1/2/3.1", "0/1/2/3.2", "0/1/3"},
@@ -1144,10 +960,6 @@ func TestGetConfigArgsBuildModulesInDirectories(t *testing.T) {
curDir: "0/1",
tidyOnly: "",
expectedArgs: []string{"GET-INSTALL-PATH-IN-0-1-2-3.1", "GET-INSTALL-PATH-IN-0-1-2-3.2", "GET-INSTALL-PATH-IN-0-1"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: ""}},
}, {
description: "tidy only environment variable specified",
dirsInTrees: []string{"0/1/2/3.1", "0/1/2/3.2", "0/1/2/3.3"},
@@ -1156,10 +968,6 @@ func TestGetConfigArgsBuildModulesInDirectories(t *testing.T) {
curDir: "0/1/2",
tidyOnly: "1",
expectedArgs: []string{"tidy_only"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: ""}},
}, {
description: "normal execution from top dir directory",
dirsInTrees: []string{"0/1/2/3.1", "0/1/2/3.2", "0/1/3", "0/2"},
@@ -1169,10 +977,6 @@ func TestGetConfigArgsBuildModulesInDirectories(t *testing.T) {
curDir: ".",
tidyOnly: "",
expectedArgs: []string{"MODULES-IN-0-1-2-3.1", "MODULES-IN-0-1-2-3.2", "MODULES-IN-0-1-3", "MODULES-IN-0-2"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: ""}},
}, {
description: "normal execution from top dir directory in symlink",
dirsInTrees: []string{"0/1/2/3.1", "0/1/2/3.2", "0/1/3", "0/2"},
@@ -1182,14 +986,10 @@ func TestGetConfigArgsBuildModulesInDirectories(t *testing.T) {
curDir: ".",
tidyOnly: "",
expectedArgs: []string{"MODULES-IN-0-1-2-3.1", "MODULES-IN-0-1-2-3.2", "MODULES-IN-0-1-3", "MODULES-IN-0-2"},
- expectedEnvVars: []envVar{
- envVar{
- name: "ONE_SHOT_MAKEFILE",
- value: ""}},
}}
for _, tt := range tests {
t.Run("build action BUILD_MODULES_IN_DIRS, "+tt.description, func(t *testing.T) {
- testGetConfigArgs(t, tt, BUILD_MODULES_IN_DIRECTORIES, true)
+ testGetConfigArgs(t, tt, BUILD_MODULES_IN_DIRECTORIES)
})
}
}
diff --git a/ui/build/kati.go b/ui/build/kati.go
index 959d0bdf..90414055 100644
--- a/ui/build/kati.go
+++ b/ui/build/kati.go
@@ -42,9 +42,6 @@ func genKatiSuffix(ctx Context, config Config) {
if args := config.KatiArgs(); len(args) > 0 {
katiSuffix += "-" + spaceSlashReplacer.Replace(strings.Join(args, "_"))
}
- if oneShot, ok := config.Environment().Get("ONE_SHOT_MAKEFILE"); ok {
- katiSuffix += "-" + spaceSlashReplacer.Replace(oneShot)
- }
// If the suffix is too long, replace it with a md5 hash and write a
// file that contains the original suffix.