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

Use module aliasing to solve build error while using original JPEG Swift package #116

Merged
merged 3 commits into from Apr 12, 2024
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
5 changes: 3 additions & 2 deletions .github/workflows/build-run-tests-macos.yml
Expand Up @@ -12,8 +12,9 @@ on:
jobs:
build:

runs-on: macOS-12 # used to be macos-latest
# look https://github.com/actions/runner-images/issues/6384
runs-on: macOS-13 # used to be macos-latest
# look https://github.com/actions/runner-images/issues/6384 for info
# why it was changed from macos-latest to macOS-12

steps:
- uses: actions/checkout@v3
Expand Down
16 changes: 8 additions & 8 deletions Package.resolved
Expand Up @@ -3,16 +3,16 @@
{
"identity" : "jpeg",
"kind" : "remoteSourceControl",
"location" : "https://github.com/valeriyvan/jpeg.git",
"location" : "https://github.com/tayloraswift/jpeg.git",
"state" : {
"revision" : "6ab5fffa49626116ff6b46510fe9828b71b708af",
"version" : "1.0.2"
"branch" : "master",
"revision" : "fc21d193b85ad8593b0a894b1dec9bef56254058"
}
},
{
"identity" : "swift-algorithms",
"kind" : "remoteSourceControl",
"location" : "git@github.com:apple/swift-algorithms.git",
"location" : "https://github.com/apple/swift-algorithms.git",
"state" : {
"revision" : "b14b7f4c528c942f121c8b860b9410b2bf57825e",
"version" : "1.0.0"
Expand All @@ -21,7 +21,7 @@
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "git@github.com:apple/swift-argument-parser.git",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "9f39744e025c7d377987f30b03770805dcb0bcd1",
"version" : "1.1.4"
Expand All @@ -39,7 +39,7 @@
{
"identity" : "swift-png",
"kind" : "remoteSourceControl",
"location" : "https://github.com/kelvin13/swift-png.git",
"location" : "https://github.com/tayloraswift/swift-png.git",
"state" : {
"revision" : "075dfb248ae327822635370e9d4f94a5d3fe93b2",
"version" : "4.0.2"
Expand All @@ -48,7 +48,7 @@
{
"identity" : "swift-snapshot-testing",
"kind" : "remoteSourceControl",
"location" : "git@github.com:pointfreeco/swift-snapshot-testing.git",
"location" : "https://github.com/pointfreeco/swift-snapshot-testing.git",
"state" : {
"revision" : "696b86a6d151578bca7c1a2a3ed419a5f834d40f",
"version" : "1.13.0"
Expand All @@ -66,7 +66,7 @@
{
"identity" : "swiftlintplugin",
"kind" : "remoteSourceControl",
"location" : "git@github.com:lukepistrol/SwiftLintPlugin.git",
"location" : "https://github.com/lukepistrol/SwiftLintPlugin.git",
"state" : {
"revision" : "67d09110cc967b9d393a5313b3b21c1b0be59adb",
"version" : "0.0.4"
Expand Down
11 changes: 8 additions & 3 deletions Package.swift
Expand Up @@ -3,8 +3,8 @@
import PackageDescription

var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/kelvin13/swift-png.git", from: "4.0.2"),
.package(url: "https://github.com/valeriyvan/jpeg.git", from: "1.0.2"),
.package(url: "https://github.com/tayloraswift/swift-png.git", from: "4.0.2"), // try upgrade to latest 4.4.1
.package(url: "https://github.com/tayloraswift/jpeg.git", revision: "fc21d193b85ad8593b0a894b1dec9bef56254058"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.13.0"),
.package(url: "https://github.com/apple/swift-algorithms.git", from: "1.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.1.4"),
Expand Down Expand Up @@ -53,7 +53,12 @@ let package = Package(
"Geometrize",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
.product(name: "PNG", package: "swift-png"),
.product(name: "JPEG", package: "jpeg")
.product(name: "JPEG", package: "jpeg", moduleAliases: ["JPEG": "SwiftJPEG"])
// alias solves build error
// error: multiple products named 'unit-test' in: 'jpeg' (at '****/jpeg'), 'swift-png' (from 'https://github.com/tayloraswift/swift-png.git')
// https://github.com/tayloraswift/jpeg/issues/4
// https://forums.swift.org/t/product-names-from-different-packages-collide-if-packages-are-used-as-dependencies-in-same-package/60178
// Uses Swift 5.7 feature https://github.com/apple/swift-evolution/blob/main/proposals/0339-module-aliasing-for-disambiguation.md
],
plugins: plugins
),
Expand Down