swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.73k stars 1.34k forks source link

Build host tools in release even when leaf target is building for debug #7233

Open rauhul opened 9 months ago

rauhul commented 9 months ago

Targets which depend on macros and plugins should use release variants of those tools even if the target itself is being built in debug mode.

An optional flag can be used to build the host tools in debug.

neonichu commented 9 months ago

Plugins don't follow the regular build at all and are currently always build in debug mode, but if we had an option to select the build configuration we could easily change that.

Things are more tricky for targets in the regular build graph because this implies that we need the ability to build multiple copies of targets, e.g. if you have a macro and are building a product that uses swift-syntax in debug mode in the same build graph.

rauhul commented 9 months ago

Definitely introduces complexity to spm but I think it's both warranted and necessary. In medium to large use of swift-mmio, I see the emit-module time drop from ~2.5m to ~20s after switching from debug to release.