(context, sanitizedSource, args, xcode)
| 448 | } |
| 449 | |
| 450 | function previewSourceModule(context, sanitizedSource, args, xcode) { |
| 451 | const extraSwift = arrayArg(args.extraSwift); |
| 452 | if (extraSwift.length > 0) { |
| 453 | console.warn( |
| 454 | "[simdeck-preview] warning: --split-compile currently falls back when --extra-swift is used.", |
| 455 | ); |
| 456 | return null; |
| 457 | } |
| 458 | const swiftcArgs = [...xcodeSwiftcArgs(xcode), ...arrayArg(args.swiftcArg)]; |
| 459 | const hash = crypto |
| 460 | .createHash("sha256") |
| 461 | .update(context.target) |
| 462 | .update("\0") |
| 463 | .update(context.sdkPath) |
| 464 | .update("\0") |
| 465 | .update(xcode?.moduleName ?? "") |
| 466 | .update("\0") |
| 467 | .update(swiftcArgs.join("\0")) |
| 468 | .update("\0") |
| 469 | .update(sanitizedSource) |
| 470 | .digest("hex") |
| 471 | .slice(0, 16); |
| 472 | const directory = path.join(context.buildRoot, "source-cache", hash); |
| 473 | return { |
| 474 | directory, |
| 475 | moduleName: `SimDeckPreviewSource_${hash}`, |
| 476 | modulePath: path.join( |
| 477 | directory, |
| 478 | `SimDeckPreviewSource_${hash}.swiftmodule`, |
| 479 | ), |
| 480 | objectPath: path.join(directory, `SimDeckPreviewSource_${hash}.o`), |
| 481 | }; |
| 482 | } |
| 483 | |
| 484 | function compilePreviewSourceModule( |
| 485 | context, |
no test coverage detected