Update recipe to actually fetch and build changes Currently, we only test the bootstrap. Change-Id: I63c0aaf3f5c7f8b0abe52d480517515844b332ef Reviewed-on: https://gn-review.googlesource.com/1260 Reviewed-by: Scott Graham <scottmg@chromium.org> Commit-Queue: Petr Hosek <phosek@google.com>
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..2491fdf --- /dev/null +++ b/.editorconfig
@@ -0,0 +1,3 @@ +[*.py] +indent_style = space +indent_size = 2
diff --git a/.gitignore b/.gitignore index ae30641..4c20aff 100644 --- a/.gitignore +++ b/.gitignore
@@ -42,6 +42,7 @@ .metadata .project .pydevproject +.recipe_deps .checkstyle cscope.* out/ @@ -54,7 +55,6 @@ Thumbs.db # Settings directories for eclipse /.externalToolBuilders/ -/.recipe_deps/ /.settings/ /.vs/ # Visual Studio Code
diff --git a/infra/README.recipes.md b/infra/README.recipes.md index 72fb3b3..5c58118 100644 --- a/infra/README.recipes.md +++ b/infra/README.recipes.md
@@ -8,12 +8,17 @@ ### *recipes* / [gn](/infra/recipes/gn.py) -[DEPS](/infra/recipes/gn.py#6): [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/step][recipe_engine/recipe_modules/step] +[DEPS](/infra/recipes/gn.py#6): [recipe\_engine/buildbucket][recipe_engine/recipe_modules/buildbucket], [recipe\_engine/context][recipe_engine/recipe_modules/context], [recipe\_engine/path][recipe_engine/recipe_modules/path], [recipe\_engine/platform][recipe_engine/recipe_modules/platform], [recipe\_engine/properties][recipe_engine/recipe_modules/properties], [recipe\_engine/python][recipe_engine/recipe_modules/python], [recipe\_engine/step][recipe_engine/recipe_modules/step], [recipe\_engine/url][recipe_engine/recipe_modules/url] Recipe for building GN. -— **def [RunSteps](/infra/recipes/gn.py#13)(api):** +— **def [RunSteps](/infra/recipes/gn.py#18)(api):** +[recipe_engine/recipe_modules/buildbucket]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/10f67fe223a7973a95bc5fff219d1a7a3d95a326/README.recipes.md#recipe_modules-buildbucket +[recipe_engine/recipe_modules/context]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/10f67fe223a7973a95bc5fff219d1a7a3d95a326/README.recipes.md#recipe_modules-context [recipe_engine/recipe_modules/path]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/10f67fe223a7973a95bc5fff219d1a7a3d95a326/README.recipes.md#recipe_modules-path [recipe_engine/recipe_modules/platform]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/10f67fe223a7973a95bc5fff219d1a7a3d95a326/README.recipes.md#recipe_modules-platform +[recipe_engine/recipe_modules/properties]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/10f67fe223a7973a95bc5fff219d1a7a3d95a326/README.recipes.md#recipe_modules-properties +[recipe_engine/recipe_modules/python]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/10f67fe223a7973a95bc5fff219d1a7a3d95a326/README.recipes.md#recipe_modules-python [recipe_engine/recipe_modules/step]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/10f67fe223a7973a95bc5fff219d1a7a3d95a326/README.recipes.md#recipe_modules-step +[recipe_engine/recipe_modules/url]: https://chromium.googlesource.com/infra/luci/recipes-py.git/+/10f67fe223a7973a95bc5fff219d1a7a3d95a326/README.recipes.md#recipe_modules-url
diff --git a/infra/recipes/gn.expected/ci_linux.json b/infra/recipes/gn.expected/ci_linux.json new file mode 100644 index 0000000..1a01c40 --- /dev/null +++ b/infra/recipes/gn.expected/ci_linux.json
@@ -0,0 +1,57 @@ +[ + { + "cmd": [], + "name": "git" + }, + { + "cmd": [ + "git", + "init", + "[START_DIR]/gn" + ], + "cwd": "[START_DIR]/gn", + "name": "git.init", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "fetch", + "https://gn.googlesource.com/gn", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + ], + "cwd": "[START_DIR]/gn", + "name": "git.fetch", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "checkout", + "FETCH_HEAD" + ], + "cwd": "[START_DIR]/gn", + "name": "git.checkout", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "[START_DIR]/gn/tools/gn/bootstrap/bootstrap.py", + "--no-rebuild" + ], + "name": "bootstrap" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file
diff --git a/infra/recipes/gn.expected/ci_mac.json b/infra/recipes/gn.expected/ci_mac.json new file mode 100644 index 0000000..1a01c40 --- /dev/null +++ b/infra/recipes/gn.expected/ci_mac.json
@@ -0,0 +1,57 @@ +[ + { + "cmd": [], + "name": "git" + }, + { + "cmd": [ + "git", + "init", + "[START_DIR]/gn" + ], + "cwd": "[START_DIR]/gn", + "name": "git.init", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "fetch", + "https://gn.googlesource.com/gn", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + ], + "cwd": "[START_DIR]/gn", + "name": "git.fetch", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "checkout", + "FETCH_HEAD" + ], + "cwd": "[START_DIR]/gn", + "name": "git.checkout", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "[START_DIR]/gn/tools/gn/bootstrap/bootstrap.py", + "--no-rebuild" + ], + "name": "bootstrap" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file
diff --git a/infra/recipes/gn.expected/ci_win.json b/infra/recipes/gn.expected/ci_win.json new file mode 100644 index 0000000..d1fea74 --- /dev/null +++ b/infra/recipes/gn.expected/ci_win.json
@@ -0,0 +1,57 @@ +[ + { + "cmd": [], + "name": "git" + }, + { + "cmd": [ + "git", + "init", + "[START_DIR]\\gn" + ], + "cwd": "[START_DIR]\\gn", + "name": "git.init", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "fetch", + "https://gn.googlesource.com/gn", + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + ], + "cwd": "[START_DIR]\\gn", + "name": "git.fetch", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "checkout", + "FETCH_HEAD" + ], + "cwd": "[START_DIR]\\gn", + "name": "git.checkout", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "[START_DIR]\\gn\\tools\\gn\\bootstrap\\bootstrap.py", + "--no-rebuild" + ], + "name": "bootstrap" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file
diff --git a/infra/recipes/gn.expected/cq_linux.json b/infra/recipes/gn.expected/cq_linux.json new file mode 100644 index 0000000..61a5569 --- /dev/null +++ b/infra/recipes/gn.expected/cq_linux.json
@@ -0,0 +1,57 @@ +[ + { + "cmd": [], + "name": "git" + }, + { + "cmd": [ + "git", + "init", + "[START_DIR]/gn" + ], + "cwd": "[START_DIR]/gn", + "name": "git.init", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "fetch", + "https://gn-review.googlesource.com/gn", + "refs/changes/00/1000/1" + ], + "cwd": "[START_DIR]/gn", + "name": "git.fetch", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "cherry-pick", + "FETCH_HEAD" + ], + "cwd": "[START_DIR]/gn", + "name": "git.cherry-pick", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "[START_DIR]/gn/tools/gn/bootstrap/bootstrap.py", + "--no-rebuild" + ], + "name": "bootstrap" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file
diff --git a/infra/recipes/gn.expected/cq_mac.json b/infra/recipes/gn.expected/cq_mac.json new file mode 100644 index 0000000..61a5569 --- /dev/null +++ b/infra/recipes/gn.expected/cq_mac.json
@@ -0,0 +1,57 @@ +[ + { + "cmd": [], + "name": "git" + }, + { + "cmd": [ + "git", + "init", + "[START_DIR]/gn" + ], + "cwd": "[START_DIR]/gn", + "name": "git.init", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "fetch", + "https://gn-review.googlesource.com/gn", + "refs/changes/00/1000/1" + ], + "cwd": "[START_DIR]/gn", + "name": "git.fetch", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "cherry-pick", + "FETCH_HEAD" + ], + "cwd": "[START_DIR]/gn", + "name": "git.cherry-pick", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "[START_DIR]/gn/tools/gn/bootstrap/bootstrap.py", + "--no-rebuild" + ], + "name": "bootstrap" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file
diff --git a/infra/recipes/gn.expected/cq_win.json b/infra/recipes/gn.expected/cq_win.json new file mode 100644 index 0000000..11f3933 --- /dev/null +++ b/infra/recipes/gn.expected/cq_win.json
@@ -0,0 +1,57 @@ +[ + { + "cmd": [], + "name": "git" + }, + { + "cmd": [ + "git", + "init", + "[START_DIR]\\gn" + ], + "cwd": "[START_DIR]\\gn", + "name": "git.init", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "fetch", + "https://gn-review.googlesource.com/gn", + "refs/changes/00/1000/1" + ], + "cwd": "[START_DIR]\\gn", + "name": "git.fetch", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "git", + "cherry-pick", + "FETCH_HEAD" + ], + "cwd": "[START_DIR]\\gn", + "name": "git.cherry-pick", + "~followup_annotations": [ + "@@@STEP_NEST_LEVEL@1@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "[START_DIR]\\gn\\tools\\gn\\bootstrap\\bootstrap.py", + "--no-rebuild" + ], + "name": "bootstrap" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file
diff --git a/infra/recipes/gn.expected/linux.json b/infra/recipes/gn.expected/linux.json deleted file mode 100644 index 6631ad0..0000000 --- a/infra/recipes/gn.expected/linux.json +++ /dev/null
@@ -1,16 +0,0 @@ -[ - { - "cmd": [ - "git", - "clone", - "https://gn.googlesource.com/gn", - "[START_DIR]/gn" - ], - "name": "checkout" - }, - { - "name": "$result", - "recipe_result": null, - "status_code": 0 - } -] \ No newline at end of file
diff --git a/infra/recipes/gn.expected/mac.json b/infra/recipes/gn.expected/mac.json deleted file mode 100644 index 6631ad0..0000000 --- a/infra/recipes/gn.expected/mac.json +++ /dev/null
@@ -1,16 +0,0 @@ -[ - { - "cmd": [ - "git", - "clone", - "https://gn.googlesource.com/gn", - "[START_DIR]/gn" - ], - "name": "checkout" - }, - { - "name": "$result", - "recipe_result": null, - "status_code": 0 - } -] \ No newline at end of file
diff --git a/infra/recipes/gn.expected/win.json b/infra/recipes/gn.expected/win.json deleted file mode 100644 index c3438b0..0000000 --- a/infra/recipes/gn.expected/win.json +++ /dev/null
@@ -1,16 +0,0 @@ -[ - { - "cmd": [ - "git", - "clone", - "https://gn.googlesource.com/gn", - "[START_DIR]\\gn" - ], - "name": "checkout" - }, - { - "name": "$result", - "recipe_result": null, - "status_code": 0 - } -] \ No newline at end of file
diff --git a/infra/recipes/gn.py b/infra/recipes/gn.py index 7a4224f..cf551a9 100644 --- a/infra/recipes/gn.py +++ b/infra/recipes/gn.py
@@ -4,18 +4,64 @@ """Recipe for building GN.""" DEPS = [ + 'recipe_engine/buildbucket', + 'recipe_engine/context', 'recipe_engine/path', 'recipe_engine/platform', + 'recipe_engine/properties', + 'recipe_engine/python', 'recipe_engine/step', + 'recipe_engine/url', ] def RunSteps(api): src_dir = api.path['start_dir'].join('gn') - api.step('checkout', - ['git', 'clone', 'https://gn.googlesource.com/gn', src_dir]) + + with api.step.nest('git'), api.context(cwd=src_dir): + api.step('init', ['git', 'init', src_dir]) + + build_input = api.buildbucket.build_input + if build_input.gitiles_commits: + commit = build_input.gitiles_commits[0] + api.step('fetch', [ + 'git', 'fetch', + 'https://%s/%s' % (commit.host, commit.project), commit.id + ]) + api.step('checkout', ['git', 'checkout', 'FETCH_HEAD']) + if build_input.gerrit_changes: + for change in build_input.gerrit_changes: + api.step('fetch', [ + 'git', 'fetch', + 'https://%s/gn' % change.host, + 'refs/changes/%s/%s/%s' % + (str(change.change)[-2:], change.change, change.patchset) + ]) + api.step('cherry-pick', ['git', 'cherry-pick', 'FETCH_HEAD']) + + api.python( + 'bootstrap', + src_dir.join('tools', 'gn', 'bootstrap', 'bootstrap.py'), + args=['--no-rebuild']) def GenTests(api): for platform in ('linux', 'mac', 'win'): - yield api.test(platform) + api.platform.name(platform) + yield (api.test('ci_' + platform) + api.platform.name(platform) + + api.properties(buildbucket={ + 'build': { + 'tags': [ + 'buildset:commit/gitiles/gn.googlesource.com/gn/+/' + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', + ] + } + })) + yield ( + api.test('cq_' + platform) + api.platform.name(platform) + + api.properties(buildbucket={ + 'build': { + 'tags': [ + 'buildset:patch/gerrit/gn-review.googlesource.com/1000/1', + ] + } + }))