[Preview] Swift-Syntax Prebuilts for Macros

Thanks. For posterity the manifest is at https://download.swift.org/prebuilts/swift-syntax/601.0.1/swiftlang-6.2.0.9.909-manifest.json, which is the full version output from swift --version.

I just need this in case I need to manually download the artifacts to prime our corporate proxy.

Yes, it's derived from the Swift compilerVersion in swiftc -print-target-info.

Created Enabling prebuilts for custom macros confuses `--explicit-target-dependency-import-check=error` · Issue #8798 · swiftlang/swift-package-manager · GitHub

1 Like

Gave this a go using xcodebuild, but the build fails when "Build for Testing" (regular build works), both in xcode and our CI.

We are using a macro target in our Package.swift. This target is used by a Macros package that is then imported by other modules. Legacy previews is off, as mentioned in other comments.

cannot load module 'SwiftSyntax' built with SDK 'macosx15.5' when using SDK 'iphonesimulator18.5' appears for the macro target.

2 Likes

That's a known issue with this first release of the prebuilts.

3 Likes

In the beginning this was working great, and it was a major speedup but now i notice it's not working anymore.

I tried on two configurations Xcode26 Beta 2
and on our CI machine Xcode 16.4

I see it requests https://download.swift.org/prebuilts/swift-syntax/601.0.1/swiftlang-6.2.0.10.950-manifest.json which leads to a 404

Is this misconfigured on my side?

I would really appreciate some more verbose logging why around why prebuilts where not used, allowing me to trouble shoot it more effectively.

2 Likes

Yeah, even the 6.1 manifests seem to have been removed, so perhaps the feature has been disabled while they fix the bugs with other use cases.

I'm not aware there were going to be any changes. I'll check with the infrastructure team to see what's happening. I do know we don't have the Beta 3 prebuilts up yet. There's still some discussion on how to do pre-release builds more regularly.

Oh, wait Beta 3 isn't out yet so it's definitely missing :). Looks like Beta 2 is missing too though.

BTW, we still see the 6.1 manifests there.

OK, Beta-2 should be there now, i.e. 6.2.0.10.950

4 Likes

Hey thanks for great work, what is proper flag name for swift package file?

enableExperimentalFeature(name)

or I need to always specify it in my build/extra flags for now?

It's a SwiftPM flag so does need to be on the command line. In Swift 6.2 it's on by default so you won't need to use the flag unless you want to disable the feature.

We are seeing xcode 16.4 not using prebuilts because it is returning 404 on 6.1.2.1.2 -> https://download.swift.org/prebuilts/swift-syntax/601.0.1/swiftlang-6.1.2.1.2-manifest.json

Yes same problem; but swift build --enable-experimental-prebuilts --very-verbose works as it switches to building swift-syntax

debug: Loaded manifest for 'swift-syntax' (from 'https://github.com/swiftlang/swift-syntax') in 0.56s
debug: search credentials for 'https://download.swift.org' [https://download.swift.org/prebuilts/swift-syntax/601.0.1/6.1-manifest.json] in keychain
debug: no credentials found for 'https://download.swift.org' in keychain
info: Failed to decode prebuilt manifest: invalidCertChain

The SSL certificate looks ok, but I assume this is the the contents of the manifest.json?

Also running into Xcode archive with library evolution isn't able to build swift-syntax, prebuilt presumably for the same reason invalidCertChain?

I'm seeing:

error	13:56:14.782619+0300	syspolicyd	Unable to get certificates array: (null)
error	13:56:14.906760+0300	syspolicyd	Unable to get certificates array: (null)
default	13:56:15.189639+0300	xcodebuild	boringssl_context_info_handler(2372) [C1.1.1.1:2][0x10f035000] Client handshake state: TLS 1.3 client read_certificate_request
default	13:56:15.189655+0300	xcodebuild	boringssl_context_info_handler(2372) [C1.1.1.1:2][0x10f035000] Client handshake state: TLS 1.3 client read_server_certificate
default	13:56:15.189670+0300	xcodebuild	boringssl_context_info_handler(2372) [C1.1.1.1:2][0x10f035000] Client handshake state: TLS 1.3 client read_server_certificate_verify
default	13:56:15.192859+0300	trustd	ocsp responder: (null) did not include status of requested cert

This feature's lack of logging in Xcode, combined with an overly aggressive corporate filter, means that the prebuilt comes and goes as I clean projects or switch between versions of Xcode. Can we get visible logging in Xcode, which includes the attempted URL, so we can see what's going on? Sometimes the prebuilt isn't available, sometimes it's blocked by the filter, it would be good to see which.

4 Likes

There should be some logging in the activity log when package prebuilts are used. This was introduced in Xcode 26 Beta 2, so you may need to update to a newer version.

2 Likes

That seems to only be positive logging. If the prebuilt fails, it never seems to show up in the logs at all, it simply checks out swift-syntax. Even the raw logs show nothing.

Hi @dschaefer2 I just got this response to my Feedback FB17778220:

Hello Michael,

Thank you for your feedback. After reviewing, we are unable to reproduce the issue you mentioned.

We have defaults write com.apple.dt.Xcode IDEPackageEnablePrebuilts YES.

But when we build your sample app we still see all of Swift Syntax being built from source and everything works fine, both in XOJIT and legacy execution mode. What are we missing to get the prebuilt?

With this Xcode selected as the default I get this swift version info:
❯ xcrun swift --version
swift-driver version: 1.127.5.3 Apple Swift version 6.2 (swiftlang-6.2.0.10.950 clang-1700.3.10.950)
Target: arm64-apple-macosx26.0

We appreciate your feedback and look forward to hear from you.

I'm not sure what's going on, but I didn't supply a sample app so this paragraph makes no sense to me:

But when we build your sample app we still see all of Swift Syntax being built from source and everything works fine, both in XOJIT and legacy execution mode. What are we missing to get the prebuilt?

I'm tagging you since you said you were able to reproduce this the bug would come to you, but this response doesn't look like it came from you :smiley:

According to this comment on the issue I opened, it appears that you can use both "swift-syntax" and "swift-syntax.git" in your URL, but only one of these will make use of the prebuilts.

I'm not sure the .git is really the issue. That's been working for a while and nothing changed there. There was a delay publishing the Beta-3 prebuilts. They are there now.

There are still some manual steps when publishing the prebuilts so there will always be a bit of a delay after toolchains are released. Hopefully not as long as this one.