-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuild.xml
206 lines (181 loc) · 8.32 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
206
<project name="Haskell" basedir=".">
<description>Haskell plugin</description>
<taskdef classname="jflex.anttask.JFlexTask" name="jflex" classpath="lib/jflex-1.5.1.jar"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="cabal.lexer.result.file" value="plugin/src/org/jetbrains/cabal/parser/_CabalLexer.java"/>
<property name="cabal.lexer.flex.file" value="plugin/src/org/jetbrains/cabal/parser/Cabal.flex"/>
<property name="haskell.lexer.result.file" value="plugin/src/org/jetbrains/haskell/parser/lexer/_HaskellLexer.java"/>
<property name="haskell.lexer.flex.file" value="plugin/src/org/jetbrains/haskell/parser/lexer/Haskell.flex"/>
<property name="idea" value="${build.dir}/IDEA"/>
<property name="idea.download.url" value="https://www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/idea/ideaIC/2017.1.4/ideaIC-2017.1.4.zip"/>
<property name="plugin.destination" value="${build.dir}/haskell-plugin/lib/" />
<property name="build.number" value="snapshot"/>
<path id="kotlinc-jar">
<fileset file="${build.dir}/kotlinc/lib/*.jar"/>
<fileset file="${basedir}/lib/asm-all.jar"/>
</path>
<path id="build.classpath">
<fileset dir="${idea}/lib">
<include name="*.jar"/>
<exclude name="kotlin-reflect.jar"/>
<exclude name="kotlin-runtime.jar"/>
</fileset>
<fileset dir="${basedir}/lib">
<include name="*.jar"/>
<exclude name="kotlin-reflect.jar"/>
<exclude name="kotlin-runtime.jar"/>
</fileset>
</path>
<target name="compile.haskell.lexer">
<sequential>
<delete file="${haskell.lexer.result.file}"/>
<jflex file="${haskell.lexer.flex.file}"
skeleton="tools/idea-flex.skeleton"/>
</sequential>
</target>
<target name="compile.grammar.lexer">
<sequential>
<delete file="./generator/src/org/jetbrains/generator/GrammarLexer.java"/>
<jflex file="./generator/src/org/jetbrains/generator/Generator.flex" />
</sequential>
</target>
<!--hamlet lexer-->
<target name="compile.hamlet.lexer">
<sequential>
<delete file="./plugin/src/org/jetbrains/yesod/hamlet/parser/_HamletLexer.java"/>
<jflex file="./plugin/src/org/jetbrains/yesod/hamlet/parser/Hamlet.flex"
skeleton="tools/idea-flex.skeleton"/>
</sequential>
</target>
<!--julius lexer-->
<target name="compile.julius.lexer">
<sequential>
<delete file="./plugin/src/org/jetbrains/yesod/julius/parser/_JuliusLexer.java"/>
<jflex file="./plugin/src/org/jetbrains/yesod/julius/parser/Julius.flex"
skeleton="tools/idea-flex.skeleton"/>
</sequential>
</target>
<!--cassius lexer-->
<target name="compile.cassius.lexer">
<sequential>
<delete file="./plugin/src/org/jetbrains/yesod/cassius/parser/_CassiusLexer.java"/>
<jflex file="./plugin/src/org/jetbrains/yesod/cassius/parser/Cassius.flex"
skeleton="tools/idea-flex.skeleton"/>
</sequential>
</target>
<!--lucius lexer-->
<target name="compile.lucius.lexer">
<sequential>
<delete file="./plugin/src/org/jetbrains/yesod/lucius/parser/_LuciusLexer.java"/>
<jflex file="./plugin/src/org/jetbrains/yesod/lucius/parser/Lucius.flex"
skeleton="tools/idea-flex.skeleton"/>
</sequential>
</target>
<!--cabal lexer-->
<target name="compile.cabal.lexer">
<sequential>
<delete file="${cabal.lexer.result.file}"/>
<jflex file="${cabal.lexer.flex.file}"
skeleton="tools/idea-flex.skeleton"/>
</sequential>
</target>
<!-- Unpack idea-*.zip file -->
<target name="idea" depends="download.idea" description="Extract downloaded artifacts and set up idea.home">
<delete dir="${idea}"/>
<mkdir dir="${idea}"/>
<basename property="idea.filename" file="${idea.download.url}"/>
<unzip src="${build.dir}/${idea.filename}" dest="${build.dir}/IDEA"/>
</target>
<!-- Download IntelliJ IDEA distribution -->
<target name="download.idea"
depends="mk.buid"
description="Downloads IntelliJ IDEA artifacts">
<get src="${idea.download.url}"
dest="${build.dir}" skipexisting="true"/>
</target>
<target name="mk.buid">
<mkdir dir="${build.dir}"/>
</target>
<!-- Download Kotlin compiler -->
<target name="kotlinc" depends="mk.buid">
<get src="https://github.com/JetBrains/kotlin/releases/download/v1.1/kotlin-compiler-1.1.zip"
dest="${build.dir}" skipexisting="true"/>
<unzip dest="${build.dir}">
<fileset dir="${build.dir}" includes="kotlin-compiler-*.zip"/>
</unzip>
<delete file="${build.dir}/kotlin-compiler-1.1.zip" />
</target>
<target name="get.dependencies" depends="kotlinc, idea">
</target>
<target name="compile.jps">
<mkdir dir="${build.dir}/jps-plugin"/>
<javac classpathref="build.classpath"
srcdir="${basedir}/jps-plugin/src"
destdir="${build.dir}/jps-plugin/"/>
<copy todir="${build.dir}/jps-plugin/">
<fileset dir="${basedir}/jps-plugin/src">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="compile.plugin">
<typedef resource="org/jetbrains/kotlin/ant/antlib.xml"
classpath="${build.dir}/kotlinc/lib/kotlin-ant.jar"/>
<path id="javac2.classpath">
<pathelement location="${idea}/lib/javac2.jar"/>
<pathelement location="${idea}/lib/asm-all.jar"/>
</path>
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
<mkdir dir="${build.dir}/plugin"/>
<javac2 destdir="${build.dir}/plugin"
classpathref="build.classpath"
includeAntRuntime="false">
<src path="${basedir}/plugin/src"/>
<src path="${basedir}/plugin/gen"/>
<withKotlin/>
</javac2>
</target>
<target name="build" depends="compile.plugin, compile.jps">
<mkdir dir="${plugin.destination}"/>
<copy todir="${build.dir}/plugin/">
<fileset dir="${basedir}/plugin/resources/" includes="**"/>
</copy>
<copy file="${basedir}/plugin/META-INF/plugin.xml" todir="${build.dir}/plugin/META-INF"/>
<replace file="${build.dir}/plugin/META-INF/plugin.xml" token="@snapshot@" value="${build.number}"/>
<jar destfile="${plugin.destination}/haskell-jps-plugin.jar">
<fileset dir="${build.dir}/jps-plugin/"/>
</jar>
<jar destfile="${plugin.destination}/haskell-plugin.jar">
<fileset dir="${build.dir}/plugin/"/>
</jar>
<copy file="${build.dir}/kotlinc/lib/kotlin-runtime.jar" todir="${plugin.destination}"/>
<copy file="${basedir}/lib/json-simple-1.1.1.jar" todir="${plugin.destination}"/>
<copy file="${basedir}/lib/commons-compress-1.8.jar" todir="${plugin.destination}"/>
<copy file="${basedir}/lib/pty4j-0.3.jar" todir="${plugin.destination}"/>
<copy todir="${plugin.destination}" >
<fileset dir="${basedir}/lib/os/" includes="**"/>
</copy>
<zip destfile="${build.dir}/haskell-plugin.zip"
basedir="${build.dir}"
includes="haskell-plugin/**"
update="true"/>
</target>
<target name="clean">
<delete includeEmptyDirs="true">
<fileset dir="${build.dir}" includes="**/*">
<exclude name="ideaIU-13.zip"/>
<exclude name="kotlin-compiler-*.zip"/>
</fileset>
</delete>
</target>
<target name="generateUpdateXml">
<delete file="${build.dir}/updatePlugin.xml" />
<echoxml file="${build.dir}/updatePlugin.xml">
<plugins>
<plugin id="org.jetbrains.haskell"
url="http://teamcity.jetbrains.com/guestAuth/repository/download/Haskell_Build/.lastSuccessful/haskell-plugin.zip"
version="0.5.1-b.${build.number}" />
</plugins>
</echoxml>
</target>
</project>