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

Fix #784 Swift Package Manager (Embed & Sign) for dynamic packages. #788

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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Next Version

#### Added
- Support Swift Package Manager (Embed & Sign/Embed Without Signing) for dynamic packages. [#788](https://github.com/yonaskolb/XcodeGen/pull/788)

#### Fixed
- Set `defaultConfigurationName` for every target which is defined in a project. [#787](https://github.com/yonaskolb/XcodeGen/pull/787)

Expand Down
8 changes: 8 additions & 0 deletions Sources/XcodeGenKit/PBXProjGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,14 @@ public class PBXProjGenerator {
)
dependencies.append(targetDependency)
}

if dependency.embed == true {
let embedFile = addObject(
PBXBuildFile(product: packageDependency,
settings: getEmbedSettings(dependency: dependency, codeSign: dependency.codeSign ?? true))
)
copyFrameworksReferences.append(embedFile)
}
case .bundle:
// Static and dynamic libraries can't copy resources
guard target.type != .staticLibrary && target.type != .dynamicLibrary else { break }
Expand Down
44 changes: 44 additions & 0 deletions Tests/Fixtures/SPM/SPM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

/* Begin PBXBuildFile section */
2DA7998902987953B119E4CE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26F7EFEE613987D1E1258A60 /* AppDelegate.swift */; };
3986ED6965842721C46C0452 /* SwiftRoaringDynamic in Frameworks */ = {isa = PBXBuildFile; productRef = DC73B269C8B0C0BF6912842C /* SwiftRoaringDynamic */; };
578E78BC3627CF48FB2CE129 /* App.xctestplan in Resources */ = {isa = PBXBuildFile; fileRef = A9601593D0AD02931266A4E5 /* App.xctestplan */; };
78E2E1F9F271C0C4CDA04BD9 /* StaticLibrary.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F7AFEF8ECCC678519EA643C /* StaticLibrary.a */; };
9C4AD0711D706FD3ED0E436D /* StaticLibrary.swift in Sources */ = {isa = PBXBuildFile; fileRef = 61C17B77601A9D1B7895AB42 /* StaticLibrary.swift */; };
B89EA0F3859878A1DCF7BAFD /* SwiftRoaringDynamic in Embed Frameworks */ = {isa = PBXBuildFile; productRef = DC73B269C8B0C0BF6912842C /* SwiftRoaringDynamic */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
CE46CBA5671B951B546C8673 /* Codability in Frameworks */ = {isa = PBXBuildFile; productRef = 16E6FE01D5BD99F78D4A17E2 /* Codability */; };
E368431019ABC696E4FFC0CF /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4E22B8BCC18A29EFE1DE3BE4 /* Assets.xcassets */; };
/* End PBXBuildFile section */
Expand All @@ -25,6 +27,20 @@
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
528B26CADD32E3F39B813BEE /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
B89EA0F3859878A1DCF7BAFD /* SwiftRoaringDynamic in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
097F2DB5622B591E21BC3C73 /* App.app */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = wrapper.application; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; };
26F7EFEE613987D1E1258A60 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand All @@ -42,6 +58,7 @@
buildActionMask = 2147483647;
files = (
CE46CBA5671B951B546C8673 /* Codability in Frameworks */,
3986ED6965842721C46C0452 /* SwiftRoaringDynamic in Frameworks */,
78E2E1F9F271C0C4CDA04BD9 /* StaticLibrary.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -109,10 +126,12 @@
);
dependencies = (
D85FFB99444DD260A72DDDA7 /* PBXTargetDependency */,
DDD17C561AD5065DF4FA4072 /* PBXTargetDependency */,
);
name = StaticLibrary;
packageProductDependencies = (
AF233B61592982A7F6431FC6 /* Codability */,
C816AEB28ED71C3C47F31B98 /* SwiftRoaringDynamic */,
);
productName = StaticLibrary;
productReference = 3F7AFEF8ECCC678519EA643C /* StaticLibrary.a */;
Expand All @@ -125,6 +144,7 @@
460F52476B5219D2CDA494C2 /* Sources */,
F77D37B94534F63D9B461F30 /* Resources */,
796E7DE873F16699BD82FFEA /* Frameworks */,
528B26CADD32E3F39B813BEE /* Embed Frameworks */,
);
buildRules = (
);
Expand All @@ -134,6 +154,7 @@
name = App;
packageProductDependencies = (
16E6FE01D5BD99F78D4A17E2 /* Codability */,
DC73B269C8B0C0BF6912842C /* SwiftRoaringDynamic */,
);
productName = App;
productReference = 097F2DB5622B591E21BC3C73 /* App.app */;
Expand All @@ -160,6 +181,7 @@
mainGroup = 218F6C96DF9E182F526258CF;
packageReferences = (
5BA91390AE78D2EE15C60091 /* XCRemoteSwiftPackageReference "Codability" */,
E3887F3CB2C069E70D98092F /* XCRemoteSwiftPackageReference "SwiftRoaring" */,
);
projectDirPath = "";
projectRoot = "";
Expand Down Expand Up @@ -230,6 +252,10 @@
isa = PBXTargetDependency;
productRef = AF233B61592982A7F6431FC6 /* Codability */;
};
DDD17C561AD5065DF4FA4072 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = C816AEB28ED71C3C47F31B98 /* SwiftRoaringDynamic */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
Expand Down Expand Up @@ -448,6 +474,14 @@
minimumVersion = 0.2.1;
};
};
E3887F3CB2C069E70D98092F /* XCRemoteSwiftPackageReference "SwiftRoaring" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/piotte13/SwiftRoaring";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.4;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand All @@ -461,6 +495,16 @@
package = 5BA91390AE78D2EE15C60091 /* XCRemoteSwiftPackageReference "Codability" */;
productName = Codability;
};
C816AEB28ED71C3C47F31B98 /* SwiftRoaringDynamic */ = {
isa = XCSwiftPackageProductDependency;
package = E3887F3CB2C069E70D98092F /* XCRemoteSwiftPackageReference "SwiftRoaring" */;
productName = SwiftRoaringDynamic;
};
DC73B269C8B0C0BF6912842C /* SwiftRoaringDynamic */ = {
isa = XCSwiftPackageProductDependency;
package = E3887F3CB2C069E70D98092F /* XCRemoteSwiftPackageReference "SwiftRoaring" */;
productName = SwiftRoaringDynamic;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = F7B09D77DB7447B17DCDA3C4 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,6 @@
"version": "3.1.5"
}
},
{
"package": "Shell",
"repositoryURL": "https://github.com/tuist/Shell",
"state": {
"branch": null,
"revision": "d38121f89401db902b0d0bfc30b987e2c84c254e",
"version": "2.0.3"
}
},
{
"package": "Spectre",
"repositoryURL": "https://github.com/kylef/Spectre.git",
Expand All @@ -69,17 +60,35 @@
"repositoryURL": "https://github.com/jakeheis/SwiftCLI.git",
"state": {
"branch": null,
"revision": "5318c37d3cacc8780f50b87a8840a6774320ebdf",
"version": "5.2.2"
"revision": "c72c4564f8c0a24700a59824880536aca45a4cae",
"version": "6.0.1"
}
},
{
"package": "SwiftRoaring",
"repositoryURL": "https://github.com/piotte13/SwiftRoaring",
"state": {
"branch": null,
"revision": "9104cf3f35e7a38c9fb633084c7adb63a9f27f8b",
"version": "1.0.4"
}
},
{
"package": "Version",
"repositoryURL": "https://github.com/mxcl/Version",
"state": {
"branch": null,
"revision": "a94b48f36763c05629fc102837398505032dead9",
"version": "2.0.0"
}
},
{
"package": "XcodeProj",
"repositoryURL": "https://github.com/tuist/xcodeproj.git",
"repositoryURL": "https://github.com/tuist/XcodeProj.git",
"state": {
"branch": null,
"revision": "aefcbf59cea5b0831837ed2f385e6dfd80d82cc9",
"version": "7.1.0"
"revision": "f32704e01d2752bdc17cde3963bee4256c1f4df4",
"version": "7.8.0"
}
},
{
Expand Down
8 changes: 8 additions & 0 deletions Tests/Fixtures/SPM/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ packages:
Codability:
url: https://github.com/yonaskolb/Codability
majorVersion: 0.2.1
SwiftRoaring:
url: https://github.com/piotte13/SwiftRoaring
majorVersion: 1.0.4
localPackages:
- ../../.. #XcodeGen itself
targets:
Expand All @@ -13,10 +16,15 @@ targets:
scheme: {}
dependencies:
- package: Codability
- package: SwiftRoaring
product: SwiftRoaringDynamic
embed: true
- target: StaticLibrary
StaticLibrary:
type: library.static
platform: iOS
sources: StaticLibrary
dependencies:
- package: Codability
- package: SwiftRoaring
product: SwiftRoaringDynamic