I tried exactly that:
- Created the packages directly under Windows with the installed Swift (5.4.2).
- Referenced one package (
https://github.com/stefanspringer1/SwiftXMLInterfaces2.git
) by the other (https://github.com/stefanspringer1/SwiftXMLParser2.git
).
When trying to build SwiftXMLParser2 with the reference to SwiftXMLInterfaces2 (Package.swift see below), the following error is displayed:
error: the manifest is missing a Swift tools version specification; consider prepending to the manifest '// swift-tools-version:5.4.0' to specify the current Swift toolchain version as the lowest Swift version supported by the project; if such a specification already exists, consider moving it to the top of the manifest, or prepending it with '//' to help Swift Package Manager find it
This is already very strange because the package files were just created by the same SPM on the same system (only the dependency added)!
I removed the reference to the other package, the build was successful. When again referencing the other package and trying to build again (without any change), the following error is displayed:
Updating https://github.com/stefanspringer1/SwiftXMLInterfaces2.git
error: InternalError(description: "Internal error. Please file a bug at https://bugs.swift.org with this info. unable to get tag for swiftxmlinterfaces2[https://github.com/stefanspringer1/SwiftXMLInterfaces2.git] 0.0.1; available versions []")
error: ExitCode(rawValue: 1)
[0/1] Planning build
warning: failed to load the cached build description: fatalError
The current Package.swift file has the following content:
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "SwiftXMLParser2",
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "SwiftXMLParser2",
targets: ["SwiftXMLParser2"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/stefanspringer1/SwiftXMLInterfaces2.git", from: "0.0.1"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SwiftXMLParser2",
dependencies: ["SwiftXMLInterfaces2"]),
.testTarget(
name: "SwiftXMLParser2Tests",
dependencies: ["SwiftXMLParser2"]),
]
)
Something here is fundamentally broken! I do not think that my projects are not OK, because a) the projects are being built with no problem on macOS and CentOS 7, and b) besides the added dependency as above, both new packages are exactly as created by the SPM, c) I tried with different (also fresh) installations of Windows (Pro and Home, English and German, all running in a Parallels VM) and with different versions of Git (2.33, 2.23, 2.30), and d) with different settings for the tools version (5.3, 5.4, 5.4.0). Could something that Parallels sets for the Windows VMs be a problem?
UPDATE: After restarting also the host computer, every package in the line https://github.com/stefanspringer1/SwiftXMLInterfaces2.git
-> https://github.com/stefanspringer1/SwiftXMLParser2.git
-> https://github.com/stefanspringer1/SwiftXML2.git
was built successfully, but when trying to build the executable https://github.com/stefanspringer1/SwiftXMLDemo2.git
, again the following error:
Fetching https://github.com/stefanspringer1/SwiftXML2.git
Fetching https://github.com/stefanspringer1/SwiftXMLParser2.git from cache
error: Dependencies could not be resolved because root depends on 'SwiftXML2' 0.0.1..<1.0.0.
'SwiftXML2' cannot be used because 'SwiftXML2' depends on 'SwiftXMLParser2' 0.0.1..<1.0.0 and no versions of 'SwiftXMLParser2' match the requirement 0.0.1..<1.0.0.
This error message is nonsense, because the same SwiftXML2
that is not correct because of its dependency according to the error message had just been built correctly!
After again cleaning the caches up and trying to build again:
Fetching https://github.com/stefanspringer1/SwiftXML2.git
https://github.com/stefanspringer1/SwiftXML2.git @ 0.0.1: error: https://github.com/stefanspringer1/SwiftXML2.git has no Package.swift manifest for version 0.0.1 in https://github.com/stefanspringer1/SwiftXML2.git
That is no better than before.
Note: I also deactivated the Windows Defender etc. No help.
UPDATE 2: After re-trying a few times (also without cleaning up the caches) and after varying error messages, https://github.com/stefanspringer1/SwiftXMLDemo2.git
could finally be build. Seems to be a little bit a game of luck...
UPDATE 3: Inserted my old source files into https://github.com/stefanspringer1/SwiftXMLInterfaces2.git
and set the new tags 0.0.2
(following the initial 0.0.1) throughout the chain and referencing those. I then got the following error message which cites a version 0.0.3
, but a version 0.0.3
is not written anywhere in those new repositories, SPM seems to search furher up from 0.0.2 because it does not like tools version 5.3(.0), the same tools version that did not pose a problem before and which was written by SPM itself when initializing the packages!
Updating https://github.com/stefanspringer1/SwiftXMLInterfaces2.git
Updating https://github.com/stefanspringer1/SwiftXML2.git
Updating https://github.com/stefanspringer1/SwiftXMLParser2.git
error: Dependencies could not be resolved because root depends on 'SwiftXML2' 0.0.2..<1.0.0.
'SwiftXML2' >= 0.0.2 cannot be used because no versions of 'SwiftXML2' match the requirement 0.0.3..<1.0.0 and 'SwiftXML2' 0.0.2 contains incompatible tools version (5.3.0).
error: ExitCode(rawValue: 1)
[0/1] Planning build
warning: failed to load the cached build description: fatalError