Comments (8)
Wait a second!!
env DEVELOPER_DIR=/Applications/Xcode-15.3.0-Beta.2.app xcrun xcodebuild -IDEClonedSourcePackagesDirPathOverride=$workDir/.dependencies -skipMacroValidation -skipPackagePluginValidation -derivedDataPath $workDir/.derivedData build -scheme TextStory-Package -destination generic/platform=xros
TextStory-Package
This is a dependency of this package, but not the correct scheme for this package itself.
from swiftpackageindex-server.
Yup that's it. I had copy-pasta'ed the scheme name. This command fails for me locally:
xcodebuild build -scheme TextFormation -destination generic/platform=visionOS
from swiftpackageindex-server.
Huh, that's bizarre. We shouldn't be picking that scheme, I'll need to check what's going on with our scheme heuristics.
Thanks for the report, @mattmassicotte !
from swiftpackageindex-server.
So I know what's happening but I don't know exactly why and how to best address it.
Your package lists four schemes when you run xcodebuild -list -json
:
{
"workspace" : {
"name" : "TextFormation",
"schemes" : [
"TextFormation",
"TextStory",
"TextStory-Package",
"TextStoryTesting"
]
}
}
This is the input to our package scheme detection heuristics. One of them is to filter for *-Package
schemes and if there's only one, that's the one we pick. That's clearly wrong in this case, so the first impulse is to reject this heuristic.
If we do that, we probably fail to build some (many?) packages. We could recover some if we only pick *-Package
if it's the only scheme.
Looking at the JSON one might think to check if there's a scheme with the same name as the workspace name. The problem with that is that the workspace name is really the checkout directory base name. We check out all repositories into <tempdir>/checkout
and when you run xcodebuild -list -json
on that you get
{
"workspace" : {
"name" : "checkout",
"schemes" : [
"TextFormation",
"TextStory",
"TextStory-Package",
"TextStoryTesting"
]
}
}
😖
Of course, we could look at the project URL's last path element ... and we'd be placing another piece on our jenga tower of scheme guesses.
I wanted to get a feel how broken our assumption is that picking the autogenerated *-Package
is a good idea. As I recall this scheme isn't / shouldn't be generated for dependencies.
I just picked a random repo that seems similar in that it
- has a dependency
- has no embedded
.xcodeproj
or.xcodeworkspace
- has no
scheme:
set in.spi.yml
i.e. a project that should be structurally equivalent to TextFormation. Runestone seems to fit that bill.
So here's xcodebuild -list -json
for Runestone:
{
"workspace" : {
"name" : "Runestone",
"schemes" : [
"Runestone"
]
}
}
None of its dependencies show up. There's no *-Package
scheme at all.
I suspected that perhaps the custom target logic in TextFormation's Package.swift
let swiftSettings: [SwiftSetting] = [
.enableExperimentalFeature("StrictConcurrency")
]
for target in package.targets {
var settings = target.swiftSettings ?? []
settings.append(contentsOf: swiftSettings)
target.swiftSettings = settings
}
file might mess with scheme autogeneration and so I removed it (from a fresh checkout, to avoid caching issues). Still, Xcode lists all four schemes, as above. I have no idea why it's generating these schemes here and not for Runestone.
Moreover, I now wonder and worry what it does for other repos.
I think there are a few things to consider here:
- Should we deploy the hack of looking for a clone URL base name match with a scheme name? If so, how lenient should be be here? Obviously case insensitive but what about prefixes like
swift-
or suffixes like-iOS
which we do see frequently. That's a nice looking hole and I'm sure there's a rabbit at the end of it. - Do we have a (much) bigger problem here where we're building the wrong schemes in some/many cases? (NB: of 6964 packages that have
Package.resolved
reported in, 3965 (57%) have no dependencies. So a good chunk are safe by default. Runestone indicates that even among those with dependencies there are some/many that will be ok.) - How can we get a better view of the problem so we can decide how to fix it?
- Can we get some info on how Xcode autogenerates schemes?
It's tempting to hack something together along the lines of 1) but our heuristics are getting messier and messier and it might be better to hold off.
An immediate fix for Matt's repo is for it to add a scheme: TextFormation
entry to its .spi.yml
file to ensure we do the right thing.
In order to figure out how big a problem we've got, we could do the following:
- capture the
xcodebuild -list -json
output and send it with the build report - also send the scheme we've picked (via heuristics or an
.spi.yml
override)
This would allow us to run a full analysis across all packages and see how well this is working.
I'm leaning towards spending the effort on 3. rather than patch this over via 1.
We should also try and get in touch with someone on the Xcode team to find out about scheme autogeneration so there's less guesswork on our part (4.). I vaguely recall talking to a couple of folks very early on when creating the build system but this was never any formal documentation, more along the lines "this should work".
from swiftpackageindex-server.
TextStory itself is special, in that it has multiple targets. I think Xcode will only auto-generate schemes for package dependencies that have multiple targets. Also, I believe the "-Package" scheme is only present in that situation as well. But I'm not 100% sure about either of those things.
I think what you need to do is pull out the package name
field from the Package.swift file. From there, you list the schemes. If there is a name-Package
you build that. Otherwise, you build name
. Could that work?
from swiftpackageindex-server.
I think that might be best, yes. It would mean another dump-package
in the builder (which triggers package resolution) but it shouldn't actually be that bad, because xcodebuild -list
also triggers a package resolution. The only problem I can see is that they don't share the "resolution cache".
I'll give that a go, that's certainly a more sensible approach that peeking at the URL and feels like it might solve the whole problem without adding more instrumentation. (However, that's perhaps still a good idea to do at some point.)
from swiftpackageindex-server.
Fixed here: https://gitlab.com/finestructure/swiftpackageindex-builder/-/merge_requests/262
- deploy
from swiftpackageindex-server.
This is now deployed. I believe you've actually fixed the visionOS build now, haven't you @mattmassicotte ? Let me know if not and I'll retrigger builds on main to correct the compatibility matrix!
from swiftpackageindex-server.
Related Issues (20)
- Funding link related crash HOT 12
- Investigate swift-backtrace hangs HOT 1
- Move the blog under the main SPI site HOT 2
- Remove the word "Compatibility" from shields.io badges
- `.spi.yml` exceeds size limit HOT 4
- The SPI Manifest validator should check the maximum size of a manifest HOT 1
- Minor layout issue with funding links
- Alamofire Shows No Info For Dependencies HOT 4
- Calculate package scores and the score report from stable versions where possible
- Index not showing latest versions for lottie-ios and lottie-spm packages HOT 6
- swift-custom-dump docs didn't generate HOT 1
- Add Swift 5.10 HOT 7
- 5.10 builds with nightly significantly slower HOT 5
- Remove blog front-matter from posts HOT 2
- Orka cleanup failures
- mlx-swift is not showing docs HOT 2
- Swift Version CI badge sorting 5.10 last instead of first HOT 1
- Update to Swift 5.10 release HOT 2
- Swift 6 preview testing HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swiftpackageindex-server.