Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow skipping compile source build phase for bundles #878

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
- Optimize simplifying paths for faster project generation. [#857](https://github.com/yonaskolb/XcodeGen/pull/857) @akkyie
- Fixed issue where wrapper folders may not include correctly in the generated project. [#862](https://github.com/yonaskolb/XcodeGen/pull/862) @KhaosT
- Compile `xcmappingmodel` files instead of copying bundle resources. [#834](https://github.com/yonaskolb/XcodeGen/pull/834) @jcolicchio
- Fixed issue where `Complie Sources` build phase is generated for resource bundles even when they have no files to compile [#878](https://github.com/yonaskolb/XcodeGen/pull/878) @nkukushkin

## 2.15.1

Expand Down
4 changes: 2 additions & 2 deletions Sources/ProjectSpec/XCProjExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ extension PBXProductType {

public var canSkipCompileSourcesBuildPhase: Bool {
switch self {
case .stickerPack, .messagesApplication:
// Sticker packs and simple messages applications without sources should not include a
case .bundle, .stickerPack, .messagesApplication:
// Bundles, sticker packs and simple messages applications without sources should not include a
// compile sources build phase. Doing so can cause Xcode to produce an error on build.
return true
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
isa = PBXNativeTarget;
buildConfigurationList = 32C09717E388BCD9DB9E513C /* Build configuration list for PBXNativeTarget "BundleX" */;
buildPhases = (
B3BCC260A0A2F2F00458816F /* Sources */,
);
buildRules = (
);
Expand Down Expand Up @@ -100,13 +99,6 @@
/* End PBXProject section */

/* Begin PBXSourcesBuildPhase section */
B3BCC260A0A2F2F00458816F /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
F08051CAC5E72EEEB8FB447B /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down
6 changes: 4 additions & 2 deletions Tests/XcodeGenKitTests/ProjectGeneratorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -719,9 +719,11 @@ class ProjectGeneratorTests: XCTestCase {
let copyBundlesPhase = copyFilesPhases.first { $0.dstSubfolderSpec == .resources }

// All targets should have a compile sources phase,
// except for the sticker pack one
// except for the resourceBundle and sticker pack one
let targetsGeneratingSourcePhases = targets
.filter { ![.bundle, .stickerPack].contains($0.type) }
let sourcesPhases = pbxProject.sourcesBuildPhases
try expect(sourcesPhases.count) == targets.count - 1
try expect(sourcesPhases.count) == targetsGeneratingSourcePhases.count

// ensure only the right resources are copied, no more, no less
if let expectedResourceFiles = expectedResourceFiles[target.name] {
Expand Down