ANT task for J2S build

20 views
Skip to first unread message

Simone Gianni

unread,
Sep 19, 2007, 1:54:14 PM9/19/07
to Java2Script
Hi,
I'm used to relay to external build tools (ANT, but much better maven)
and to use eclipse only as an IDE, and most importantly not forcing
people that build my application to use Eclipse for it. That also
mean, NOT committing .project files to SVN/CVS.

So, I started writing an ANT task to run the J2S, and maybe I'll write
also a Maven plugin for it.

My first try was to move the code of the astvisitors outside a plugin,
so that they can run as stand alone stuff. The problem is that they
depend on reference resolution, and AST does not yet support reference
resolution outside of a complete eclipse environment. That's why GWT
reimplemented they binding oracles and similar stuff.

So, my second run is trying to run an headless eclipse and invoke the
builder from there. This also involves keeping required jars at a
minimum (startup,jar, core, resources and jdp from eclipse, j2s core).

My plan is the following :
- Subclass the javac ant task
- Create a temporary folder acting as a workspace
- Create inside this a folder acting as poject
- Create inside a src folder
- Copy there the java files returned by ANT (so, letting ANT perform
all exclusions etc..)
- Copy there the .j2s files
- Run a workbench on the temporary workspace folder
- Create a new project
- Give it the java nature
- Configure the classpath with the classpath computed by ANT
- Give it the J2S nature
- Run the J2S builder
- Take the .js files created and move them to the specified
destination folder
- Discard the workspace temporary folder

Right now, I wrote an IPlatformRunnable doing all the steps needed
inside eclipse (create a project, give natures, configure classpath
etc...). I'm in the process of writing the ANT task.

Do you see any problem in this approach? Could there be a better way
of solving it?

Simone Gianni

Zhou Renjian

unread,
Sep 19, 2007, 2:45:19 PM9/19/07
to java2...@googlegroups.com
Hi Simone Gianni,

Feature of supporting Java to JavaScript compiling outside Eclipse workbench is not in Java2Script schedule right now.

Once I was thinking about such a way to provide such a feature: Find out the essential plugins to create virtual workbench and run the virtual workbench as a server. To build a project, just uploading and importing the project and call virtual workbench's build project action. After project is built, copy out (download) all *.js ...

Things are similar to what you have just mentioned.

As time is limited, technical break-through is uncertain and priority is low, this external building task is not scheduled in development.

It seems that a lot of things about Eclipse workbench should be familiar with. Hope you can work it out.

If you come across any problems about Java2Script nature or Java2Script compilers, please let me know.

Regards,
Zhou Renjian

Simone Gianni

unread,
Sep 20, 2007, 10:27:21 AM9/20/07
to Java2Script
Hi Zhou,
I want to use Java2Script in my company. As an Apache committer, we
all use Apache tools in my company, like Ant and Maven, so for me this
is an extremely important piece of software.

I'll work it out, I just hope it can be contributed to Java2Script.
That's why I'm asking if you think this is the right way of working it
out.

Simone

On 19 Set, 20:45, "Zhou Renjian" <zhourenj...@gmail.com> wrote:
> Hi Simone Gianni,
>
> Feature of supporting Java to JavaScript compiling outside Eclipse workbench
> is not in Java2Script schedule right now.
>
> Once I was thinking about such a way to provide such a feature: Find out the
> essential plugins to create virtual workbench and run the virtual workbench
> as a server. To build a project, just uploading and importing the project
> and call virtual workbench's build project action. After project is built,
> copy out (download) all *.js ...
>
> Things are similar to what you have just mentioned.
>
> As time is limited, technical break-through is uncertain and priority is
> low, this external building task is not scheduled in development.
>
> It seems that a lot of things about Eclipse workbench should be familiar
> with. Hope you can work it out.
>
> If you come across any problems about Java2Script nature or Java2Script
> compilers, please let me know.
>
> Regards,
> Zhou Renjian
>

Zhou Renjian

unread,
Sep 20, 2007, 11:59:48 AM9/20/07
to java2...@googlegroups.com
Hi Simone,

This will be a big feature for Java2Script.

Thanks!

BTW: I remember that someone requested this feature last year.


On 9/20/07, Simone Gianni <simone...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages