Skip to content

Commit 5528988

Browse files
Deniz Dizmanjakepetroules
authored andcommitted
Upstream: add LM_ENABLE_APP_NAME_OVERRIDE option to AppIntentsMetadata spec
1 parent 187d0ae commit 5528988

File tree

2 files changed

+136
-0
lines changed

2 files changed

+136
-0
lines changed

Sources/SWBApplePlatform/Specs/AppIntentsMetadata.xcspec

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,15 @@
203203
NO = ();
204204
};
205205
},
206+
{
207+
Name = LM_ENABLE_APP_NAME_OVERRIDE;
208+
Type = Boolean;
209+
DefaultValue = NO;
210+
CommandLineArgs = {
211+
YES = ( "--app-shortcuts-app-name-override" );
212+
NO = ();
213+
};
214+
},
206215
);
207216
},
208217
)

Tests/SWBTaskConstructionTests/AppIntentsMetadataTaskConstructionTests.swift

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,133 @@ fileprivate struct AppIntentsMetadataTaskConstructionTests: CoreBasedTests {
15951595
}
15961596
}
15971597

1598+
@Test(.requireSDKs(.iOS))
1599+
func appNameOverrideIsNotPresent() async throws {
1600+
try await withTemporaryDirectory { tmpDir in
1601+
let testProject = try await TestProject(
1602+
"aProject",
1603+
sourceRoot: tmpDir,
1604+
groupTree: TestGroup(
1605+
"SomeFiles",
1606+
children: [
1607+
TestFile("source.swift"),
1608+
TestFile(appShortcutsStringsFileName)
1609+
]),
1610+
buildConfigurations: [
1611+
TestBuildConfiguration(
1612+
"Debug",
1613+
buildSettings: [
1614+
"AD_HOC_CODE_SIGNING_ALLOWED": "YES",
1615+
"ARCHS": "arm64",
1616+
"CODE_SIGN_IDENTITY": "-",
1617+
"GENERATE_INFOPLIST_FILE": "YES",
1618+
"PRODUCT_BUNDLE_IDENTIFIER": "com.foo.bar",
1619+
"PRODUCT_NAME": "$(TARGET_NAME)",
1620+
"SDKROOT": "iphoneos",
1621+
"SWIFT_EXEC": swiftCompilerPath.str,
1622+
"SWIFT_VERSION": swiftVersion,
1623+
"VERSIONING_SYSTEM": "apple-generic",
1624+
"SWIFT_EMIT_CONST_VALUE_PROTOCOLS": "Foo Bar",
1625+
]),
1626+
],
1627+
targets: [
1628+
TestStandardTarget(
1629+
"LinkTest",
1630+
type: .application,
1631+
buildConfigurations: [
1632+
TestBuildConfiguration(
1633+
"Debug",
1634+
buildSettings: [
1635+
"LM_ENABLE_LINK_GENERATION": "YES",
1636+
"LM_ENABLE_APP_NAME_OVERRIDE": "NO"
1637+
]),
1638+
],
1639+
buildPhases: [
1640+
TestResourcesBuildPhase([TestBuildFile(appShortcutsStringsFileName)]),
1641+
TestSourcesBuildPhase(["source.swift"]),
1642+
]
1643+
)
1644+
])
1645+
1646+
let core = try await getCore()
1647+
let tester = try TaskConstructionTester(core, testProject)
1648+
await tester.checkBuild(runDestination: .iOS) { results in
1649+
results.checkTask(.matchRuleType("ExtractAppIntentsMetadata")) { task in
1650+
let executableName = task.commandLine.first
1651+
if let executableName,
1652+
executableName == "appintentsmetadataprocessor" {
1653+
task.checkCommandLineDoesNotContain("--app-shortcuts-app-name-override")
1654+
}
1655+
results.checkNoDiagnostics()
1656+
}
1657+
}
1658+
}
1659+
}
1660+
1661+
1662+
@Test(.requireSDKs(.iOS))
1663+
func appNameOverride() async throws {
1664+
try await withTemporaryDirectory { tmpDir in
1665+
let testProject = try await TestProject(
1666+
"aProject",
1667+
sourceRoot: tmpDir,
1668+
groupTree: TestGroup(
1669+
"SomeFiles",
1670+
children: [
1671+
TestFile("source.swift"),
1672+
TestFile(appShortcutsStringsFileName)
1673+
]),
1674+
buildConfigurations: [
1675+
TestBuildConfiguration(
1676+
"Debug",
1677+
buildSettings: [
1678+
"AD_HOC_CODE_SIGNING_ALLOWED": "YES",
1679+
"ARCHS": "arm64",
1680+
"CODE_SIGN_IDENTITY": "-",
1681+
"GENERATE_INFOPLIST_FILE": "YES",
1682+
"PRODUCT_BUNDLE_IDENTIFIER": "com.foo.bar",
1683+
"PRODUCT_NAME": "$(TARGET_NAME)",
1684+
"SDKROOT": "iphoneos",
1685+
"SWIFT_EXEC": swiftCompilerPath.str,
1686+
"SWIFT_VERSION": swiftVersion,
1687+
"VERSIONING_SYSTEM": "apple-generic",
1688+
"SWIFT_EMIT_CONST_VALUE_PROTOCOLS": "Foo Bar",
1689+
]),
1690+
],
1691+
targets: [
1692+
TestStandardTarget(
1693+
"LinkTest",
1694+
type: .application,
1695+
buildConfigurations: [
1696+
TestBuildConfiguration(
1697+
"Debug",
1698+
buildSettings: [
1699+
"LM_ENABLE_LINK_GENERATION": "YES",
1700+
"LM_ENABLE_APP_NAME_OVERRIDE": "YES"
1701+
]),
1702+
],
1703+
buildPhases: [
1704+
TestResourcesBuildPhase([TestBuildFile(appShortcutsStringsFileName)]),
1705+
TestSourcesBuildPhase(["source.swift"]),
1706+
]
1707+
)
1708+
])
1709+
1710+
let core = try await getCore()
1711+
let tester = try TaskConstructionTester(core, testProject)
1712+
await tester.checkBuild(runDestination: .iOS) { results in
1713+
results.checkTask(.matchRuleType("ExtractAppIntentsMetadata")) { task in
1714+
let executableName = task.commandLine.first
1715+
if let executableName,
1716+
executableName == "appintentsmetadataprocessor" {
1717+
task.checkCommandLineContains(["--app-shortcuts-app-name-override"])
1718+
}
1719+
results.checkNoDiagnostics()
1720+
}
1721+
}
1722+
}
1723+
}
1724+
15981725
@Test(.requireSDKs(.iOS))
15991726
func quietWarnings() async throws {
16001727
try await withTemporaryDirectory { tmpDir in

0 commit comments

Comments
 (0)