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

Add a Rails app to the examples folder if and when possible. #144

Open
kigster opened this issue Jul 26, 2024 · 8 comments
Open

Add a Rails app to the examples folder if and when possible. #144

kigster opened this issue Jul 26, 2024 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@kigster
Copy link

kigster commented Jul 26, 2024

Not sure if the rules can already be used on a Rails App, but I think that this should be ultimately a goal because so many huge monolithic applications can benefit from partial Bazel builds (that would likely be mostly running tests on sub-sections of the app that changed).

Perhaps leave this as a placeholder for now, or comment why this isn't a goal, or what do you think about Rails support down the road.

@p0deje
Copy link
Member

p0deje commented Jul 27, 2024

I think it would be great to have a Rails example, PRs are welcome!

@p0deje p0deje added the help wanted Extra attention is needed label Aug 16, 2024
@J-Swift
Copy link

J-Swift commented Aug 21, 2024

I was just thinking through what it would mean to put a Rails app in bazel and landed here : D

Agreed, Id love to see the intended way to split code to be more 'bazely' for a rails app.

@p0deje
Copy link
Member

p0deje commented Aug 21, 2024

@J-Swift I don't think there is that much to be done to make Rails work via Bazel. In fact, there should not be a big need to change the codebase structure in any way except for adding BUILD files in specific directories and making the dependencies more explicit.

@J-Swift
Copy link

J-Swift commented Aug 21, 2024

I was thinking more about trying to actually leverage bazel in a rails app so you could eg slice up the test suite and not run the whole thing

@p0deje
Copy link
Member

p0deje commented Aug 21, 2024

I was thinking more about trying to actually leverage bazel in a rails app so you could eg slice up the test suite and not run the whole thing

That's what I mean by "making the dependencies more explicit". For example, you can create separate targets for app/models/user.rb and test/models/user_test.rb. The latter would depend on the former. Now, whenever the model is changed, the bazel test ... would run the model test. But if the model was not changed, it would re-use the cached test result until one of the test target dependencies change.

@J-Swift
Copy link

J-Swift commented Aug 21, 2024

I guess I just think rails apps typically are not operating with such explicit boundaries and so really the only way I imagined it being possible is if things were split into code modules (eg engines, or gems)

@p0deje
Copy link
Member

p0deje commented Aug 21, 2024

Nothing really stops you from doing the dependencies only with Bazel. In this case, during the test execution, Bazel will symlink dependencies into a test runfiles tree, allowing you to see when the boundaries are violated.

@J-Swift
Copy link

J-Swift commented Aug 21, 2024

Ok interesting Ill have to test it out when I get time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants