Skip to content

rewrite swiftSettings to avoid causing SPM build failures #358

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

Merged
merged 5 commits into from
Mar 2, 2022

Conversation

tayloraswift
Copy link
Member

fixes the issue described here by kicking the unsafe flags logic up a level, so non-CI builds pass an empty array of SwiftSettings instead of an empty array of unsafe flags.

@akyrtzi akyrtzi requested a review from ahoppen February 11, 2022 20:50
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this. For readability, however, I would prefer to use an if instead the map, and just change `swiftSyntaxUnsafeSwiftFlags

var swiftSyntaxSwiftSettings: [SwiftSetting] = []

/// If we are in a controlled CI environment, we can use internal compiler flags
/// to speed up the build or improve it.
if ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] != nil {
  let groupFile = URL(fileURLWithPath: #file)
    .deletingLastPathComponent()
    .appendingPathComponent("utils")
    .appendingPathComponent("group.json")

  swiftSyntaxSwiftSettings.append(.unsafeFlags([
    "-Xfrontend", "-group-info-path",
    "-Xfrontend", groupFile.path,
    // Enforcing exclusivity increases compile time of release builds by 2 minutes.
    // Disable it when we're in a controlled CI environment.
    "-enforce-exclusivity=unchecked"
  ]))
}

@tayloraswift
Copy link
Member Author

rewrote it without the map, is

if case _? = ProcessInfo.processInfo.environment["SWIFT_BUILD_SCRIPT_ENVIRONMENT"] {

fine?

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thanks for continuing to drive this. I’ve got two more stylistic comments inline.

tayloraswift and others added 2 commits February 23, 2022 14:05
Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

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

Thanks. Looks good to me now.

@ahoppen
Copy link
Member

ahoppen commented Feb 25, 2022

@swift-ci Please test

@tayloraswift
Copy link
Member Author

is this ready to merge?

@ahoppen ahoppen merged commit 71cc83f into swiftlang:main Mar 2, 2022
@ahoppen
Copy link
Member

ahoppen commented Mar 2, 2022

Sorry, forgot to hit the merge button. Thanks for the ping.

@tayloraswift tayloraswift deleted the kelvin13-omit-unsafe-flags branch March 2, 2022 23:48
keith pushed a commit to keith/swift-syntax that referenced this pull request Mar 15, 2022
dduan pushed a commit to dduan/swift-syntax that referenced this pull request Mar 17, 2022
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