wiki:Web
Last modified 6 weeks ago Last modified on 04/13/12 11:09:59

Web

Compilation

As a general rule, you will need lots of resources to compile GeoGebraWeb. However it does not seem compulsory currently, you may want to consider increasing the maximal amount of open files by reading one of these articles:

Try to use as much memory as possible. At least 3 GB RAM is recommended (virtual memory can also be used, e.g. 2 GB physical RAM + 1 GB virtual memory), but the more memory you have, the comfortable and quicker compilation you obtain.

From Eclipse

We assume that you already installed all prerequisities (described on the SetUp page). (In fact, many of them are unnecessary, but for convenience we don't go into any details now.)

Before compiling GeoGebraWeb, you may need some additional libraries to download. So please do the following (very similar as described for the desktop version):

  • Package Explorer -> Project “web” -> kickstart.xml -> Right click -> Run As... -> 2 Ant Build...-> Build tab -> disable "Build before launch" -> Run -> Console “BUILD SUCCESSFUL”
  • Package Explorer -> Project “web” -> refresh (F5)

Usually you need a development mode build as an every day task. Just click on Package Explorer -> web -> src -> geogebra -> Web.gwt.xml, now right click on it, Run As -> 1 Web Application. Now select ggbtest.html from the list, press OK. Now some time will be needed for the compilation. (If any error occurs, just ignore it and press Proceed.) Now a message asks you to double-click to open an URL (like http://127.0.0.1:8888/ggbtest.html?gwt.codesvr=127.0.0.1:9997, but this may be somewhat different for you). A new page in your web browser will be shown, but first you may have to download the GWT Developer Plugin. (As of writing this, Firefox 11 has no GWT Developer Plugin yet, but Firefox 10 has. You may want to run not the most recent version of Firefox to run GeoGebraWeb in debug mode.) That's all, have fun! :-)

If you want to create a standalone bundle for GeoGebraWeb (e.g. for making a release), then you have to run a production mode build: go to Package Explorer -> web, right click, Google -> GWT Compile -> Compile. (Errors may be ignored.) The result fileset will be put into web/war/, and you can start GeoGebraWeb by pointing your browser to some of the .html files in that folder (currently degenerateConincs.html and ggbWebTools.html works properly since other examples may require cross site downloads which may be prohibited in some browsers).

Please note that a debug mode build requires more resources than a production build. If you have a slow machine, it may be difficult to develop GeoGebraWeb conveniently.

From command line

You will need Java >= 6, Ant, JavaCC, XMLStarlet and the GWT SDK for command line compilation (and a Subversion client to download the latest sources). To learn how to get Java and Ant please read the SetUpCommandLine page. To get JavaCC and the GWT SDK, the easiest way is as follows:

geek@pc:~/workspace/geogebra$ cd web; ant -f kickstart.xml geogebraweb-developer-commandline

This will also download some extra libraries on demand. (You can also use the GWT SDK from your Eclipse installation, but since we focus on pure command line build now, please read the autobuild.conf.dist file for details.) To install XMLStarlet on Debian/Ubuntu, you will need the libxml2-dev and libxslt1-dev packages first (and maybe build-essential), then you must compile XMLStarlet from source. (As an alternate solution, you may use the native xmlstarlet package, but it will offer the tool with the name "xmlstarlet".)

Now you must run the "build" script like this (run "./build -h" to see an explanation of command line options):

geek@pc:~/workspace/geogebra/web$ ./build -u safari -i /tmp/ggw -- -draftCompile
* GWT SDK directory is set to /home/geek/workspace/geogebra/gwt-2.4.0
* User agents: safari
* Compilation style: OBFUSCATED
Buildfile: /home/geek/workspace/geogebra/desktop/build.xml

compile-grammar-clean:

compile-grammar:
   [javacc] Java Compiler Compiler Version 5.0 (Parser Generator)
   [javacc] (type "javacc" with no arguments for help)
   [javacc] Reading from file /home/geek/workspace/geogebra/common/src/geogebra/common/kernel/parser/Parser.jj . . .
   [javacc] Warning: Line 203, Column 5: Non-ASCII characters used in regular expression.
   [javacc] Please make sure you use the correct Reader when you create the parser, one that can handle your character set.
   [javacc] File "TokenMgrError.java" does not exist.  Will create one.
   [javacc] File "ParseException.java" does not exist.  Will create one.
   [javacc] File "Token.java" does not exist.  Will create one.
   [javacc] File "SimpleCharStream.java" does not exist.  Will create one.
   [javacc] Parser generated with 0 errors and 1 warnings.

compile-grammar-cl:

BUILD SUCCESSFUL
Total time: 3 seconds
Buildfile: /home/geek/workspace/geogebra/web/build.xml

libs:

javac:
    [javac] /home/geek/workspace/geogebra/web/build.xml:49: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 1590 source files to /home/geek/workspace/geogebra/web/war/WEB-INF/classes
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
     [copy] Copying 1 file to /home/geek/workspace/geogebra/web/war/WEB-INF/classes

BUILD SUCCESSFUL
Total time: 14 seconds
[WARN] Non-relative source package: /common/src/geogebra/jre/
Compiling module geogebra.Web
   Scanning for additional dependencies: jar:file:/home/geek/workspace/geogebra/gwt-2.4.0/gwt-user.jar!/com/google/gwt/cell/client/ImageLoadingCell.java
      Computing all possible rebind results for 'com.google.gwt.cell.client.ImageLoadingCell.Template'
         Rebinding com.google.gwt.cell.client.ImageLoadingCell.Template
            Invoking generator com.google.gwt.safehtml.rebind.SafeHtmlTemplatesGenerator
               Constructing interface com.google.gwt.cell.client.ImageLoadingCell.Template
                  Generating method body for img()
                     [WARN] Template with variable in URL attribute context: The template code generator cannot guarantee HTML-safety of the template -- please inspect manually or use SafeUri to specify arguments in a URL attribute context
   Compiling 1 permutation
      Compiling permutation 0...
   Compile of permutations succeeded
Linking into /home/geek/workspace/geogebra/web/war/web
   Link succeeded
   Compilation succeeded -- 48,549s
Trying to remove and create /tmp/ggw...
GeoGebraWeb compilation and installation finished. Insert this URL into your browser (for example):
file:////tmp/ggw/degenerateConics.html
* Cleaning up: putting back original Web.gwt.xml
* Cleaning up: removing link to com
* Cleaning up: removing link to common
* Cleaning up: removing link to webapache

GWT "hoops"

Object.clone not supported, so can't be @Overriden

Object.clone not supported

so subclasses which have @Override annotation for it can't actually override it. Delete the override annotation.

Firefox GWT plugin does not follow versions

Search for the latest plugin or if it doesn't work, use older Firefox or use Chrome (but in Chrome there are problems with the "long running script window" during debug.

Common project should be recompiled

If you change the code in the Common, sometimes if may happen that you should recompile it directly, so compile both the Common and the Web projects in GWT. It is suggested to recompile the Common project with GWT after every change on it (at testing before commit).

Needed Libraries

Firebug or Google Development Tools (ctrl+shift+c in Chrome).

Net panel

Net panel in Firebug or Network tab in Chrome to monitor network activity (which resources downloaded).

Html panel

Html panel in Firefox or Elements in Chrome to monitor what element is where in the page layout.

Chrome OS test howto

Set up the Chrome OS for testing in Virtualbox.