diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/1024.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/1024.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/1024.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/1024.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/114.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/114.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/114.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/114.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/120.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/120.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/120.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/120.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/180.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/180.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/180.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/180.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/29.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/29.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/29.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/29.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/40.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/40.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/40.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/40.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/57.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/57.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/57.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/57.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/58.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/58.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/58.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/58.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/60.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/60.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/60.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/60.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/80.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/80.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/80.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/80.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/87.png b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/87.png similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/87.png rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/87.png diff --git a/CouchTracker/Assets.xcassets/AppIcon.appiconset/Contents.json b/CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from CouchTracker/Assets.xcassets/AppIcon.appiconset/Contents.json rename to CouchTracker/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json diff --git a/CouchTracker/Assets.xcassets/Contents.json b/CouchTracker/Resources/Assets.xcassets/Contents.json similarity index 100% rename from CouchTracker/Assets.xcassets/Contents.json rename to CouchTracker/Resources/Assets.xcassets/Contents.json diff --git a/CouchTracker/Base.lproj/LaunchScreen.storyboard b/CouchTracker/Resources/Base.lproj/LaunchScreen.storyboard similarity index 100% rename from CouchTracker/Base.lproj/LaunchScreen.storyboard rename to CouchTracker/Resources/Base.lproj/LaunchScreen.storyboard diff --git a/CouchTrackerApp/Images/Assets.xcassets/BackdropPlaceholder.imageset/Contents.json b/CouchTrackerApp/Resources/Assets.xcassets/BackdropPlaceholder.imageset/Contents.json similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/BackdropPlaceholder.imageset/Contents.json rename to CouchTrackerApp/Resources/Assets.xcassets/BackdropPlaceholder.imageset/Contents.json diff --git a/CouchTrackerApp/Images/Assets.xcassets/BackdropPlaceholder.imageset/backdrop_placehoder.jpg b/CouchTrackerApp/Resources/Assets.xcassets/BackdropPlaceholder.imageset/backdrop_placehoder.jpg similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/BackdropPlaceholder.imageset/backdrop_placehoder.jpg rename to CouchTrackerApp/Resources/Assets.xcassets/BackdropPlaceholder.imageset/backdrop_placehoder.jpg diff --git a/CouchTrackerApp/Images/Assets.xcassets/Contents.json b/CouchTrackerApp/Resources/Assets.xcassets/Contents.json similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Contents.json rename to CouchTrackerApp/Resources/Assets.xcassets/Contents.json diff --git a/CouchTrackerApp/Images/Assets.xcassets/Direction.imageset/Contents.json b/CouchTrackerApp/Resources/Assets.xcassets/Direction.imageset/Contents.json similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Direction.imageset/Contents.json rename to CouchTrackerApp/Resources/Assets.xcassets/Direction.imageset/Contents.json diff --git a/CouchTrackerApp/Images/Assets.xcassets/Direction.imageset/direction-1.png b/CouchTrackerApp/Resources/Assets.xcassets/Direction.imageset/direction-1.png similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Direction.imageset/direction-1.png rename to CouchTrackerApp/Resources/Assets.xcassets/Direction.imageset/direction-1.png diff --git a/CouchTrackerApp/Images/Assets.xcassets/Direction.imageset/direction.png b/CouchTrackerApp/Resources/Assets.xcassets/Direction.imageset/direction.png similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Direction.imageset/direction.png rename to CouchTrackerApp/Resources/Assets.xcassets/Direction.imageset/direction.png diff --git a/CouchTrackerApp/Images/Assets.xcassets/Filter.imageset/Contents.json b/CouchTrackerApp/Resources/Assets.xcassets/Filter.imageset/Contents.json similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Filter.imageset/Contents.json rename to CouchTrackerApp/Resources/Assets.xcassets/Filter.imageset/Contents.json diff --git a/CouchTrackerApp/Images/Assets.xcassets/Filter.imageset/filter-1.png b/CouchTrackerApp/Resources/Assets.xcassets/Filter.imageset/filter-1.png similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Filter.imageset/filter-1.png rename to CouchTrackerApp/Resources/Assets.xcassets/Filter.imageset/filter-1.png diff --git a/CouchTrackerApp/Images/Assets.xcassets/Filter.imageset/filter.png b/CouchTrackerApp/Resources/Assets.xcassets/Filter.imageset/filter.png similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Filter.imageset/filter.png rename to CouchTrackerApp/Resources/Assets.xcassets/Filter.imageset/filter.png diff --git a/CouchTrackerApp/Images/Assets.xcassets/PosterListPlaceholder.imageset/Contents.json b/CouchTrackerApp/Resources/Assets.xcassets/PosterListPlaceholder.imageset/Contents.json similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/PosterListPlaceholder.imageset/Contents.json rename to CouchTrackerApp/Resources/Assets.xcassets/PosterListPlaceholder.imageset/Contents.json diff --git a/CouchTrackerApp/Images/Assets.xcassets/PosterListPlaceholder.imageset/poster_placeholder.jpg b/CouchTrackerApp/Resources/Assets.xcassets/PosterListPlaceholder.imageset/poster_placeholder.jpg similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/PosterListPlaceholder.imageset/poster_placeholder.jpg rename to CouchTrackerApp/Resources/Assets.xcassets/PosterListPlaceholder.imageset/poster_placeholder.jpg diff --git a/CouchTrackerApp/Images/Assets.xcassets/PosterPlacehoder.imageset/Contents.json b/CouchTrackerApp/Resources/Assets.xcassets/PosterPlacehoder.imageset/Contents.json similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/PosterPlacehoder.imageset/Contents.json rename to CouchTrackerApp/Resources/Assets.xcassets/PosterPlacehoder.imageset/Contents.json diff --git a/CouchTrackerApp/Images/Assets.xcassets/PosterPlacehoder.imageset/poster_placehoder.png b/CouchTrackerApp/Resources/Assets.xcassets/PosterPlacehoder.imageset/poster_placehoder.png similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/PosterPlacehoder.imageset/poster_placehoder.png rename to CouchTrackerApp/Resources/Assets.xcassets/PosterPlacehoder.imageset/poster_placehoder.png diff --git a/CouchTrackerApp/Images/Assets.xcassets/Settings.imageset/Contents.json b/CouchTrackerApp/Resources/Assets.xcassets/Settings.imageset/Contents.json similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Settings.imageset/Contents.json rename to CouchTrackerApp/Resources/Assets.xcassets/Settings.imageset/Contents.json diff --git a/CouchTrackerApp/Images/Assets.xcassets/Settings.imageset/settings-1.png b/CouchTrackerApp/Resources/Assets.xcassets/Settings.imageset/settings-1.png similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Settings.imageset/settings-1.png rename to CouchTrackerApp/Resources/Assets.xcassets/Settings.imageset/settings-1.png diff --git a/CouchTrackerApp/Images/Assets.xcassets/Settings.imageset/settings.png b/CouchTrackerApp/Resources/Assets.xcassets/Settings.imageset/settings.png similarity index 100% rename from CouchTrackerApp/Images/Assets.xcassets/Settings.imageset/settings.png rename to CouchTrackerApp/Resources/Assets.xcassets/Settings.imageset/settings.png diff --git a/CouchTrackerUITests/CouchTrackerUITests.swift b/CouchTrackerUITests/CouchTrackerUITests.swift deleted file mode 100644 index 1c717e83..00000000 --- a/CouchTrackerUITests/CouchTrackerUITests.swift +++ /dev/null @@ -1,23 +0,0 @@ -import XCTest - -class CouchTrackerUITests: XCTestCase { - override func setUp() { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDown() { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() { - // This is an example of a functional test case. - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testPerformanceExample() { - // This is an example of a performance test case. - measure { - // Put the code you want to measure the time of here. - } - } -} diff --git a/Project.swift b/Project.swift index 0cff9b4d..0e6347d2 100644 --- a/Project.swift +++ b/Project.swift @@ -1,6 +1,140 @@ import ProjectDescription +// MARK: - Extensions + +func + (lhs: [String: String], rhs: [String: String]) -> [String: String] { + return lhs.merging(rhs) { first, second in first } +} + +extension Dictionary where Key == String, Value == String { + func asConfig() -> Configuration { + return Configuration(settings: self) + } +} + + +// MARK: - Constants + let baseBundleId = "io.github.pietrocaselani" +let miniOSVersion = "10.0" + +// MARK: - Target structures + +enum CouchTracker { + static let name = "CouchTracker" + static func target() -> Target { + return Target(name: CouchTracker.name, + platform: .iOS, + product: .app, + bundleId: "\(baseBundleId).couchtracker", + infoPlist: "CouchTracker/Info.plist", + sources: ["CouchTracker/**"], + resources: ["CouchTracker/Resources/**"], + dependencies: [ + .target(name: "CouchTrackerApp"), + .target(name: "CouchTrackerPersistence"), + .target(name: "CouchTrackerDebug"), + .target(name: "CouchTrackerCore-iOS"), + .target(name: "TMDBSwift-iOS"), + .target(name: "TVDBSwift-iOS"), + .target(name: "TraktSwift-iOS"), + ], + settings: settings()) + } + + private static func settings() -> Settings { + let debug = [ + "PROVISIONING_PROFILE_SPECIFIER": "match Development io.github.pietrocaselani.couchtracker" + ] + baseSettingsiOSTargets() + debugCodeSigning() + + + let release = [ + "PROVISIONING_PROFILE_SPECIFIER": "match AppStore io.github.pietrocaselani.couchtracker" + ] + baseSettingsiOSTargets() + releaseCodeSigning() + + return Settings(debug: debug.asConfig(), release: release.asConfig()) + } +} + +enum CouchTrackerUITests { + static let name = "CouchTrackerUITests" + + static func target() -> Target { + return Target(name: CouchTrackerUITests.name, + platform: .macOS, + product: .unitTests, + bundleId: "\(baseBundleId).CouchTrackerUITests", + infoPlist: "CouchTrackerUITests/Info.plist", + sources: ["CouchTrackerUITests/**"], + dependencies: [ + .target(name: "CouchTrackerAppTestable") + ], + settings: settings()) + } + + private static func settings() -> Settings { + let base = [ + "TEST_HOST": "$(BUILT_PRODUCTS_DIR)/CouchTracker.app/CouchTracker", + "BUNDLE_LOADER": "$(TEST_HOST)", + ] + disableCodeSigning() + baseSettingsiOSTargets() + return Settings(base: base) + } +} + +enum CouchTrackerApp { + static let name = "CouchTrackerApp" + + static func target() -> Target { + return Target(name: CouchTrackerApp.name, + platform: .iOS, + product: .framework, + bundleId: "\(baseBundleId).CouchTrackerApp", + infoPlist: "CouchTrackerApp/Info.plist", + sources: ["CouchTrackerApp/**"], + resources: ["CouchTrackerApp/Resources/**"], + headers: Headers(public: "CouchTrackerApp/Headers/Public/CouchTrackerApp.h"), + dependencies: [ + .target(name: "CouchTrackerPersistence"), + .target(name: "CouchTrackerDebug"), + .target(name: "CouchTrackerCore-iOS"), + .target(name: "TMDBSwift-iOS"), + .target(name: "TVDBSwift-iOS"), + .target(name: "TraktSwift-iOS"), + ], + settings: settings()) + } + + private static func settings() -> Settings { + return Settings(base: baseSettingsiOSTargets(), + debug: debugCodeSigning().asConfig(), + release: releaseCodeSigning().asConfig()) + } +} + +// MARK: - Settings functions + +func baseSettingsiOSTargets() -> [String: String] { + return [ + "IPHONEOS_DEPLOYMENT_TARGET": miniOSVersion, + "TARGETED_DEVICE_FAMILY": "1", + "CODE_SIGN_STYLE": "Manual", + "DEVELOPMENT_TEAM": "B5RPM7SE3L", + ] +} + +func disableCodeSigning() -> [String: String] { + return ["CODE_SIGN_IDENTITY": ""] +} + +func releaseCodeSigning() -> [String: String] { + return ["CODE_SIGN_IDENTITY": "iPhone Distribution"] +} + +func debugCodeSigning() -> [String: String] { + return ["CODE_SIGN_IDENTITY": "iPhone Developer"] +} + +// MARK: - Legacy func traktSwiftTargets() -> [Target] { return [ @@ -31,7 +165,7 @@ func traktSwiftTargets() -> [Target] { bundleId: "\(baseBundleId).TraktSwiftTests", infoPlist: "TraktSwiftTests/Info.plist", sources: ["TraktSwiftTests/**"], - dependencies: []) + dependencies: []), ] } @@ -64,7 +198,7 @@ func tmdbSwiftTargets() -> [Target] { bundleId: "\(baseBundleId).TMDBSwiftTests", infoPlist: "TMDBSwiftTests/Info.plist", sources: ["TMDBSwiftTests/**"], - dependencies: []) + dependencies: []), ] } @@ -97,7 +231,7 @@ func tvdbSwiftTargets() -> [Target] { bundleId: "\(baseBundleId).TVDBSwiftTests", infoPlist: "TVDBSwiftTests/Info.plist", sources: ["TVDBSwiftTests/**"], - dependencies: []) + dependencies: []), ] } @@ -131,34 +265,20 @@ func couchTrackerCoreTargets() -> [Target] { bundleId: "\(baseBundleId).CouchTrackerCoreTests", infoPlist: "CouchTrackerCoreTests/Info.plist", sources: ["CouchTrackerCoreTests/**"], - dependencies: []) + dependencies: []), ] } func couchTrackerAppTargets() -> [Target] { return [ - Target(name: "CouchTrackerApp", - platform: .iOS, - product: .framework, - bundleId: "\(baseBundleId).CouchTrackerApp", - infoPlist: "CouchTrackerApp/Info.plist", - sources: ["CouchTrackerApp/**"], - dependencies: [ - .target(name: "CouchTrackerPersistence"), - .target(name: "CouchTrackerDebug"), - .target(name: "CouchTrackerCore-iOS"), - .target(name: "TMDBSwift-iOS"), - .target(name: "TVDBSwift-iOS"), - .target(name: "TraktSwift-iOS"), - ]), Target(name: "CouchTrackerAppTestable", platform: .macOS, product: .framework, bundleId: "\(baseBundleId).CouchTrackerAppTestable", infoPlist: "CouchTrackerAppTestable/Info.plist", sources: ["CouchTrackerAppTestable/**"], - dependencies: []) - ] + dependencies: []), + ] + [CouchTrackerApp.target()] } func persistanceAndDebugTargets() -> [Target] { @@ -178,44 +298,19 @@ func persistanceAndDebugTargets() -> [Target] { sources: ["CouchTrackerDebug/**"], dependencies: [ .target(name: "CouchTrackerCore-iOS"), - ]) - ] -} - -func couchTrackerTargets() -> [Target] { - return [ - Target(name: "CouchTracker", - platform: .iOS, - product: .app, - bundleId: "\(baseBundleId).couchtracker", - infoPlist: "CouchTracker/Info.plist", - sources: ["CouchTracker/**"], - dependencies: [ - .target(name: "CouchTrackerApp"), - .target(name: "CouchTrackerPersistence"), - .target(name: "CouchTrackerDebug"), - .target(name: "CouchTrackerCore-iOS"), - .target(name: "TMDBSwift-iOS"), - .target(name: "TVDBSwift-iOS"), - .target(name: "TraktSwift-iOS"), ]), - Target(name: "CouchTrackerUITests", - platform: .macOS, - product: .unitTests, - bundleId: "\(baseBundleId).CouchTrackerUITests", - infoPlist: "CouchTrackerUITests/Info.plist", - sources: ["CouchTrackerUITests/**"], - dependencies: []) ] } func allTargets() -> [Target] { - let apiTargets = traktSwiftTargets() + tmdbSwiftTargets() + tvdbSwiftTargets() - let dependencies = couchTrackerCoreTargets() + couchTrackerAppTargets() + persistanceAndDebugTargets() - let appTargets = couchTrackerTargets() + let apiTargets = traktSwiftTargets() + tmdbSwiftTargets() + tvdbSwiftTargets() + let dependencies = couchTrackerAppTargets() + couchTrackerCoreTargets() + persistanceAndDebugTargets() + let appTargets = [CouchTracker.target(), CouchTrackerUITests.target()] - return apiTargets + dependencies + appTargets + return appTargets + dependencies + apiTargets } +// MARK: - Project + let project = Project(name: "CouchTracker", targets: allTargets())