Skip to content

Commit

Permalink
Support for swiftcrossimport folders (#1317)
Browse files Browse the repository at this point in the history
* Naive support for swiftcrossimport

* Update SourceGenerator.swift

* Add changelog entry

* Update CHANGELOG.md

* Add test fixture

* Check-in generated diffs
  • Loading branch information
Iron-Ham committed Jan 25, 2023
1 parent 9551979 commit 366981b
Show file tree
Hide file tree
Showing 10 changed files with 885 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Changed

- Renamed build phase `Embed App Extensions` to `Embed Foundation Extensions` to fix Xcode 14 warning #1310 @casperriboe
- Added support for `swiftcrossimport` folders. #1317 @Iron-Ham

### Fixed

Expand Down
7 changes: 7 additions & 0 deletions Sources/XcodeGenKit/SourceGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ class SourceGenerator {
subpath: "include/$(PRODUCT_NAME)",
phaseOrder: .preCompile
))
case "swiftcrossimport":
guard targetType == .framework else { return nil }
return .copyFiles(BuildPhaseSpec.CopyFilesSettings(
destination: .productsDirectory,
subpath: "$(PRODUCT_NAME).framework/Modules",
phaseOrder: .preCompile
))
default:
return .resources
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/XcodeGenKit/XCProjExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ extension Xcode {
// cases that aren't handled (yet) in XcodeProj.
case ("appex", .extensionKitExtension):
return "wrapper.extensionkit-extension"
case ("swiftcrossimport", _):
return "wrapper.swiftcrossimport"
default:
// fallback to XcodeProj defaults
return Xcode.filetype(extension: fileExtension)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
%YAML 1.2
---
version: 1
modules:
- name: _CrossOverlayFramework_Framework
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import Foundation

public struct FrameworkStruct {

public init() {}
}
24 changes: 24 additions & 0 deletions Tests/Fixtures/TestProject/CrossOverlayFramework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.2</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// MyFramework.h
// MyFramework
//
// Created by Yonas Kolb on 21/7/17.
// Copyright © 2017 Yonas Kolb. All rights reserved.
//


Empty file.
830 changes: 823 additions & 7 deletions Tests/Fixtures/TestProject/Project.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions Tests/Fixtures/TestProject/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,14 @@ targets:
- sdk: Platforms/iPhoneOS.platform/Developer/Library/Frameworks/XCTest.framework
root: DEVELOPER_DIR

CrossOverlayFramework:
type: framework
platform: [iOS, tvOS, watchOS, macOS]
sources:
- path: CrossOverlayFramework
excludes:
- "*.xcodeproj"

App_iOS_Tests:
type: bundle.unit-test
platform: iOS
Expand Down

0 comments on commit 366981b

Please sign in to comment.