rules_gwt icon indicating copy to clipboard operation
rules_gwt copied to clipboard

Nice to include source directories of dependencies in super dev mode

Open solomatov opened this issue 8 years ago • 5 comments

Current, they are included as binary dependencies, which makes them hard to use especially if you have a large multi module project.

Thanks, Kostya

solomatov avatar Dec 15 '16 05:12 solomatov

Could you describe your project layout a bit more and how you're expecting things to work? The default assumption is that your Java sources are all under java/ or src/main/java/. If that's not the case, you can set java_roots in your gwt_application, which can include multiple paths. So if you have a workspace structured like this:

WORKSPACE
FooModule/
  src/
    com/
      mycompany/
        Foo.java
BarModule/
  src/
    com/
      mycompany/
        Bar.java

Then you would set java_roots in your gwt_application to ["FooModule/src/", "BarModule/src/"]. I've only done a small amount of testing with multiple source roots, so let me know if there are any problems with it.

ekuefler avatar Dec 18 '16 02:12 ekuefler

@ekuefler We have a large project with many modules: we have different UI components, UI framework , etc. We prefer to develop parts, while working in gwt super dev mode on concrete applications. Due to the project size it's unpractical to put everything into one module.

solomatov avatar Dec 18 '16 03:12 solomatov

@ekuefler You can find open source part of our app converted to bazel here: https://github.com/JetBrains/jetpad-mapper/tree/bazel

solomatov avatar Dec 18 '16 03:12 solomatov

That makes sense. Does the java_roots solution not work for you? If I'm understanding your project structure correctly, that would involve modifying https://github.com/JetBrains/jetpad-mapper/blob/bazel/samples/todo/BUILD to add

java_roots = [
  "gwt-util/src/main/java/",
  "mappers/src/main/java/",
  "model/src/main/java/",
  "sample/todo/src/main/java/",
]

I agree that it's annoying having to maintain this in parallel with the deps. Currently we need this information to figure out where the actual source files (not just a srcjar containing them) are on your filesystem so GWT can detect changes to them without having to re-run Bazel. If you don't include a root then super dev mode will still work, but changes to those files won't be visible until you restart it.

It might be possible to somehow try to infer the roots from the dependencies that are known to Bazel, but last time I looked it seemed like there wasn't a good way to do that (and it might be impossible in general - if all you see is foobar/src/Baz.java, there's no way to tell if Baz belongs to package foobar.src, src, or the default package).

ekuefler avatar Dec 20 '16 21:12 ekuefler

@ekuefler java_roots works in this situation, but it's just a tip of the iceberg. We have 2 more repositories in our project (they aren't open source), and the whole application might end up with more than a 100 of source folders which are hard to update, since we change the project structure from time to time.

solomatov avatar Dec 20 '16 21:12 solomatov