Skip to content

Include _GenerateSwiftFormat in buildOnlyTests #1050

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 1 commit into from
Jul 21, 2025

Conversation

TTOzzi
Copy link
Member

@TTOzzi TTOzzi commented Jul 21, 2025

No description provided.

@@ -27,6 +27,7 @@ add_executable(swift-format
Utilities/StderrDiagnosticPrinter.swift
Utilities/TTY.swift)
target_link_libraries(swift-format PRIVATE
_GenerateSwiftFormat
Copy link
Contributor

Choose a reason for hiding this comment

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

swift-format doesn't depend on _GenerateSwiftFormat so this shouldn't be needed. We also never build generate-swift-format in cmake, so technically the added CMakeLists.txt isn't needed either. We could add an extra in generate-swift-format so that it is buildable from cmake as well, but that's not the PR testing issue.

The PR testing issue is that we set SWIFTFORMAT_BUILD_ONLY_TESTS which then does this:

if buildOnlyTests {
  products = []
  targets = targets.compactMap { target in
    guard target.isTest || target.name == "_SwiftFormatTestSupport" else {
      return nil
    }
    target.dependencies = target.dependencies.filter { dependency in
      if case .byNameItem(name: "_SwiftFormatTestSupport", _) = dependency {
        return true
      }
      return false
    }
    return target
  }
}

That needs to be updated to allow _GenerateSwiftFormat as well

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah thanks for letting me know. I wasn't aware of this 🙇
I’ve updated it as you suggested.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks, LGTM!

@TTOzzi TTOzzi changed the title Generate cmake files for _GenerateSwiftFormat Include _GenerateSwiftFormat in buildOnlyTests Jul 21, 2025
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.

Thanks @TTOzzi!

@bnbarham bnbarham enabled auto-merge July 21, 2025 22:41
@bnbarham bnbarham merged commit bd5a712 into swiftlang:main Jul 21, 2025
21 checks passed
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