1
votes

Since my attempt to set up a Dart project myself I think I miss something fundamental since I didn't succeeded. So I still need the help of the community.

  1. Coming from GWT I am used to a single application forming a single JS file which is ran and will augment a HTML element once it is recognized by the application.
  2. There will be usually two JS files, one for the user-frontend and the web applications backend application.
  3. I want a solution with an incremental build during development time (which I guess Dart offers when used in Dartium)
  4. I have an inhouse web framework that I want to be started and used to send the Dart files for the Dartium session. How this will integrate and interfere with the debug sessions?

Update regarding web framework:

The web framework is a component based rendering engine, including database and uses its own resource management including everything http related like setting the cache flags etc. Its about 1.5 MB with 1200+ tests. Its simply everything you need starting with a simple servlet. Its also using an embedded jetty.

The relevance here is that I need to know how the debugger connects to Dartium and how it finds the files once an instance is running and delivered a html file containing dartium sources, so how can I start my own web server at a given port and still have dartium debug capabilities?

Update regarding the former answers:

I tried it but after two days gave up to learn more and do some other stuff. I just don't know why it is just not possible to add a simple file to the root package of my Dart module like the good old package.html (javadoc) fil. I then just add the Dart libaries to my project and the Dart plugin adds the required Dart nature to the project and creates a builder entry, done. Why do I have to do all the fuzz. Or even better why cant I just annotate my Module's main class to form a module and so I can replace the extra file completely?

I guess the Dart plugin has a model of the Dart code already so discovery is done on the fly in Eclipse.

I also do not know why I cant put my dart code in a dart source folder like src/dart/main and src/dart/test.

Or is this possible? I am still trying to get this done. I will use a fresh Eclipse 3.8 install and check if I can get Dartium to work. Just installing the plugin seams not to do the trick.

Update regarding the JS generation:

I cannot understand why Dart is not offering an incremental build of JS files. Even if it is a single file. It should not be that hard to debundle the given compile steps. I guess it will be something like compile each source file independently and link those together, do some tree shaking and done. Would be awesome if this can be made possible. Remember one can hold a model of the output file in memory (or on disk) and know what part of the js relates to what source file. Then just look up the link symbol tables and write back the part that has changed.

For me the killer feature for Dart would be the ease of configuration as I outlined and the incremental build of JS files making co-developing in JS a no-brainer. I guess in the end both JS files will be just about 750kb combined. So all the stuff with additional compression would not force me to upgrade my 8GB memory or will stress my SSD at all (350MB/sec for writes in burst mode).

Is there any work planed on this? Would be great to have Dart as the final solution for JS creation but to be honest I do not understand why GWT is the way to create JS this way. An incremental build and easy setup for GWT would be also welcome.

1
What have you tried? What didn't work as expected? What does your 'inhouse webframework' do or what is is for? What do you actually want to know? - Günter Zöchbauer
I am quite puzzled about it. I tried to use the Dart Editor and it worked as expected but when I use the Eclipse IDE with the Dart Plugin I currently have several issues. - Martin Kersten
I plan to set up a new Eclipse 3.8 + Dart on weekend and play with different project mixes. Therefore I try to kind of prework my upcomming affords. - Martin Kersten

1 Answers

2
votes
  1. Seems not to be a question ...

  2. In Dart you have usually one JS file because Dart on the server runs native (without transpiling)

  3. With Dartium you don't have a build at all because it also runs Dart natively. You build to JavaScript only for deployment (and of course to test the build output before deployment).

  4. The debugging is done by Dartium itself (you can use the Chrome DevTools debugger without DartEditor if you want). DartEditor access the debugger API of Dartium and acts as a remote display/control. Debugging web clients loaded from other webservers is supported.
    What might cause some work is setting up your custom web server so that it forwards requests to source files to pub serve the web server used by DartEditor (or standalone).
    pub serve runs transformers (on the fly code transformations/generation). Some framework depend on transformers being run on the code to make it functional.

I have no idea what this means but I don't use Eclipse/Dart plugin.

[Update regarding the former answers] I tried it but after two 
days gave up to learn more and do some other stuff. I just dont
know why it is just not possible to add a simple file to the 
root package of my module like the good old package.html file
for the java docs and then all i do is add the Dart libaries
to my project and the Dart plugin adds the nature to it and
creates a builder entry, done. Why do I have to do all the fuzz.
Or even better why cant I just annotate my Module's main class
to form a module and so I can replace the extra files?

To integrate Dart with your Java project create the Dart project independent from your project and move the Dart build output to a directory where you have your other static files.

While development configure your web server to forward to pub serve as explained above.

As already stated in my first answer, this

[Update regarding the JS generation] I can not understand why
dartium is not offering an incremental build of JS files. Even
if it is a single file. It should not be that hard to debundle
the given compile steps. I guess it will be something like
compile a single file and link those then the magical tree
shake and done

is irrelevant. You don't do anything with JavaScript while developing. If you load the page with a non-Dartium browser pub serve will serve built JavaScript instead of Dart. Incremental build is in the works to improve responsiveness. But incremental build is not available for file generation (would make sense anyway IMHO).