浏览代码

Merge branch 'Kotlin-Support' of tflucke/iEat2 into master

Thomas Flucke 6 年之前
父节点
当前提交
215799bc06
共有 4 个文件被更改,包括 52 次插入12 次删除
  1. 39 11
      build.xml
  2. 4 0
      conf/dev/ant/app.properties
  3. 1 1
      conf/dev/ant/build.properties
  4. 8 0
      conf/dev/ant/test.properties

+ 39 - 11
build.xml

@@ -1,17 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<project name="ieat2" basedir="." default="war" xmlns:ivy="antlib:org.apache.ivy.ant">
+<project name="ieat2" basedir="." default="war"
+         xmlns:ivy="antlib:org.apache.ivy.ant">
   <property name="lib.dir" value="lib/"/>
   <property name="web.dir" value="web/"/>
   <property name="test.dir" value="tests/"/>
   <property name="conf.dir" value="conf/dev/"/>
   <property name="script.dir" value="scripts/"/>
-  
-  <property name="app.name" value="ieat"/>  
-  <property name="app.conf.dir" value="${conf.dir}/app/"/>
 
   <property name="ant.lib" value="${user.home}/.ant/lib"/>
   <property name="ant.conf.dir" value="${conf.dir}/ant/"/>
+  
+  <property prefix="app" file="${ant.conf.dir}/app.properties"/>
+  <property name="app.conf.dir" value="${conf.dir}/app/"/>
 
   <property prefix="tomcat" file="${ant.conf.dir}/tomcat.properties"/>
 
@@ -23,8 +24,7 @@
 	<format property="build.time" pattern="MM/dd/yyyy hh:mm aa z" />
   </tstamp>
 
-  <property name="test.halt.failure" value="off"/>
-  <property name="test.halt.error" value="off"/>
+  <property prefix="test" file="${ant.conf.dir}/test.properties"/>
   <property name="test.lib" value="${lib.dir}/test/"/>
   <property name="test.target.dir" value="${build.dir}/tests"/>
 
@@ -44,13 +44,18 @@
   <property name="ivy.jar" value="${ant.lib}/ivy.jar"/>
   <property name="ivy.dep.file" value="${ant.conf.dir}/ivy.xml" />
   <available property="ivy.installed" file="${ivy.jar}"/>
+
+  <property name="kotlin.lib" value="/opt/kotlinc/lib" />
+  <typedef resource="org/jetbrains/kotlin/ant/antlib.xml"
+           classpath="${kotlin.lib}/kotlin-ant.jar"/>
   
   <target name="help" description="Display build help">
 	<echo>iEat v${build.version}</echo>
 	<echo>To see list of targets, use ant -p</echo>
   </target>
 
-  <target name="skip.ivy" description="Do not check dependencies. (Saves laptop battery)">
+  <target name="skip.ivy"
+          description="Do not check dependencies. (Saves laptop battery)">
     <property name="ivy.skip" value="true"/>  
   </target>
 
@@ -58,11 +63,14 @@
     <mkdir dir="${ant.lib}"/>
     <get dest="${ivy.jar}"
          src="http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar"/>
-    <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar}"/>
+    <taskdef resource="org/apache/ivy/ant/antlib.xml"
+             uri="antlib:org.apache.ivy.ant"
+             classpath="${ivy.jar}"/>
     <property name="ivy.installed" value="true"/>
   </target>
 
-  <target name="ivy.tree" depends="ivy.install" description="Show the dependency tree.">
+  <target name="ivy.tree" depends="ivy.install"
+          description="Show the dependency tree.">
     <ivy:dependencytree />
   </target>
 
@@ -83,7 +91,8 @@
   </target>
   
   <target name="test.load" depends="ivy.resolve.ant">
-    <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" />
+    <taskdef name="junit"
+             classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" />
   </target>
 
   <target name="init.db"
@@ -118,7 +127,7 @@
           description="Compile server source files">
     <mkdir dir="${target.dir.server}"/>
 	<javac srcdir="${source.dir.java}"
-           excludes="name.tflucke.ieat2/client/**"
+           excludes="name/tflucke/ieat2/client/**"
            verbose="${compile.verbose}"
 		   destdir="${target.dir.server}"
 		   debug="${compile.debug}" 
@@ -130,12 +139,31 @@
 		   target="${build.java.version}"
 		   source="${build.java.version}">
 	  <classpath refid="compile.classpath" />
+      <withKotlin/>
 	</javac>
+    <!--
+        TF 2019-09-09: May not be nessisary because of withKotlin
+	<kotlinc src="${source.dir.kotlin}"
+		     output="${target.dir.server}"
+             nowarn="${compile.nowarn}"
+             classpath="${compile.classpath}">
+      <compilerarg value="-verbose"/>
+      <compilerarg line="-jvm-target ${build.java.version}"/>
+      
+           verbose="${compile.verbose}" -verbose
+		   deprecation="${compile.deprecation}" -progressive
+		   optimize="${compile.optimize}" -Xno-optimize
+	</kotlinc>
+    -->
   </target>
 
   <target name="compile.client" depends="ivy.resolve.compile"
           description="Compile client source files">
     <mkdir dir="${target.dir.client}"/>
+    <kotlin2js src="${source.dir.java}"
+		     output="${target.dir.client}/generated.js"
+             nowarn="${compile.nowarn}">
+    </kotlin2js>
   </target>
 
   <target name="compile.tests" depends="ivy.resolve.test,compile.server"

+ 4 - 0
conf/dev/ant/app.properties

@@ -0,0 +1,4 @@
+# Basic information about the app
+
+# App Name
+name = ieat

+ 1 - 1
conf/dev/ant/build.properties

@@ -9,4 +9,4 @@ dir = build/
 # Java version
 java.version = 1.8
 # Path to libraries matching the java version
-bootstrap.path = /usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar
+bootstrap.path = /usr/lib/jvm/java-8-openjdk/jre/lib/rt.jar

+ 8 - 0
conf/dev/ant/test.properties

@@ -0,0 +1,8 @@
+# Test configuration information
+# Includes information such as how to handle failures
+
+# Halt tests when there's a failure
+halt.failure = off
+
+# Halt tests when there's an error
+halt.error = off