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

Migrate from sbt to bazel #615

Merged
merged 104 commits into from
May 31, 2024
Merged

Migrate from sbt to bazel #615

merged 104 commits into from
May 31, 2024

Conversation

agluszak
Copy link
Collaborator

@agluszak agluszak commented Sep 27, 2023

Closes #613

I also rewrote the Scala codegen in Kotlin, so from now on all generators will use the same IR.

@agluszak
Copy link
Collaborator Author

Cc @KatKlo

@agluszak
Copy link
Collaborator Author

agluszak commented Oct 2, 2023

@adpi2 @lefou will you be able to review it this week?

@adpi2
Copy link
Member

adpi2 commented Oct 2, 2023

I can start reviewing it this week, but I have almost no experience with Bazel so I will have more questions than useful comments.

@lefou
Copy link
Contributor

lefou commented Oct 2, 2023

I don't have profound Bazel experience so I can't say anything about the changes. Looks like the docs already mention how to build with bazel. I wonder why all those format changes to the generated source files need to be part of the tooling change. This really obfuscates the more essential change.

@agluszak
Copy link
Collaborator Author

agluszak commented Oct 2, 2023

I can start reviewing it this week, but I have almost no experience with Bazel so I will have more questions than useful comments.

No problem, I'll do my best to answer them!

I wonder why all those format changes to the generated source files need to be part of the tooling change. This really obfuscates the more essential change.

That's because bazel-super-formatter I used supports prettier (for the website) and java formatting, but doesn't support scalafmt. I managed to disable java formatting for now, but I'll have to think how to handle scalafmt.

@adpi2
Copy link
Member

adpi2 commented Oct 2, 2023

I managed to disable java formatting for now, but I'll have to think how to handle scalafmt.

You can use coursier to download the scalafmt binary in the repo, and then commit it to the repo:

coursier bootstrap org.scalameta:scalafmt-cli_2.13:3.7.14 \
  -r sonatype:snapshots --main org.scalafmt.cli.Cli \
  --standalone \
  -o scalafmt

.bazelrc Outdated Show resolved Hide resolved
@agluszak
Copy link
Collaborator Author

agluszak commented Oct 2, 2023

I managed to disable java formatting for now, but I'll have to think how to handle scalafmt.

You can use coursier to download the scalafmt binary in the repo, and then commit it to the repo:

coursier bootstrap org.scalameta:scalafmt-cli_2.13:3.7.14 \
  -r sonatype:snapshots --main org.scalafmt.cli.Cli \
  --standalone \
  -o scalafmt

No need to, I'll plug scalafmt into the existing formatting pipeline, but it's going to take some work. It's already exposed in rules_scala

@agluszak
Copy link
Collaborator Author

agluszak commented Oct 4, 2023

@lefou all formatting changes should be gone now

@lefou
Copy link
Contributor

lefou commented Oct 5, 2023

@agluszak Thanks. I have no further comments. LGTM.

CONTRIBUTING.md Outdated Show resolved Hide resolved
WORKSPACE Outdated Show resolved Hide resolved
old-scala-codegen/BUILD Outdated Show resolved Hide resolved
resources/buildServerProtocol.svg Outdated Show resolved Hide resolved
spec-traits/src/main/kotlin/traits/DataKindTrait.kt Outdated Show resolved Hide resolved
website/pnpm-lock.yaml Outdated Show resolved Hide resolved
agluszak and others added 6 commits October 9, 2023 19:33
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Andrzej Głuszak <[email protected]>
Co-authored-by: Scala Steward <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Mikołaj Komar <[email protected]>
Co-authored-by: juliapodrazka <[email protected]>
Co-authored-by: Julia Podrażka <[email protected]>
Co-authored-by: Sheng Chen <[email protected]>
Copy link
Member

@jastice jastice left a comment

Choose a reason for hiding this comment

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

From my mostly surface-level review, LGTM! I can't evaluate the deeper logic without serious digging. Questions are only for clarification

- name: Fail if we detect changed files
if: steps.verify-changed-files.outputs.files_changed == 'true'
run: |
echo "Detected changed files: ${{ steps.verify-changed-files.outputs.changed_files }}"
echo "Make sure to run 'sbt generate' before pushing."
echo "Make sure to run 'bazel run //:generate' before pushing."
Copy link
Member

Choose a reason for hiding this comment

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

will we be able to avoid checking in generated files in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

why?

Copy link
Contributor

Choose a reason for hiding this comment

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

If they can be automatically generated, they should, unless there are good reasons not to (e.g. the tooling needs some remote resources temporarily unavailable or unstable).

.gitignore Show resolved Hide resolved
@agluszak agluszak merged commit 79abf7b into master May 31, 2024
1 check 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.

Migrate this repo to Bazel and merge with bsp-generators
6 participants