forked from aionnetwork/AVM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
205 lines (185 loc) · 10.9 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="clean_buildmain" name="AVM">
<property name="dir.global.workspace" value="."/>
<property name="dir.global.build" value="${dir.global.workspace}/build"/>
<property name="dir.global.build.main" value="${dir.global.build}/main"/>
<property name="dir.global.build.scratch-deps-jar" value="${dir.global.build.main}/scratch-deps.jar"/>
<target name="clean">
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.utilities/build.xml" target="clean">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.rt/build.xml" target="clean">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.core/build.xml" target="clean">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.api/build.xml" target="clean">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.userlib/build.xml" target="clean">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.tooling/build.xml" target="clean">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.embed/build.xml" target="clean">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<delete dir="${dir.global.build}"/>
<delete file="${dir.global.workspace}/avm.jar"/>
</target>
<target name="clean_buildmain">
<echo message="Building ${ant.project.name}..."/>
<delete dir="${dir.global.build.main}"/>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.utilities/build.xml" target="clean_buildmain">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.api/build.xml" target="clean_buildmain">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.rt/build.xml" target="clean_buildmain">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.userlib/build.xml" target="clean_buildmain">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.core/build.xml" target="clean_buildmain">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.tooling/build.xml" target="clean_buildmain">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.embed/build.xml" target="clean_buildmain">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<delete dir="${dir.global.workspace}/dist"/>
<!-- Create a scratch JAR of our dependencies since we can't filter their contents in one step -->
<jar jarfile="${dir.global.build.scratch-deps-jar}" >
<zipgroupfileset dir="${dir.global.build.main}" includes="*.jar" />
<zipgroupfileset dir="${dir.global.workspace}/lib" includes="*.jar" />
</jar>
<!-- Now, build this dependency JAR into our static avm.jar -->
<jar jarfile="${dir.global.workspace}/dist/avm.jar">
<manifest>
<attribute name="Automatic-Module-Name" value="avm" />
<attribute name="Main-Class" value="org.aion.cli.AvmCLI" />
</manifest>
<zipfileset src="${dir.global.build.scratch-deps-jar}">
<exclude name="META-INF/**" />
<exclude name="module-info.class" />
</zipfileset>
</jar>
<!-- Scratch deps is now done -->
<delete file="${dir.global.build.scratch-deps-jar}"/>
<copy file="${dir.global.build.main}/org-aion-avm-api.jar" todir="${dir.global.workspace}/dist/lib"></copy>
<copy file="${dir.global.build.main}/org-aion-avm-userlib.jar" todir="${dir.global.workspace}/dist/lib"></copy>
<copy file="docs/README.md" todir="${dir.global.workspace}/dist"></copy>
<copy file="docs/USER_GUIDE.md" todir="${dir.global.workspace}/dist"></copy>
<copy file="LICENSE.txt" todir="${dir.global.workspace}/dist"></copy>
<copy file="scripts/compile.sh" todir="${dir.global.workspace}/dist"></copy>
<chmod perm="755" file="${dir.global.workspace}/dist/compile.sh"></chmod>
<javadoc
defaultexcludes="yes"
destdir="${dir.global.workspace}/dist/javadoc"
author="true"
version="true"
use="true"
overview="org.aion.avm.api/src/overview.html"
windowtitle="AVM Blockchain API">
<classpath>
<pathelement path="${dir.global.workspace}/lib/*"/>
<pathelement path="${dir.global.workspace}/build/main/*"/>
</classpath>
<arg value = "-html5"/>
<fileset dir="org.aion.avm.api/src">
<include name="**/*.java"/>
<exclude name="**/module-info.java"/>
</fileset>
<fileset dir="org.aion.avm.userlib/src">
<include name="**/*.java"/>
<exclude name="**/module-info.java"/>
</fileset>
<fileset dir="org.aion.avm.embed/src">
<include name="**/org/aion/avm/embed/AvmRule.java"/>
<include name="**/org/aion/avm/embed/package-info.java"/>
</fileset>
</javadoc>
<copy todir="${dir.global.workspace}/dist/examples">
<fileset dir="${dir.global.workspace}/org.aion.avm.embed/src/examples">
<include name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="test">
<echo message="Building tests for ${ant.project.name}..."/>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.utilities/build.xml" target="test">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.userlib/build.xml" target="test">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.core/build.xml" target="test">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.rt/build.xml" target="test">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.tooling/build.xml" target="test">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<ant inheritAll="false" antfile="${dir.global.workspace}/org.aion.avm.embed/build.xml" target="test">
<property name="compile.debug" value="${compile.debug}"/>
</ant>
<!-- We want to test that the dist and example work, especially when AVM is embedded in a non-system classloader.
(In the future, we might formalize this, but we will start with inline logic, here)
-->
<delete dir="${dir.global.build}/dist"/>
<copy todir="${dir.global.build}/dist">
<fileset dir="${dir.global.workspace}/dist">
</fileset>
</copy>
<chmod perm="755" file="${dir.global.build}/dist/compile.sh"></chmod>
<javac debug="true" debuglevel="source,lines,vars" includeantruntime="false" release="10"
srcdir="${dir.global.workspace}/dist_test"
excludes="**/package-info.java"
destdir="${dir.global.workspace}/dist_test" includes="**/*.java">
</javac>
<copy file="${dir.global.workspace}/dist_test/EmbedCli.class" todir="${dir.global.build}/dist"></copy>
<exec executable="./compile.sh" dir="${dir.global.build}/dist">
<arg value="examples.HelloWorld"/>
<arg value="examples/HelloWorld.java"/>
</exec>
<java classname="EmbedCli" dir="${dir.global.build}/dist" fork="true" failonerror="true">
<arg value="avm.jar"/>
<arg value="build/dapp.jar"/>
</java>
</target>
<!-- We will treat our "package" build as a distinct task which just puts together the JARs we need for embedding in the kernel.
-->
<target name="package">
<property name="jar.utilities" value="org-aion-avm-utilities"/>
<property name="jar.api" value="org-aion-avm-api"/>
<property name="jar.core" value="org-aion-avm-core"/>
<property name="jar.rt" value="org-aion-avm-rt"/>
<property name="jar.tooling" value="org-aion-avm-tooling"/>
<property name="jar.embed" value="org-aion-avm-embed"/>
<property name="jar.userlib" value="org-aion-avm-userlib"/>
<property name="dir.embedding" value="${dir.global.workspace}/embedding"/>
<exec executable="git" outputproperty="git.revision" failifexecutionfails="true">
<arg value="describe"/>
<arg value="--always"/>
<arg value="HEAD"/>
</exec>
<echo message="Packaging AVM ${git.revision} for kernel embedding in ${dir.embedding}"/>
<delete dir="${dir.embedding}"/>
<mkdir dir="${dir.embedding}"/>
<copy file="${dir.global.build.main}/${jar.utilities}.jar" tofile="${dir.embedding}/${jar.utilities}-${git.revision}.jar"/>
<copy file="${dir.global.build.main}/${jar.api}.jar" tofile="${dir.embedding}/${jar.api}-${git.revision}.jar"/>
<copy file="${dir.global.build.main}/${jar.core}.jar" tofile="${dir.embedding}/${jar.core}-${git.revision}.jar"/>
<copy file="${dir.global.build.main}/${jar.rt}.jar" tofile="${dir.embedding}/${jar.rt}-${git.revision}.jar"/>
<copy file="${dir.global.build.main}/${jar.tooling}.jar" tofile="${dir.embedding}/${jar.tooling}-${git.revision}.jar"/>
<copy file="${dir.global.build.main}/${jar.embed}.jar" tofile="${dir.embedding}/${jar.embed}-${git.revision}.jar"/>
<copy file="${dir.global.build.main}/${jar.userlib}.jar" tofile="${dir.embedding}/${jar.userlib}-${git.revision}.jar"/>
</target>
</project>