forked from adempiere/adempiere
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.xml
131 lines (122 loc) · 7.08 KB
/
build.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
<project name="Adempiere Build" default="build" basedir=".">
<description>
Building ADempiere, by
Yamel Senih (http://www.erpya.com)
Victor Perez ([email protected], http://www.e-evolution.com)
Mario Calderon ([email protected], http://westfalia-it.com)
</description>
<property environment="env" />
<!-- set global properties for this build -->
<property name="env_directory" location="adempiere/Adempiere/utils"/>
<property name="AD_directory" location="adempiere/Adempiere"/>
<property name="adempiere_build" location="utils_dev/build.xml"/>
<property name="myEnvironment" location="adempiere/Adempiere/utils/myEnvironment.sh"/>
<property name="myEnvironmentTemplate" location="adempiere/Adempiere/utils/myEnvironmentTemplate.sh"/>
<property name="RUN_DBRestore" location="adempiere/Adempiere/utils/RUN_DBRestore.sh"/>
<property name="RUN_DBExport" location="adempiere/Adempiere/utils/RUN_DBExport.sh"/>
<property name="RUN_ExportReference" location="adempiere/Adempiere/utils/RUN_ExportReference.sh"/>
<property name="RUN_ImportAdempiere" location="adempiere/Adempiere/utils/RUN_ImportAdempiere.sh"/>
<property name="RUN_MigrateXML" location="adempiere/Adempiere/utils/RUN_MigrateXML.sh"/>
<property name="RUN_silentsetup" location="adempiere/Adempiere/RUN_silentsetup.sh"/>
<property name="AdempierePropertiesFrom" location="adempiere/Adempiere/AdempiereEnvTemplate.properties"/>
<property name="AdempierePropertiesTo" location="adempiere/Adempiere/AdempiereEnv.properties"/>
<property name="myDBcopyTemplate" location="adempiere/Adempiere/utils/myDBcopyTemplate.sh"/>
<property name="myDBcopy" location="adempiere/Adempiere/utils/myDBcopy.sh"/>
<target name="build" description="Step 1: Create installation artifacts">
<echo message="Building ADempiere"/>
<ant antfile="${adempiere_build}" target="complete"/>
<echo message="Build finished"/>
<antcall target="deploy"/>
</target>
<target name="deploy" description="Step 2: Deploy ADempiere prior to installation">
<echo message="Deploy ADempiere"/>
<chmod dir="${AD_directory}" perm="ugo+rx" includes="**/*.sh"/>
<chmod dir="${AD_directory}/data" perm="ugo+rx" includes="**/*.dmp"/>
<chmod dir="${env_directory}" perm="ugo+rx" includes="**/*.sh"/>
<chmod dir="${env_directory}/PostgreSQL" perm="ugo+rx" includes="**/*.sh"/>
<echo message="Java Home : ${env.JAVA_HOME}"/>
<echo message="ADempiere Home : ${env.ADEMPIERE_HOME}"/>
<echo message="Copy AdempiereEnvTemplate.properties to AdempiereEnv.properties"/>
<copy file="${AdempierePropertiesFrom}" tofile="${AdempierePropertiesTo}" filtering="yes" overwrite="yes" />
<replaceregexp file="${AdempierePropertiesTo}" match="ADEMPIERE_HOME=/opt/Adempiere" replace="ADEMPIERE_HOME=${env.ADEMPIERE_HOME}" byline="true"/>
<replaceregexp file="${AdempierePropertiesTo}" match="JAVA_HOME=/usr/lib/jvm/jdk-11" replace="JAVA_HOME=${env.JAVA_HOME}" byline="true"/>
<property file="${AdempierePropertiesTo}"/>
<filter filtersfile="${AdempierePropertiesTo}" />
<echo message="Generate myEnvironment.sh"/>
<copy file="${myEnvironmentTemplate}" tofile="${myEnvironment}" filtering="yes" overwrite="yes" />
<echo message="Deploy finished"/>
<antcall target="silent-setup"/>
</target>
<target name="silent-setup" description="Step 3: Run SilentSetup">
<echo message="Install ADempiere"/>
<java dir="${env.ADEMPIERE_HOME}" classname="org.compiere.install.SilentSetup" fork="true">
<arg value="ALL"/>
<jvmarg value="--add-opens"/>
<jvmarg value="java.base/sun.security.tools.keytool=ALL-UNNAMED"/>
<jvmarg value="--add-exports"/>
<jvmarg value="java.base/jdk.internal.misc=ALL-UNNAMED"/>
<jvmarg value="--add-opens"/>
<jvmarg value="java.base/java.lang=ALL-UNNAMED"/>
<sysproperty key="ADEMPIERE_HOME" value="${env.ADEMPIERE_HOME}"/>
<classpath>
<pathelement location="${env.ADEMPIERE_HOME}/lib/CInstall.jar"/>
<pathelement location="${env.ADEMPIERE_HOME}/lib/Adempiere.jar"/>
<pathelement location="${env.ADEMPIERE_HOME}/lib/CCTools.jar"/>
<pathelement location="${env.ADEMPIERE_HOME}/lib/oracle.jar"/>
<pathelement location="${env.ADEMPIERE_HOME}/lib/postgresql.jar"/>
<pathelement path="${java.class.path}"/>
</classpath>
</java>
<echo message="Install ADempiere finished"/>
<tstamp>
<format property="current.time" pattern="dd/MM/yyyy hh:mm:ss"/>
</tstamp>
<concat destfile="${AdempierePropertiesTo}" append="true">CDate=${current.time}</concat>
<echo message="Copy myDBcopyTemplate to myDBcopy"/>
<copy file="${myDBcopyTemplate}"
tofile="${myDBcopy}" filtering="yes" overwrite="yes" />
<antcall target="import-database-seed"/>
</target>
<!-- Target will be executed if called as follows: -Dnodbrestore=false or without parameter -->
<!-- Target will not be executed if called as follows: -Dnodbrestore=true -->
<target name="import-database-seed" description="Step 4: Run Import ADempiere: import seed" unless="${nodbrestore}">
<echo message="Run Import ADempiere"/>
<exec dir="${env_directory}" executable="/bin/bash" failonerror="true">
<arg value="${RUN_ImportAdempiere}"/>
</exec>
<echo message="Import seed finished"/>
<!-- <antcall target="restore-database-seed"/> Skip Restore because database was already restored -->
<antcall target="import-xml-files"/>
</target>
<!-- Target will be executed if called as follows: -Dnodbrestore=false or without parameter -->
<!-- Target will NOT be executed if called as follows: -Dnodbrestore=true -->
<!-- Skip Restore because database was already restored
<target name="restore-database-seed" description="Step 5: Run DB Restore ADempiere: restore seed" unless="${nodbrestore}">
<echo message="Run DB Restore ADempiere"/>
<exec dir="${env_directory}" executable="/bin/bash" failonerror="true">
<arg value="${RUN_DBRestore}"/>
</exec>
<echo message="Restore seed finished"/>
<antcall target="import-xml-files"/>
</target>
-->
<!-- Target will be executed if called as follows: -Dnodbrestore=false or without parameter -->
<!-- Target will not be executed if called as follows: -Dnodbrestore=true -->
<target name="import-xml-files" description="Step 5: Run Migrate XML: load and apply all migration xml files" unless="${nodbrestore}">
<echo message="Run Migrate XML"/>
<exec dir="${AD_directory}" executable="/bin/bash" failonerror="true">
<arg value="${RUN_MigrateXML}"/>
</exec>
<echo message="Run Migrate XML finished"/>
<antcall target="export-database"/>
</target>
<!-- Target will be executed if called as follows: -Dnodbrestore=false or without parameter -->
<!-- Target will not be executed if called as follows: -Dnodbrestore=true -->
<target name="export-database" description="Step 6: Export restored and migrated database" unless="${nodbrestore}">
<echo message="Run Export Database"/>
<exec dir="${env_directory}" executable="/bin/bash" failonerror="true">
<arg value="${RUN_ExportReference}"/>
</exec>
<echo message="Run Export Database finished"/>
</target>
</project>