Use Fuchsia Clang toolchain distribution on Linux
This is needed to ensure that the host compiler has C++14 support.
Change-Id: I42de5d0e2552032d043e50dd69875ed99d827a78
Reviewed-on: https://gn-review.googlesource.com/1400
Reviewed-by: Scott Graham <scottmg@chromium.org>
diff --git a/infra/recipes/gn.expected/ci_linux.json b/infra/recipes/gn.expected/ci_linux.json
index a9265a5..81f6cb2 100644
--- a/infra/recipes/gn.expected/ci_linux.json
+++ b/infra/recipes/gn.expected/ci_linux.json
@@ -49,7 +49,7 @@
"-root",
"[START_DIR]/cipd",
"-ensure-file",
- "infra/ninja/${platform} version:1.8.2",
+ "fuchsia/clang/${platform} goma\ninfra/ninja/${platform} version:1.8.2",
"-json-output",
"/path/to/tmp/json"
],
@@ -60,6 +60,10 @@
"@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-goma------------\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"fuchsia/clang/${platform}\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/ninja/${platform}\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -80,10 +84,11 @@
"[START_DIR]/gn/build/gen.py"
],
"cwd": "[START_DIR]/gn",
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/cipd"
- ]
+ "env": {
+ "AR": "[START_DIR]/cipd/bin/llvm-ar",
+ "CC": "[START_DIR]/cipd/bin/clang",
+ "CXX": "[START_DIR]/cipd/bin/clang++",
+ "LDFLAGS": "-static-libstdc++ -ldl -lpthread"
},
"name": "build.generate",
"~followup_annotations": [
@@ -96,11 +101,6 @@
"-C",
"[START_DIR]/gn/out"
],
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/cipd"
- ]
- },
"name": "build.ninja",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
diff --git a/infra/recipes/gn.expected/ci_mac.json b/infra/recipes/gn.expected/ci_mac.json
index a9265a5..7619c6f 100644
--- a/infra/recipes/gn.expected/ci_mac.json
+++ b/infra/recipes/gn.expected/ci_mac.json
@@ -80,11 +80,6 @@
"[START_DIR]/gn/build/gen.py"
],
"cwd": "[START_DIR]/gn",
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/cipd"
- ]
- },
"name": "build.generate",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
@@ -96,11 +91,6 @@
"-C",
"[START_DIR]/gn/out"
],
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/cipd"
- ]
- },
"name": "build.ninja",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
diff --git a/infra/recipes/gn.expected/ci_win.json b/infra/recipes/gn.expected/ci_win.json
index 0a3d7b5..b78f9ae 100644
--- a/infra/recipes/gn.expected/ci_win.json
+++ b/infra/recipes/gn.expected/ci_win.json
@@ -80,11 +80,6 @@
"[START_DIR]\\gn\\build\\gen.py"
],
"cwd": "[START_DIR]\\gn",
- "env_prefixes": {
- "PATH": [
- "[START_DIR]\\cipd"
- ]
- },
"name": "build.generate",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
@@ -96,11 +91,6 @@
"-C",
"[START_DIR]\\gn\\out"
],
- "env_prefixes": {
- "PATH": [
- "[START_DIR]\\cipd"
- ]
- },
"name": "build.ninja",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
diff --git a/infra/recipes/gn.expected/cq_linux.json b/infra/recipes/gn.expected/cq_linux.json
index e5dd9d4..4fe3e09 100644
--- a/infra/recipes/gn.expected/cq_linux.json
+++ b/infra/recipes/gn.expected/cq_linux.json
@@ -76,7 +76,7 @@
"-root",
"[START_DIR]/cipd",
"-ensure-file",
- "infra/ninja/${platform} version:1.8.2",
+ "fuchsia/clang/${platform} goma\ninfra/ninja/${platform} version:1.8.2",
"-json-output",
"/path/to/tmp/json"
],
@@ -87,6 +87,10 @@
"@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
"@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
"@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-goma------------\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"fuchsia/clang/${platform}\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }, @@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
"@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-version:1.8.2---\", @@@",
"@@@STEP_LOG_LINE@json.output@ \"package\": \"infra/ninja/${platform}\"@@@",
"@@@STEP_LOG_LINE@json.output@ }@@@",
@@ -107,10 +111,11 @@
"[START_DIR]/gn/build/gen.py"
],
"cwd": "[START_DIR]/gn",
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/cipd"
- ]
+ "env": {
+ "AR": "[START_DIR]/cipd/bin/llvm-ar",
+ "CC": "[START_DIR]/cipd/bin/clang",
+ "CXX": "[START_DIR]/cipd/bin/clang++",
+ "LDFLAGS": "-static-libstdc++ -ldl -lpthread"
},
"name": "build.generate",
"~followup_annotations": [
@@ -123,11 +128,6 @@
"-C",
"[START_DIR]/gn/out"
],
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/cipd"
- ]
- },
"name": "build.ninja",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
diff --git a/infra/recipes/gn.expected/cq_mac.json b/infra/recipes/gn.expected/cq_mac.json
index e5dd9d4..2f59a09 100644
--- a/infra/recipes/gn.expected/cq_mac.json
+++ b/infra/recipes/gn.expected/cq_mac.json
@@ -107,11 +107,6 @@
"[START_DIR]/gn/build/gen.py"
],
"cwd": "[START_DIR]/gn",
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/cipd"
- ]
- },
"name": "build.generate",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
@@ -123,11 +118,6 @@
"-C",
"[START_DIR]/gn/out"
],
- "env_prefixes": {
- "PATH": [
- "[START_DIR]/cipd"
- ]
- },
"name": "build.ninja",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
diff --git a/infra/recipes/gn.expected/cq_win.json b/infra/recipes/gn.expected/cq_win.json
index 70f96ab..d8da1a0 100644
--- a/infra/recipes/gn.expected/cq_win.json
+++ b/infra/recipes/gn.expected/cq_win.json
@@ -107,11 +107,6 @@
"[START_DIR]\\gn\\build\\gen.py"
],
"cwd": "[START_DIR]\\gn",
- "env_prefixes": {
- "PATH": [
- "[START_DIR]\\cipd"
- ]
- },
"name": "build.generate",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
@@ -123,11 +118,6 @@
"-C",
"[START_DIR]\\gn\\out"
],
- "env_prefixes": {
- "PATH": [
- "[START_DIR]\\cipd"
- ]
- },
"name": "build.ninja",
"~followup_annotations": [
"@@@STEP_NEST_LEVEL@1@@@"
diff --git a/infra/recipes/gn.py b/infra/recipes/gn.py
index 8268374..9c7bf33 100644
--- a/infra/recipes/gn.py
+++ b/infra/recipes/gn.py
@@ -43,17 +43,31 @@
packages = {
'infra/ninja/${platform}': 'version:1.8.2',
}
+ packages.update({
+ 'linux': {
+ 'fuchsia/clang/${platform}': 'goma',
+ },
+ 'mac': {},
+ 'win': {},
+ }[api.platform.name])
api.cipd.ensure(cipd_dir, packages)
- with api.step.nest('build'):
- with api.context(env_prefixes={'PATH': [cipd_dir]}, cwd=src_dir):
- api.python(
- 'generate',
- src_dir.join('build', 'gen.py'))
+ environ = {
+ 'linux': {
+ 'CC': cipd_dir.join('bin', 'clang'),
+ 'CXX': cipd_dir.join('bin', 'clang++'),
+ 'AR': cipd_dir.join('bin', 'llvm-ar'),
+ 'LDFLAGS': '-static-libstdc++ -ldl -lpthread',
+ },
+ 'mac': {},
+ 'win': {},
+ }[api.platform.name]
- with api.context(env_prefixes={'PATH': [cipd_dir]}):
- api.step('ninja',
- ['ninja', '-C', src_dir.join('out')])
+ with api.step.nest('build'):
+ with api.context(env=environ, cwd=src_dir):
+ api.python('generate', src_dir.join('build', 'gen.py'))
+
+ api.step('ninja', ['ninja', '-C', src_dir.join('out')])
with api.context(cwd=src_dir):
api.step('test', [src_dir.join('out', 'gn_unittests')])