forked from olabini/ioke
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ioke-ikc.build
232 lines (204 loc) · 8.47 KB
/
ioke-ikc.build
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
<?xml version="1.0"?>
<project name="ioke" default="build" basedir=".">
<description>
ioke is a next generation language, based on Io, Self, Smalltalk, Ruby and Lisp
</description>
<property name="src.raw.dir" value="src"/>
<property name="src.dir" value="src/ikc/main"/>
<property name="lib.dir" value="lib"/>
<property name="lib.build.dir" value="${lib.dir}/build"/>
<property name="bin.dir" value="bin"/>
<property name="release.dir" value="rels"/>
<property name="build.dir" value="build"/>
<property name="build.filtered.dir" value="${build.dir}/filtered"/>
<property name="test.results.dir" value="${build.dir}/test-results"/>
<script language="C#" prefix="version">
<code>
<![CDATA[
[Function("extract-property")]
public static string ExtractProperty(string name, string from) {
try {
string outp = System.IO.File.ReadAllText(from);
string[] pieces = outp.Split('\n');
foreach(string s in pieces) {
string[] keyAndValue = s.Split('=');
if(keyAndValue[0].Equals(name))
return keyAndValue[1];
}
return null;
} catch(System.Exception) { return null; }
}
]]>
</code>
</script>
<property name="VERSION_NAME" value="${version::extract-property('VERSION_NAME', 'version.properties')}" />
<property name="VERSION_NUMBER" value="${version::extract-property('VERSION_NUMBER', 'version.properties')}" />
<property name="VERSION_ADDITION" value="${version::extract-property('VERSION_ADDITION', 'version.properties')}" />
<if test="${environment::variable-exists('BUILD_RELEASE_VERSION')}">
<property name="VERSION_ADDITION" value="" />
</if>
<if test="${environment::variable-exists('ADD_SNAPSHOT_VERSION')}">
<property name="VERSION_ADDITION" value="-p${environment::get-variable('GO_PIPELINE_COUNTER')}" />
</if>
<target name="prepare" description="Creates the directories needed for building">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.filtered.dir}"/>
<mkdir dir="${release.dir}"/>
</target>
<target name="generate_filters" depends="prepare" description="Generates source files">
<exec program="ruby" failonerror="false">
<arg value="generate_filter_data.rb"/>
</exec>
</target>
<target name="generate_version_data" depends="generate_filters" description="Generates version data">
<echo file="${build.filtered.dir}/Ioke.Lang.version.properties">ioke.build.version=${VERSION_NAME}
ioke.build.runtimeVersion=${VERSION_NUMBER}${VERSION_ADDITION}
ioke.build.versionString=Ioke ${VERSION_NAME} ikc ${VERSION_NUMBER}${VERSION_ADDITION}
ioke.build.date=${version::extract-property('DATE', 'version_data.properties')}
ioke.build.commit=${version::extract-property('COMMIT', 'version_data.properties')}
</echo>
</target>
<target name="compile" depends="generate_version_data" description="Compile the source files for the project.">
<csc target="library" output="${bin.dir}/Ioke.Math.dll" debug="true">
<sources>
<include name="${src.dir}/Ioke.Math/**/*.cs" />
</sources>
</csc>
<csc target="library" output="${bin.dir}/Ioke.Lang.dll" debug="true">
<sources>
<include name="${src.dir}/getline.cs" />
<include name="${src.dir}/Ioke.Lang/**/*.cs" />
<exclude name="${src.dir}/Ioke.Lang/Main.cs"/>
<exclude name="${src.dir}/Ioke.Lang/ISpecMain.cs"/>
<exclude name="${src.dir}/Ioke.Lang/DokgenMain.cs"/>
</sources>
<references basedir="${bin.dir}">
<include name="Ioke.Math.dll" />
<include name="NRegex.dll" />
</references>
<resources basedir="${src.raw.dir}" dynamicprefix="true">
<include name="builtin/**/*.ik" />
</resources>
<resources basedir="${src.raw.dir}/ikc" dynamicprefix="true">
<include name="builtin/**/*.ik" />
</resources>
<resources basedir="${build.filtered.dir}" dynamicprefix="true">
<include name="*.properties" />
</resources>
</csc>
<csc target="exe" output="${bin.dir}/ioke.exe" debug="true">
<sources>
<include name="${src.dir}/Ioke.Lang/Main.cs"/>
</sources>
<references basedir="${bin.dir}">
<include name="Ioke.Lang.dll" />
</references>
</csc>
<csc target="exe" output="${bin.dir}/ispec.exe" debug="true">
<sources>
<include name="${src.dir}/Ioke.Lang/ISpecMain.cs"/>
</sources>
<references basedir="${bin.dir}">
<include name="ioke.exe" />
</references>
</csc>
<csc target="exe" output="${bin.dir}/dokgen.exe" debug="true">
<sources>
<include name="${src.dir}/Ioke.Lang/DokgenMain.cs"/>
</sources>
<references basedir="${bin.dir}">
<include name="ioke.exe" />
</references>
</csc>
</target>
<target name="compile-version" depends="generate_version_data" description="Compiles a version DLL">
<al output="${bin.dir}/Ioke.Lang.Version.dll" target="lib">
<sources basedir="${build.filtered.dir}" defaultexcludes="true">
<include name="*.properties" />
</sources>
</al>
</target>
<target name="add-new-version-file" depends="compile-version" description="Adds a version DLL to the original DLL">
<move file="${bin.dir}/Ioke.Lang.dll" tofile="${bin.dir}/Ioke.Lang.Org.dll"/>
<exec managed="true" program="bin/ILRepack.exe">
<arg line="/out:${bin.dir}/Ioke.Lang.dll ${bin.dir}/Ioke.Lang.Org.dll ${bin.dir}/Ioke.Lang.Version.dll"/>
</exec>
<delete file="${bin.dir}/Ioke.Lang.Org.dll"/>
</target>
<target name="test" depends="compile" description="Runs all ISpec tests">
<exec managed="true" program="bin/ispec.exe">
<arg line="test -fs"/>
</exec>
</target>
<target name="ci-test" description="Runs all ISpec tests">
<exec managed="true" program="bin/ispec.exe">
<arg line="test -fx to: ${test.results.dir}"/>
</exec>
</target>
<target name="build" depends="test" description="Builds everything">
</target>
<target name="dist-bin">
<tar destfile="${release.dir}/ioke-${VERSION_NAME}-ikc-${VERSION_NUMBER}${VERSION_ADDITION}.tar.gz" compression="GZip">
<fileset filemode="755" basedir="." prefix="ioke">
<include name="bin/*.dll"/>
<include name="bin/*.exe"/>
<include name="bin/ispec"/>
<include name="bin/dokgen"/>
<exclude name="bin/Ioke.Lang.Org.dll"/>
<exclude name="bin/Ioke.Lang.Version.dll"/>
<exclude name="bin/ILRepack.exe"/>
</fileset>
<fileset basedir="." prefix="ioke">
<include name="lib/ioke/**"/>
<include name="dok/**"/>
<include name="share/**"/>
<include name="COPYING"/>
<include name="LICENSE"/>
<include name="LICENSE.kawa"/>
<include name="LICENSE.icu4j"/>
<include name="README"/>
</fileset>
</tar>
<zip zipfile="${release.dir}/ioke-${VERSION_NAME}-ikc-${VERSION_NUMBER}${VERSION_ADDITION}.zip">
<fileset basedir="." prefix="ioke">
<include name="bin/*.dll"/>
<include name="bin/*.exe"/>
<include name="bin/ispec"/>
<include name="bin/dokgen"/>
<exclude name="bin/Ioke.Lang.Org.dll"/>
<exclude name="bin/Ioke.Lang.Version.dll"/>
<exclude name="bin/ILRepack.exe"/>
</fileset>
<fileset basedir="." prefix="ioke">
<include name="lib/ioke/**"/>
<include name="dok/**"/>
<include name="share/**"/>
<include name="COPYING"/>
<include name="LICENSE"/>
<include name="LICENSE.kawa"/>
<include name="LICENSE.icu4j"/>
<include name="README"/>
</fileset>
</zip>
</target>
<target name="dist" depends="build, dist-bin"/>
<target name="dist-notest" depends="compile, dist-bin"/>
<target name="ci-dist" depends="prepare, dist-bin"/>
<target name="ci-clean-dist">
<delete dir="${release.dir}"/>
</target>
<target name="clean" description="clean almost everything">
<delete file="${bin.dir}/ioke.dll"/>
<delete file="${bin.dir}/ioke.dll.mdb"/>
<delete file="${bin.dir}/ioke.exe"/>
<delete file="${bin.dir}/ioke.exe.mdb"/>
<delete file="${bin.dir}/ispec.exe"/>
<delete file="${bin.dir}/ispec.exe.mdb"/>
<delete file="${bin.dir}/dokgen.exe"/>
<delete file="${bin.dir}/dokgen.exe.mdb"/>
<delete file="${bin.dir}/Ioke.Lang.dll"/>
<delete file="${bin.dir}/Ioke.Lang.dll.mdb"/>
<delete file="${bin.dir}/Ioke.Math.dll"/>
<delete file="${bin.dir}/Ioke.Math.dll.mdb"/>
</target>
</project>