Integrate Elemental to the build and deploy as Maven artifact
Contributed by tbroyer

Review at http://gwt-code-reviews.appspot.com/1727808/


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@11064 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/elemental/build.xml b/elemental/build.xml
index fe48c91..d30ec28 100644
--- a/elemental/build.xml
+++ b/elemental/build.xml
@@ -16,7 +16,7 @@
 
   <target name="compile" description="Compile all class files">
     <mkdir dir="${javac.out}" />
-    <gwt.javac excludes="**/super/**">
+    <gwt.javac srcdir="src:idl/generated/src" excludes="**/super/**">
       <classpath>
         <pathelement location="${gwt.dev.jar}" />
         <pathelement location="${gwt.user.jar}" />
@@ -41,6 +41,7 @@
           <java classname="com.google.gwt.dev.CompileModule" fork="yes" failonerror="true">
             <classpath>
               <pathelement location="${gwt.root}/elemental/src" />
+              <pathelement location="${gwt.root}/elemental/idl/generated/src" />
               <pathelement location="${gwt.dev.jar}" />
               <pathelement location="${gwt.user.jar}" />
             </classpath>
@@ -56,6 +57,8 @@
 
   <target name="clean"
       description="Cleans this project's intermediate and output files">
+    <delete dir="idl/generated" />
+    <delete dir="idl/database" />
     <delete dir="${project.build}" />
     <delete file="${project.lib}" />
   </target>
diff --git a/elemental/idl/build b/elemental/idl/build
index 8f6b266..028ea83 100755
--- a/elemental/idl/build
+++ b/elemental/idl/build
@@ -10,4 +10,7 @@
 
 python ${ROOT}/scripts/elemental_fremontcutbuilder.py
 python ${ROOT}/scripts/elementaldomgenerator.py
-cp -R ${ROOT}/generated/src/elemental/* ${ROOT}/../java/elemental/
+# Keep compatibility with Google's internal build
+if [ -d ${ROOT}/../java/elemental/ ]; then
+  cp -R ${ROOT}/generated/src/elemental/* ${ROOT}/../java/elemental/
+fi
diff --git a/elemental/idl/scripts/idlparser.py b/elemental/idl/scripts/idlparser.py
index fcf7e60..ba67687 100755
--- a/elemental/idl/scripts/idlparser.py
+++ b/elemental/idl/scripts/idlparser.py
@@ -412,8 +412,7 @@
       includePaths -- an array of path strings.
     """
     # FIXME: Handle gcc not found, or any other processing errors
-    if 'CC' in os.environ:
-      gcc = os.environ['CC']
+    gcc = os.environ.get('CC', None)
     if not gcc:
       gcc = 'gcc'
     cmd = [gcc, '-E', '-P', '-C', '-x', 'c++'];