prep for 1.2.0 release updates
This commit is contained in:
@@ -237,6 +237,12 @@ struct ProjectScaffolderTests {
|
||||
#expect(ProjectTemplate(string: "iosui") == .iosUI)
|
||||
#expect(ProjectTemplate(string: "auv3") == .auv3)
|
||||
#expect(ProjectTemplate(string: "AUV3") == .auv3)
|
||||
#expect(ProjectTemplate(string: "shoegaze") == .shoegaze)
|
||||
#expect(ProjectTemplate(string: "shoe-gaze") == .shoegaze)
|
||||
#expect(ProjectTemplate(string: "SHOEGAZE") == .shoegaze)
|
||||
#expect(ProjectTemplate(string: "shoegaze-ios") == .shoegazeIOS)
|
||||
#expect(ProjectTemplate(string: "shoegazeios") == .shoegazeIOS)
|
||||
#expect(ProjectTemplate(string: "SHOEGAZE-IOS") == .shoegazeIOS)
|
||||
}
|
||||
|
||||
@Test func shipsXcodeProjectClassification() {
|
||||
@@ -245,9 +251,244 @@ struct ProjectScaffolderTests {
|
||||
#expect(ProjectTemplate.uiDemo.shipsXcodeProject == false)
|
||||
#expect(ProjectTemplate.nrt.shipsXcodeProject == false)
|
||||
#expect(ProjectTemplate.score.shipsXcodeProject == false)
|
||||
// shoegaze is now an Xcode-bearing template (macOS .app bundle).
|
||||
#expect(ProjectTemplate.shoegaze.shipsXcodeProject == true)
|
||||
#expect(ProjectTemplate.macosUIXcode.shipsXcodeProject == true)
|
||||
#expect(ProjectTemplate.iosUI.shipsXcodeProject == true)
|
||||
#expect(ProjectTemplate.auv3.shipsXcodeProject == true)
|
||||
#expect(ProjectTemplate.shoegazeIOS.shipsXcodeProject == true)
|
||||
}
|
||||
|
||||
// MARK: - shoegaze template (macOS Xcode app)
|
||||
|
||||
@Test func shoegazeMacOSScaffoldCreatesAllFiles() throws {
|
||||
let fm: FileManager = FileManager.default
|
||||
let tmp: String = fm.temporaryDirectory
|
||||
.appendingPathComponent("LyrebirdScaffolderTest_\(UUID().uuidString)").path
|
||||
try fm.createDirectory(atPath: tmp, withIntermediateDirectories: true, attributes: nil)
|
||||
defer { try? fm.removeItem(atPath: tmp) }
|
||||
|
||||
try ProjectScaffolder.scaffold(name: "MyRig", template: .shoegaze, in: tmp)
|
||||
|
||||
let root: String = (tmp as NSString).appendingPathComponent("MyRig")
|
||||
let expected: [String] = [
|
||||
"MyRig.xcodeproj/project.pbxproj",
|
||||
"MyRig.xcodeproj/xcshareddata/xcschemes/MyRig.xcscheme",
|
||||
"MyRig.xcworkspace/contents.xcworkspacedata",
|
||||
"MyRig/MyRigApp.swift",
|
||||
"MyRig/MyRigAppModel.swift",
|
||||
"MyRig/Info.plist",
|
||||
]
|
||||
for rel: String in expected {
|
||||
let path: String = (root as NSString).appendingPathComponent(rel)
|
||||
#expect(fm.fileExists(atPath: path),
|
||||
"missing shoegaze macOS file: \(rel)")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSWorkspaceReferencesXcodeproj() throws {
|
||||
let fm: FileManager = FileManager.default
|
||||
let tmp: String = fm.temporaryDirectory
|
||||
.appendingPathComponent("LyrebirdScaffolderTest_\(UUID().uuidString)").path
|
||||
try fm.createDirectory(atPath: tmp, withIntermediateDirectories: true, attributes: nil)
|
||||
defer { try? fm.removeItem(atPath: tmp) }
|
||||
|
||||
try ProjectScaffolder.scaffold(name: "MyRig", template: .shoegaze, in: tmp)
|
||||
|
||||
let workspacePath: String = (tmp as NSString)
|
||||
.appendingPathComponent("MyRig/MyRig.xcworkspace/contents.xcworkspacedata")
|
||||
let contents: String = try String(contentsOfFile: workspacePath, encoding: .utf8)
|
||||
#expect(contents.contains("group:MyRig.xcodeproj"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppSwiftContainsShoeGazeView() {
|
||||
let src: String = ProjectScaffolder.shoegazeMacOSAppSwift(name: "MyRig")
|
||||
#expect(src.contains("ShoeGazeView"))
|
||||
#expect(src.contains("import LyrebirdShoeGazeUI"))
|
||||
#expect(src.contains("@main"))
|
||||
#expect(src.contains("toggleMute"))
|
||||
#expect(src.contains(".keyboardShortcut"))
|
||||
// Must not embed the Lyrebird copyright in emitted user source.
|
||||
#expect(!src.contains("Joshua Parmenter"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppSwiftSubstitutesName() {
|
||||
let src: String = ProjectScaffolder.shoegazeMacOSAppSwift(name: "GuitarPedals")
|
||||
#expect(src.contains("GuitarPedalsApp"))
|
||||
#expect(src.contains("GuitarPedalsAppModel"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppModelContainsEngineAndBoard() {
|
||||
let src: String = ProjectScaffolder.shoegazeMacOSAppModelSwift(name: "MyRig")
|
||||
#expect(src.contains("import LyrebirdShoeGaze"))
|
||||
#expect(src.contains("CoreAudioDriver"))
|
||||
#expect(src.contains("ShoeGaze(engine:"))
|
||||
#expect(src.contains("OverdrivePedal"))
|
||||
#expect(src.contains("DelayPedal"))
|
||||
#expect(src.contains("ReverbPedal"))
|
||||
#expect(src.contains("ModulationPedal"))
|
||||
#expect(src.contains("@Observable"))
|
||||
#expect(src.contains("toggleMute"))
|
||||
// Must not embed the Lyrebird copyright in emitted user source.
|
||||
#expect(!src.contains("Joshua Parmenter"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSAppModelSubstitutesName() {
|
||||
let src: String = ProjectScaffolder.shoegazeMacOSAppModelSwift(name: "GuitarPedals")
|
||||
#expect(src.contains("GuitarPedalsAppModel"))
|
||||
#expect(src.contains("GuitarPedals"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSInfoPlistContainsMicrophoneKey() {
|
||||
let plist: String = ProjectScaffolder.shoegazeMacOSInfoPlist(name: "MyRig")
|
||||
#expect(plist.contains("NSMicrophoneUsageDescription"))
|
||||
#expect(plist.contains("LSMinimumSystemVersion"))
|
||||
#expect(plist.contains("NSHighResolutionCapable"))
|
||||
#expect(plist.contains("public.app-category.music"))
|
||||
#expect(plist.contains("NSPrincipalClass"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSPBXProjReferencesMacOSXAndShoeGaze() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeMacOSPBXProj(name: "MyRig")
|
||||
#expect(pbx.contains("SDKROOT = macosx"))
|
||||
#expect(pbx.contains("MACOSX_DEPLOYMENT_TARGET = 15.0"))
|
||||
#expect(pbx.contains("ENABLE_HARDENED_RUNTIME = YES"))
|
||||
#expect(pbx.contains("LyrebirdShoeGaze"))
|
||||
#expect(pbx.contains("LyrebirdShoeGazeUI"))
|
||||
#expect(pbx.contains("LyrebirdUI"))
|
||||
#expect(pbx.contains("Lyrebird"))
|
||||
#expect(pbx.contains(ProjectScaffolder.shoegazePackageURL))
|
||||
#expect(pbx.contains("MyRig.app"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSPBXProjUsesLocalRefsWhenPathsSet() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeMacOSPBXProj(
|
||||
name: "MyRig",
|
||||
lyrebirdPath: "/abs/Lyrebird",
|
||||
shoegazePath: "/abs/ShoeGaze"
|
||||
)
|
||||
#expect(pbx.contains("XCLocalSwiftPackageReference"))
|
||||
#expect(pbx.contains(#"relativePath = "/abs/ShoeGaze""#))
|
||||
#expect(pbx.contains(#"relativePath = "/abs/Lyrebird""#))
|
||||
#expect(!pbx.contains("XCRemoteSwiftPackageReference"))
|
||||
}
|
||||
|
||||
@Test func shoegazeMacOSPBXProjUsesRemoteRefsWhenPathsNil() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeMacOSPBXProj(name: "MyRig")
|
||||
#expect(pbx.contains("XCRemoteSwiftPackageReference"))
|
||||
#expect(pbx.contains(ProjectScaffolder.shoegazePackageURL))
|
||||
#expect(pbx.contains(ProjectScaffolder.lyrebirdPackageURL))
|
||||
}
|
||||
|
||||
// MARK: - shoegaze-ios template
|
||||
|
||||
@Test func shoegazeIOSScaffoldCreatesAllFiles() throws {
|
||||
let fm: FileManager = FileManager.default
|
||||
let tmp: String = fm.temporaryDirectory
|
||||
.appendingPathComponent("LyrebirdScaffolderTest_\(UUID().uuidString)").path
|
||||
try fm.createDirectory(atPath: tmp, withIntermediateDirectories: true, attributes: nil)
|
||||
defer { try? fm.removeItem(atPath: tmp) }
|
||||
|
||||
try ProjectScaffolder.scaffold(name: "MyRig", template: .shoegazeIOS, in: tmp)
|
||||
|
||||
let root: String = (tmp as NSString).appendingPathComponent("MyRig")
|
||||
let expected: [String] = [
|
||||
"MyRig.xcodeproj/project.pbxproj",
|
||||
"MyRig.xcodeproj/xcshareddata/xcschemes/MyRig.xcscheme",
|
||||
"MyRig.xcworkspace/contents.xcworkspacedata",
|
||||
"MyRig/MyRigApp.swift",
|
||||
"MyRig/MyRigAppModel.swift",
|
||||
"MyRig/Info.plist",
|
||||
]
|
||||
for rel: String in expected {
|
||||
let path: String = (root as NSString).appendingPathComponent(rel)
|
||||
#expect(fm.fileExists(atPath: path),
|
||||
"missing shoegaze-ios file: \(rel)")
|
||||
}
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppSwiftContainsShoeGazeView() {
|
||||
let src: String = ProjectScaffolder.shoegazeIOSAppSwift(name: "MyRig")
|
||||
#expect(src.contains("ShoeGazeView"))
|
||||
#expect(src.contains("import LyrebirdShoeGazeUI"))
|
||||
#expect(src.contains("@main"))
|
||||
#expect(src.contains("NavigationStack"))
|
||||
#expect(src.contains("ScrollView"))
|
||||
// Must not embed the Lyrebird copyright in emitted user source.
|
||||
#expect(!src.contains("Joshua Parmenter"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppSwiftSubstitutesName() {
|
||||
let src: String = ProjectScaffolder.shoegazeIOSAppSwift(name: "GuitarPedals")
|
||||
#expect(src.contains("GuitarPedalsApp"))
|
||||
#expect(src.contains("GuitarPedalsAppModel"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppModelContainsEngineAndBoard() {
|
||||
let src: String = ProjectScaffolder.shoegazeIOSAppModelSwift(name: "MyRig")
|
||||
#expect(src.contains("import LyrebirdShoeGaze"))
|
||||
#expect(src.contains("iOSAudioDriver"))
|
||||
#expect(src.contains("AVAudioSession"))
|
||||
#expect(src.contains("ShoeGaze(engine:"))
|
||||
#expect(src.contains("OverdrivePedal"))
|
||||
#expect(src.contains("DelayPedal"))
|
||||
#expect(src.contains("ReverbPedal"))
|
||||
#expect(src.contains("ModulationPedal"))
|
||||
#expect(src.contains("@Observable"))
|
||||
// Must not embed the Lyrebird copyright in emitted user source.
|
||||
#expect(!src.contains("Joshua Parmenter"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSAppModelSubstitutesName() {
|
||||
let src: String = ProjectScaffolder.shoegazeIOSAppModelSwift(name: "GuitarPedals")
|
||||
#expect(src.contains("GuitarPedalsAppModel"))
|
||||
#expect(src.contains("GuitarPedals"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSPBXProjReferencesIPhoneOSAndShoeGaze() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeIOSPBXProj(name: "MyRig")
|
||||
#expect(pbx.contains("SDKROOT = iphoneos"))
|
||||
#expect(pbx.contains("IPHONEOS_DEPLOYMENT_TARGET = 18.0"))
|
||||
#expect(pbx.contains("TARGETED_DEVICE_FAMILY"))
|
||||
#expect(pbx.contains("LyrebirdShoeGaze"))
|
||||
#expect(pbx.contains("LyrebirdShoeGazeUI"))
|
||||
#expect(pbx.contains("LyrebirdUI"))
|
||||
#expect(pbx.contains(ProjectScaffolder.shoegazePackageURL))
|
||||
#expect(pbx.contains("MyRig.app"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSPBXProjUsesLocalShoegazeRefWhenPathSet() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeIOSPBXProj(
|
||||
name: "MyRig",
|
||||
lyrebirdPath: "/abs/Lyrebird",
|
||||
shoegazePath: "/abs/ShoeGaze"
|
||||
)
|
||||
#expect(pbx.contains("XCLocalSwiftPackageReference"))
|
||||
#expect(pbx.contains(#"relativePath = "/abs/ShoeGaze""#))
|
||||
#expect(pbx.contains(#"relativePath = "/abs/Lyrebird""#))
|
||||
#expect(!pbx.contains("XCRemoteSwiftPackageReference"))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSPBXProjUsesRemoteRefWhenPathsNil() {
|
||||
let pbx: String = ProjectScaffolder.shoegazeIOSPBXProj(name: "MyRig")
|
||||
#expect(pbx.contains("XCRemoteSwiftPackageReference"))
|
||||
#expect(pbx.contains(ProjectScaffolder.shoegazePackageURL))
|
||||
#expect(pbx.contains(ProjectScaffolder.lyrebirdPackageURL))
|
||||
}
|
||||
|
||||
@Test func shoegazeIOSWorkspaceReferencesXcodeproj() throws {
|
||||
let fm: FileManager = FileManager.default
|
||||
let tmp: String = fm.temporaryDirectory
|
||||
.appendingPathComponent("LyrebirdScaffolderTest_\(UUID().uuidString)").path
|
||||
try fm.createDirectory(atPath: tmp, withIntermediateDirectories: true, attributes: nil)
|
||||
defer { try? fm.removeItem(atPath: tmp) }
|
||||
|
||||
try ProjectScaffolder.scaffold(name: "MyRig", template: .shoegazeIOS, in: tmp)
|
||||
|
||||
let workspacePath: String = (tmp as NSString)
|
||||
.appendingPathComponent("MyRig/MyRig.xcworkspace/contents.xcworkspacedata")
|
||||
let contents: String = try String(contentsOfFile: workspacePath, encoding: .utf8)
|
||||
#expect(contents.contains("group:MyRig.xcodeproj"))
|
||||
}
|
||||
|
||||
// MARK: - Xcode-bearing templates: structure
|
||||
|
||||
Reference in New Issue
Block a user