Skip to content
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

build: introduce a CMake based build for swift-format #677

Merged
merged 1 commit into from
Jan 28, 2024

Conversation

compnerd
Copy link
Collaborator

@compnerd compnerd commented Jan 9, 2024

This is in preparation to use SwiftFormat from SourceKit-LSP which is distributed as part of the toolchain.

On Windows, we are now able to build swift-format against the shared Swift Syntax package, yielding an overall size reduction:

SPM
swift-format.exe: 75,683,840 b
CMake
swift-format.exe: 830,464 b
SwiftFormat.dll: 7,818,240 b

Net Savings: 67,035,136 b

@compnerd
Copy link
Collaborator Author

compnerd commented Jan 9, 2024

This does require apple/swift-cmark#69 as well as apple/swift-markdown#141

@compnerd
Copy link
Collaborator Author

compnerd commented Jan 9, 2024

CC: @ahoppen

CMakeLists.txt Outdated Show resolved Hide resolved
Sources/SwiftFormat/CMakeLists.txt Show resolved Hide resolved
cmake/modules/SwiftSupport.cmake Show resolved Hide resolved
CMakeLists.txt Show resolved Hide resolved
cmake/modules/SwiftSupport.cmake Show resolved Hide resolved
Copy link
Contributor

@bnbarham bnbarham left a comment

Choose a reason for hiding this comment

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

LGTM now other than the copyright headers still 😅. Same in the other linked PRs.

And would be good to run full toolchain builds in apple/swift#70814 first.

@compnerd
Copy link
Collaborator Author

Now that the base change is in, yes, it is possible to do the toolchain test - which is not a "good" but really a "must" as we risk breaking the Windows installer build at the very least and we need to ensure that the packaged content is correct.

This is in preparation to use SwiftFormat from SourceKit-LSP which is
distributed as part of the toolchain.

On Windows, we are now able to build swift-format against the shared
Swift Syntax package, yielding an overall size reduction:

SPM
  swift-format.exe: 75,683,840 b
CMake
  swift-format.exe:    830,464 b
  SwiftFormat.dll:   7,818,240 b

Net Savings: 67,035,136 b
@compnerd compnerd merged commit e312ede into apple:main Jan 28, 2024
@compnerd compnerd deleted the cmake branch January 28, 2024 17:56
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.

None yet

3 participants