Skip to content

Commit

Permalink
Simplify GN pools, use for some toolchain actions (#856)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanderso authored May 10, 2024
1 parent d0b4860 commit 7840a4a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
9 changes: 9 additions & 0 deletions build/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/toolchain/toolchain.gni")

pool("toolchain_pool") {
depth = concurrent_toolchain_jobs
}
4 changes: 4 additions & 0 deletions build/toolchain/gcc_toolchain.gni
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ template("gcc_toolchain") {
}

tool("asm") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
depfile = "{{output}}.d"
command = "$asm -MMD -MF$depfile {{defines}} {{include_dirs}} {{asmflags}} {{cflags}} {{cflags_c}} $coverage_flags -c {{source}} -o {{output}}"
depsformat = "gcc"
Expand All @@ -150,6 +151,7 @@ template("gcc_toolchain") {
}

tool("alink") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
rspfile = "{{output}}.rsp"
command = "rm -f {{output}} && $ar rcs {{output}} @$rspfile"
description = "AR {{output}}"
Expand All @@ -161,6 +163,7 @@ template("gcc_toolchain") {
}

tool("solink") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
soname = "{{target_output_name}}{{output_extension}}" # e.g. "libfoo.so".
sofile = "{{root_out_dir}}/$soname" # Possibly including toolchain dir.
rspfile = sofile + ".rsp"
Expand Down Expand Up @@ -228,6 +231,7 @@ template("gcc_toolchain") {
}

tool("link") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
exename = "{{target_output_name}}{{output_extension}}"
outfile = "{{root_out_dir}}/$exename"
rspfile = "$outfile.rsp"
Expand Down
6 changes: 6 additions & 0 deletions build/toolchain/mac/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ template("mac_toolchain") {
}

tool("asm") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
depfile = "{{output}}.d"
command = "$asm -MMD -MF $depfile {{defines}} {{include_dirs}} {{asmflags}} {{cflags}} {{cflags_c}} $sysroot_flags -c {{source}} -o {{output}}"
depsformat = "gcc"
Expand All @@ -124,6 +125,7 @@ template("mac_toolchain") {
}

tool("objc") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
depfile = "{{output}}.d"
command = "$objc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_c}} {{cflags_objc}} $sysroot_flags $coverage_flags -c {{source}} -o {{output}}"
depsformat = "gcc"
Expand All @@ -133,6 +135,7 @@ template("mac_toolchain") {
}

tool("objcxx") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
depfile = "{{output}}.d"
command = "$objc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {{cflags_cc}} {{cflags_objcc}} $sysroot_flags $coverage_flags -c {{source}} -o {{output}}"
depsformat = "gcc"
Expand All @@ -142,6 +145,7 @@ template("mac_toolchain") {
}

tool("alink") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
command = "rm -f {{output}} && $ar rcs {{output}} {{inputs}}"
description = "CREATE ARCHIVE {{output}}"
outputs =
Expand All @@ -151,6 +155,7 @@ template("mac_toolchain") {
}

tool("solink") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
dylib = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # eg
# "./libfoo.dylib"
rspfile = dylib + ".rsp"
Expand Down Expand Up @@ -202,6 +207,7 @@ template("mac_toolchain") {
}

tool("link") {
pool = "//build/toolchain:toolchain_pool($current_toolchain)"
outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}"
rspfile = "$outfile.rsp"

Expand Down
5 changes: 4 additions & 1 deletion build/toolchain/toolchain.gni
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Copyright 2020 The Flutter Authors. All rights reserved.
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

declare_args() {
buildtools_path = "//buildtools"

# Maximum number of local toolchain tasks to run in parallel.
concurrent_toolchain_jobs = 1
}

use_xcode_clang = false

0 comments on commit 7840a4a

Please sign in to comment.