mirror of
https://github.com/garrytan/gstack.git
synced 2026-07-18 21:47:20 +02:00
fix(ios-qa): make generated Swift manifests valid on first run
This commit is contained in:
@@ -31,10 +31,5 @@ let package = Package(
|
|||||||
],
|
],
|
||||||
path: "Sources/GenAccessors"
|
path: "Sources/GenAccessors"
|
||||||
),
|
),
|
||||||
.testTarget(
|
|
||||||
name: "GenAccessorsTests",
|
|
||||||
dependencies: ["GenAccessors"],
|
|
||||||
path: "Tests/GenAccessorsTests"
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// swift-tools-version:5.9
|
||||||
// AUTO-GENERATED from gstack/ios-qa/templates/Package.swift.template
|
// AUTO-GENERATED from gstack/ios-qa/templates/Package.swift.template
|
||||||
//
|
//
|
||||||
// Drop-in SPM package definition for the DebugBridge stack. Three targets:
|
// Drop-in SPM package definition for the DebugBridge stack. Three targets:
|
||||||
@@ -18,7 +19,6 @@
|
|||||||
// CI invariant: `swift build -c release` + `nm -j build/Release/<binary>
|
// CI invariant: `swift build -c release` + `nm -j build/Release/<binary>
|
||||||
// | grep -q DebugBridge && exit 1`.
|
// | grep -q DebugBridge && exit 1`.
|
||||||
|
|
||||||
// swift-tools-version:5.9
|
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
@@ -58,10 +58,5 @@ let package = Package(
|
|||||||
.define("DEBUG", .when(configuration: .debug)),
|
.define("DEBUG", .when(configuration: .debug)),
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
.testTarget(
|
|
||||||
name: "DebugBridgeCoreTests",
|
|
||||||
dependencies: ["DebugBridgeCore"],
|
|
||||||
path: "Tests/DebugBridgeCoreTests"
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { join } from 'path';
|
|||||||
const ROOT = join(import.meta.dir, '..');
|
const ROOT = join(import.meta.dir, '..');
|
||||||
const FIXTURE_PATH = join(ROOT, 'test/fixtures/ios-qa/FixtureApp');
|
const FIXTURE_PATH = join(ROOT, 'test/fixtures/ios-qa/FixtureApp');
|
||||||
const TEMPLATES_PATH = join(ROOT, 'ios-qa/templates');
|
const TEMPLATES_PATH = join(ROOT, 'ios-qa/templates');
|
||||||
|
const GEN_ACCESSORS_PACKAGE = join(ROOT, 'ios-qa/scripts/gen-accessors-tool/Package.swift');
|
||||||
|
|
||||||
// Parity: canonical Obj-C touch templates must match the fixture's working
|
// Parity: canonical Obj-C touch templates must match the fixture's working
|
||||||
// copy. The fixture is the only place the .m / .h are exercised end-to-end
|
// copy. The fixture is the only place the .m / .h are exercised end-to-end
|
||||||
@@ -59,6 +60,19 @@ describe('template ↔ fixture parity', () => {
|
|||||||
// app gets the transitive set with one dependency entry.
|
// app gets the transitive set with one dependency entry.
|
||||||
expect(tmpl).toMatch(/name:\s*"DebugBridgeUI"[\s\S]*?dependencies:\s*\["DebugBridgeCore",\s*"DebugBridgeTouch"\]/);
|
expect(tmpl).toMatch(/name:\s*"DebugBridgeUI"[\s\S]*?dependencies:\s*\["DebugBridgeCore",\s*"DebugBridgeTouch"\]/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('generated Swift packages only reference shipped test directories', () => {
|
||||||
|
const genAccessorsPackage = readFileSync(GEN_ACCESSORS_PACKAGE, 'utf-8');
|
||||||
|
const debugBridgePackage = readFileSync(join(TEMPLATES_PATH, 'Package.swift.template'), 'utf-8');
|
||||||
|
|
||||||
|
expect(genAccessorsPackage).not.toContain('Tests/GenAccessorsTests');
|
||||||
|
expect(debugBridgePackage).not.toContain('Tests/DebugBridgeCoreTests');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Package.swift.template keeps swift-tools-version on the first line', () => {
|
||||||
|
const tmpl = readFileSync(join(TEMPLATES_PATH, 'Package.swift.template'), 'utf-8');
|
||||||
|
expect(tmpl.split(/\r?\n/, 1)[0]).toBe('// swift-tools-version:5.9');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function hasSwift(): boolean {
|
function hasSwift(): boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user