|
1 | | -import { deepEqual, equal, match, notEqual, throws } from "node:assert/strict"; |
| 1 | +import { |
| 2 | + deepEqual, |
| 3 | + equal, |
| 4 | + match, |
| 5 | + notEqual, |
| 6 | + ok, |
| 7 | + throws, |
| 8 | +} from "node:assert/strict"; |
2 | 9 | import * as path from "node:path"; |
3 | 10 | import { afterEach, beforeEach, describe, it } from "node:test"; |
| 11 | +import { fileURLToPath, URL } from "node:url"; |
| 12 | +import { isObject, jsonFromPlist } from "../../ios/utils.mjs"; |
4 | 13 | import { |
| 14 | + applyBuildSettings as applyBuildSettingsActual, |
| 15 | + applyPreprocessorDefinitions, |
| 16 | + applySwiftFlags, |
| 17 | + applyUserHeaderSearchPaths, |
5 | 18 | CODE_SIGN_ENTITLEMENTS, |
6 | 19 | CODE_SIGN_IDENTITY, |
| 20 | + configureBuildSchemes as configureBuildSchemesActual, |
7 | 21 | DEVELOPMENT_TEAM, |
8 | 22 | GCC_PREPROCESSOR_DEFINITIONS, |
9 | 23 | OTHER_SWIFT_FLAGS, |
| 24 | + overrideBuildSettings, |
10 | 25 | PRODUCT_BUILD_NUMBER, |
11 | 26 | PRODUCT_BUNDLE_IDENTIFIER, |
12 | 27 | USER_HEADER_SEARCH_PATHS, |
13 | | - applyBuildSettings as applyBuildSettingsActual, |
14 | | - applyPreprocessorDefinitions, |
15 | | - applySwiftFlags, |
16 | | - applyUserHeaderSearchPaths, |
17 | | - configureBuildSchemes as configureBuildSchemesActual, |
18 | | - overrideBuildSettings, |
19 | 28 | } from "../../ios/xcode.mjs"; |
20 | 29 | import { readTextFile, v } from "../../scripts/helpers.js"; |
21 | 30 | import type { |
@@ -454,3 +463,52 @@ describe("overrideBuildSettings()", () => { |
454 | 463 | equal(buildSettings["ONLY_ACTIVE_ARCH"], "YES"); |
455 | 464 | }); |
456 | 465 | }); |
| 466 | + |
| 467 | +describe("macos/ReactTestApp.xcodeproj", () => { |
| 468 | + // Xcode expects the development team used for code signing to exist when |
| 469 | + // targeting macOS. Unlike when targeting iOS, the warnings are treated as |
| 470 | + // errors. |
| 471 | + it("does not specify development team", () => { |
| 472 | + const xcodeproj = jsonFromPlist( |
| 473 | + fileURLToPath( |
| 474 | + new URL( |
| 475 | + "../../macos/ReactTestApp.xcodeproj/project.pbxproj", |
| 476 | + import.meta.url |
| 477 | + ) |
| 478 | + ) |
| 479 | + ); |
| 480 | + |
| 481 | + const { objects } = xcodeproj; |
| 482 | + |
| 483 | + ok(isObject(objects)); |
| 484 | + ok(typeof xcodeproj.rootObject === "string"); |
| 485 | + |
| 486 | + const rootObject = objects[xcodeproj.rootObject]; |
| 487 | + |
| 488 | + ok(isObject(rootObject)); |
| 489 | + ok(Array.isArray(rootObject.targets)); |
| 490 | + ok(typeof rootObject.targets[0] === "string"); |
| 491 | + |
| 492 | + const appTarget = objects[rootObject.targets[0]]; |
| 493 | + |
| 494 | + ok(isObject(appTarget)); |
| 495 | + equal(appTarget.name, "ReactTestApp"); |
| 496 | + ok(typeof appTarget.buildConfigurationList === "string"); |
| 497 | + |
| 498 | + const buildConfigurationList = objects[appTarget.buildConfigurationList]; |
| 499 | + |
| 500 | + ok(isObject(buildConfigurationList)); |
| 501 | + ok(Array.isArray(buildConfigurationList.buildConfigurations)); |
| 502 | + |
| 503 | + for (const config of buildConfigurationList.buildConfigurations) { |
| 504 | + ok(typeof config === "string"); |
| 505 | + |
| 506 | + const buildConfiguration: JSONValue = objects[config]; |
| 507 | + |
| 508 | + ok(isObject(buildConfiguration)); |
| 509 | + ok(isObject(buildConfiguration.buildSettings)); |
| 510 | + equal(buildConfiguration.buildSettings[CODE_SIGN_IDENTITY], "-"); |
| 511 | + equal(buildConfiguration.buildSettings[DEVELOPMENT_TEAM], undefined); |
| 512 | + } |
| 513 | + }); |
| 514 | +}); |
0 commit comments