Open DimaRU opened 2 years ago
cc @abertelrud
With prebuild commands it is indeed supposed to run before every build. I will have to repro with the test case to see what's going on in this case. I know that project loading is skipped on incremental builds, but the prebuild commands should be persisted and run in any case. So I think the understanding is correct, and this looks like a bug.
After the first succeed running of the plugin, unless you change Package.swift
or save it manually, it seems not working anymore.
Preface
I am trying to use the new amazing feature of Swift 5.6 - prebuild plugin and have encountered a flaw in the plugin execution. Maybe I don’t understand how the plugin works.
I used the plugin to auto-generate the build version from the GIT repository information.
From prebuild plugin documentation:
"Commands of type
.prebuildCommand
run before the start of every build.":SE-0303
swift-package-manager/Sources/PackagePlugin/Command.swift
The plugin with documentation is located here: https://github.com/DimaRU/PackageBuildInfo
Sample project: https://github.com/DimaRU/PackageBuildInfoExample
Expected behavior
swift package clean
used to force rebuild entire project by cleanup build artifacts each run.Actual behavior
Steps to reproduce
mint install DimaRU/PackageBuildInfo
Swift Package Manager version
Swift & OS version (output of
swift --version && uname -a
)