[infra] Simplify infra/recipes/gn.py It turns out that it is not necessary to copy the rpmalloc sources after all, and that multi-arch builds work properly now, so simplify the recipe script accordingly. Change-Id: I4a6afbd78ed9e10360759c688b7e0cbc0b7862bc Reviewed-on: https://gn-review.googlesource.com/c/gn/+/10780 Reviewed-by: Scott Graham <scottmg@chromium.org> Reviewed-by: Petr Hosek <phosek@google.com> Commit-Queue: David Turner <digit@google.com>
diff --git a/infra/README.recipes.md b/infra/README.recipes.md index 6fa4190..02e4098 100644 --- a/infra/README.recipes.md +++ b/infra/README.recipes.md
@@ -93,7 +93,7 @@ Recipe for building GN. -— **def [RunSteps](/infra/recipes/gn.py#101)(api, repository):** +— **def [RunSteps](/infra/recipes/gn.py#102)(api, repository):** ### *recipes* / [macos\_sdk:examples/full](/infra/recipe_modules/macos_sdk/examples/full.py) [DEPS](/infra/recipe_modules/macos_sdk/examples/full.py#5): [macos\_sdk](#recipe_modules-macos_sdk), [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/step][recipe_engine/recipe_modules/step]
diff --git a/infra/recipes/gn.expected/ci_linux.json b/infra/recipes/gn.expected/ci_linux.json index 54e55c4..61b1fa7 100644 --- a/infra/recipes/gn.expected/ci_linux.json +++ b/infra/recipes/gn.expected/ci_linux.json
@@ -138,39 +138,6 @@ ] }, { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "rmtree", - "[CLEANUP]/rpmalloc-linux-amd64" - ], - "infra_step": true, - "name": "rpmalloc.remove sources linux-amd64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "copytree", - "[START_DIR]/rpmalloc", - "[CLEANUP]/rpmalloc-linux-amd64" - ], - "infra_step": true, - "name": "rpmalloc.copy sources linux-amd64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { "cmd": [], "name": "rpmalloc.build rpmalloc-linux-amd64", "~followup_annotations": [ @@ -181,14 +148,14 @@ "cmd": [ "python", "-u", - "[CLEANUP]/rpmalloc-linux-amd64/configure.py", + "[START_DIR]/rpmalloc/configure.py", "-c", "release", "-a", "x86-64", "--lto" ], - "cwd": "[CLEANUP]/rpmalloc-linux-amd64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -206,7 +173,7 @@ "[START_DIR]/cipd/ninja", "lib/linux/release/x86-64/librpmallocwrap.a" ], - "cwd": "[CLEANUP]/rpmalloc-linux-amd64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -220,39 +187,6 @@ ] }, { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "rmtree", - "[CLEANUP]/rpmalloc-linux-arm64" - ], - "infra_step": true, - "name": "rpmalloc.remove sources linux-arm64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "copytree", - "[START_DIR]/rpmalloc", - "[CLEANUP]/rpmalloc-linux-arm64" - ], - "infra_step": true, - "name": "rpmalloc.copy sources linux-arm64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { "cmd": [], "name": "rpmalloc.build rpmalloc-linux-arm64", "~followup_annotations": [ @@ -263,14 +197,14 @@ "cmd": [ "python", "-u", - "[CLEANUP]/rpmalloc-linux-arm64/configure.py", + "[START_DIR]/rpmalloc/configure.py", "-c", "release", "-a", "arm64", "--lto" ], - "cwd": "[CLEANUP]/rpmalloc-linux-arm64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -288,7 +222,7 @@ "[START_DIR]/cipd/ninja", "lib/linux/release/arm64/librpmallocwrap.a" ], - "cwd": "[CLEANUP]/rpmalloc-linux-arm64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -386,7 +320,7 @@ "[START_DIR]/gn/build/gen.py", "--use-lto", "--use-icf", - "--link-lib=[CLEANUP]/rpmalloc-linux-amd64/lib/linux/release/x86-64/librpmallocwrap.a" + "--link-lib=[START_DIR]/rpmalloc/lib/linux/release/x86-64/librpmallocwrap.a" ], "cwd": "[START_DIR]/gn", "env": { @@ -491,7 +425,7 @@ "[START_DIR]/gn/build/gen.py", "--use-lto", "--use-icf", - "--link-lib=[CLEANUP]/rpmalloc-linux-arm64/lib/linux/release/arm64/librpmallocwrap.a" + "--link-lib=[START_DIR]/rpmalloc/lib/linux/release/arm64/librpmallocwrap.a" ], "cwd": "[START_DIR]/gn", "env": {
diff --git a/infra/recipes/gn.expected/cipd_exists.json b/infra/recipes/gn.expected/cipd_exists.json index b93e7c4..e7d6a03 100644 --- a/infra/recipes/gn.expected/cipd_exists.json +++ b/infra/recipes/gn.expected/cipd_exists.json
@@ -138,39 +138,6 @@ ] }, { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "rmtree", - "[CLEANUP]/rpmalloc-linux-amd64" - ], - "infra_step": true, - "name": "rpmalloc.remove sources linux-amd64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "copytree", - "[START_DIR]/rpmalloc", - "[CLEANUP]/rpmalloc-linux-amd64" - ], - "infra_step": true, - "name": "rpmalloc.copy sources linux-amd64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { "cmd": [], "name": "rpmalloc.build rpmalloc-linux-amd64", "~followup_annotations": [ @@ -181,14 +148,14 @@ "cmd": [ "python", "-u", - "[CLEANUP]/rpmalloc-linux-amd64/configure.py", + "[START_DIR]/rpmalloc/configure.py", "-c", "release", "-a", "x86-64", "--lto" ], - "cwd": "[CLEANUP]/rpmalloc-linux-amd64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -206,7 +173,7 @@ "[START_DIR]/cipd/ninja", "lib/linux/release/x86-64/librpmallocwrap.a" ], - "cwd": "[CLEANUP]/rpmalloc-linux-amd64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -220,39 +187,6 @@ ] }, { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "rmtree", - "[CLEANUP]/rpmalloc-linux-arm64" - ], - "infra_step": true, - "name": "rpmalloc.remove sources linux-arm64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "copytree", - "[START_DIR]/rpmalloc", - "[CLEANUP]/rpmalloc-linux-arm64" - ], - "infra_step": true, - "name": "rpmalloc.copy sources linux-arm64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { "cmd": [], "name": "rpmalloc.build rpmalloc-linux-arm64", "~followup_annotations": [ @@ -263,14 +197,14 @@ "cmd": [ "python", "-u", - "[CLEANUP]/rpmalloc-linux-arm64/configure.py", + "[START_DIR]/rpmalloc/configure.py", "-c", "release", "-a", "arm64", "--lto" ], - "cwd": "[CLEANUP]/rpmalloc-linux-arm64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -288,7 +222,7 @@ "[START_DIR]/cipd/ninja", "lib/linux/release/arm64/librpmallocwrap.a" ], - "cwd": "[CLEANUP]/rpmalloc-linux-arm64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -386,7 +320,7 @@ "[START_DIR]/gn/build/gen.py", "--use-lto", "--use-icf", - "--link-lib=[CLEANUP]/rpmalloc-linux-amd64/lib/linux/release/x86-64/librpmallocwrap.a" + "--link-lib=[START_DIR]/rpmalloc/lib/linux/release/x86-64/librpmallocwrap.a" ], "cwd": "[START_DIR]/gn", "env": { @@ -530,7 +464,7 @@ "[START_DIR]/gn/build/gen.py", "--use-lto", "--use-icf", - "--link-lib=[CLEANUP]/rpmalloc-linux-arm64/lib/linux/release/arm64/librpmallocwrap.a" + "--link-lib=[START_DIR]/rpmalloc/lib/linux/release/arm64/librpmallocwrap.a" ], "cwd": "[START_DIR]/gn", "env": {
diff --git a/infra/recipes/gn.expected/cipd_register.json b/infra/recipes/gn.expected/cipd_register.json index 75d38d2..6eebe17 100644 --- a/infra/recipes/gn.expected/cipd_register.json +++ b/infra/recipes/gn.expected/cipd_register.json
@@ -138,39 +138,6 @@ ] }, { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "rmtree", - "[CLEANUP]/rpmalloc-linux-amd64" - ], - "infra_step": true, - "name": "rpmalloc.remove sources linux-amd64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "copytree", - "[START_DIR]/rpmalloc", - "[CLEANUP]/rpmalloc-linux-amd64" - ], - "infra_step": true, - "name": "rpmalloc.copy sources linux-amd64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { "cmd": [], "name": "rpmalloc.build rpmalloc-linux-amd64", "~followup_annotations": [ @@ -181,14 +148,14 @@ "cmd": [ "python", "-u", - "[CLEANUP]/rpmalloc-linux-amd64/configure.py", + "[START_DIR]/rpmalloc/configure.py", "-c", "release", "-a", "x86-64", "--lto" ], - "cwd": "[CLEANUP]/rpmalloc-linux-amd64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -206,7 +173,7 @@ "[START_DIR]/cipd/ninja", "lib/linux/release/x86-64/librpmallocwrap.a" ], - "cwd": "[CLEANUP]/rpmalloc-linux-amd64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -220,39 +187,6 @@ ] }, { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "rmtree", - "[CLEANUP]/rpmalloc-linux-arm64" - ], - "infra_step": true, - "name": "rpmalloc.remove sources linux-arm64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "copytree", - "[START_DIR]/rpmalloc", - "[CLEANUP]/rpmalloc-linux-arm64" - ], - "infra_step": true, - "name": "rpmalloc.copy sources linux-arm64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { "cmd": [], "name": "rpmalloc.build rpmalloc-linux-arm64", "~followup_annotations": [ @@ -263,14 +197,14 @@ "cmd": [ "python", "-u", - "[CLEANUP]/rpmalloc-linux-arm64/configure.py", + "[START_DIR]/rpmalloc/configure.py", "-c", "release", "-a", "arm64", "--lto" ], - "cwd": "[CLEANUP]/rpmalloc-linux-arm64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -288,7 +222,7 @@ "[START_DIR]/cipd/ninja", "lib/linux/release/arm64/librpmallocwrap.a" ], - "cwd": "[CLEANUP]/rpmalloc-linux-arm64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -386,7 +320,7 @@ "[START_DIR]/gn/build/gen.py", "--use-lto", "--use-icf", - "--link-lib=[CLEANUP]/rpmalloc-linux-amd64/lib/linux/release/x86-64/librpmallocwrap.a" + "--link-lib=[START_DIR]/rpmalloc/lib/linux/release/x86-64/librpmallocwrap.a" ], "cwd": "[START_DIR]/gn", "env": { @@ -552,7 +486,7 @@ "[START_DIR]/gn/build/gen.py", "--use-lto", "--use-icf", - "--link-lib=[CLEANUP]/rpmalloc-linux-arm64/lib/linux/release/arm64/librpmallocwrap.a" + "--link-lib=[START_DIR]/rpmalloc/lib/linux/release/arm64/librpmallocwrap.a" ], "cwd": "[START_DIR]/gn", "env": {
diff --git a/infra/recipes/gn.expected/cq_linux.json b/infra/recipes/gn.expected/cq_linux.json index 2593ed3..7ac4cfc 100644 --- a/infra/recipes/gn.expected/cq_linux.json +++ b/infra/recipes/gn.expected/cq_linux.json
@@ -165,39 +165,6 @@ ] }, { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "rmtree", - "[CLEANUP]/rpmalloc-linux-amd64" - ], - "infra_step": true, - "name": "rpmalloc.remove sources linux-amd64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "copytree", - "[START_DIR]/rpmalloc", - "[CLEANUP]/rpmalloc-linux-amd64" - ], - "infra_step": true, - "name": "rpmalloc.copy sources linux-amd64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { "cmd": [], "name": "rpmalloc.build rpmalloc-linux-amd64", "~followup_annotations": [ @@ -208,14 +175,14 @@ "cmd": [ "python", "-u", - "[CLEANUP]/rpmalloc-linux-amd64/configure.py", + "[START_DIR]/rpmalloc/configure.py", "-c", "release", "-a", "x86-64", "--lto" ], - "cwd": "[CLEANUP]/rpmalloc-linux-amd64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -233,7 +200,7 @@ "[START_DIR]/cipd/ninja", "lib/linux/release/x86-64/librpmallocwrap.a" ], - "cwd": "[CLEANUP]/rpmalloc-linux-amd64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -247,39 +214,6 @@ ] }, { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "rmtree", - "[CLEANUP]/rpmalloc-linux-arm64" - ], - "infra_step": true, - "name": "rpmalloc.remove sources linux-arm64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { - "cmd": [ - "python", - "-u", - "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py", - "--json-output", - "/path/to/tmp/json", - "copytree", - "[START_DIR]/rpmalloc", - "[CLEANUP]/rpmalloc-linux-arm64" - ], - "infra_step": true, - "name": "rpmalloc.copy sources linux-arm64", - "~followup_annotations": [ - "@@@STEP_NEST_LEVEL@1@@@" - ] - }, - { "cmd": [], "name": "rpmalloc.build rpmalloc-linux-arm64", "~followup_annotations": [ @@ -290,14 +224,14 @@ "cmd": [ "python", "-u", - "[CLEANUP]/rpmalloc-linux-arm64/configure.py", + "[START_DIR]/rpmalloc/configure.py", "-c", "release", "-a", "arm64", "--lto" ], - "cwd": "[CLEANUP]/rpmalloc-linux-arm64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -315,7 +249,7 @@ "[START_DIR]/cipd/ninja", "lib/linux/release/arm64/librpmallocwrap.a" ], - "cwd": "[CLEANUP]/rpmalloc-linux-arm64", + "cwd": "[START_DIR]/rpmalloc", "env": { "AR": "[START_DIR]/cipd/bin/llvm-ar", "CC": "[START_DIR]/cipd/bin/clang", @@ -413,7 +347,7 @@ "[START_DIR]/gn/build/gen.py", "--use-lto", "--use-icf", - "--link-lib=[CLEANUP]/rpmalloc-linux-amd64/lib/linux/release/x86-64/librpmallocwrap.a" + "--link-lib=[START_DIR]/rpmalloc/lib/linux/release/x86-64/librpmallocwrap.a" ], "cwd": "[START_DIR]/gn", "env": { @@ -478,7 +412,7 @@ "[START_DIR]/gn/build/gen.py", "--use-lto", "--use-icf", - "--link-lib=[CLEANUP]/rpmalloc-linux-arm64/lib/linux/release/arm64/librpmallocwrap.a" + "--link-lib=[START_DIR]/rpmalloc/lib/linux/release/arm64/librpmallocwrap.a" ], "cwd": "[START_DIR]/gn", "env": {
diff --git a/infra/recipes/gn.py b/infra/recipes/gn.py index bac3233..0cb4269 100644 --- a/infra/recipes/gn.py +++ b/infra/recipes/gn.py
@@ -204,23 +204,14 @@ rpmalloc_os = RPMALLOC_MAP.get(rpmalloc_os, rpmalloc_os) rpmalloc_arch = RPMALLOC_MAP.get(rpmalloc_arch, rpmalloc_arch) - # The rpmalloc build system doesn't support out-of-tree builds, and - # trying to build binaries for multiple target architectures doesn't - # work unless one cleans the build. To work around these issues, - # simply copy the source tree into a new clean directory. - rpmalloc_build_dir = api.path['cleanup'].join('rpmalloc-' + platform) - api.file.rmtree('remove sources ' + platform, rpmalloc_build_dir) - api.file.copytree('copy sources ' + platform, rpmalloc_src_dir, - rpmalloc_build_dir) - env = _get_compilation_environment(api, all_config_platforms[platform], cipd_dir) with api.step.nest('build rpmalloc-' + platform), api.context( - env=env, cwd=rpmalloc_build_dir): + env=env, cwd=rpmalloc_src_dir): api.python( 'configure', - rpmalloc_build_dir.join('configure.py'), + rpmalloc_src_dir.join('configure.py'), args=['-c', 'release', '-a', rpmalloc_arch, '--lto']) # NOTE: Only build the static library. @@ -229,7 +220,7 @@ 'librpmallocwrap.a') api.step('ninja', [cipd_dir.join('ninja'), rpmalloc_static_lib]) - rpmalloc_static_libs[platform] = rpmalloc_build_dir.join( + rpmalloc_static_libs[platform] = rpmalloc_src_dir.join( rpmalloc_static_lib) for config in configs: