jetbridge 0.1.0-rc.2 → 0.1.0-rc.3

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/README.md CHANGED
@@ -136,6 +136,7 @@ jetbridge install --device --json | jq -c 'select(.event == "step" and .phase ==
136
136
  {"event":"signing","decision":"cached","profiles":["Acme wave app","Acme wave uploadwidget"]}
137
137
  {"event":"step","step":"build","phase":"start"}
138
138
  {"event":"step","step":"build","phase":"end","ok":true,"durationMs":72000,"buildNumber":"1786437647","configuration":"Debug"}
139
+ {"event":"step","step":"settings","phase":"end","ok":true,"durationMs":5000,"product":"Acme.app"}
139
140
  {"event":"step","step":"install","phase":"end","ok":true,"durationMs":18000,"device":{"id":"10BFE051","name":"Dev's 17 Pro"},"bundleId":"io.acme.app.dev.wave"}
140
141
  {"event":"done","ok":true,"durationMs":113000,"devices":1,"bundleId":"io.acme.app.dev.wave"}
141
142
  ```
package/dist/cli.js CHANGED
@@ -2550,6 +2550,7 @@ function fillTemplate(template, values) {
2550
2550
 
2551
2551
  // src/build.ts
2552
2552
  import { join as join9 } from "path";
2553
+ import { z as z2 } from "zod";
2553
2554
 
2554
2555
  // src/signing.ts
2555
2556
  import { createHash } from "crypto";
@@ -2681,15 +2682,72 @@ function buildArgs(boundary, project, request) {
2681
2682
  ...request.verbose ? [] : ["-quiet"]
2682
2683
  ];
2683
2684
  }
2684
- function productPath(request, config, platform) {
2685
+ function productPath(request, productName, platform) {
2685
2686
  return join9(
2686
2687
  request.derivedDataPath,
2687
2688
  "Build",
2688
2689
  "Products",
2689
2690
  `${request.configuration}-${platform}`,
2690
- `${config.project.scheme}.app`
2691
+ productName
2691
2692
  );
2692
2693
  }
2694
+ function settingsArgs(project, request) {
2695
+ return [
2696
+ "-showBuildSettings",
2697
+ "-json",
2698
+ ...project.xcodebuildTarget(),
2699
+ "-scheme",
2700
+ project.config.project.scheme,
2701
+ "-configuration",
2702
+ request.configuration,
2703
+ "-destination",
2704
+ request.destination,
2705
+ "-derivedDataPath",
2706
+ request.derivedDataPath,
2707
+ ...variantSettings(request.suffix, request.displayName)
2708
+ ];
2709
+ }
2710
+ var SettingsOutput = z2.array(
2711
+ z2.object({
2712
+ buildSettings: z2.object({
2713
+ PRODUCT_TYPE: z2.string().optional(),
2714
+ FULL_PRODUCT_NAME: z2.string().optional()
2715
+ })
2716
+ })
2717
+ );
2718
+ function appProductName(stdout) {
2719
+ let json;
2720
+ try {
2721
+ json = JSON.parse(stdout);
2722
+ } catch {
2723
+ return null;
2724
+ }
2725
+ const parsed = SettingsOutput.safeParse(json);
2726
+ if (!parsed.success) return null;
2727
+ const apps = parsed.data.filter(
2728
+ (entry) => entry.buildSettings.PRODUCT_TYPE === "com.apple.product-type.application"
2729
+ );
2730
+ return apps.length === 1 ? apps[0].buildSettings.FULL_PRODUCT_NAME ?? null : null;
2731
+ }
2732
+ async function builtApp(boundary, project, request, platform) {
2733
+ const name = await boundary.report.run("settings", "read build settings", async (step) => {
2734
+ const result = await boundary.exec.run("xcodebuild", settingsArgs(project, request), {
2735
+ cwd: project.root,
2736
+ allowFail: true
2737
+ });
2738
+ const found = result.ok ? appProductName(result.stdout) : null;
2739
+ const name2 = found ?? `${project.config.project.scheme}.app`;
2740
+ if (!found) {
2741
+ boundary.report.note(`the build settings name no single app \u2014 assuming ${name2}`);
2742
+ }
2743
+ step.detail(name2);
2744
+ step.data({ product: name2 });
2745
+ return name2;
2746
+ });
2747
+ const path = productPath(request, name, platform);
2748
+ if (!boundary.fs.exists(path)) fail(`the build reported success but produced no app at ${path}`);
2749
+ return path;
2750
+ }
2693
2751
  async function requireToolchain(boundary, project, binaries) {
2694
2752
  for (const binary of binaries) {
2695
2753
  const found = await boundary.exec.run("command", ["-v", binary], { allowFail: true });
@@ -3274,29 +3332,23 @@ async function wiredInstall(boundary, project, options) {
3274
3332
  return { byTarget: Object.fromEntries(provisioned.map((p) => [p.target, p.profileName])) };
3275
3333
  });
3276
3334
  await runHook(boundary, project, "preBuild");
3277
- const appPath = await withEntitlementSwap(
3335
+ const request = {
3336
+ configuration,
3337
+ suffix: options.suffix,
3338
+ displayName: options.displayName,
3339
+ profiles,
3340
+ derivedDataPath: derivedData,
3341
+ destination: "generic/platform=iOS",
3342
+ buildNumber: buildNumber(boundary),
3343
+ verbose: options.verbose
3344
+ };
3345
+ await withEntitlementSwap(
3278
3346
  boundary,
3279
3347
  project,
3280
3348
  { suffix: options.suffix, backupPath: join12(scratch, "project.pbxproj.orig"), configuration },
3281
- async () => {
3282
- const request = {
3283
- configuration,
3284
- suffix: options.suffix,
3285
- displayName: options.displayName,
3286
- profiles,
3287
- derivedDataPath: derivedData,
3288
- destination: "generic/platform=iOS",
3289
- buildNumber: buildNumber(boundary),
3290
- verbose: options.verbose
3291
- };
3292
- await build(boundary, project, request);
3293
- const built = productPath(request, config, "iphoneos");
3294
- if (!boundary.fs.exists(built)) {
3295
- fail(`the build reported success but produced no app at ${built}`);
3296
- }
3297
- return built;
3298
- }
3349
+ () => build(boundary, project, request)
3299
3350
  );
3351
+ const appPath = await builtApp(boundary, project, request, "iphoneos");
3300
3352
  await runHook(boundary, project, "postBuild");
3301
3353
  const failures = [];
3302
3354
  for (const target of targets) {
@@ -4024,10 +4076,7 @@ async function simInstall(boundary, project, options) {
4024
4076
  verbose: options.verbose
4025
4077
  };
4026
4078
  await build(boundary, project, request);
4027
- const appPath = productPath(request, config, "iphonesimulator");
4028
- if (!boundary.fs.exists(appPath)) {
4029
- fail(`the build reported success but produced no app at ${appPath}`);
4030
- }
4079
+ const appPath = await builtApp(boundary, project, request, "iphonesimulator");
4031
4080
  await runHook(boundary, project, "postBuild");
4032
4081
  await report.run("install", simulator.name, async (step) => {
4033
4082
  step.data({ device: { id: simulator.udid, name: simulator.name }, bundleId, appPath });