diff --git a/Sources/SkipBuild/Commands/UpgradeCommand.swift b/Sources/SkipBuild/Commands/UpgradeCommand.swift index 595308f1..98ffffd5 100644 --- a/Sources/SkipBuild/Commands/UpgradeCommand.swift +++ b/Sources/SkipBuild/Commands/UpgradeCommand.swift @@ -51,12 +51,12 @@ struct UpgradeCommand: MessageCommand, ToolOptionsCommand { } extension SkipCommand { - /// Checks the https://source.skip.tools/skip/releases.atom page and returns the semantic version contained in the title of the first entry (i.e., the latest release of Skip) + /// Checks the https://github.com/skiptools/skip/releases.atom page and returns the semantic version contained in the title of the first entry (i.e., the latest release of Skip) func checkSkipUpdates(with out: MessageQueue) async -> String? { try? await outputOptions.monitor(with: out, "Check Skip Updates", resultHandler: { result in (result, MessageBlock(status: result?.messageStatusAny, "Check Skip Updates: \((try? result?.get()) ?? "?")")) }) { loggingHandler in - try await fetchLatestRelease(from: URL(string: "https://source.skip.tools/skip/releases.atom")!) + try await fetchLatestRelease(from: URL(string: "https://github.com/skiptools/skip/releases.atom")!) }.get() } diff --git a/Sources/SkipBuild/Commands/VerifyCommand.swift b/Sources/SkipBuild/Commands/VerifyCommand.swift index 9a0ed523..908920e6 100644 --- a/Sources/SkipBuild/Commands/VerifyCommand.swift +++ b/Sources/SkipBuild/Commands/VerifyCommand.swift @@ -151,6 +151,12 @@ struct VerifyCommand: SkipCommand, StreamingCommand, ProjectCommand, ToolOptions } +/// The host and organization for Skip repositories, to which package dependency URLs should refer. +let skipRepositoryHost = "github.com/skiptools" + +/// The legacy Skip repository host, which redirects to `skipRepositoryHost`. +let legacySkipRepositoryHost = "source.skip.tools" + struct NoResultOutputError : LocalizedError { var errorDescription: String? } @@ -227,6 +233,22 @@ extension ToolOptionsCommand where Self : StreamingCommand { } } + // check that the Package.swift references the current Skip repository host rather than the legacy redirecting host + let packageSwiftURL = URL(fileURLWithPath: "Package.swift", isDirectory: false, relativeTo: projectFolderURL) + await verifyFile(packageSwiftURL, title: "Check Skip repository URLs") { title, url in + let contents = try String(contentsOf: url, encoding: .utf8) + if !contents.contains(legacySkipRepositoryHost) { + return CheckStatus(status: .pass, message: title) + } + if autofix { + let updated = contents.replacingOccurrences(of: legacySkipRepositoryHost, with: skipRepositoryHost) + try updated.write(to: url, atomically: false, encoding: .utf8) + return CheckStatus(status: .warn, message: "\(title): updated \(legacySkipRepositoryHost) references to \(skipRepositoryHost)") + } else { + return CheckStatus(status: .fail, message: "\(title): Package.swift references \(legacySkipRepositoryHost), which should be \(skipRepositoryHost): run skip verify --fix") + } + } + let packageJSON = try await parseSwiftPackage(with: out, at: projectPath) let packageName = packageJSON.name diff --git a/Sources/SkipBuild/SkipCommand.swift b/Sources/SkipBuild/SkipCommand.swift index 6693b141..22394cec 100644 --- a/Sources/SkipBuild/SkipCommand.swift +++ b/Sources/SkipBuild/SkipCommand.swift @@ -1300,7 +1300,7 @@ public struct PackageResolved : Hashable, Decodable { { "identity" : "skip", "kind" : "remoteSourceControl", - "location" : "https://source.skip.tools/skip.git", + "location" : "https://github.com/skiptools/skip.git", "state" : { "revision" : "18aba366924bf622d047b97f3249560e1471cc25", "version" : "1.5.21" diff --git a/Sources/SkipBuild/SkipProject.swift b/Sources/SkipBuild/SkipProject.swift index 4f2160d3..d452a741 100644 --- a/Sources/SkipBuild/SkipProject.swift +++ b/Sources/SkipBuild/SkipProject.swift @@ -232,7 +232,7 @@ class FrameworkProjectLayout { """ var packageDependencies: [String] = [ - ".package(url: \"https://source.skip.tools/skip.git\", from: \"\(skipPackageVersion)\")" + ".package(url: \"https://github.com/skiptools/skip.git\", from: \"\(skipPackageVersion)\")" ] for moduleIndex in modules.indices { @@ -1347,7 +1347,7 @@ struct TestData : Codable, Hashable { var skipModuleDeps: [String] = [] for modDep in modDeps { if let repoName = modDep.repositoryName { - let repoURL = modDep.organizationName != nil ? "https://github.com/\(modDep.organizationName!)" : "https://source.skip.tools" + let repoURL = modDep.organizationName != nil ? "https://github.com/\(modDep.organizationName!)" : "https://github.com/skiptools" var packDep = ".package(url: \"\(repoURL)/\(repoName).git\", " var depVersion = modDep.repositoryVersion ?? "1.0.0" // "1.2.3"..<"1.2.6" @@ -1441,7 +1441,7 @@ struct TestData : Codable, Hashable { packageSource += """ if Context.environment["SKIP_BRIDGE"] ?? "0" != "0" { - package.dependencies += [.package(url: "https://source.skip.tools/skip-bridge.git", "0.0.0"..<"2.0.0")] + package.dependencies += [.package(url: "https://github.com/skiptools/skip-bridge.git", "0.0.0"..<"2.0.0")] package.targets.forEach({ target in target.dependencies += [.product(name: "SkipBridge", package: "skip-bridge")] }) @@ -1483,7 +1483,7 @@ struct TestData : Codable, Hashable { // remove the Skip package dependencies package.dependencies.removeAll(where: { dependency in if case .sourceControl(_, let url, _) = dependency.kind { - return url.hasPrefix("https://source.skip.dev/") || url.hasPrefix("https://source.skip.tools/") + return url.hasPrefix("https://source.skip.dev/") || url.hasPrefix("https://source.skip.tools/") || url.hasPrefix("https://github.com/skiptools/") } else { return false } diff --git a/Tests/SkipBuildTests/SkipCommandTests.swift b/Tests/SkipBuildTests/SkipCommandTests.swift index 3467247d..bf1343b6 100644 --- a/Tests/SkipBuildTests/SkipCommandTests.swift +++ b/Tests/SkipBuildTests/SkipCommandTests.swift @@ -60,8 +60,8 @@ final class SkipCommandTests: XCTestCase { .library(name: "SomeModule", type: .dynamic, targets: ["SomeModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-foundation.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-foundation.git", from: "1.0.0") ], targets: [ .target(name: "SomeModule", dependencies: [ @@ -99,7 +99,7 @@ final class SkipCommandTests: XCTestCase { // remove the Skip package dependencies package.dependencies.removeAll(where: { dependency in if case .sourceControl(_, let url, _) = dependency.kind { - return url.hasPrefix("https://source.skip.dev/") || url.hasPrefix("https://source.skip.tools/") + return url.hasPrefix("https://source.skip.dev/") || url.hasPrefix("https://source.skip.tools/") || url.hasPrefix("https://github.com/skiptools/") } else { return false } @@ -141,8 +141,8 @@ final class SkipCommandTests: XCTestCase { .library(name: "TeenyModule", type: .dynamic, targets: ["TeenyModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-foundation.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-foundation.git", from: "1.0.0") ], targets: [ .target(name: "TeenyModule", dependencies: [ @@ -229,8 +229,8 @@ final class SkipCommandTests: XCTestCase { .library(name: "SomeModule", type: .dynamic, targets: ["SomeModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-foundation.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-foundation.git", from: "1.0.0") ], targets: [ .target(name: "SomeModule", dependencies: [ @@ -292,8 +292,8 @@ final class SkipCommandTests: XCTestCase { .library(name: "FreeModule", type: .dynamic, targets: ["FreeModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-foundation.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-foundation.git", from: "1.0.0") ], targets: [ .target(name: "FreeModule", dependencies: [ @@ -360,8 +360,8 @@ final class SkipCommandTests: XCTestCase { .library(name: "BridgedModule", type: .dynamic, targets: ["BridgedModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-foundation.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-foundation.git", from: "1.0.0") ], targets: [ .target(name: "BridgedModule", dependencies: [ @@ -375,7 +375,7 @@ final class SkipCommandTests: XCTestCase { ) if Context.environment["SKIP_BRIDGE"] ?? "0" != "0" { - package.dependencies += [.package(url: "https://source.skip.tools/skip-bridge.git", "0.0.0"..<"2.0.0")] + package.dependencies += [.package(url: "https://github.com/skiptools/skip-bridge.git", "0.0.0"..<"2.0.0")] package.targets.forEach({ target in target.dependencies += [.product(name: "SkipBridge", package: "skip-bridge")] }) @@ -797,8 +797,8 @@ final class SkipCommandTests: XCTestCase { .library(name: "SomeModule", type: .dynamic, targets: ["SomeModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-fuse.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-fuse.git", from: "1.0.0") ], targets: [ .target(name: "SomeModule", dependencies: [ @@ -894,8 +894,8 @@ final class SkipCommandTests: XCTestCase { .library(name: "SomeModule", type: .dynamic, targets: ["SomeModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-fuse.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-fuse.git", from: "1.0.0") ], targets: [ .target(name: "SomeModule", dependencies: [ @@ -1065,10 +1065,10 @@ final class SkipCommandTests: XCTestCase { .library(name: "ModelModule", type: .dynamic, targets: ["ModelModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-ui.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-fuse.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-model.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-ui.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-fuse.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-model.git", from: "1.0.0") ], targets: [ .target(name: "AppModule", dependencies: [ @@ -1240,10 +1240,10 @@ final class SkipCommandTests: XCTestCase { .library(name: "ModelModule", type: .dynamic, targets: ["ModelModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-fuse-ui.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-fuse.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-model.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-fuse-ui.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-fuse.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-model.git", from: "1.0.0") ], targets: [ .target(name: "AppModule", dependencies: [ @@ -1355,8 +1355,8 @@ final class SkipCommandTests: XCTestCase { .library(name: "AppModule", type: .dynamic, targets: ["AppModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-fuse-ui.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-fuse-ui.git", from: "1.0.0") ], targets: [ .target(name: "AppModule", dependencies: [ @@ -1488,10 +1488,10 @@ final class SkipCommandTests: XCTestCase { .library(name: "FreeAppModel", type: .dynamic, targets: ["FreeAppModel"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), .package(url: "https://github.com/appfair/appfair-app.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-foundation.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-model.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip-foundation.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-model.git", from: "1.0.0") ], targets: [ .target(name: "FreeApp", dependencies: [ @@ -1626,10 +1626,10 @@ final class SkipCommandTests: XCTestCase { .library(name: "BottomModule", type: .dynamic, targets: ["BottomModule"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-ui.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-model.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-foundation.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-ui.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-model.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-foundation.git", from: "1.0.0") ], targets: [ .target(name: "TopModule", dependencies: [ @@ -1683,7 +1683,7 @@ final class SkipCommandTests: XCTestCase { // remove the Skip package dependencies package.dependencies.removeAll(where: { dependency in if case .sourceControl(_, let url, _) = dependency.kind { - return url.hasPrefix("https://source.skip.dev/") || url.hasPrefix("https://source.skip.tools/") + return url.hasPrefix("https://source.skip.dev/") || url.hasPrefix("https://source.skip.tools/") || url.hasPrefix("https://github.com/skiptools/") } else { return false } @@ -1792,10 +1792,10 @@ final class SkipCommandTests: XCTestCase { .library(name: "M5", type: .dynamic, targets: ["M5"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-ui.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-model.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-foundation.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-ui.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-model.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-foundation.git", from: "1.0.0") ], targets: [ .target(name: "M1", dependencies: [ @@ -1927,10 +1927,10 @@ final class SkipCommandTests: XCTestCase { .library(name: "M5", type: .dynamic, targets: ["M5"]), ], dependencies: [ - .package(url: "https://source.skip.tools/skip.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-ui.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-model.git", from: "1.0.0"), - .package(url: "https://source.skip.tools/skip-fuse.git", from: "1.0.0") + .package(url: "https://github.com/skiptools/skip.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-ui.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-model.git", from: "1.0.0"), + .package(url: "https://github.com/skiptools/skip-fuse.git", from: "1.0.0") ], targets: [ .target(name: "M1", dependencies: [ diff --git a/scripts/release_skip.sh b/scripts/release_skip.sh index cbc9deb6..f2a6b6c0 100755 --- a/scripts/release_skip.sh +++ b/scripts/release_skip.sh @@ -128,16 +128,16 @@ PLUGIN_LINUX_CHECKSUM=$(shasum -a 256 ${RELSTAGING}/${PLUGIN_LINUX_ZIP} | cut -f # make a release of the skip command cd ${SKIPPKGDIR} -ARTIFACT_MACOS_URL="https://source.skip.tools/skip/releases/download/${SKIP_VERSION}/${PLUGIN_MACOS_ZIP}" +ARTIFACT_MACOS_URL="https://github.com/skiptools/skip/releases/download/${SKIP_VERSION}/${PLUGIN_MACOS_ZIP}" sed -I '' 's;.binaryTarget(name: "'${ARTIFACT}'", url:.*'${PLUGIN_MACOS_ZIP}'.*);.binaryTarget(name: "'${ARTIFACT}'", url: "'${ARTIFACT_MACOS_URL}'", checksum: "'${PLUGIN_MACOS_CHECKSUM}'");g' ${SKIPPKG} -ARTIFACT_LINUX_URL="https://source.skip.tools/skip/releases/download/${SKIP_VERSION}/${PLUGIN_LINUX_ZIP}" +ARTIFACT_LINUX_URL="https://github.com/skiptools/skip/releases/download/${SKIP_VERSION}/${PLUGIN_LINUX_ZIP}" sed -I '' 's;.binaryTarget(name: "'${ARTIFACT}'", url:.*'${PLUGIN_LINUX_ZIP}'.*);.binaryTarget(name: "'${ARTIFACT}'", url: "'${ARTIFACT_LINUX_URL}'", checksum: "'${PLUGIN_LINUX_CHECKSUM}'");g' ${SKIPPKG} -# package(url: "https://source.skip.tools/skipstone.git", exact: "1.6.12") -sed -I '' 's;.package(url: "https://.*/skipstone.git", exact: ".*");.package(url: "https://source.skip.tools/skipstone.git", exact: "'${SKIP_VERSION}'");g' ${SKIPPKG} +# package(url: "https://github.com/skiptools/skipstone.git", exact: "1.6.12") +sed -I '' 's;.package(url: "https://.*/skipstone.git", exact: ".*");.package(url: "https://github.com/skiptools/skipstone.git", exact: "'${SKIP_VERSION}'");g' ${SKIPPKG} -sed -I '' 's;.package(url: "https://.*/skip.git", from: ".*");.package(url: "https://source.skip.tools/skip.git", from: "'${SKIP_VERSION}'");g' "README.md" +sed -I '' 's;.package(url: "https://.*/skip.git", from: ".*");.package(url: "https://github.com/skiptools/skip.git", from: "'${SKIP_VERSION}'");g' "README.md" if [[ "${DRY_RUN:-'0'}" == "1" ]]; then echo "DRY RUN: EXITING"