Skip to content

Commit e9c4eeb

Browse files
Add a GN arg that configures the path to the buildtools tree (#838)
This is in preparation for moving //buildtools out of the buildroot and into //flutter/buildtools
1 parent 5268669 commit e9c4eeb

File tree

11 files changed

+30
-15
lines changed

11 files changed

+30
-15
lines changed

build/config/clang/BUILD.gn

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# found in the LICENSE file.
44

55
import("//build/toolchain/clang.gni")
6+
import("//build/toolchain/toolchain.gni")
67
import("clang.gni")
78

89
# Empty entry to satisfy ANGLE build, which tries to remove this config.
@@ -26,10 +27,10 @@ config("extra_warnings") {
2627

2728
group("llvm-symbolizer_data") {
2829
if (is_win) {
29-
data = [ "//buildtools/windows-x64/bin/llvm-symbolizer.exe" ]
30+
data = [ "$buildtools_path/windows-x64/bin/llvm-symbolizer.exe" ]
3031
} else if (is_mac) {
31-
data = [ "//buildtools/mac-${host_cpu}/clang/bin/llvm-symbolizer" ]
32+
data = [ "$buildtools_path/mac-${host_cpu}/clang/bin/llvm-symbolizer" ]
3233
} else if (is_linux) {
33-
data = [ "//buildtools/linux-${host_cpu}/clang/bin/llvm-symbolizer" ]
34+
data = [ "$buildtools_path/linux-${host_cpu}/clang/bin/llvm-symbolizer" ]
3435
}
3536
}

build/config/compiler/BUILD.gn

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import("//build/config/sanitizers/sanitizers.gni")
2020
import("//build/fuchsia/config.gni")
2121
import("//build/toolchain/ccache.gni")
2222
import("//build/toolchain/clang.gni")
23+
import("//build/toolchain/toolchain.gni")
2324
import("//build/toolchain/wasm.gni")
2425

2526
declare_args() {
@@ -152,8 +153,8 @@ config("compiler") {
152153
if (use_custom_libcxx) {
153154
cflags_cc += [ "-nostdinc++" ]
154155
include_dirs = [
155-
"//buildtools/third_party/libc++/trunk/include",
156-
"//buildtools/third_party/libc++abi/trunk/include",
156+
"$buildtools_path/third_party/libc++/trunk/include",
157+
"$buildtools_path/third_party/libc++abi/trunk/include",
157158
]
158159
}
159160
}

build/config/sanitizers/BUILD.gn

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import("//build/config/c++/c++.gni")
66
import("//build/config/sanitizers/sanitizers.gni")
7+
import("//build/toolchain/toolchain.gni")
78

89
# Contains the dependencies needed for sanitizers to link into executables and
910
# shared_libraries. Unconditionally depend upon this target as it is empty if
@@ -14,7 +15,7 @@ group("deps") {
1415
deps += [ ":options_sources" ]
1516
}
1617
if (use_custom_libcxx) {
17-
deps += [ "//buildtools/third_party/libc++:libcxx_proxy" ]
18+
deps += [ "$buildtools_path/third_party/libc++:libcxx_proxy" ]
1819
}
1920
}
2021

build/fuchsia/sdk.gni

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# found in the LICENSE file.
44

55
import("//build/fuchsia/config.gni")
6+
import("//build/toolchain/toolchain.gni")
67

78
declare_args() {
89
# The path to where GN targets derived from the Fuchsia SDK are instantiated.
@@ -17,7 +18,7 @@ declare_args() {
1718

1819
# The following variables are Flutter buildroot specific.
1920
fuchsia_sdk_path = "//fuchsia/sdk/$host_os"
20-
fuchsia_toolchain_path = "//buildtools/${host_os}-${host_cpu}/clang"
21+
fuchsia_toolchain_path = "$buildtools_path/${host_os}-${host_cpu}/clang"
2122
}
2223

2324
declare_args() {

build/toolchain/android/BUILD.gn

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import("//build/toolchain/clang.gni")
88
import("//build/toolchain/gcc_toolchain.gni")
99
import("//build/toolchain/goma.gni")
1010
import("//build/toolchain/rbe.gni")
11+
import("//build/toolchain/toolchain.gni")
1112

1213
# The Android GCC toolchains share most of the same parameters, so we have this
1314
# wrapper around gcc_toolchain to avoid duplication of logic.
@@ -69,7 +70,7 @@ template("android_toolchain") {
6970
assert(false, "Unknown host")
7071
}
7172

72-
prefix = rebase_path("//buildtools/$host_dir/clang/bin", root_build_dir)
73+
prefix = rebase_path("$buildtools_path/$host_dir/clang/bin", root_build_dir)
7374

7475
cc = "${compiler_prefix}${prefix}/clang"
7576
cxx = "${compiler_prefix}${prefix}/clang++"

build/toolchain/fuchsia/BUILD.gn

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import("//build/toolchain/clang.gni")
66
import("//build/toolchain/goma.gni")
7+
import("//build/toolchain/toolchain.gni")
78

89
if (use_goma) {
910
goma_prefix = "$goma_dir/gomacc "
@@ -15,7 +16,7 @@ toolchain("fuchsia") {
1516
assert(target_cpu == "x64" || target_cpu == "arm64",
1617
"We currently only support 'x64' and 'arm64' targets for fuchsia.")
1718
toolchain_bin =
18-
rebase_path("//buildtools/${host_os}-${host_cpu}/clang/bin", root_out_dir)
19+
rebase_path("$buildtools_path/${host_os}-${host_cpu}/clang/bin", root_out_dir)
1920
fuchsia_sdk = rebase_path("//fuchsia/sdk/$host_os", root_out_dir)
2021

2122
# We can't do string interpolation ($ in strings) on things with dots in

build/toolchain/linux/BUILD.gn

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import("//build/toolchain/ccache.gni")
77
import("//build/toolchain/gcc_toolchain.gni")
88
import("//build/toolchain/goma.gni")
99
import("//build/toolchain/rbe.gni")
10+
import("//build/toolchain/toolchain.gni")
1011

1112
declare_args() {
1213
toolchain_prefix = ""
@@ -33,10 +34,10 @@ if (use_goma) {
3334

3435
if (host_cpu == "arm64") {
3536
rebased_clang_dir =
36-
rebase_path("//buildtools/linux-arm64/clang/bin", root_build_dir)
37+
rebase_path("$buildtools_path/linux-arm64/clang/bin", root_build_dir)
3738
} else {
3839
rebased_clang_dir =
39-
rebase_path("//buildtools/linux-x64/clang/bin", root_build_dir)
40+
rebase_path("$buildtools_path/linux-x64/clang/bin", root_build_dir)
4041
}
4142

4243
gcc_toolchain("arm") {

build/toolchain/mac/BUILD.gn

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ import("//build/toolchain/clang.gni")
1111
import("//build/toolchain/clang_static_analyzer.gni")
1212
import("//build/toolchain/goma.gni")
1313
import("//build/toolchain/rbe.gni")
14+
import("//build/toolchain/toolchain.gni")
1415

1516
# Goma doesn't support the host-arm64 toolchain, so continue using Rosetta.
1617
if (host_cpu == "arm64" && !use_goma) {
1718
rebased_clang_dir =
18-
rebase_path("//buildtools/mac-arm64/clang/bin", root_build_dir)
19+
rebase_path("$buildtools_path/mac-arm64/clang/bin", root_build_dir)
1920
} else {
2021
rebased_clang_dir =
21-
rebase_path("//buildtools/mac-x64/clang/bin", root_build_dir)
22+
rebase_path("$buildtools_path/mac-x64/clang/bin", root_build_dir)
2223
}
2324

2425
if (use_goma) {

build/toolchain/rbe.gni

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
# Defines the configuration of RBE.
66

7+
import("//build/toolchain/toolchain.gni")
8+
79
declare_args() {
810
# Set to true to enable distributed compilation using Goma.
911
use_rbe = false
@@ -31,7 +33,7 @@ declare_args() {
3133

3234
rbe_platform = ""
3335

34-
rbe_dir = rebase_path("//buildtools/linux-x64/reclient")
36+
rbe_dir = rebase_path("$buildtools_path/linux-x64/reclient")
3537

3638
rbe_cfg = rebase_path("//flutter/build/rbe/rewrapper-linux.cfg")
3739
}

build/toolchain/toolchain.gni

+4
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
# Use of this source code is governed by a BSD-style license that can be
33
# found in the LICENSE file.
44

5+
declare_args() {
6+
buildtools_path = "//buildtools"
7+
}
8+
59
use_xcode_clang = false

build/toolchain/win/BUILD.gn

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
# found in the LICENSE file.
44

55
import("//build/toolchain/rbe.gni")
6+
import("//build/toolchain/toolchain.gni")
67
import("//build/toolchain/win/win_toolchain_data.gni")
78

8-
default_clang_base_path = "//buildtools/windows-x64/clang"
9+
default_clang_base_path = "$buildtools_path/windows-x64/clang"
910

1011
declare_args() {
1112
# Path to the directory containing the VC binaries for the right

0 commit comments

Comments
 (0)