| <project name="Generates OSEE Application Server Runtime Package" default="run"> |
| |
| <target name="setup"> |
| <echo>Packaging Server Runtime</echo> |
| <echo>Output-Path: ${output-path}</echo> |
| <echo>P2-Content-Path: ${p2-content-path}</echo> |
| <echo>Output-Name: ${output-name}</echo> |
| <echo>Server-Path: ${server-path}</echo> |
| <echo>Demo-Data-Path: ${demo-content-path}</echo> |
| <echo /> |
| |
| <condition property="os-separator-exp" value="\\" else="/"> |
| <os family="windows" /> |
| </condition> |
| |
| <mkdir dir="${server-path}" /> |
| |
| <property name="server-config-path" value="${server-path}/configuration" /> |
| <property name="server-plugins-path" value="${server-path}/plugins" /> |
| |
| <mkdir dir="${server-config-path}" /> |
| <mkdir dir="${server-plugins-path}" /> |
| |
| <copy todir="${server-plugins-path}"> |
| <fileset dir="${p2-content-path}/plugins" excludes="**/*source_*.jar" /> |
| </copy> |
| |
| <pathconvert property="launcherBundlePath" setonempty="false"> |
| <path> |
| <fileset dir="${server-plugins-path}"> |
| <include name="org.eclipse.equinox.launcher_*.jar" /> |
| </fileset> |
| </path> |
| </pathconvert> |
| <propertyregex property="equinox-launcher-jar" override="true" input="${launcherBundlePath}" regexp="[^${os-separator-exp}]+$" select="\0" casesensitive="false" /> |
| </target> |
| |
| <target name="pack"> |
| <zip destfile="${output-path}/${output-name}.zip"> |
| <fileset dir="${server-path}" /> |
| </zip> |
| </target> |
| |
| <target name="cleanup"> |
| <delete dir="${server-path}" quiet="true" /> |
| </target> |
| |
| <target name="generateConfig"> |
| <generateConfigIni configPath="${server-config-path}" pluginsPath="${server-plugins-path}" /> |
| </target> |
| |
| <!-- *************************************************************** --> |
| <!-- MAIN RUN --> |
| <!-- *************************************************************** --> |
| <target name="run" depends="setup,generateConfig,generateLaunchScripts,pack" /> |
| |
| <!-- *************************************************************** --> |
| <!-- LAUNCH CONFIGS --> |
| <!-- *************************************************************** --> |
| <target name="generateTemplate"> |
| <createLaunch filepath="${server-path}/runExample.sh" connection.id="[id from connection file]" serverport="8089" executable="false" launcher="${equinox-launcher-jar}" extraVMArgs="-Dosee.connection.info.uri=[custom connection file path] \${line.separator}-Dosee.application.server.data=[binary data path] \${line.separator}-Dosee.authentication.protocol=[trustAll,demo]" /> |
| </target> |
| |
| <target name="generateHSQLLaunch"> |
| <createLaunch filepath="${server-path}/runHSQL.sh" connection.id="hsql" serverport="8089" launcher="${equinox-launcher-jar}" extraVMArgs="-Dosee.authentication.protocol=trustAll \${line.separator}-Dosee.db.embedded.server=0.0.0.0:8088" /> |
| </target> |
| |
| <target name="generateDemoLaunch"> |
| <createLaunch filepath="${server-path}/runDemo.sh" connection.id="hsql" serverport="8089" launcher="${equinox-launcher-jar}" extraVMArgs="-Dosee.authentication.protocol=demo \${line.separator}-Dosee.db.embedded.server=0.0.0.0:8088 \${line.separator}-Dosee.connection.info.uri="demo/osee.demo.db.connection.xml" \${line.separator}-Dosee.application.server.data="demo/binary_data"" /> |
| |
| <copy file="${server-path}/runDemo.sh" tofile="${server-path}/runDemo.bat" overwrite="true" /> |
| <replaceregexp file="${server-path}/runDemo.bat" match="\\" replace="^" flags="g" /> |
| |
| <!-- Copy Demo Files --> |
| <property name="server-demo-path" value="${server-path}/demo" /> |
| |
| <mkdir dir="${server-demo-path}" /> |
| <mkdir dir="${server-demo-path}/binary_data" /> |
| |
| <unzip src="${demo-content-path}/hsql.zip" dest="${server-demo-path}" /> |
| <unzip src="${demo-content-path}/binary_data.zip" dest="${server-demo-path}/binary_data" /> |
| <copy file="${demo-content-path}/osee.demo.db.connection.xml" tofile="${server-demo-path}/osee.demo.db.connection.xml" /> |
| </target> |
| |
| <target name="generateLocalPostgresLaunch"> |
| <createLaunch filepath="${server-path}/runPostgresqlLocal.sh" connection.id="postgresqlLocalhost" serverport="8089" launcher="${equinox-launcher-jar}" extraVMArgs="-Dosee.authentication.protocol=trustAll"/> |
| </target> |
| |
| <target name="generateLaunchScripts" depends="generateTemplate,generateDemoLaunch,generateHSQLLaunch,generateLocalPostgresLaunch" /> |
| |
| <!-- *************************************************************** --> |
| <!-- GENERATE CONFIG.INI --> |
| <!-- *************************************************************** --> |
| <macrodef name="generateConfigIni"> |
| <attribute name="configPath" /> |
| <attribute name="pluginsPath" /> |
| <sequential> |
| <echo file="@{configPath}/config.ini" append="false" message="osgi.bundles= \${line.separator}\${line.separator}" /> |
| |
| <pathconvert property="serverBundles" setonempty="false" pathsep=";"> |
| <path> |
| <fileset dir="@{pluginsPath}"> |
| <exclude name="org.eclipse.osgi_*.jar" /> |
| <exclude name="org.eclipse.equinox.launcher_*.jar" /> |
| <exclude name="*source_*.jar" /> |
| </fileset> |
| </path> |
| </pathconvert> |
| |
| <var name="isFirst" value="false" /> |
| <for param="bundle" delimiter=";" list="${serverBundles}" trim="true"> |
| <sequential> |
| <propertyregex override="yes" property="jarFilename" input="@{bundle}" regexp="[^${os-separator-exp}]+$" select="\0" /> |
| |
| <propertyregex property="projectName" override="true" input="${jarFilename}" regexp="(.*?)_" select="\1" casesensitive="false" /> |
| <if> |
| <equals arg1="${isFirst}" arg2="true" /> |
| <then> |
| <echo file="@{configPath}/config.ini" message=", \${line.separator}" append="true" /> |
| <var name="isFirst" value="false" /> |
| </then> |
| </if> |
| |
| <if> |
| <equals arg1="${projectName}" arg2="org.eclipse.osee.logback.config" /> |
| <then> |
| <echo file="@{configPath}/config.ini" message="${projectName}" append="true" /> |
| </then> |
| <elseif> |
| <equals arg1="${projectName}" arg2="org.eclipse.osee.logger.slf4j" /> |
| <then> |
| <echo file="@{configPath}/config.ini" message="${projectName}" append="true" /> |
| </then> |
| </elseif> |
| <elseif> |
| <equals arg1="${projectName}" arg2="org.apache.cxf.core.config" /> |
| <then> |
| <echo file="@{configPath}/config.ini" message="${projectName}" append="true" /> |
| </then> |
| </elseif> |
| <elseif> |
| <equals arg1="${projectName}" arg2="ch.qos.logback.slf4j" /> |
| <then> |
| <echo file="@{configPath}/config.ini" message="${projectName}" append="true" /> |
| </then> |
| </elseif> |
| <elseif> |
| <equals arg1="${projectName}" arg2="com.google.guava" /> |
| <then> |
| <echo file="@{configPath}/config.ini" message="${jarFilename}@start" append="true" /> |
| </then> |
| </elseif> |
| <else> |
| <echo file="@{configPath}/config.ini" message="${projectName}@start" append="true" /> |
| </else> |
| </if> |
| |
| <var name="isFirst" value="true" /> |
| </sequential> |
| </for> |
| <echo file="@{configPath}/config.ini" append="true"> |
| osgi.noShutdown=true |
| eclipse.ignoreApp=true |
| equinox.ds.debug=true |
| osee.log.default=INFO |
| </echo> |
| </sequential> |
| </macrodef> |
| |
| <!-- *************************************************************** --> |
| <!-- GENERATE LAUNCH --> |
| <!-- *************************************************************** --> |
| <macrodef name="createLaunch"> |
| <attribute name="filepath" /> |
| <attribute name="serverport" /> |
| <attribute name="connection.id" /> |
| <attribute name="db.connection.pool.size" default="100" /> |
| <attribute name="launcher" /> |
| <attribute name="session.timeout" default="3600" /> |
| <attribute name="serverMaxMem" default="1024m" /> |
| <attribute name="executable" default="true" /> |
| <attribute name="extraVMArgs" default=" " /> |
| <sequential> |
| <echo file="@{filepath}" append="false">java -server \ |
| -Xmx@{serverMaxMem} \ |
| -Dorg.osgi.service.http.port=@{serverport} \ |
| -Dosee.db.connection.id=@{connection.id} \ |
| -Dosee.db.connection.pool.size=@{db.connection.pool.size} \ |
| -Dorg.eclipse.equinox.http.jetty.context.sessioninactiveinterval=@{session.timeout} \ |
| @{extraVMArgs} \ |
| -jar plugins/@{launcher} -console -consoleLog |
| </echo> |
| <if> |
| <equals arg1="@{executable}" arg2="true" /> |
| <then> |
| <chmod file="@{filepath}" perm="ugo+rx" /> |
| </then> |
| </if> |
| </sequential> |
| </macrodef> |
| </project> |