Skip to content

Conversation

@dschaefer2
Copy link
Member

There is an issue when a macro that uses prebuilts uses a library that also depends on the swift-syntax library. This is commonly used to share utility code between macros.

However, we currently can't tell whether the library will only be built for the host so it can not take advantage of the prebuilts. When a macro which is using prebuilts uses that library, we are seeing crashes in the macro caused when the library and the swift-syntax it uses is built for debug which is then linked with the macro which uses the swift-syntax prebuilts which are built for release.

For now, this change turns off the prebuilts for macros that use such a library to avoid the crash. We'll investigate making the use of prebuilts conditional on the build settings in a future release.

To be able to implement this change, we need to be able to detect the downstream swift-syntax dependency. We move the insertion of the settings for the prebuilts from Module creation time until after the ResolvedModuleBuilder is created so that we can make the changes there before the final ResolvedModules are created.

[One line description of your change]

Motivation:

[Explain here the context, and why you're making that change. What is the problem you're trying to solve.]

Modifications:

[Describe the modifications you've done.]

Result:

[After your change, what will change.]

…#9261)

There is an issue when a macro that uses prebuilts uses a library that
also depends on the swift-syntax library. This is commonly used to share
utility code between macros.

However, we currently can't tell whether the library will only be built
for the host so it can not take advantage of the prebuilts. When a macro
which is using prebuilts uses that library, we are seeing crashes in the
macro caused when the library and the swift-syntax it uses is built for
debug which is then linked with the macro which uses the swift-syntax
prebuilts which are built for release.

For now, this change turns off the prebuilts for macros that use such a
library to avoid the crash. We'll investigate making the use of
prebuilts conditional on the build settings in a future release.

To be able to implement this change, we need to be able to detect the
downstream swift-syntax dependency. We move the insertion of the
settings for the prebuilts from Module creation time until after the
ResolvedModuleBuilder is created so that we can make the changes there
before the final ResolvedModules are created.
@dschaefer2
Copy link
Member Author

@swift-ci please test

Copy link
Contributor

@jakepetroules jakepetroules left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, just an issue with one of the file headers

@@ -0,0 +1,51 @@
//
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs the standard Apache header

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants