-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Support Module aliasing in SwiftPM #4023
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
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ffed84c
Support Module aliasing in SwiftPM
elsh 0c6a778
Update availability
elsh 0ca839d
Update
elsh 7c8faa5
Update loops
elsh eeff676
Allow null value for moduleAliases in Json parsing
elsh c6d683b
Updates
elsh 88df4aa
Merge remote-tracking branch 'origin/main' into es-mod
elsh 73e4f2e
Merge branch 'main' into es-mod
elsh 8d7bde9
Update tests
elsh e1a9bf4
Updates
elsh 438be55
Add doc comments
elsh d9f8a67
Add xctasserts for non-macOS platforms
elsh 56d7814
cleanup
elsh 2d6657e
Fix typo
elsh 954bb2b
Add module aliasing fixtures and functional tests
elsh 4993562
Update naming
elsh 54903f8
Retry naming paths
elsh e657437
Fix dir name
elsh 7404963
Add a compiler version check to tests
elsh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
Fixtures/Miscellaneous/ModuleAliasing/DirectDeps/AppPkg/Package.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// swift-tools-version:999.0 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "AppPkg", | ||
platforms: [ | ||
.macOS(.v10_12), | ||
.iOS(.v10), | ||
.tvOS(.v11), | ||
.watchOS(.v5) | ||
], | ||
dependencies: [ | ||
.package(url: "../GamePkg", from: "1.0.0"), | ||
], | ||
targets: [ | ||
.executableTarget( | ||
name: "App", | ||
dependencies: [ | ||
"Utils", | ||
.product(name: "Utils", | ||
package: "GamePkg", | ||
moduleAliases: ["Utils": "GameUtils"]) | ||
], | ||
path: "./Sources/App"), | ||
.target( | ||
name: "Utils", | ||
dependencies: [], | ||
path: "./Sources/Utils" | ||
) | ||
] | ||
) | ||
|
17 changes: 17 additions & 0 deletions
17
Fixtures/Miscellaneous/ModuleAliasing/DirectDeps/AppPkg/Sources/App/main.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
This source file is part of the Swift.org open source project | ||
|
||
Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See http://swift.org/LICENSE.txt for license information | ||
See http://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
*/ | ||
|
||
import Utils | ||
import GameUtils | ||
|
||
Utils.echoModule() | ||
|
||
let level = LevelDetector.detect(for: "TestUser") | ||
print(level) |
13 changes: 13 additions & 0 deletions
13
Fixtures/Miscellaneous/ModuleAliasing/DirectDeps/AppPkg/Sources/Utils/FileUtils.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
This source file is part of the Swift.org open source project | ||
|
||
Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See http://swift.org/LICENSE.txt for license information | ||
See http://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
*/ | ||
|
||
public func echoModule() { | ||
print("Utils") | ||
} |
14 changes: 14 additions & 0 deletions
14
Fixtures/Miscellaneous/ModuleAliasing/DirectDeps/GamePkg/Package.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// swift-tools-version:5.5 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "GamePkg", | ||
products: [ | ||
.library(name: "Game", targets: ["Game"]), | ||
.library(name: "Utils", targets: ["Utils"]), | ||
], | ||
targets: [ | ||
.target(name: "Game", dependencies: ["Utils"]), | ||
.target(name: "Utils", dependencies: []), | ||
] | ||
) |
22 changes: 22 additions & 0 deletions
22
Fixtures/Miscellaneous/ModuleAliasing/DirectDeps/GamePkg/Sources/Game/FileGame.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
This source file is part of the Swift.org open source project | ||
|
||
Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See http://swift.org/LICENSE.txt for license information | ||
See http://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
*/ | ||
|
||
import Utils | ||
|
||
public struct Game: Equatable { | ||
public var levels: [LevelDetector] | ||
|
||
public static func startGame(for user: String) -> Int { | ||
if user.isEmpty { | ||
return -1 | ||
} | ||
return LevelDetector.detect(for: user) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
Fixtures/Miscellaneous/ModuleAliasing/DirectDeps/GamePkg/Sources/Utils/FileUtils.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
This source file is part of the Swift.org open source project | ||
|
||
Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See http://swift.org/LICENSE.txt for license information | ||
See http://swift.org/CONTRIBUTORS.txt for Swift project authors | ||
*/ | ||
|
||
public struct LevelDetector: Equatable { | ||
public static func detect(for user: String) -> Int { | ||
return user.count | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.