diff --git a/CHANGELOG.md b/CHANGELOG.md index 0384707d..0d3c93e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ #### Added - Support for language and region settings on a target basis [#728](https://github.com/yonaskolb/XcodeGen/pull/728) @FranzBusch +#### Internal +- Update to SwiftCLI 6.0 and use the new property wrappers [#749](https://github.com/yonaskolb/XcodeGen/pull/749) @yonaskolb + ## 2.11.0 #### Added @@ -12,6 +15,7 @@ - Added `xcodegen dump` command [#710](https://github.com/yonaskolb/XcodeGen/pull/710) @yonaskolb - Added `--no-env` option to disable environment variables expansion [#704](https://github.com/yonaskolb/XcodeGen/pull/704) @rcari - Added custom group support for target sources [#621](https://github.com/yonaskolb/XcodeGen/pull/621) @sroebert @rcari +- Added new dependency type, `bundle`. This allows targets to copy bundles from other projects [#616](https://github.com/yonaskolb/XcodeGen/pull/616) @bsmith11 #### Fixed - Improved variable expansion runtime [#704](https://github.com/yonaskolb/XcodeGen/pull/704) @rcari diff --git a/Docs/ProjectSpec.md b/Docs/ProjectSpec.md index 1b9ab9a5..6750e6d1 100644 --- a/Docs/ProjectSpec.md +++ b/Docs/ProjectSpec.md @@ -374,13 +374,14 @@ targets: ### Dependency -A dependency can be one of a 3 types: +A dependency can be one of a 6 types: - `target: name` - links to another target - `framework: path` - links to a framework - `carthage: name` - helper for linking to a Carthage framework - `sdk: name` - links to a dependency with the SDK. This can either be a relative path within the sdk root or a single filename that references a framework (.framework) or lib (.tbd) - `package: name` - links to a Swift Package. The name must match the name of a package defined in the top level `packages` +- `bundle: name` - adds the pre-built bundle for the supplied name to the copy resources build phase. This is useful when a dependency exists on a static library target that has an associated bundle target, both existing in a separate project. Only usable in target types which can copy resources. **Linking options**: diff --git a/Package.resolved b/Package.resolved index b31ffa04..a8ffac65 100644 --- a/Package.resolved +++ b/Package.resolved @@ -51,8 +51,8 @@ "repositoryURL": "https://github.com/jakeheis/SwiftCLI.git", "state": { "branch": null, - "revision": "ba2268e67c07b9f9cfbc0801385e6238b36255eb", - "version": "5.3.2" + "revision": "c72c4564f8c0a24700a59824880536aca45a4cae", + "version": "6.0.1" } }, { diff --git a/Package.swift b/Package.swift index d6915829..070e7eda 100644 --- a/Package.swift +++ b/Package.swift @@ -17,7 +17,7 @@ let package = Package( .package(url: "https://github.com/kylef/Spectre.git", from: "0.9.0"), .package(url: "https://github.com/onevcat/Rainbow.git", from: "3.0.0"), .package(url: "https://github.com/tuist/XcodeProj.git", from: "7.4.0"), - .package(url: "https://github.com/jakeheis/SwiftCLI.git", .upToNextMinor(from: "5.3.2")), + .package(url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.0"), ], targets: [ .target(name: "XcodeGen", dependencies: [ diff --git a/Sources/ProjectSpec/Dependency.swift b/Sources/ProjectSpec/Dependency.swift index ebd0084d..3a3e1a04 100644 --- a/Sources/ProjectSpec/Dependency.swift +++ b/Sources/ProjectSpec/Dependency.swift @@ -46,6 +46,7 @@ public struct Dependency: Equatable { case carthage(findFrameworks: Bool?, linkType: CarthageLinkType) case sdk(root: String?) case package(product: String?) + case bundle } } @@ -77,6 +78,9 @@ extension Dependency: JSONObjectConvertible { let product: String? = jsonDictionary.json(atKeyPath: "product") type = .package(product: product) reference = package + } else if let bundle: String = jsonDictionary.json(atKeyPath: "bundle") { + type = .bundle + reference = bundle } else { throw SpecParsingError.invalidDependency(jsonDictionary) } @@ -130,6 +134,8 @@ extension Dependency: JSONEncodable { dict["sdk"] = reference case .package: dict["package"] = reference + case .bundle: + dict["bundle"] = reference } return dict diff --git a/Sources/XcodeGenCLI/Arguments.swift b/Sources/XcodeGenCLI/Arguments.swift index 29b90853..fef7c798 100644 --- a/Sources/XcodeGenCLI/Arguments.swift +++ b/Sources/XcodeGenCLI/Arguments.swift @@ -4,7 +4,7 @@ import SwiftCLI extension Path: ConvertibleFromString { - public static func convert(from: String) -> Path? { - Path(from) + public init?(input: String) { + self.init(input) } } diff --git a/Sources/XcodeGenCLI/Commands/DumpCommand.swift b/Sources/XcodeGenCLI/Commands/DumpCommand.swift index e6a78d3f..dc30fbda 100644 --- a/Sources/XcodeGenCLI/Commands/DumpCommand.swift +++ b/Sources/XcodeGenCLI/Commands/DumpCommand.swift @@ -6,19 +6,11 @@ import Yams class DumpCommand: ProjectCommand { - private let dumpType = Key( - "--type", - "-t", - description: """ - The type of dump to output. Either \(DumpType.allCases.map { "\"\($0.rawValue)\"" }.joined(separator: ", ")). Defaults to \(DumpType.defaultValue.rawValue). The "parsed" types parse the project into swift and then back again. - """ - ) + @Key("--type", "-t", description: "The type of dump to output. Either \(DumpType.allCases.map { "\"\($0.rawValue)\"" }.joined(separator: ", ")). Defaults to \(DumpType.defaultValue.rawValue). The \"parsed\" types parse the project into swift and then back again.") + private var dumpType: DumpType? - private let file = Key( - "--file", - "-f", - description: "The path of a file to write to. If not supplied will output to stdout" - ) + @Key("--file", "-f", description: "The path of a file to write to. If not supplied will output to stdout") + private var file: Path? init(version: Version) { super.init(version: version, @@ -27,7 +19,7 @@ class DumpCommand: ProjectCommand { } override func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws { - let type = dumpType.value ?? .defaultValue + let type = dumpType ?? .defaultValue let output: String switch type { @@ -49,7 +41,7 @@ class DumpCommand: ProjectCommand { output = project.debugDescription } - if let file = file.value { + if let file = file { try file.parent().mkpath() try file.write(output) } else { diff --git a/Sources/XcodeGenCLI/Commands/GenerateCommand.swift b/Sources/XcodeGenCLI/Commands/GenerateCommand.swift index 251368e9..d2319f4e 100644 --- a/Sources/XcodeGenCLI/Commands/GenerateCommand.swift +++ b/Sources/XcodeGenCLI/Commands/GenerateCommand.swift @@ -7,30 +7,17 @@ import XcodeProj class GenerateCommand: ProjectCommand { - let quiet = Flag( - "-q", - "--quiet", - description: "Suppress all informational and success output", - defaultValue: false - ) + @Flag("-q", "--quiet", description: "Suppress all informational and success output") + var quiet: Bool - let useCache = Flag( - "-c", - "--use-cache", - description: "Use a cache for the xcodegen spec. This will prevent unnecessarily generating the project if nothing has changed", - defaultValue: false - ) + @Flag("-c", "--use-cache", description: "Use a cache for the xcodegen spec. This will prevent unnecessarily generating the project if nothing has changed") + var useCache: Bool - let cacheFilePath = Key( - "--cache-path", - description: "Where the cache file will be loaded from and save to. Defaults to ~/.xcodegen/cache/{SPEC_PATH_HASH}" - ) + @Key("--cache-path", description: "Where the cache file will be loaded from and save to. Defaults to ~/.xcodegen/cache/{SPEC_PATH_HASH}") + var cacheFilePath: Path? - let projectDirectory = Key( - "-p", - "--project", - description: "The path to the directory where the project should be generated. Defaults to the directory the spec is in. The filename is defined in the project spec" - ) + @Key("-p", "--project", description: "The path to the directory where the project should be generated. Defaults to the directory the spec is in. The filename is defined in the project spec") + var projectDirectory: Path? init(version: Version) { super.init(version: version, @@ -40,7 +27,7 @@ class GenerateCommand: ProjectCommand { override func execute(specLoader: SpecLoader, projectSpecPath: Path, project: Project) throws { - let projectDirectory = self.projectDirectory.value?.absolute() ?? projectSpecPath.parent() + let projectDirectory = self.projectDirectory?.absolute() ?? projectSpecPath.parent() // validate project dictionary do { @@ -51,12 +38,12 @@ class GenerateCommand: ProjectCommand { let projectPath = projectDirectory + "\(project.name).xcodeproj" - let cacheFilePath = self.cacheFilePath.value ?? + let cacheFilePath = self.cacheFilePath ?? Path("~/.xcodegen/cache/\(projectSpecPath.absolute().string.md5)").absolute() var cacheFile: CacheFile? // read cache - if useCache.value || self.cacheFilePath.value != nil { + if useCache || self.cacheFilePath != nil { do { cacheFile = try specLoader.generateCacheFile() } catch { @@ -129,19 +116,19 @@ class GenerateCommand: ProjectCommand { } func info(_ string: String) { - if !quiet.value { + if !quiet { stdout.print(string) } } func warning(_ string: String) { - if !quiet.value { + if !quiet { stdout.print(string.yellow) } } func success(_ string: String) { - if !quiet.value { + if !quiet { stdout.print(string.green) } } diff --git a/Sources/XcodeGenCLI/Commands/ProjectCommand.swift b/Sources/XcodeGenCLI/Commands/ProjectCommand.swift index 18c2faa1..7bb9dac8 100644 --- a/Sources/XcodeGenCLI/Commands/ProjectCommand.swift +++ b/Sources/XcodeGenCLI/Commands/ProjectCommand.swift @@ -11,18 +11,11 @@ class ProjectCommand: Command { let name: String let shortDescription: String - let spec = Key( - "-s", - "--spec", - description: "The path to the project spec file. Defaults to project.yml" - ) + @Key("-s", "--spec", description: "The path to the project spec file. Defaults to project.yml") + var spec: Path? - let disableEnvExpansion = Flag( - "-n", - "--no-env", - description: "Disable environment variable expansions", - defaultValue: false - ) + @Flag("-n", "--no-env", description: "Disable environment variable expansions") + var disableEnvExpansion: Bool init(version: Version, name: String, shortDescription: String) { self.version = version @@ -32,7 +25,7 @@ class ProjectCommand: Command { func execute() throws { - let projectSpecPath = (spec.value ?? "project.yml").absolute() + let projectSpecPath = (spec ?? "project.yml").absolute() if !projectSpecPath.exists { throw GenerationError.missingProjectSpec(projectSpecPath) @@ -41,7 +34,7 @@ class ProjectCommand: Command { let specLoader = SpecLoader(version: version) let project: Project - let variables: [String: String] = disableEnvExpansion.value ? [:] : ProcessInfo.processInfo.environment + let variables: [String: String] = disableEnvExpansion ? [:] : ProcessInfo.processInfo.environment do { project = try specLoader.loadProject(path: projectSpecPath, variables: variables) diff --git a/Sources/XcodeGenKit/PBXProjGenerator.swift b/Sources/XcodeGenKit/PBXProjGenerator.swift index 84bc0c36..e42e8fb6 100644 --- a/Sources/XcodeGenKit/PBXProjGenerator.swift +++ b/Sources/XcodeGenKit/PBXProjGenerator.swift @@ -22,6 +22,7 @@ public class PBXProjGenerator { var carthageFrameworksByPlatform: [String: Set] = [:] var frameworkFiles: [PBXFileElement] = [] + var bundleFiles: [PBXFileElement] = [] var generated = false @@ -213,6 +214,17 @@ public class PBXProjGenerator { derivedGroups.append(group) } + if !bundleFiles.isEmpty { + let group = addObject( + PBXGroup( + children: bundleFiles, + sourceTree: .group, + name: "Bundles" + ) + ) + derivedGroups.append(group) + } + mainGroup.children = Array(sourceGenerator.rootGroups) sortGroups(group: mainGroup) // add derived groups at the end @@ -433,6 +445,7 @@ public class PBXProjGenerator { var copyFilesBuildPhasesFiles: [TargetSource.BuildPhase.CopyFilesSettings: [PBXBuildFile]] = [:] var copyFrameworksReferences: [PBXBuildFile] = [] var copyResourcesReferences: [PBXBuildFile] = [] + var copyBundlesReferences: [PBXBuildFile] = [] var copyWatchReferences: [PBXBuildFile] = [] var packageDependencies: [XCSwiftPackageProductDependency] = [] var extensions: [PBXBuildFile] = [] @@ -647,6 +660,23 @@ public class PBXProjGenerator { ) dependencies.append(targetDependency) } + case .bundle: + // Static and dynamic libraries can't copy resources + guard target.type != .staticLibrary && target.type != .dynamicLibrary else { break } + + let fileReference = sourceGenerator.getFileReference( + path: Path(dependency.reference), + inPath: project.basePath, + sourceTree: .buildProductsDir + ) + + let pbxBuildFile = PBXBuildFile(file: fileReference, settings: nil) + let buildFile = addObject(pbxBuildFile) + copyBundlesReferences.append(buildFile) + + if !bundleFiles.contains(fileReference) { + bundleFiles.append(fileReference) + } } } @@ -740,6 +770,15 @@ public class PBXProjGenerator { buildPhases.append(resourcesBuildPhase) } + if !copyBundlesReferences.isEmpty { + let copyBundlesPhase = addObject(PBXCopyFilesBuildPhase( + dstSubfolderSpec: .resources, + name: "Copy Bundles to Resources directory", + files: copyBundlesReferences + )) + buildPhases.append(copyBundlesPhase) + } + let swiftObjCInterfaceHeader = project.getCombinedBuildSetting("SWIFT_OBJC_INTERFACE_HEADER_NAME", target: target, config: project.configs[0]) as? String if target.type == .staticLibrary @@ -1047,6 +1086,10 @@ public class PBXProjGenerator { dependencies[dependency.reference] = dependency } } + case .bundle: + if isTopLevel { + dependencies[dependency.reference] = dependency + } } } diff --git a/Tests/FixtureTests/FixtureTests.swift b/Tests/FixtureTests/FixtureTests.swift index 2d81a9e7..d4ebda33 100644 --- a/Tests/FixtureTests/FixtureTests.swift +++ b/Tests/FixtureTests/FixtureTests.swift @@ -11,6 +11,7 @@ class FixtureTests: XCTestCase { func testProjectFixture() { describe { $0.it("generates Test Project") { + try generateXcodeProject(specPath: fixturePath + "TestProject/AnotherProject/project.yml") try generateXcodeProject(specPath: fixturePath + "TestProject/project.yml") } $0.it("generates Carthage Project") { diff --git a/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.pbxproj b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.pbxproj new file mode 100644 index 00000000..3942aaee --- /dev/null +++ b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.pbxproj @@ -0,0 +1,533 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 51; + objects = { + +/* Begin PBXFileReference section */ + 6023D61BF2C57E6AE09CE7A3 /* BundleX.bundle */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "wrapper.plug-in"; path = BundleX.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; + 60D6679FB526839EAFEA2EEE /* config.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXGroup section */ + 3B245BCEF731A43880657E0E /* Configs */ = { + isa = PBXGroup; + children = ( + 60D6679FB526839EAFEA2EEE /* config.xcconfig */, + ); + name = Configs; + path = ../Configs; + sourceTree = ""; + }; + 4E8CFA4275C972686621210C = { + isa = PBXGroup; + children = ( + 3B245BCEF731A43880657E0E /* Configs */, + 6BB7980FAF18A93459B051A1 /* Products */, + ); + sourceTree = ""; + }; + 6BB7980FAF18A93459B051A1 /* Products */ = { + isa = PBXGroup; + children = ( + 6023D61BF2C57E6AE09CE7A3 /* BundleX.bundle */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 63A2D4898D974A06E85B07F8 /* BundleX */ = { + isa = PBXNativeTarget; + buildConfigurationList = 32C09717E388BCD9DB9E513C /* Build configuration list for PBXNativeTarget "BundleX" */; + buildPhases = ( + B3BCC260A0A2F2F00458816F /* Sources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BundleX; + productName = BundleX; + productReference = 6023D61BF2C57E6AE09CE7A3 /* BundleX.bundle */; + productType = "com.apple.product-type.bundle"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 1B166EB49192B73A9DD8E108 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 1020; + }; + buildConfigurationList = 3DFC1105373EDB6483D4BC5D /* Build configuration list for PBXProject "AnotherProject" */; + compatibilityVersion = "Xcode 10.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + Base, + en, + ); + mainGroup = 4E8CFA4275C972686621210C; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 63A2D4898D974A06E85B07F8 /* BundleX */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + B3BCC260A0A2F2F00458816F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 011619A463B654F60012FC9E /* Test Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_ID_SUFFIX = .test; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = "Test Release"; + }; + 03418826FAC3BC1FAB207D05 /* Production Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = "Production Release"; + }; + 039F4FBE2C50C67BCD6BD67B /* Staging Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_ID_SUFFIX = .staging; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_VERSION = 5.0; + VALIDATE_PRODUCT = YES; + }; + name = "Staging Release"; + }; + 270E1D32776D2D196D435FDA /* Staging Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_ID_SUFFIX = .staging; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = "Staging Debug"; + }; + 49FA7F235A6CA1F941192151 /* Staging Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Staging Release"; + }; + 4D621C4C28C8614EA5D6ADC2 /* Production Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Production Debug"; + }; + 56ADF89C9058B2C25F6C80CE /* Staging Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Staging Debug"; + }; + 5790F0FBCBF55A0DF258AD6A /* Production Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = "Production Debug"; + }; + 5F14CE04E33ACD729A0EE6B6 /* Test Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Test Debug"; + }; + 9BD6CAD5463121A1C3FED138 /* Production Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Production Release"; + }; + C3231A91F004B1D0018146DB /* Test Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 60D6679FB526839EAFEA2EEE /* config.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + BUNDLE_ID_SUFFIX = .test; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + "DEBUG=1", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + }; + name = "Test Debug"; + }; + C7A4FCD4E277AD34B36E5185 /* Test Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Test Release"; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 32C09717E388BCD9DB9E513C /* Build configuration list for PBXNativeTarget "BundleX" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4D621C4C28C8614EA5D6ADC2 /* Production Debug */, + 9BD6CAD5463121A1C3FED138 /* Production Release */, + 56ADF89C9058B2C25F6C80CE /* Staging Debug */, + 49FA7F235A6CA1F941192151 /* Staging Release */, + 5F14CE04E33ACD729A0EE6B6 /* Test Debug */, + C7A4FCD4E277AD34B36E5185 /* Test Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = ""; + }; + 3DFC1105373EDB6483D4BC5D /* Build configuration list for PBXProject "AnotherProject" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 5790F0FBCBF55A0DF258AD6A /* Production Debug */, + 03418826FAC3BC1FAB207D05 /* Production Release */, + 270E1D32776D2D196D435FDA /* Staging Debug */, + 039F4FBE2C50C67BCD6BD67B /* Staging Release */, + C3231A91F004B1D0018146DB /* Test Debug */, + 011619A463B654F60012FC9E /* Test Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = "Production Debug"; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1B166EB49192B73A9DD8E108 /* Project object */; +} diff --git a/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..919434a6 --- /dev/null +++ b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Tests/Fixtures/TestProject/AnotherProject/AnotherProject.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Tests/Fixtures/TestProject/AnotherProject/project.yml b/Tests/Fixtures/TestProject/AnotherProject/project.yml new file mode 100644 index 00000000..a777563e --- /dev/null +++ b/Tests/Fixtures/TestProject/AnotherProject/project.yml @@ -0,0 +1,8 @@ +name: AnotherProject +include: [../environments.yml] +configFiles: + Test Debug: ../Configs/config.xcconfig +targets: + BundleX: + type: bundle + platform: iOS diff --git a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj index 5d48689b..6ca4fe9f 100644 --- a/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj +++ b/Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj @@ -122,6 +122,7 @@ E4D0F435405DABCB51C5B684 /* TestFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E43116070AFEF5D8C3A5A957 /* TestFramework.framework */; }; E5DD0AD6F7AE1DD4AF98B83E /* Localizable.stringsdict in Resources */ = {isa = PBXBuildFile; fileRef = 65C8D6D1DDC1512D396C07B7 /* Localizable.stringsdict */; }; E8A135F768448632F8D77C8F /* StandaloneAssets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3571E41E19A5AB8AAAB04109 /* StandaloneAssets.xcassets */; }; + F07FC32458F3193917261C15 /* BundleX.bundle in Copy Bundles to Resources directory */ = {isa = PBXBuildFile; fileRef = 45C12576F5AA694DD0CE2132 /* BundleX.bundle */; }; F5D71267BB5A326BDD69D532 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E55F45EACB0F382722D61C8D /* Assets.xcassets */; }; F6537CE373C94809E6653758 /* Headers in Headers */ = {isa = PBXBuildFile; fileRef = 2E1E747C7BC434ADB80CC269 /* Headers */; settings = {ATTRIBUTES = (Public, ); }; }; F7423E8738EECF04795C7601 /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3F6BCB5FEFB16F1BA368059 /* InterfaceController.swift */; }; @@ -317,6 +318,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + 32C3437B0218811108366142 /* Copy Bundles to Resources directory */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstSubfolderSpec = 7; + files = ( + F07FC32458F3193917261C15 /* BundleX.bundle in Copy Bundles to Resources directory */, + ); + name = "Copy Bundles to Resources directory"; + runOnlyForDeploymentPostprocessing = 0; + }; 6CB76DFA8662672C4245AF41 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -468,6 +479,7 @@ 3EF21DF245F66BEF5446AAEF /* Framework2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 40863AE6202CFCD0529D8438 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 41FC82ED1C4C3B7B3D7B2FB7 /* Framework.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Framework.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 45C12576F5AA694DD0CE2132 /* BundleX.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = BundleX.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 4BF4D16042A80576D259160C /* Model 3.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = "Model 3.xcdatamodel"; sourceTree = ""; }; 4D0BF47DF71A6DBA33ED23FD /* StaticLibrary_ObjC.a */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = archive.ar; path = StaticLibrary_ObjC.a; sourceTree = BUILT_PRODUCTS_DIR; }; 5116B3B58070BCD09F1487BA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -711,6 +723,7 @@ 2E1E747C7BC434ADB80CC269 /* Headers */, 6B1603BA83AA0C7B94E45168 /* ResourceFolder */, 6BBE762F36D94AB6FFBFE834 /* SomeFile */, + 79DC4A1E4D2E0D3A215179BC /* Bundles */, FC1515684236259C50A7747F /* Frameworks */, AC523591AC7BE9275003D2DB /* Products */, ); @@ -790,6 +803,14 @@ path = "App_watchOS Extension"; sourceTree = ""; }; + 79DC4A1E4D2E0D3A215179BC /* Bundles */ = { + isa = PBXGroup; + children = ( + 45C12576F5AA694DD0CE2132 /* BundleX.bundle */, + ); + name = Bundles; + sourceTree = ""; + }; 80C3A0E524EC1ABCB9149EA2 /* XPC Service */ = { isa = PBXGroup; children = ( @@ -1118,6 +1139,7 @@ buildPhases = ( 6F573D15DE1F149EF128C492 /* Sources */, 8508BA1B733839E314AF2853 /* Resources */, + 32C3437B0218811108366142 /* Copy Bundles to Resources directory */, 865AAD9909027AC34D1374EA /* CopyFiles */, 37182EC208DBF03DB1BAF452 /* Carthage */, 117840B4DBC04099F6779D00 /* Frameworks */, diff --git a/Tests/Fixtures/TestProject/Workspace.xcworkspace/contents.xcworkspacedata b/Tests/Fixtures/TestProject/Workspace.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..c4110399 --- /dev/null +++ b/Tests/Fixtures/TestProject/Workspace.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/Tests/Fixtures/TestProject/Workspace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Tests/Fixtures/TestProject/Workspace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/Tests/Fixtures/TestProject/Workspace.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Tests/Fixtures/TestProject/build.sh b/Tests/Fixtures/TestProject/build.sh index a1e22bc4..b6cb372a 100755 --- a/Tests/Fixtures/TestProject/build.sh +++ b/Tests/Fixtures/TestProject/build.sh @@ -4,10 +4,10 @@ set -e carthage bootstrap --cache-builds echo " ⚙️ Building iOS app" -xcodebuild -quiet -project Project.xcodeproj -scheme "App_iOS Test" -configuration "Test Debug" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" +xcodebuild -quiet -workspace Workspace.xcworkspace -scheme "App_iOS Test" -configuration "Test Debug" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" echo "✅ Successfully built iOS app" echo " ⚙️ Building macOS app" -xcodebuild -quiet -project Project.xcodeproj -scheme "App_macOS" -configuration "Test Debug" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" +xcodebuild -quiet -workspace Workspace.xcworkspace -scheme "App_macOS" -configuration "Test Debug" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO" echo "✅ Successfully built macOS app" diff --git a/Tests/Fixtures/TestProject/project.yml b/Tests/Fixtures/TestProject/project.yml index a7afa074..56a4c4b2 100644 --- a/Tests/Fixtures/TestProject/project.yml +++ b/Tests/Fixtures/TestProject/project.yml @@ -98,6 +98,7 @@ targets: - target: App_watchOS - target: iMessageApp - sdk: Contacts.framework + - bundle: BundleX.bundle scheme: testTargets: - App_iOS_Tests diff --git a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift index a1f2e43c..67fd353a 100644 --- a/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift +++ b/Tests/XcodeGenKitTests/ProjectGeneratorTests.swift @@ -381,6 +381,7 @@ class ProjectGeneratorTests: XCTestCase { // var expectedResourceFiles: [String: Set] = [:] + var expectedBundlesFiles: [String: Set] = [:] var expectedLinkedFiles: [String: Set] = [:] var expectedEmbeddedFrameworks: [String: Set] = [:] @@ -433,9 +434,11 @@ class ProjectGeneratorTests: XCTestCase { Dependency(type: .target, reference: iosFrameworkX.name /* , link: false */ ), Dependency(type: .framework, reference: "FrameworkX.framework" /* , link: false */ ), Dependency(type: .carthage(findFrameworks: false, linkType: .dynamic), reference: "CarthageZ"), + Dependency(type: .bundle, reference: "BundleA.bundle"), ] ) expectedResourceFiles[staticLibrary.name] = Set() + expectedBundlesFiles[staticLibrary.name] = Set() expectedLinkedFiles[staticLibrary.name] = Set([ iosFrameworkZ.filename, "FrameworkZ.framework", @@ -463,9 +466,13 @@ class ProjectGeneratorTests: XCTestCase { // Statically linked, so don't embed into test Dependency(type: .target, reference: staticLibrary.name), Dependency(type: .carthage(findFrameworks: false, linkType: .dynamic), reference: "CarthageB", embed: false), + Dependency(type: .bundle, reference: "BundleA.bundle"), ] ) expectedResourceFiles[iosFrameworkA.name] = Set() + expectedBundlesFiles[iosFrameworkA.name] = Set([ + "BundleA.bundle" + ]) expectedLinkedFiles[iosFrameworkA.name] = Set([ "FrameworkC.framework", iosFrameworkZ.filename, @@ -594,6 +601,8 @@ class ProjectGeneratorTests: XCTestCase { let resourcesPhases = pbxProject.resourcesBuildPhases.filter { buildPhases.contains($0) } let frameworkPhases = pbxProject.frameworksBuildPhases.filter { buildPhases.contains($0) } let copyFilesPhases = pbxProject.copyFilesBuildPhases.filter { buildPhases.contains($0) } + let embedFrameworkPhase = copyFilesPhases.first { $0.dstSubfolderSpec == .frameworks } + let copyBundlesPhase = copyFilesPhases.first { $0.dstSubfolderSpec == .resources } // All targets should have a compile sources phase, // except for the sticker pack one @@ -622,17 +631,23 @@ class ProjectGeneratorTests: XCTestCase { try expect(Set(linkFrameworks)) == expectedLinkedFiles } + var expectedCopyFilesPhasesCount = 0 // ensure only the right things are embedded, no more, no less - if let expectedEmbeddedFrameworks = expectedEmbeddedFrameworks[target.name] { - try expect(copyFilesPhases.count) == (expectedEmbeddedFrameworks.isEmpty ? 0 : 1) - if !expectedEmbeddedFrameworks.isEmpty { - let copyFiles = (copyFilesPhases[0].files ?? []) - .compactMap { $0.file?.nameOrPath } - try expect(Set(copyFiles)) == expectedEmbeddedFrameworks - } - } else { - try expect(copyFilesPhases.count) == 0 + if let expectedEmbeddedFrameworks = expectedEmbeddedFrameworks[target.name], !expectedEmbeddedFrameworks.isEmpty { + expectedCopyFilesPhasesCount += 1 + let copyFiles = (embedFrameworkPhase?.files ?? []) + .compactMap { $0.file?.nameOrPath } + try expect(Set(copyFiles)) == expectedEmbeddedFrameworks } + + if let expectedBundlesFiles = expectedBundlesFiles[target.name], + target.type != .staticLibrary && target.type != .dynamicLibrary { + expectedCopyFilesPhasesCount += 1 + let copyBundles = (copyBundlesPhase?.files ?? []) + .compactMap { $0.file?.nameOrPath } + try expect(Set(copyBundles)) == expectedBundlesFiles + } + try expect(copyFilesPhases.count) == expectedCopyFilesPhasesCount } } diff --git a/scripts/gen-fixtures.sh b/scripts/gen-fixtures.sh index e191a416..a3785436 100755 --- a/scripts/gen-fixtures.sh +++ b/scripts/gen-fixtures.sh @@ -1,6 +1,7 @@ #!/bin/bash set -e +swift run xcodegen --spec Tests/Fixtures/TestProject/AnotherProject/project.yml swift run xcodegen --spec Tests/Fixtures/TestProject/project.yml swift run xcodegen --spec Tests/Fixtures/CarthageProject/project.yml swift run xcodegen --spec Tests/Fixtures/SPM/project.yml