wiki:UnifyingCodebase
Last modified 7 months ago Last modified on 10/31/11 14:05:40

Unifying Codebase

Beginning with version 4.2 we are unifying the codebase for GeoGebra and GeoGebraMobile. In the future this will result in immediate update of GeoGebraMobile functionality if the original GeoGebra code is changing. This page is a detailed description on what we are going to change when preparing for the new workflow. If you are not interested in such details, but you want to develop GeoGebra with the new workflow, please read UnifyingCodebaseFAQ instead.

Restructuring folder layout in source

The following steps are documented on our test server, http://geogebra.idm.jku.at/trac/log/trunk/geogebra. The official Subversion repository for GeoGebra is not modified yet.

We will create 3 folders in the trunk/geogebra repository: Desktop/, Common/ and Web/ (http://geogebra.idm.jku.at/trac/changeset/13377). All the previous contents of trunk/geogebra will be moved to Desktop/ (http://geogebra.idm.jku.at/trac/changeset/13378), this was done by using the following Unix command line:

for i in .settings ccsd com edu geogebra geogebra3D icons installer jd2xx jogl2 lib org scripts\
 webstart xsd .ant-targets-build.xml .project INSTALL.txt _LICENSE.txt _README.txt build.pro\
 build.xml common.xml installer.xml kickstart.xml pack.xml\
 tools_p200.config; do svn move $i Desktop/$i; done

Common/ will contain the common parts for the Swing GUI application (present in Desktop/) and GeoGebraMobile (present in Web/). The first inserts for Common/ and Web/ can be viewed at http://www.geogebra.idm.jku.at/trac/changeset/13379 and http://www.geogebra.idm.jku.at/trac/changeset/13380.

Important: some new .svnignore-like things should be done yet.

Details on the created 2 new projects

Some additional restructuring can be done for simplifying and standardizing the folder hierarchy in Desktop. (To be written and done by Zoltan.)

General steps to move .java files into Common/

It is very important not to use the Subversive SVN plugin for Eclipse here, since it will broke the history for the moved files. Instead, Subclipse is the suggested tool to be used. See http://subclipse.tigris.org/servlets/ProjectProcess?pageID=p4wYuA for the detailed description on installation. (For Linux users, it can be a bit tricky. Feel free to ask us if you get into trouble.)

Below is an example is shown how to move Java files from Desktop/... to Common/... This is example was created by using the Subversive plugin, and the result is not so nice what we expect. (See http://www.geogebra.idm.jku.at/trac/changeset/13381 for the detailed commit. The problem is that the moved Java file lost its history. Another problem is that only the Desktop/ directory is committed, but the Common/ was also changed.

So, let's see the steps!

If you are lucky, your change is just to move a file to a different directory, and all refactoring is done by Eclipse for you. Usually life is not so simple, but let's assume you are extremely lucky and no extra work is required. Such a simple file is euclidian/EuclidianConstants.java.

So search for it in Package Explorer, right click, Refactor -> Move.

Then press "Create Package...", then enter "geogebracommon/src" for Source folder and "geogebra.common.euclidian" for Name.

Press Finish, then click OK in the previous window.

If no extra change is needed on the source code (because you are lucky), then the source code will be error-free, and you can compile GeoGebra as usual (in the "geogebra" project, i.e. in Desktop/), and run it from Eclipse.

To check if your code is GWT compatible, you can verify if the geogebracommon project (in Common/) is also error-free.

If yes, you are welcome to send your code back into the SVN repository. Let's see an example where the developer was not careful enough: http://www.geogebra.idm.jku.at/trac/changeset/13382. Here the commit was done by using the Subclipse plugin (that's important!), so the history for GeoGebraColorConstants.java can be followed back to several moves: http://www.geogebra.idm.jku.at/trac/log//trunk/geogebra/Common/src/geogebra/common/main/GeoGebraColorConstants.java?action=stop_on_copy&mode=follow_copy&rev=13382&stop_rev=&limit=100. But the developer was not aware of migrating the imported geogebra.main.Application (see http://www.geogebra.idm.jku.at/trac/changeset/13382#file1), so this commit does not result a compilable code (and must be reverted or fixed by moving additional files or doing something more --- finally a reversion can be seen at http://geogebra.idm.jku.at/trac/changeset/13384).

Details on porting

(To be written by Gabor and Julian.)

Additional changes for the autobuild subsystem

For convenience we will change the project names to Desktop, Common and Web (from geogebra, geogebracommon and geogebraweb). This will ease things a bit. But for this a complete new checkout will be needed in Eclipse for all developers. The proposed changes are in changesets 13386-13391, which also contains the following changes:

  • ecj must use the ../Desktop and ../Common directories instead of ".". It is very important not to include "..", because the wine directory --- which is created during the packaging --- may point to several subdirectories in the filesytem and this will crash ecj by running into an endless file search loop.
  • The geogebra_main.jar file will contain all classes from Common. Thus one of the jar tasks in the build.xml file must be extended with
    ../Common/**/*.class
    

for the appropriate target at the include attribute.

  • For convenience of easy backward compatibility a symlink should be created for geogebra -> Desktop.

Attachments