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

Don't add unnecessary headers build phase #118

Merged
merged 1 commit into from
Oct 31, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Fixtures/TestProject/Project.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -295,18 +295,6 @@
BF3515549503 /* MyFramework.h in Headers */,
);
};
HBP783122801 /* Frameworks */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
};
HBP825232101 /* Frameworks */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
);
};
/* End PBXHeadersBuildPhase section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -388,7 +376,6 @@
buildPhases = (
SBP783122801 /* Sources */,
RBP783122801 /* Resources */,
HBP783122801 /* Headers */,
);
buildRules = (
);
Expand All @@ -405,7 +392,6 @@
buildPhases = (
SBP825232101 /* Sources */,
RBP825232101 /* Resources */,
HBP825232101 /* Headers */,
FBP825232101 /* Frameworks */,
CFBP64939301 /* CopyFiles */,
SSBP81062201 /* Carthage */,
Expand Down
8 changes: 5 additions & 3 deletions Sources/XcodeGenKit/PBXProjGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,11 @@ public class PBXProjGenerator {
addObject(resourcesBuildPhase)
buildPhases.append(resourcesBuildPhase.reference)

let headersBuildPhase = PBXHeadersBuildPhase(reference: generateUUID(PBXHeadersBuildPhase.self, target.name), files: getBuildFilesForPhase(.headers))
addObject(headersBuildPhase)
buildPhases.append(headersBuildPhase.reference)
if target.type == .framework || target.type == .dynamicLibrary {
let headersBuildPhase = PBXHeadersBuildPhase(reference: generateUUID(PBXHeadersBuildPhase.self, target.name), files: getBuildFilesForPhase(.headers))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also only create this if getBuildFilesForPhase here returns a non-empty array?

Copy link
Owner

@yonaskolb yonaskolb Oct 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this check could be added though the same would apply to the sources and resources build phase. I had it like this originally incase people wanted to easily add files to these build phases in Xcode (that's assuming they are only generating once and then checking in the project file)
In either case it's not something we have to cover in this PR

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah makes sense, I guess for some of these it's just preference, since in our all swift project we'll never need this build phase.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think the empty ones could be removed

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been done in #149

addObject(headersBuildPhase)
buildPhases.append(headersBuildPhase.reference)
}

if !targetFrameworkBuildFiles.isEmpty {

Expand Down