forked from atsky/haskell-idea-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
155 lines (134 loc) · 6.22 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
<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="http://download.jetbrains.com/idea/ideaIU-13.zip"/>
<property name="external.annotations.path" value="${basedir}/annotations"/>
<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"/>
</fileset>
<fileset dir="${basedir}/lib">
<include name="*.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.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="Unzip downloaded artifacts and set up idea.home">
<delete dir="${idea}"/>
<mkdir dir="${idea}"/>
<basename property="idea.filename" file="${idea.download.url}"/>
<unzip dest="${idea}">
<fileset dir="${build.dir}" includes="${idea.filename}"/>
</unzip>
</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="download.kotlinc" depends="mk.buid">
<get src="https://github.com/JetBrains/kotlin/releases/download/build-0.8.11/kotlin-compiler-0.8.11.zip"
dest="${build.dir}" skipexisting="true"/>
</target>
<target name="mk.buid">
<mkdir dir="${build.dir}"/>
</target>
<!-- Download IntelliJ IDEA distribution -->
<target name="kotlinc" depends="download.kotlinc">
<unzip dest="${build.dir}">
<fileset dir="${build.dir}" includes="kotlin-compiler-*.zip"/>
</unzip>
</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/jet/buildtools/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/asm4-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"
srcdir="${basedir}/plugin/src">
<withKotlin externalannotations="${external.annotations.path}"/>
</javac2>
</target>
<target name="build" depends="compile.plugin, compile.jps">
<mkdir dir="${plugin.destination}"/>
<copydir src="${basedir}/plugin/resources/" dest="${build.dir}/plugin/"/>
<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="${basedir}/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}"/>
<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.3.${build.number}" />
</plugins>
</echoxml>
</target>
</project>