-
-
Notifications
You must be signed in to change notification settings - Fork 624
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
SwiftTemplate
fails to build due to Invalid manifest
#1322
Comments
This repeatedly occurs when attempting to build using Bitrise continuous integration platform |
We're currently using Sourcery 2.2.2. I've attempting passing private func createBuildCommands(
tool: PluginContext.Tool,
configPath: Path,
outputDirectory: Path
) -> [Command] {
let cachePath = outputDirectory.appending(subpath: "SourceryPlugin/Cache")
let buildPath = outputDirectory.appending(subpath: "SourceryPlugin/Build")
return [
.prebuildCommand(
displayName: "Generate mocked types for target",
executable: tool.path,
arguments: [
"--config", configPath,
"--cacheBasePath", cachePath,
"--buildPath", buildPath,
"--disableCache",
"--verbose"
],
environment: ["DERIVED_SOURCES_DIR": outputDirectory],
outputFilesDirectory: outputDirectory
) |
I'm now struggling to reproduce locally, the output appears to succeed: Raw compilation of SwiftTemplate took: 7.120736837387085 |
Hi @markst , aside from other issues you've reported, for which there are billions of thanks ❤️ , You can verify this by using |
You can normally resolve this issue using swift package purge-cache |
@art-divin possibly it's failing to get the cached build since it's failing to complete the build? |
Hello @markst , I wonder, can you try using Sourcery 2.2.1 version? There is one concurrency issue to be resolved by the end of the upcoming week (next release should be done on the next weekend). Maybe it is related to the issue you are facing, but I suspect it is not. 🕵🏻♂️ |
Investigating 🕵🏻 |
Hello @markst , first thing I notice, is that you are using This is not the root cause of your issue, but thing is, |
@markst by the way, the speed with which in the gif you've shared the build is failing, tells me that the compilation of SwiftTemplate fails for one or the other reason. Flag That would help a lot 👍🏻 |
I'm not sure if my issue is exactly the same as yours, but in my case the issue is specifically with SwiftTemplate when sourcery in invoked from a build plugin in Xcode 16 beta 3+. I did an experiment running almost identical code from aCommand plugin - and in that case it works fine. My conclusion, from this behaviour and the error messages, is that in the latest xcode16 betas, the sandboxing around the build plugin has been tightened up so that the generated SwiftTemplate package cannot load in the external modules it need to compile. |
could you be using a different version of xcode on CI than locally? |
Using Xcode 15.4 on local and Bitrise. Weirdly it's only certain templates which cause the issue, using a simpler stencil doesn't produce the error.
(this particular output is Xcode 15.2) |
I can reproduce this when using
It's confusing it's trying to build the .buildCommand(
displayName: "Generate mocked types for target",
executable: tool.path,
arguments: [
"--config", configPath,
"--cacheBasePath", cachePath.string,
"--buildPath", buildPath.string,
"--verbose"
],
environment: ["OUTPUT_DIR": outputDirectory],
outputFiles: [
outputDirectory.appending("Mock.generated.swift")
]
) |
Just to update here, the original issue only happens when using I tested using a really simple // Found <%= types.all.count %> types |
So I tested using Xcode 16 Beta 4 locally and my plugin works fine. Output
@swwol I'm curious to know how your Sourcery plugin is different from mine since it does seem we're experiencing similar issues when using SwiftTemplate specifically. |
Created a demo project in order to test. Weirdly the project fails to build locally! |
We've gone with using https://github.com/Kolos65/Mockable instead |
Looking at your comment above, one difference is I am using the plugin work directory for build and cache paths rather than output directory. |
@swwol thanks for response! possibly changed since earlier comments. It is now using |
We're using a
XcodeBuildToolPlugin
to generate mocks using Sourcery as mentioned in this issue:#1229
This works when running in Xcode, however occasionally when running tests using xcodebuild the following can occur:
The text was updated successfully, but these errors were encountered: