Refactored build.
This commit is contained in:
parent
2927fd3d38
commit
bf94f1abbc
6 changed files with 68 additions and 122 deletions
|
@ -18,11 +18,6 @@
|
||||||
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/>
|
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11-sources.jar"/>
|
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11-sources.jar"/>
|
||||||
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar"/>
|
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="owner.project.facets" value="jst.utility"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_45">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="owner.project.facets" value="java"/>
|
<attribute name="owner.project.facets" value="java"/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<project default="dist" name="jarbuild">
|
<project default="dist" name="Build-libjar">
|
||||||
<!--ANT 1.7 is required -->
|
<!--ANT 1.7 is required -->
|
||||||
<property name="buildjar.version" value="1.4" />
|
<property name="buildjar.version" value="1.5" />
|
||||||
<property file="build.properties" />
|
<property file="build.properties" />
|
||||||
<property name="build.dir" value="${basedir}/build" />
|
<property name="build.dir" value="${basedir}/build" />
|
||||||
<property name="build.src" value="${basedir}/src" />
|
<property name="build.src" value="${basedir}/src" />
|
||||||
|
@ -25,23 +25,31 @@
|
||||||
<pathelement path="${test.classes}" />
|
<pathelement path="${test.classes}" />
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
|
|
||||||
<!-- ***** Help ***** -->
|
<!-- ***** Help ***** -->
|
||||||
<target name="help" description="Display detailed usage information">
|
<target name="help" description="Display detailed usage information">
|
||||||
<echo>Type ant -p</echo>
|
<echo>Type ant -p</echo>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<!-- ***** Clear ***** -->
|
||||||
|
<target name="clear" description="Clean temporary directories before work">
|
||||||
|
<delete dir="${build.dir}" />
|
||||||
|
</target>
|
||||||
|
|
||||||
<!-- ***** Clean ***** -->
|
<!-- ***** Clean ***** -->
|
||||||
<target name="clean" description="Clean temporary directories">
|
<target name="clean" description="Clean temporary directories afeter work">
|
||||||
<delete dir="${build.dir}" />
|
<delete dir="${build.dir}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Compile ***** -->
|
<!-- ***** Compile ***** -->
|
||||||
<target name="compile" description="Compile main code">
|
<target name="compile" description="Compile main code">
|
||||||
<mkdir dir="${build.dir}/classes" />
|
<delete dir="${build.classes}" />
|
||||||
|
<mkdir dir="${build.classes}" />
|
||||||
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
<javac srcdir="${build.src}" destdir="${build.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
||||||
<classpath refid="test.classpath.compile" />
|
<classpath refid="build.classpath" />
|
||||||
</javac>
|
</javac>
|
||||||
|
<copy todir="${build.classes}">
|
||||||
|
<fileset dir="${build.src}" excludes="**/*.java" />
|
||||||
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Compile test ***** -->
|
<!-- ***** Compile test ***** -->
|
||||||
|
@ -50,11 +58,13 @@
|
||||||
<javac srcdir="${test.src}" destdir="${test.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
<javac srcdir="${test.src}" destdir="${test.classes}" debug="${debug}" deprecation="on" includeantruntime="false">
|
||||||
<classpath refid="test.classpath.compile" />
|
<classpath refid="test.classpath.compile" />
|
||||||
</javac>
|
</javac>
|
||||||
|
<copy todir="${test.classes}">
|
||||||
|
<fileset dir="${test.src}" excludes="**/*.java" />
|
||||||
|
</copy>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
||||||
<!-- ***** Test ***** -->
|
<!-- ***** Test ***** -->
|
||||||
<target name="test" description="Run unit tests" depends="clean,compile,compile-test">
|
<target name="test" description="Run unit tests" depends="clear,compile,compile-test">
|
||||||
<mkdir dir="${build.dir}/test-reports" />
|
<mkdir dir="${build.dir}/test-reports" />
|
||||||
<junit printsummary="yes" haltonfailure="no">
|
<junit printsummary="yes" haltonfailure="no">
|
||||||
<classpath refid="test.classpath.run" />
|
<classpath refid="test.classpath.run" />
|
||||||
|
@ -77,25 +87,23 @@
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Dist ***** -->
|
<!-- ***** Dist ***** -->
|
||||||
<target name="dist" description="Build distribution" depends="clean,compile,javadoc">
|
<target name="dist" description="Build distribution" depends="clear,compile,javadoc">
|
||||||
<!-- -->
|
|
||||||
<buildnumber file="build.num" description="Id of the build" />
|
|
||||||
<!-- AUTOMATIC MANAGEMENT -->
|
<!-- AUTOMATIC MANAGEMENT -->
|
||||||
|
<buildnumber file="build.num" description="Id of the build" />
|
||||||
<property name="dist.version" value="${product.revision.major}.${product.revision.minor}.${build.number}" />
|
<property name="dist.version" value="${product.revision.major}.${product.revision.minor}.${build.number}" />
|
||||||
<property name="dist.name" value="${product.name}-${dist.version}" />
|
<property name="dist.name" value="${product.name}-${dist.version}" />
|
||||||
<property name="dist.dir" value="${basedir}/dist/${dist.name}" />
|
<property name="dist.dir" value="${basedir}/dist/${dist.name}" />
|
||||||
|
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<mkdir dir="${dist.dir}" />
|
<copy file="LICENSE" todir="${dist.dir}/" overwrite="true" failonerror="false" />
|
||||||
|
<copy file="README" todir="${dist.dir}/" overwrite="true" failonerror="false" />
|
||||||
<!-- -->
|
<copy file="README.md" todir="${dist.dir}/" overwrite="true" failonerror="false" />
|
||||||
<copy file="LICENSE" todir="${dist.dir}/" overwrite="true" />
|
|
||||||
|
|
||||||
<!-- Package main -->
|
<!-- Package main -->
|
||||||
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
|
<property name="dist.jar" value="${dist.dir}/${dist.name}.jar" />
|
||||||
<tstamp>
|
<tstamp>
|
||||||
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
|
|
||||||
<!-- TODAY -->
|
<!-- TODAY -->
|
||||||
|
<format property="dist.time" pattern="dd/MM/yyyy HH:mm:ss" />
|
||||||
</tstamp>
|
</tstamp>
|
||||||
<jar destfile="${dist.jar}">
|
<jar destfile="${dist.jar}">
|
||||||
<manifest>
|
<manifest>
|
||||||
|
@ -103,7 +111,6 @@
|
||||||
<attribute name="Built-Date" value="${dist.time}" />
|
<attribute name="Built-Date" value="${dist.time}" />
|
||||||
</manifest>
|
</manifest>
|
||||||
<fileset dir="${build.classes}" />
|
<fileset dir="${build.classes}" />
|
||||||
<zipfileset dir="${basedir}/" includes="LICENSE" />
|
|
||||||
</jar>
|
</jar>
|
||||||
|
|
||||||
<!-- Package sources -->
|
<!-- Package sources -->
|
||||||
|
@ -115,37 +122,40 @@
|
||||||
|
|
||||||
<!-- Package Javadoc -->
|
<!-- Package Javadoc -->
|
||||||
<property name="dist.javadoc.zip" value="${dist.dir}/${dist.name}-javadoc.zip" />
|
<property name="dist.javadoc.zip" value="${dist.dir}/${dist.name}-javadoc.zip" />
|
||||||
<zip destfile="${dist.javadoc.zip}" update="true" preserve0permissions="true">
|
<zip destfile="${dist.javadoc.zip}" update="true">
|
||||||
<fileset dir="${build.javadoc}" />
|
<fileset dir="${build.javadoc}" />
|
||||||
<zipfileset dir="${basedir}/" includes="LICENSE" />
|
<zipfileset dir="${basedir}/" includes="LICENSE" />
|
||||||
</zip>
|
</zip>
|
||||||
|
|
||||||
<!-- Package lib -->
|
<!-- Zip package -->
|
||||||
<copy todir="${dist.dir}/lib" overwrite="true">
|
<property name="dist.zip" value="${basedir}/dist/${dist.name}.zip" />
|
||||||
<fileset dir="lib" excludes="hamcrest-core*,junit*" />
|
<!--
|
||||||
</copy>
|
<property name="dist.zip" value="${basedir}/dist/${dist.name}.zip" />
|
||||||
|
<zip destfile="${dist.zip}" update="true">
|
||||||
|
<fileset dir="${dist.dir}" />
|
||||||
|
<zipfileset filemode="755" dir="${dist.dir}/" includes="*.sh *.command" />
|
||||||
|
</zip>
|
||||||
|
-->
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<!-- ***** Dist ***** -->
|
<!-- ***** Build and GIT ***** -->
|
||||||
<target name="buildandgit" depends="dist">
|
<target name="buildandgit" depends="dist,clean">
|
||||||
<!-- GIT actions-->
|
<echo message="Commit build.num" />
|
||||||
<echo message="Commit build.num"/>
|
<exec executable="git" outputproperty="git.commit.out" failifexecutionfails="true">
|
||||||
<exec executable="git" outputproperty="git.commit.out" failifexecutionfails="true">
|
<arg line="commit -m 'Build ${dist.version}' build.num" />
|
||||||
<arg line="commit -m 'Build ${dist.version}' build.num"/>
|
</exec>
|
||||||
</exec>
|
|
||||||
<echo message="${git.commit.out}" />
|
<echo message="${git.commit.out}" />
|
||||||
|
|
||||||
<echo message="Tag"/>
|
<echo message="Tag" />
|
||||||
<exec executable="git" outputproperty="git.tag.out" failifexecutionfails="true">
|
<exec executable="git" outputproperty="git.tag.out" failifexecutionfails="true">
|
||||||
<arg line="tag -a ${dist.version} -m 'Build ${dist.version}'"/>
|
<arg line="tag -a ${dist.version} -m 'Build ${dist.version}'" />
|
||||||
</exec>
|
</exec>
|
||||||
<echo message="${git.tag.out}" />
|
<echo message="${git.tag.out}" />
|
||||||
|
|
||||||
<echo message="Push"/>
|
<echo message="Push" />
|
||||||
<exec executable="git" outputproperty="git.push.out" failifexecutionfails="true">
|
<exec executable="git" outputproperty="git.push.out" failifexecutionfails="true">
|
||||||
<arg line="push --follow-tags"/>
|
<arg line="push --follow-tags" />
|
||||||
</exec>
|
</exec>
|
||||||
<echo message="${git.push.out}" />
|
<echo message="${git.push.out}" />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
</project>
|
</project>
|
|
@ -1,3 +1,3 @@
|
||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Wed Feb 05 00:08:42 CET 2014
|
#Wed Sep 21 14:25:05 CEST 2016
|
||||||
build.number=0
|
build.number=1
|
||||||
|
|
10
build.xml
10
build.xml
|
@ -1,5 +1,9 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<project default="dist" name="kiss4web">
|
<project default="main" name="Build">
|
||||||
<!-- -->
|
<!-- ***** Import ***** -->
|
||||||
<import file="buildjar.xml" />
|
<import file="build-libjar.xml" />
|
||||||
|
|
||||||
|
<!-- ***** Main ***** -->
|
||||||
|
<target name="main" description="" depends="dist,clean" />
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
<project default="buildandgit" name="kiss4web">
|
<project default="main" name="Buildandgit">
|
||||||
<!-- -->
|
<!-- -->
|
||||||
<import file="buildjar.xml" />
|
<import file="build.xml" />
|
||||||
|
|
||||||
|
<target name="main" description="" depends="buildandgit,clean"/>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
*/
|
*/
|
||||||
package fr.devinsy.kiss4web;
|
package fr.devinsy.kiss4web;
|
||||||
|
|
||||||
import javax.mail.Session;
|
|
||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
import javax.naming.Context;
|
import javax.naming.Context;
|
||||||
import javax.naming.InitialContext;
|
import javax.naming.InitialContext;
|
||||||
|
@ -43,7 +42,6 @@ import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import fr.devinsy.util.strings.StringList;
|
|
||||||
import fr.devinsy.util.strings.StringListUtils;
|
import fr.devinsy.util.strings.StringListUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -112,69 +110,6 @@ public class EnvironmentInformation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getSessionToString(final Context environment, final String name)
|
|
||||||
{
|
|
||||||
String result;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (environment == null)
|
|
||||||
{
|
|
||||||
result = null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Session session = (Session) environment.lookup(name);
|
|
||||||
|
|
||||||
StringList buffer = new StringList();
|
|
||||||
for (Object key : session.getProperties().keySet().toArray())
|
|
||||||
{
|
|
||||||
buffer.append((String) key).append("=").append(session.getProperties().getProperty((String) key)).append(",");
|
|
||||||
}
|
|
||||||
buffer.removeLast();
|
|
||||||
result = buffer.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (NamingException exception)
|
|
||||||
{
|
|
||||||
logger.info("Error: {}", exception.getMessage());
|
|
||||||
result = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public String getSessionToString(final String name)
|
|
||||||
{
|
|
||||||
String result;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Context initialContext = new InitialContext();
|
|
||||||
|
|
||||||
Context environment = (Context) initialContext.lookup("java:comp/env");
|
|
||||||
result = getSessionToString(environment, name);
|
|
||||||
}
|
|
||||||
catch (NamingException exception)
|
|
||||||
{
|
|
||||||
logger.info("Error: {}", exception.getMessage());
|
|
||||||
result = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
|
Loading…
Reference in a new issue