File tree Expand file tree Collapse file tree 3 files changed +55
-0
lines changed
Expand file tree Collapse file tree 3 files changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,12 @@ following flag to Bazel:
100100where ` toolchain.id ` is the value of the ` CFBundleIdentifier ` key in the
101101toolchain's Info.plist file.
102102
103+ To list the available toolchains and their bundle identifiers, you can run:
104+
105+ ```
106+ bazel run @build_bazel_rules_swift//tools/dump_toolchains
107+ ```
108+
103109** Linux hosts:** At this time, Bazel uses whichever ` swift ` executable is
104110encountered first on your ` PATH ` .
105111
Original file line number Diff line number Diff line change 1+ licenses (["notice" ])
2+
3+ sh_binary (
4+ name = "dump_toolchains" ,
5+ srcs = ["dump_toolchains.sh" ],
6+ visibility = ["//visibility:public" ],
7+ )
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ #
3+ # Copyright 2019 The Bazel Authors. All rights reserved.
4+ #
5+ # Licensed under the Apache License, Version 2.0 (the "License");
6+ # you may not use this file except in compliance with the License.
7+ # You may obtain a copy of the License at
8+ #
9+ # http://www.apache.org/licenses/LICENSE-2.0
10+ #
11+ # Unless required by applicable law or agreed to in writing, software
12+ # distributed under the License is distributed on an "AS IS" BASIS,
13+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ # See the License for the specific language governing permissions and
15+ # limitations under the License.
16+
17+ set -euo pipefail
18+
19+ if [[ " $( uname) " != Darwin ]]; then
20+ echo " error: dumping toolchains is only supported on macOS"
21+ exit 1
22+ fi
23+
24+ toolchain_directory=/Library/Developer/Toolchains
25+ if [[ ! -d " $toolchain_directory " ]]; then
26+ echo " error: '$toolchain_directory ' doesn't exist"
27+ exit 1
28+ fi
29+
30+ for toolchain in " $toolchain_directory " /* .xctoolchain
31+ do
32+ plist_path=" $toolchain /Info.plist"
33+
34+ if [[ ! -f " $plist_path " ]]; then
35+ echo " error: '$toolchain ' is missing Info.plist"
36+ exit 1
37+ fi
38+
39+ bundle_id=$( /usr/libexec/PlistBuddy -c " print :CFBundleIdentifier" " $plist_path " )
40+ toolchain_name=$( basename " $toolchain " )
41+ echo " $toolchain_name -> $bundle_id "
42+ done
You can’t perform that action at this time.
0 commit comments