forked from molgenis/molgenis_apps-legacy
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build_compute3.xml
149 lines (124 loc) · 5.91 KB
/
build_compute3.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
<project>
<!-- This name is used to name the war file -->
<property name="app_name" value="compute" />
<!-- This holds all the settings for the generator -->
<property name="app_properties" value="apps/${app_name}/org/molgenis/${app_name}/${app_name}.properties" />
<!-- This determines what handwritten modules should be loaded -->
<path id="app.class.path">
<pathelement location="apps/${app_name}" />
<pathelement location="modules/auth" />
<pathelement location="modules/compute" />
<pathelement location="modules/compute3" />
<pathelement location="modules/pheno" />
<pathelement location="modules/import" />
<pathelement location="modules/settings" />
<pathelement location="modules/file" />
<pathelement location="modules/datamodel" />
<pathelement location="modules/decorators/core" />
<pathelement location="modules/decorators/pheno" />
<pathelement location="modules/decorators/auth" />
<pathelement location="modules/webserver" />
</path>
<!-- Import all tasks from build_common: clean, generate, compile, test, war, standalone-jar -->
<import file="build_common.xml" />
<!-- Make a distribution:
* Generate and compile this molgenis app
* Bundle it with all associated dependencies and resources like manuals, example files, etc.
* Create a *.zip archive -->
<target name="makedistro">
<!-- Create folder structure for distro -->
<property name="root_distro_dir" value="${basedir}/dist/"/>
<property name="app_distro_dir" value="${root_distro_dir}/molgenis_${app_name}/"/>
<mkdir dir="${app_distro_dir}"/>
<!-- Get SVN revision info from the commandline SVN client-->
<exec executable="svn" output="${app_distro_dir}/svn.properties">
<arg value="info"/>
<!--<arg value="http://www.molgenis.org/svn/molgenis_apps/trunk"/>-->
<arg value="${basedir}"/>
</exec>
<exec executable="sed" output="${app_distro_dir}/svn.properties">
<arg value="s/[[:space:]]//g"/>
<arg value="${app_distro_dir}/svn.properties"/>
</exec>
<exec executable="sed" output="${app_distro_dir}/svn.properties">
<arg value="s/(.*)//"/>
<arg value="${app_distro_dir}/svn.properties"/>
</exec>
<property prefix="svn" file="${app_distro_dir}/svn.properties"/>
<echo>Creating MOLGENIS/compute distro based on SVN Revision: ${svn.Revision}</echo>
<echo>Creating MOLGENIS/compute distro based on SVN LCD: ${svn.LastChangedDate}</echo>
<!-- Delete the old distro -->
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${app_distro_dir}" />
</delete>
<!-- Create folder substructure for distro -->
<property name="app-r_distro_dir" value="${app_distro_dir}/molgenis_${app_name}-r${svn.Revision}/"/>
<property name="lib_dir" value="${app-r_distro_dir}/lib/"/>
<property name="templates_dir" value="${app-r_distro_dir}/templates/"/>
<property name="protocols_dir" value="${app-r_distro_dir}/protocols/"/>
<property name="workflows_dir" value="${app-r_distro_dir}/workflows/"/>
<property name="app_module_dir" value="${basedir}/modules/compute/" />
<property name="app_module_compute3_dir" value="${basedir}/modules/compute3/" />
<!-- Copy README to the distro dir -->
<copy todir="${app-r_distro_dir}">
<fileset dir="${basedir}/apps/${app_name}/org/molgenis/${app_name}/">
<include name="README*"/>
</fileset>
</copy>
<!-- Copy example script to analyze a test data set -->
<copy todir="${app_distro_dir}">
<fileset dir="${basedir}/apps/${app_name}/org/molgenis/${app_name}/">
<include name="test_molgenis_compute.sh"/>
</fileset>
</copy>
<!-- Copy all generic templates, protocols and workflows to the distro dir -->
<copy todir="${templates_dir}">
<fileset dir="${app_module_compute3_dir}/templates/"/>
</copy>
<copy todir="${protocols_dir}">
<fileset dir="${app_module_dir}/protocols/"/>
</copy>
<copy todir="${workflows_dir}">
<fileset dir="${app_module_dir}/workflows/"/>
</copy>
<!-- Copy all dependencies to the distro lib dir -->
<!-- This is a manually maintained list of libs for now, but we should collect this from include statements -->
<copy todir="${lib_dir}">
<fileset dir="${molgenis.dir}/lib/">
<include name="commons-io-2.4.jar"/>
<include name="freemarker.jar"/>
<include name="log4j-1.2.15.jar"/>
</fileset>
</copy>
<!-- Create molgenis.jar -->
<jar jarfile="${lib_dir}/molgenis-r${svn.Revision}.jar" basedir="${build.molgenis.dir}" update="false"/>
<!-- Create molgenis_app.jar in folder dist/${app} -->
<jar jarfile="${lib_dir}/molgenis_${app_name}-r${svn.Revision}.jar" basedir="${build.molgenis_apps.dir}" update="false"/>
<!-- Make shell script to start molgenis app from the commandline -->
<echo file="${app-r_distro_dir}/molgenis_${app_name}.sh">#!/bin/bash
#
# This script runs the MOLGENIS/compute commandline with only the jars needed added to the CLASSPATH.
# To get relative path to this script use $(dirname -- "$0").
#
MCDIR=$( cd -P "$( dirname "$0" )" && pwd )
java -cp \
$(dirname -- "$0")/lib/molgenis-r${svn.Revision}.jar:\
$(dirname -- "$0")/lib/molgenis_compute-r${svn.Revision}.jar:\
$(dirname -- "$0")/lib/commons-io-2.4.jar:\
$(dirname -- "$0")/lib/freemarker.jar:\
$(dirname -- "$0")/lib/log4j-1.2.15.jar \
org.molgenis.compute.commandline.ComputeCommandLine \
-mcdir=${MCDIR} \
$*
</echo>
<chmod file="${app-r_distro_dir}/molgenis_${app_name}.sh" perm="755"/>
<!-- Make package with 'lib','workflows','protocols' and shell script -->
<zip destfile="${root_distro_dir}/molgenis_${app_name}-r${svn.Revision}.zip" basedir="${app_distro_dir}" update="false" />
<!-- Cleanup -->
<delete includeEmptyDirs="true" failonerror="false">
<fileset dir="${app_distro_dir}" />
</delete>
</target>
<target name="clean-generate-compile-test-makedistro" depends="clean,generate,compile,test,makedistro"/>
<target name="clean-generate-compile-makedistro" depends="clean,generate,compile,makedistro"/>
</project>