Skip to main content
summaryrefslogblamecommitdiffstats
blob: 43499e61c20885a460899adaa682539bc8dda8e0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                                                
 



                                                                                           
                                                                              







                                                                                                


                                                                               































                                                                                                                                                                                   


                                                                                                                                                                                                                                                                     

                 

                                                                                                                                                                                                                                      

                 

                                                                                                                                                                                                                                                                                                                                                                                                         









                                                                                                              
                                                                                        



                                                                                                                                         
                                                                                                
































                                                                                                                                                                         












                                                                                                                                               
                                                                                                                          









                                                                                                                                               





                                                                                                                                                     




                                                                                                                                             


















                                                                                
                                                                          
                                             
                                                                   


                                                                 
                                               
                            
                                                                              


                                            
                                                           
                                                                                     
                                           
                
                                             









                                                                                  
<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" />
		<property name="server-etc-path" value="${server-path}/etc" />

		<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>

		<mkdir dir="${server-etc-path}" />
		<copydir src="${etc-content-path}" dest="${server-etc-path}" />

		<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="postgreSqlLaunch">
		<createLaunch filepath="${server-path}/runPostgreSqlLocal.sh" cm.cfg.uri="etc/osee.postgresql.json" connection.id="postgresqlLocalhost" serverport="8089" launcher="${equinox-launcher-jar}" extraVMArgs="-Dosee.authentication.protocol=trustAll" />
	</target>

	<target name="hsqlLaunch">
		<createLaunch filepath="${server-path}/runHsql.sh" cm.cfg.uri="etc/osee.hsql.json" connection.id="hsql" serverport="8089" launcher="${equinox-launcher-jar}" extraVMArgs="-Dosee.authentication.protocol=trustAll " />
	</target>

	<target name="demoLaunch">
		<createLaunch filepath="${server-path}/runDemo.sh" cm.cfg.uri="etc/osee.hsql.json" connection.id="hsql" serverport="8089" launcher="${equinox-launcher-jar}" extraVMArgs="-Dosee.authentication.protocol=demo \${line.separator}-Dosee.connection.info.uri=&quot;demo/osee.demo.db.connection.xml&quot; \${line.separator}-Dosee.application.server.data=&quot;demo/binary_data&quot;" />

		<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="generateLaunchScripts" depends="demoLaunch,hsqlLaunch,postgreSqlLaunch" />

	<!-- *************************************************************** -->
	<!--   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=" " />
		<attribute name="cm.cfg.uri" />
		<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} \
-Dcm.config.uri=&quot;@{cm.cfg.uri}&quot; \
@{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>

Back to the top