VueGWT / vue-gwt

Vue.js Components/Custom Elements in Java with GWT. Developed at https://www.genmymodel.com.
https://vuegwt.github.io/vue-gwt/
MIT License
204 stars 46 forks source link

How to run template generator during "GWT Compile" ? #13

Closed slavap closed 6 years ago

slavap commented 6 years ago

Currently, if I have broken html template, "GWT Compile" passed just fine, without any errors. Then I run superdev mode on jetty and getting error only when code server starts compiling of my project. That's ok, but would be nice to get errors during "GWT Compile" stage.

adrienbaron commented 6 years ago

Hi!

Short answer: Not yet. Long answer: For now we use a GWT2 generator to start the compilation of your template, and those are run when the code server compiles. In the future, we intend to move to Annotation Processing for that part too (actually there is a working annotation processor on the feature/gwt3 branch, but it's very much a test). The only reason we are not pushing this one yet is that Annotation Processors can't be triggered by resources changes. Which mean that it won't run automatically if you touch the HTML file. Either an IDE plugin or some watcher config would be necessary to make it run each time you touch the HTML. I got some success creating a File Watcher in IntelliJ that "touch" the corresponding Java file each time you edit the HTML, but I'm not sure that's a solution for everyone.

slavap commented 6 years ago

@adrienbaron In Eclipse there are project builders, they have file watchers integrated, I’m using them for generating java files based on ui.xml files, so I don’t need to write @UiField annotations manually. I can provide code if you need more details.

adrienbaron commented 6 years ago

@slavap That would be great! We will probably need it anyway for GWT3. I will probably ask the opinion of the community on Gitter to know what they think about moving from Generators to Annotation Processor + IDE config as both have advantages and issues.

slavap commented 6 years ago

@adrienbaron Actually, it's quite simple in Eclipse, I bet Idea should have something similar.

public class UiBinderToJavaGenerator {
    public static void main(final String[] args) throws Exception {
        // here goes the auto-generation logic, you can read and write files
    }
}

image

image

image

"Specify Resources..." button configures folders watcher (usually it's all folders in my project src/client) Works very fast, especially if you check (in generator code) files hashes before generation, i.e. don't re-generate not changed files every time.

slavap commented 6 years ago

@adrienbaron ui.xml to java generating code, based on Tessell http://www.tessell.org/ Perhaps it could be useful for you somehow :-) UiBinderToJava.zip

adrienbaron commented 6 years ago

Closing this issue for now, thanks for the info :). Will have to look into all of this ;)