Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Sources/SWBApplePlatform/Specs/AppIntentsMetadata.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@
NO = ();
};
},
{
Name = LM_ENABLE_APP_NAME_OVERRIDE;
Type = Boolean;
DefaultValue = NO;
CommandLineArgs = {
YES = ( "--app-shortcuts-app-name-override" );
NO = ();
};
},
);
},
)
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,133 @@ fileprivate struct AppIntentsMetadataTaskConstructionTests: CoreBasedTests {
}
}

@Test(.requireSDKs(.iOS))
func appNameOverrideIsNotPresent() async throws {
try await withTemporaryDirectory { tmpDir in
let testProject = try await TestProject(
"aProject",
sourceRoot: tmpDir,
groupTree: TestGroup(
"SomeFiles",
children: [
TestFile("source.swift"),
TestFile(appShortcutsStringsFileName)
]),
buildConfigurations: [
TestBuildConfiguration(
"Debug",
buildSettings: [
"AD_HOC_CODE_SIGNING_ALLOWED": "YES",
"ARCHS": "arm64",
"CODE_SIGN_IDENTITY": "-",
"GENERATE_INFOPLIST_FILE": "YES",
"PRODUCT_BUNDLE_IDENTIFIER": "com.foo.bar",
"PRODUCT_NAME": "$(TARGET_NAME)",
"SDKROOT": "iphoneos",
"SWIFT_EXEC": swiftCompilerPath.str,
"SWIFT_VERSION": swiftVersion,
"VERSIONING_SYSTEM": "apple-generic",
"SWIFT_EMIT_CONST_VALUE_PROTOCOLS": "Foo Bar",
]),
],
targets: [
TestStandardTarget(
"LinkTest",
type: .application,
buildConfigurations: [
TestBuildConfiguration(
"Debug",
buildSettings: [
"LM_ENABLE_LINK_GENERATION": "YES",
"LM_ENABLE_APP_NAME_OVERRIDE": "NO"
]),
],
buildPhases: [
TestResourcesBuildPhase([TestBuildFile(appShortcutsStringsFileName)]),
TestSourcesBuildPhase(["source.swift"]),
]
)
])

let core = try await getCore()
let tester = try TaskConstructionTester(core, testProject)
await tester.checkBuild(runDestination: .iOS) { results in
results.checkTask(.matchRuleType("ExtractAppIntentsMetadata")) { task in
let executableName = task.commandLine.first
if let executableName,
executableName == "appintentsmetadataprocessor" {
task.checkCommandLineDoesNotContain("--app-shortcuts-app-name-override")
}
results.checkNoDiagnostics()
}
}
}
}


@Test(.requireSDKs(.iOS))
func appNameOverride() async throws {
try await withTemporaryDirectory { tmpDir in
let testProject = try await TestProject(
"aProject",
sourceRoot: tmpDir,
groupTree: TestGroup(
"SomeFiles",
children: [
TestFile("source.swift"),
TestFile(appShortcutsStringsFileName)
]),
buildConfigurations: [
TestBuildConfiguration(
"Debug",
buildSettings: [
"AD_HOC_CODE_SIGNING_ALLOWED": "YES",
"ARCHS": "arm64",
"CODE_SIGN_IDENTITY": "-",
"GENERATE_INFOPLIST_FILE": "YES",
"PRODUCT_BUNDLE_IDENTIFIER": "com.foo.bar",
"PRODUCT_NAME": "$(TARGET_NAME)",
"SDKROOT": "iphoneos",
"SWIFT_EXEC": swiftCompilerPath.str,
"SWIFT_VERSION": swiftVersion,
"VERSIONING_SYSTEM": "apple-generic",
"SWIFT_EMIT_CONST_VALUE_PROTOCOLS": "Foo Bar",
]),
],
targets: [
TestStandardTarget(
"LinkTest",
type: .application,
buildConfigurations: [
TestBuildConfiguration(
"Debug",
buildSettings: [
"LM_ENABLE_LINK_GENERATION": "YES",
"LM_ENABLE_APP_NAME_OVERRIDE": "YES"
]),
],
buildPhases: [
TestResourcesBuildPhase([TestBuildFile(appShortcutsStringsFileName)]),
TestSourcesBuildPhase(["source.swift"]),
]
)
])

let core = try await getCore()
let tester = try TaskConstructionTester(core, testProject)
await tester.checkBuild(runDestination: .iOS) { results in
results.checkTask(.matchRuleType("ExtractAppIntentsMetadata")) { task in
let executableName = task.commandLine.first
if let executableName,
executableName == "appintentsmetadataprocessor" {
task.checkCommandLineContains(["--app-shortcuts-app-name-override"])
}
results.checkNoDiagnostics()
}
}
}
}

@Test(.requireSDKs(.iOS))
func quietWarnings() async throws {
try await withTemporaryDirectory { tmpDir in
Expand Down
Loading