lim 0.13.2 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/ios/create.js +1 -1
- package/dist/commands/ios/create.js.map +1 -1
- package/dist/commands/run.d.ts +1 -8
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +22 -121
- package/dist/commands/run.js.map +1 -1
- package/dist/commands/xcode/rbe/install.d.ts +18 -0
- package/dist/commands/xcode/rbe/install.d.ts.map +1 -0
- package/dist/commands/xcode/rbe/install.js +118 -0
- package/dist/commands/xcode/rbe/install.js.map +1 -0
- package/dist/commands/xcode/rbe.d.ts +71 -0
- package/dist/commands/xcode/rbe.d.ts.map +1 -0
- package/dist/commands/xcode/rbe.js +559 -0
- package/dist/commands/xcode/rbe.js.map +1 -0
- package/dist/lib/progress.d.ts +18 -0
- package/dist/lib/progress.d.ts.map +1 -0
- package/dist/lib/progress.js +125 -0
- package/dist/lib/progress.js.map +1 -0
- package/dist/lib/rbe-session.d.ts +72 -0
- package/dist/lib/rbe-session.d.ts.map +1 -0
- package/dist/lib/rbe-session.js +188 -0
- package/dist/lib/rbe-session.js.map +1 -0
- package/dist/lib/rbe-workspace.d.ts +132 -0
- package/dist/lib/rbe-workspace.d.ts.map +1 -0
- package/dist/lib/rbe-workspace.js +356 -0
- package/dist/lib/rbe-workspace.js.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TRY_IMPORT_LINE = exports.LIMRUN_DIR = void 0;
|
|
7
|
+
exports.findBazelWorkspaceRoot = findBazelWorkspaceRoot;
|
|
8
|
+
exports.inferBuildTarget = inferBuildTarget;
|
|
9
|
+
exports.detectBazelMajorVersion = detectBazelMajorVersion;
|
|
10
|
+
exports.isBazel9OrLater = isBazel9OrLater;
|
|
11
|
+
exports.renderXcodeConfigBuild = renderXcodeConfigBuild;
|
|
12
|
+
exports.renderLimrunBazelrc = renderLimrunBazelrc;
|
|
13
|
+
exports.ensureTryImport = ensureTryImport;
|
|
14
|
+
exports.writeRbeWorkspaceFiles = writeRbeWorkspaceFiles;
|
|
15
|
+
const fs_1 = __importDefault(require("fs"));
|
|
16
|
+
const path_1 = __importDefault(require("path"));
|
|
17
|
+
/**
|
|
18
|
+
* Generates the .limrun/ workspace companion for `lim xcode rbe`: a Bazel
|
|
19
|
+
* package pinning the remote fleet's Xcode version and an rc fragment with the
|
|
20
|
+
* remote-execution flags under the `limrun` config. The caller learns the
|
|
21
|
+
* fleet's version key from the instance's RBE status, so the generated config
|
|
22
|
+
* always matches the fleet without any user action; rerunning the command
|
|
23
|
+
* after a fleet Xcode upgrade regenerates the pin.
|
|
24
|
+
*/
|
|
25
|
+
exports.LIMRUN_DIR = '.limrun';
|
|
26
|
+
exports.TRY_IMPORT_LINE = 'try-import %workspace%/.limrun/bazelrc';
|
|
27
|
+
const TRY_IMPORT_COMMENT = '# Added by lim xcode rbe: loads the generated remote-execution config.';
|
|
28
|
+
const WORKSPACE_MARKERS = ['MODULE.bazel', 'WORKSPACE', 'WORKSPACE.bazel'];
|
|
29
|
+
/**
|
|
30
|
+
* Finds the Bazel workspace root by walking up from `startDir` to the first
|
|
31
|
+
* ancestor containing a MODULE.bazel / WORKSPACE / WORKSPACE.bazel, mirroring
|
|
32
|
+
* how Bazel itself locates the workspace when run from a subdirectory. Returns
|
|
33
|
+
* null when no workspace is found up to the filesystem root. The generated
|
|
34
|
+
* `.limrun/` and the `try-import` must live at this root, since `%workspace%`
|
|
35
|
+
* in bazelrc resolves here regardless of the directory the build is run from.
|
|
36
|
+
*/
|
|
37
|
+
function findBazelWorkspaceRoot(startDir) {
|
|
38
|
+
let dir = path_1.default.resolve(startDir);
|
|
39
|
+
for (;;) {
|
|
40
|
+
if (WORKSPACE_MARKERS.some((m) => fs_1.default.existsSync(path_1.default.join(dir, m)))) {
|
|
41
|
+
return dir;
|
|
42
|
+
}
|
|
43
|
+
const parent = path_1.default.dirname(dir);
|
|
44
|
+
if (parent === dir) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
dir = parent;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const APP_RULE_RE = /\b(?:ios|macos|tvos|watchos)_application\s*\(/;
|
|
51
|
+
const TARGET_NAME_RE = /^\s*name\s*=\s*"([^"]+)"/;
|
|
52
|
+
const TARGET_SCAN_SKIP_DIRS = new Set(['.git', 'node_modules', '.limrun']);
|
|
53
|
+
/**
|
|
54
|
+
* Best-effort guess of a single buildable app target to show in the printed
|
|
55
|
+
* build command, so it reads `//App` instead of a `//your:target` placeholder.
|
|
56
|
+
* Scans the workspace's BUILD files (buildifier-formatted) for apple
|
|
57
|
+
* `*_application` rules — no bazel invocation — and returns the label in short
|
|
58
|
+
* form (`//pkg` when the target name matches the package's last segment).
|
|
59
|
+
* Returns null when there are zero or multiple candidates (ambiguous → caller
|
|
60
|
+
* keeps the placeholder).
|
|
61
|
+
*/
|
|
62
|
+
function inferBuildTarget(workspaceRoot) {
|
|
63
|
+
const found = [];
|
|
64
|
+
const walk = (dir) => {
|
|
65
|
+
if (found.length > 1)
|
|
66
|
+
return; // already ambiguous; stop early
|
|
67
|
+
let entries;
|
|
68
|
+
try {
|
|
69
|
+
entries = fs_1.default.readdirSync(dir, { withFileTypes: true });
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
for (const entry of entries) {
|
|
75
|
+
if (entry.isDirectory()) {
|
|
76
|
+
if (TARGET_SCAN_SKIP_DIRS.has(entry.name) || entry.name.startsWith('bazel-'))
|
|
77
|
+
continue;
|
|
78
|
+
walk(path_1.default.join(dir, entry.name));
|
|
79
|
+
}
|
|
80
|
+
else if (entry.name === 'BUILD' || entry.name === 'BUILD.bazel') {
|
|
81
|
+
collectAppTargets(path_1.default.join(dir, entry.name), workspaceRoot, found);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
walk(workspaceRoot);
|
|
86
|
+
return found.length === 1 ? found[0] : null;
|
|
87
|
+
}
|
|
88
|
+
/** Appends `//pkg[:name]` labels of apple application rules in one BUILD file. */
|
|
89
|
+
function collectAppTargets(buildFile, workspaceRoot, out) {
|
|
90
|
+
let content;
|
|
91
|
+
try {
|
|
92
|
+
content = fs_1.default.readFileSync(buildFile, 'utf8');
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const pkg = path_1.default.relative(workspaceRoot, path_1.default.dirname(buildFile)).split(path_1.default.sep).join('/');
|
|
98
|
+
let inAppRule = false;
|
|
99
|
+
for (const line of content.split('\n')) {
|
|
100
|
+
// Skip comment lines so a commented-out `# ios_application(` can't start a
|
|
101
|
+
// phantom rule (and a commented `# name = ...` can't be captured), which
|
|
102
|
+
// would otherwise leave inAppRule set and mislabel a later rule's name.
|
|
103
|
+
if (line.trimStart().startsWith('#'))
|
|
104
|
+
continue;
|
|
105
|
+
if (!inAppRule) {
|
|
106
|
+
if (APP_RULE_RE.test(line))
|
|
107
|
+
inAppRule = true;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const match = line.match(TARGET_NAME_RE);
|
|
111
|
+
if (match) {
|
|
112
|
+
const name = match[1];
|
|
113
|
+
const last = pkg.split('/').pop();
|
|
114
|
+
out.push(pkg === '' || pkg === '.' ? `//:${name}`
|
|
115
|
+
: last === name ? `//${pkg}`
|
|
116
|
+
: `//${pkg}:${name}`);
|
|
117
|
+
inAppRule = false;
|
|
118
|
+
}
|
|
119
|
+
else if (/^\)/.test(line)) {
|
|
120
|
+
inAppRule = false; // rule closed before a name line we could read
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Reads the workspace's pinned Bazel major version from `.bazelversion`, or
|
|
126
|
+
* null when the file is absent or its first line has no leading integer.
|
|
127
|
+
*
|
|
128
|
+
* Used to decide whether the generated BUILD must `load` the Xcode rules from
|
|
129
|
+
* apple_support: in Bazel 9 they are no longer native globals and must be
|
|
130
|
+
* loaded, while in Bazel 8 they ARE native globals and the apple_support rule
|
|
131
|
+
* impls `fail()` on the unmigrated Bazel, so loading them there breaks
|
|
132
|
+
* analysis. The generator runs in the workspace on the client, so the file is
|
|
133
|
+
* the authoritative signal for the Bazel that bazelisk will launch.
|
|
134
|
+
*/
|
|
135
|
+
function detectBazelMajorVersion(workspaceDir) {
|
|
136
|
+
try {
|
|
137
|
+
const raw = fs_1.default.readFileSync(path_1.default.join(workspaceDir, '.bazelversion'), 'utf8');
|
|
138
|
+
const firstLine = (raw.split('\n', 1)[0] ?? '').trim();
|
|
139
|
+
const match = firstLine.match(/^(\d+)/);
|
|
140
|
+
return match ? Number(match[1]) : null;
|
|
141
|
+
}
|
|
142
|
+
catch {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Whether to treat the workspace as Bazel 9+ for RBE config: true when the
|
|
148
|
+
* detected major version is >= 9, OR unknown (no `.bazelversion` means bazelisk
|
|
149
|
+
* runs the latest release, which is 9+). This single predicate decides both
|
|
150
|
+
* emitting the apple_support Xcode-rule loads and surfacing the SHA256 digest
|
|
151
|
+
* hint, so the two stay in lockstep.
|
|
152
|
+
*/
|
|
153
|
+
function isBazel9OrLater(bazelMajor) {
|
|
154
|
+
return bazelMajor === null || bazelMajor >= 9;
|
|
155
|
+
}
|
|
156
|
+
/** Major.minor short alias (e.g. "26.4") used for the SDK default and --xcode_version. */
|
|
157
|
+
function shortVersion(versionKey) {
|
|
158
|
+
const parts = versionKey.split('.');
|
|
159
|
+
if (parts.length < 3) {
|
|
160
|
+
throw new Error(`unexpected Xcode version key from the instance: ${versionKey}`);
|
|
161
|
+
}
|
|
162
|
+
return `${parts[0]}.${parts[1]}`;
|
|
163
|
+
}
|
|
164
|
+
/** Renders one xcode_version rule from a major.minor.patch.build version key. */
|
|
165
|
+
function renderXcodeVersionRule(name, versionKey) {
|
|
166
|
+
// shortVersion validates the key shape (major.minor.patch[.build]) and yields
|
|
167
|
+
// the major.minor used for both the SDK defaults and the short alias.
|
|
168
|
+
const sdk = shortVersion(versionKey);
|
|
169
|
+
const parts = versionKey.split('.');
|
|
170
|
+
const fullAlias = `${parts[0]}.${parts[1]}.${parts[2]}`;
|
|
171
|
+
return `xcode_version(
|
|
172
|
+
name = "${name}",
|
|
173
|
+
aliases = [
|
|
174
|
+
"${sdk}",
|
|
175
|
+
"${fullAlias}",
|
|
176
|
+
],
|
|
177
|
+
default_ios_sdk_version = "${sdk}",
|
|
178
|
+
default_macos_sdk_version = "${sdk}",
|
|
179
|
+
default_tvos_sdk_version = "${sdk}",
|
|
180
|
+
default_watchos_sdk_version = "${sdk}",
|
|
181
|
+
version = "${versionKey}",
|
|
182
|
+
)`;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Renders an `available_xcodes` set with a single member that is also its
|
|
186
|
+
* mandatory default. Both sets the BUILD file emits (remote, local) are
|
|
187
|
+
* single-version sets of this shape, pointing at the same fleet pin.
|
|
188
|
+
*/
|
|
189
|
+
function renderAvailableXcodes(name, target) {
|
|
190
|
+
return `available_xcodes(
|
|
191
|
+
name = "${name}",
|
|
192
|
+
default = "${target}",
|
|
193
|
+
versions = ["${target}"],
|
|
194
|
+
)`;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Renders the generated Bazel package pinning the Xcode version to the fleet's.
|
|
198
|
+
*
|
|
199
|
+
* remoteVersionKey is the fleet's `xcodebuild -version` in major.minor.patch.build
|
|
200
|
+
* form (e.g. 26.4.0.17E192).
|
|
201
|
+
*
|
|
202
|
+
* Uses Bazel's remote/local `xcode_config` split with BOTH sets pointing at the
|
|
203
|
+
* SAME fleet pin (rather than a single `default=/versions=` bucket, which
|
|
204
|
+
* resolves with availability UNKNOWN and leaves Apple/Swift actions eligible for
|
|
205
|
+
* local execution). With local == remote, `--xcode_version` resolves as
|
|
206
|
+
* "mutually available" (BOTH), which declares up front that this build uses only
|
|
207
|
+
* the fleet's Xcode AND keeps apple_support from emitting its remote-only
|
|
208
|
+
* "...specified, but it is not available locally..." DEBUG notice (that notice
|
|
209
|
+
* fires only when the pinned version is in `remote_versions` but not
|
|
210
|
+
* `local_versions`).
|
|
211
|
+
*
|
|
212
|
+
* We intentionally do NOT name the client's own local Xcode: under
|
|
213
|
+
* `--config=limrun` every action runs remotely (`--spawn_strategy=remote` +
|
|
214
|
+
* `--noremote_local_fallback`), so a local DEVELOPER_DIR is never resolved.
|
|
215
|
+
* Declaring a distinct local version would only reintroduce that DEBUG notice on
|
|
216
|
+
* a client whose Xcode differs from the fleet's. (The fleet pin is used, not
|
|
217
|
+
* Bazel's `@local_config_xcode//:host_available_xcodes`: that repo is not
|
|
218
|
+
* visible from the main module under bzlmod and is never generated off-darwin.)
|
|
219
|
+
*
|
|
220
|
+
* When `emitLoads` is true (Bazel 9+), the Xcode rules are loaded from
|
|
221
|
+
* apple_support; on Bazel 8 they are native globals and MUST NOT be loaded
|
|
222
|
+
* (the apple_support rule impls fail on the unmigrated Bazel).
|
|
223
|
+
*/
|
|
224
|
+
function renderXcodeConfigBuild(remoteVersionKey, emitLoads) {
|
|
225
|
+
// Bazel 9 migrated xcode_version/available_xcodes/xcode_config out of native
|
|
226
|
+
// globals into apple_support; they must be loaded there. The repo_name
|
|
227
|
+
// @build_bazel_apple_support is the apple_support module convention.
|
|
228
|
+
const loads = emitLoads ?
|
|
229
|
+
`load("@build_bazel_apple_support//xcode:xcode_version.bzl", "xcode_version")
|
|
230
|
+
load("@build_bazel_apple_support//xcode:available_xcodes.bzl", "available_xcodes")
|
|
231
|
+
load("@build_bazel_apple_support//xcode:xcode_config.bzl", "xcode_config")
|
|
232
|
+
|
|
233
|
+
`
|
|
234
|
+
: '';
|
|
235
|
+
const remoteRule = renderXcodeVersionRule('remote_xcode', remoteVersionKey);
|
|
236
|
+
return `# Generated by lim xcode rbe. Do not edit; rerun the command to refresh.
|
|
237
|
+
#
|
|
238
|
+
# Pins the Xcode version Bazel uses to the limrun fleet's Xcode, independent of
|
|
239
|
+
# any Xcode installed on this machine. Both the remote and local sets point at
|
|
240
|
+
# the SAME pin so --xcode_version resolves as mutually available (no
|
|
241
|
+
# apple_support remote-only DEBUG notice); under --config=limrun all actions run
|
|
242
|
+
# remotely, so a local DEVELOPER_DIR is never resolved. Selected via
|
|
243
|
+
# .limrun/bazelrc (--config=limrun).
|
|
244
|
+
${loads}${remoteRule}
|
|
245
|
+
|
|
246
|
+
# Both sets point at the single fleet pin.
|
|
247
|
+
${renderAvailableXcodes('remote_xcodes', ':remote_xcode')}
|
|
248
|
+
|
|
249
|
+
${renderAvailableXcodes('local_xcodes', ':remote_xcode')}
|
|
250
|
+
|
|
251
|
+
xcode_config(
|
|
252
|
+
name = "remote_xcode_config",
|
|
253
|
+
remote_versions = ":remote_xcodes",
|
|
254
|
+
local_versions = ":local_xcodes",
|
|
255
|
+
)
|
|
256
|
+
`;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Renders the rc fragment with the remote-execution flags under
|
|
260
|
+
* --config=limrun.
|
|
261
|
+
*
|
|
262
|
+
* - `--xcode_version` pins the fleet's version: without it, a mac client
|
|
263
|
+
* lacking that exact version has no mutual version and silently falls back
|
|
264
|
+
* to its LOCAL default, shipping the wrong version to the remote worker via
|
|
265
|
+
* XCODE_VERSION_OVERRIDE (the worker then rejects it).
|
|
266
|
+
* - `--strategy=SwiftCompile=remote` / `--strategy=Genrule=remote` override
|
|
267
|
+
* mnemonic-specific strategies a workspace may pin (rules_swift defaults
|
|
268
|
+
* SwiftCompile to a local persistent `worker`; repos often pin Genrule to
|
|
269
|
+
* `standalone`). Those run locally and break RBE: a local Swift worker can't
|
|
270
|
+
* run on a Linux client at all, and on a mac it would demand the fleet's
|
|
271
|
+
* Xcode locally. --spawn_strategy=remote does not override per-mnemonic
|
|
272
|
+
* pins, so these explicit overrides are required.
|
|
273
|
+
* - PATH includes /usr/sbin:/sbin so genrules that probe `sysctl` (e.g.
|
|
274
|
+
* `hw.logicalcpu` for `make -j`) resolve it on the worker.
|
|
275
|
+
* - `--remote_download_outputs=minimal` keeps build outputs (the .ipa) in the
|
|
276
|
+
* instance's CAS instead of downloading them to the client. `lim xcode rbe
|
|
277
|
+
* install` then installs the artifact on the attached simulator server-side
|
|
278
|
+
* (fast diff-sync), so the bytes never round-trip — pointless on a Linux
|
|
279
|
+
* client, and the artifact is produced in the instance anyway. Scoped to
|
|
280
|
+
* --config=limrun, so a plain `bazel build` still materializes outputs.
|
|
281
|
+
* - `--build_event_json_file` writes the Build Event Protocol to .limrun/bep.json;
|
|
282
|
+
* `lim xcode rbe install` reads the built target's .ipa CAS digest from it. The
|
|
283
|
+
* path is ABSOLUTE on purpose: Bazel expands `%workspace%` only in
|
|
284
|
+
* import/try-import, NOT in flag values (it would be taken literally and create
|
|
285
|
+
* a junk `%workspace%/` dir), and a relative path resolves against bazel's cwd
|
|
286
|
+
* rather than the workspace root.
|
|
287
|
+
* - `--extra_execution_platforms` is emitted ONLY for non-mac clients: a Linux
|
|
288
|
+
* host has no auto-detected darwin execution platform, so the Apple/Swift
|
|
289
|
+
* toolchain (exec_compatible_with macos) needs one registered to route
|
|
290
|
+
* actions to the mac RBE pool. On a mac it is HARMFUL: it makes bazel run
|
|
291
|
+
* exec-config actions on the local host instead of the remote worker, which
|
|
292
|
+
* then demand a local Xcode.
|
|
293
|
+
*/
|
|
294
|
+
function renderLimrunBazelrc(port, versionKey, isMacClient, bepPath) {
|
|
295
|
+
const execPlatform = isMacClient ? '' : ('build:limrun --extra_execution_platforms=@build_bazel_apple_support//platforms:darwin_arm64\n');
|
|
296
|
+
return `# Generated by lim xcode rbe. Do not edit; rerun the command to refresh.
|
|
297
|
+
build:limrun --remote_executor=grpc://127.0.0.1:${port}
|
|
298
|
+
build:limrun --remote_default_exec_properties=OSFamily=Darwin
|
|
299
|
+
build:limrun --spawn_strategy=remote
|
|
300
|
+
build:limrun --noremote_local_fallback
|
|
301
|
+
build:limrun --strategy=SwiftCompile=remote
|
|
302
|
+
build:limrun --strategy=Genrule=remote
|
|
303
|
+
build:limrun --xcode_version_config=//.limrun:remote_xcode_config
|
|
304
|
+
build:limrun --xcode_version=${shortVersion(versionKey)}
|
|
305
|
+
build:limrun --remote_download_outputs=minimal
|
|
306
|
+
build:limrun --build_event_json_file=${bepPath}
|
|
307
|
+
${execPlatform}build:limrun --action_env=PATH=/usr/bin:/bin:/usr/sbin:/sbin
|
|
308
|
+
`;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Idempotently ensures the workspace .bazelrc try-imports the generated
|
|
312
|
+
* fragment. Creates .bazelrc when missing. Returns true when the file changed.
|
|
313
|
+
*/
|
|
314
|
+
function ensureTryImport(workspaceDir) {
|
|
315
|
+
const bazelrcPath = path_1.default.join(workspaceDir, '.bazelrc');
|
|
316
|
+
let current = '';
|
|
317
|
+
if (fs_1.default.existsSync(bazelrcPath)) {
|
|
318
|
+
current = fs_1.default.readFileSync(bazelrcPath, 'utf8');
|
|
319
|
+
// Match the try-import on a line basis (exact, uncommented) rather than a
|
|
320
|
+
// raw substring, so a commented-out occurrence (e.g. `# try-import ...`)
|
|
321
|
+
// doesn't make us skip wiring the active import.
|
|
322
|
+
const alreadyWired = current.split('\n').some((line) => line.trim() === exports.TRY_IMPORT_LINE);
|
|
323
|
+
if (alreadyWired) {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
const block = `${TRY_IMPORT_COMMENT}\n${exports.TRY_IMPORT_LINE}\n`;
|
|
328
|
+
const next = current === '' ? block : `${current.replace(/\n*$/, '\n\n')}${block}`;
|
|
329
|
+
fs_1.default.writeFileSync(bazelrcPath, next);
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Writes .limrun/{BUILD,bazelrc,.gitignore} into the workspace and wires the
|
|
334
|
+
* try-import. The .gitignore containing "*" makes the directory self-ignoring
|
|
335
|
+
* so nothing else in the user's repo needs to change.
|
|
336
|
+
*/
|
|
337
|
+
function writeRbeWorkspaceFiles(workspaceDir, xcodeVersionKey, port, isMacClient = process.platform === 'darwin', bazelMajor = detectBazelMajorVersion(workspaceDir)) {
|
|
338
|
+
const dir = path_1.default.join(workspaceDir, exports.LIMRUN_DIR);
|
|
339
|
+
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
340
|
+
const buildFile = path_1.default.join(dir, 'BUILD');
|
|
341
|
+
const bazelrcFragment = path_1.default.join(dir, 'bazelrc');
|
|
342
|
+
// Load the Xcode rules from apple_support on Bazel 9+, where they are no
|
|
343
|
+
// longer native globals. On a known Bazel 8 workspace they ARE native (and
|
|
344
|
+
// loading would fail), so omit the loads.
|
|
345
|
+
const emitLoads = isBazel9OrLater(bazelMajor);
|
|
346
|
+
// Absolute BEP path so it resolves regardless of bazel's cwd; lim xcode rbe
|
|
347
|
+
// install reads the same path. .limrun/ is gitignored and regenerated per run,
|
|
348
|
+
// so a machine-specific absolute path here is fine.
|
|
349
|
+
const bepFile = path_1.default.join(dir, 'bep.json');
|
|
350
|
+
fs_1.default.writeFileSync(buildFile, renderXcodeConfigBuild(xcodeVersionKey, emitLoads));
|
|
351
|
+
fs_1.default.writeFileSync(bazelrcFragment, renderLimrunBazelrc(port, xcodeVersionKey, isMacClient, bepFile));
|
|
352
|
+
fs_1.default.writeFileSync(path_1.default.join(dir, '.gitignore'), '*\n');
|
|
353
|
+
const bazelrcUpdated = ensureTryImport(workspaceDir);
|
|
354
|
+
return { buildFile, bazelrcFragment, bazelrcUpdated };
|
|
355
|
+
}
|
|
356
|
+
//# sourceMappingURL=rbe-workspace.js.map
|
|
@@ -0,0 +1 @@
|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,EAAE,CAAC,CAAC;IACvC,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAClD,yEAAyE;IACzE,2EAA2E;IAC3E,0CAA0C;IAC1C,MAAM,SAAS,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAC9C,4EAA4E;IAC5E,+EAA+E;IAC/E,oDAAoD;IACpD,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAC3C,YAAE,CAAC,aAAa,CAAC,SAAS,EAAE,sBAAsB,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC,CAAC;IAChF,YAAE,CAAC,aAAa,CAAC,eAAe,EAAE,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IACpG,YAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,EAAE,KAAK,CAAC,CAAC;IACtD,MAAM,cAAc,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IACrD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AACxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lim",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Use remote XCode, iOS Simulator, Android Emulator and more to build and test apps from Linux, Windows or macOS.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"lim": "./bin/run.js"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"test": "jest"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@limrun/api": "^0.
|
|
27
|
+
"@limrun/api": "^0.31.1",
|
|
28
28
|
"@oclif/core": "^4",
|
|
29
29
|
"cli-progress": "^3.12.0",
|
|
30
30
|
"cli-table3": "^0.6.5",
|