-
Notifications
You must be signed in to change notification settings - Fork 31
/
build.xml
246 lines (218 loc) · 11.8 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
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2005-2022 Sixth and Red River Software, Bas Leijdekkers
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project name="MetricsReloaded" default="package">
<property file="build.properties"/>
<!--
Override these next two properties `idea.dir` and `idea.plugin.dir` in a
build.properties file.
The IntelliJ IDEA version must be at least Ultimate 2020.1 and needs to have plugins
installed for Java, JSP, Groovy, Kotlin, JavaScript, CSS and Scale. Of these Scala
is the only one not included in a default IntelliJ IDEA install and needs to be
downloaded separately. Newer versions of IntelliJ IDEA may work as well, but often
fail because of changes in jar packaging.
-->
<property name="idea.dir" value="/Applications/IntelliJ IDEA 2020.1.app/Contents"/>
<property name="idea.plugin.dir" value="${user.home}/Library/Application Support/IntelliJIdea2020.1"/>
<property name="src.dir" value="src"/>
<property name="build.classes.dir" value="build/jar-classes"/>
<property name="debug" value="true"/>
<property name="jar.file" value="build/MetricsReloaded.jar"/>
<property name="resources.jar.file" value="build/resources_en.jar"/>
<property name="project.fullname" value="MetricsReloaded"/>
<property name="dist.zip.file" value="build/${project.fullname}.zip"/>
<property name="openapi.src.dir" value="openapi/src"/>
<property name="openapi.build.classes.dir" value="openapi/${build.classes.dir}"/>
<property name="openapi.jar.file" value="openapi/build/MetricsReloadedOpenAPI.jar"/>
<property name="openapi.javadoc.dir" value="openapi/build/javadoc"/>
<property name="stockmetrics.src.dir" value="stockmetrics/src"/>
<property name="stockmetrics.build.classes.dir" value="stockmetrics/${build.classes.dir}"/>
<property name="stockmetrics.jar.file" value="stockmetrics/build/stockmetrics.jar"/>
<property name="stockmetrics.resources.jar.file" value="stockmetrics/build/stockmetrics_resources_en.jar"/>
<property name="utils.src.dir" value="utils/src"/>
<property name="utils.build.classes.dir" value="utils/${build.classes.dir}"/>
<property name="utils.jar.file" value="utils/build/utils.jar"/>
<property name="build.compiler" value="modern"/>
<property name="build.sysclasspath" value="ignore"/>
<path id="openapi.class.path">
<pathelement location="${idea.dir}/lib/platform-api.jar"/>
<pathelement location="${idea.dir}/redist/annotations-java8.jar"/>
<pathelement location="${idea.dir}/lib/util.jar"/>
<pathelement location="${idea.dir}/lib/extensions.jar"/>
<pathelement location="${idea.dir}/plugins/java/lib/java-api.jar"/>
</path>
<path id="utils.class.path">
<pathelement location="${idea.dir}/lib/trove4j.jar"/>
<pathelement location="${idea.dir}/redist/annotations-java8.jar"/>
<pathelement location="${idea.dir}/lib/platform-api.jar"/>
<pathelement location="${idea.dir}/lib/util.jar"/>
<pathelement location="${idea.dir}/lib/extensions.jar"/>
<pathelement location="${idea.dir}/plugins/java/lib/java-api.jar"/>
</path>
<path id="plugin.class.path">
<pathelement location="lib/jcommon-0.9.1.jar"/>
<pathelement location="lib/jfreechart-0.9.16.jar"/>
<pathelement location="lib/args4j-2.32.jar" />
<pathelement location="${openapi.build.classes.dir}"/>
<pathelement location="${utils.build.classes.dir}"/>
<pathelement location="${idea.dir}/lib/platform-api.jar"/>
<pathelement location="${idea.dir}/lib/platform-impl.jar"/>
<pathelement location="${idea.dir}/lib/platform-core-ui.jar"/>
<pathelement location="${idea.dir}/lib/platform-util-ui.jar"/>
<pathelement location="${idea.dir}/lib/util.jar"/>
<pathelement location="${idea.dir}/lib/extensions.jar"/>
<pathelement location="${idea.dir}/lib/jdom.jar"/>
<pathelement location="${idea.dir}/lib/intellij-xml.jar"/>
<pathelement location="${idea.dir}/redist/annotations-java8.jar"/>
<pathelement location="${idea.dir}/redist/forms_rt.jar"/>
<!-- jars for language specific metrics support -->
<pathelement location="${idea.dir}/plugins/java/lib/java-api.jar"/>
<pathelement location="${idea.dir}/plugins/java/lib/java-impl.jar"/>
<pathelement location="${idea.dir}/plugins/CSS/lib/css-openapi.jar"/>
<pathelement location="${idea.dir}/plugins/Groovy/lib/Groovy.jar"/>
<pathelement location="${idea.dir}/plugins/jsp/lib/jsp-impl.jar"/>
<pathelement location="${idea.dir}/plugins/JavaScriptLanguage/lib/javascript-openapi.jar"/>
<pathelement location="${idea.plugin.dir}/Scala/lib/scala-plugin.jar"/>
<pathelement location="${idea.plugin.dir}/Kotlin/lib/kotlin-plugin.jar"/>
</path>
<path id="javac2.classpath">
<pathelement location="${idea.dir}/lib/javac2.jar"/>
<pathelement location="${idea.dir}/lib/asm-all.jar"/>
</path>
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
<target name="prepare">
<loadfile property="version" srcFile="${src.dir}/version.txt"/>
<replaceregexp file="${src.dir}/META-INF/plugin.xml"
match="<version>[\d\.]+</version>"
replace="<version>${version}</version>"/>
<mkdir dir="${openapi.build.classes.dir}"/>
<mkdir dir="${stockmetrics.build.classes.dir}"/>
<mkdir dir="${utils.build.classes.dir}"/>
<mkdir dir="${build.classes.dir}"/>
</target>
<target name="compile-openapi" depends="prepare">
<javac2 srcdir="${openapi.src.dir}" destdir="${openapi.build.classes.dir}" includes="com/sixrr/**" debug="${debug}">
<classpath refid="openapi.class.path"/>
</javac2>
</target>
<target name="javadoc-openapi" depends="prepare">
<javadoc sourcepath="${openapi.src.dir}" destdir="${openapi.javadoc.dir}" packagenames="com.sixrr.metrics"
classpathref="openapi.class.path"/>
</target>
<target name="create-openapi-jar" depends="compile-openapi">
<jar jarfile="${openapi.jar.file}" duplicate="fail" index="true" indexMetaInf="true">
<fileset dir="${openapi.build.classes.dir}"/>
</jar>
</target>
<target name="compile-utils" depends="prepare, compile-openapi">
<javac2 srcdir="${utils.src.dir}" destdir="${utils.build.classes.dir}"
includes="com/sixrr/**" debug="${debug}">
<classpath refid="utils.class.path"/>
</javac2>
</target>
<target name="create-utils-jar" depends="compile-utils">
<jar jarfile="${utils.jar.file}" duplicate="fail" index="true" indexMetaInf="true">
<fileset dir="${utils.build.classes.dir}"/>
</jar>
</target>
<target name="compile-stockmetrics" depends="prepare, compile-openapi, compile-utils">
<javac2 srcdir="${stockmetrics.src.dir}" destdir="${stockmetrics.build.classes.dir}"
includes="com/sixrr/**" debug="${debug}">
<classpath refid="plugin.class.path"/>
</javac2>
</target>
<target name="create-stockmetrics-jars" depends="compile-stockmetrics">
<jar jarfile="${stockmetrics.jar.file}" duplicate="fail" index="true" indexMetaInf="true">
<fileset dir="${stockmetrics.build.classes.dir}"/>
</jar>
<jar jarfile="${stockmetrics.resources.jar.file}" duplicate="fail" index="true" indexMetaInf="true">
<fileset dir="stockmetrics/src">
<include name="**/*.properties"/>
</fileset>
<fileset dir="stockmetrics/metricsDescriptions">
<include name="**/**"/>
</fileset>
</jar>
</target>
<target name="compile" depends="prepare, compile-openapi, compile-utils, compile-stockmetrics">
<javac2 srcdir="${src.dir}" destdir="${build.classes.dir}"
includes="com/sixrr/**" debug="${debug}">
<classpath refid="plugin.class.path"/>
</javac2>
</target>
<target name="create-jars" depends="compile">
<jar jarfile="${jar.file}" duplicate="fail" index="true" indexMetaInf="true">
<fileset dir="${build.classes.dir}"/>
<fileset dir="${src.dir}" includes="META-INF/*.xml" />
</jar>
<jar jarfile="${resources.jar.file}" duplicate="fail" index="true"
indexMetaInf="true">
<fileset dir="src" includes="**/*.properties"/>
<fileset dir="resources"/>
</jar>
</target>
<target name="deploy" depends="create-utils-jar, create-openapi-jar, create-jars, create-stockmetrics-jars"
description="deploy the plugin to the plugin directory">
<mkdir dir="${idea.plugin.dir}"/>
<mkdir dir="${idea.plugin.dir}/MetricsReloaded"/>
<mkdir dir="${idea.plugin.dir}/MetricsReloaded/doc"/>
<mkdir dir="${idea.plugin.dir}/MetricsReloaded/license"/>
<mkdir dir="${idea.plugin.dir}/MetricsReloaded/lib"/>
<mkdir dir="${idea.plugin.dir}/MetricsReloaded/help"/>
<copy file="${openapi.jar.file}" todir="${idea.plugin.dir}/MetricsReloaded/lib" overwrite="true"/>
<copy file="${stockmetrics.jar.file}" todir="${idea.plugin.dir}/MetricsReloaded/lib" overwrite="true"/>
<copy file="${stockmetrics.resources.jar.file}" todir="${idea.plugin.dir}/MetricsReloaded/lib" overwrite="true"/>
<copy file="${utils.jar.file}" todir="${idea.plugin.dir}/MetricsReloaded/lib" overwrite="true"/>
<copy file="${jar.file}" todir="${idea.plugin.dir}/MetricsReloaded/lib" overwrite="true"/>
<copy file="${resources.jar.file}" todir="${idea.plugin.dir}/MetricsReloaded/lib" overwrite="true"/>
<copy file="lib/jcommon-0.9.1.jar" todir="${idea.plugin.dir}/MetricsReloaded/lib" overwrite="true"/>
<copy file="lib/jfreechart-0.9.16.jar" todir="${idea.plugin.dir}/MetricsReloaded/lib" overwrite="true"/>
<copy file="lib/args4j-2.32.jar" todir="${idea.plugin.dir}/MetricsReloaded/lib" overwrite="true"/>
<copy todir="${idea.plugin.dir}/MetricsReloaded/license" overwrite="true">
<fileset dir="license">
<include name="**/**"/>
</fileset>
</copy>
</target>
<target name="clean" description="Clean up the distribution">
<delete dir="${build.classes.dir}"/>
<delete dir="${openapi.build.classes.dir}"/>
<delete dir="${stockmetrics.build.classes.dir}"/>
<delete dir="${utils.build.classes.dir}"/>
<delete file="${jar.file}"/>
<delete file="${resources.jar.file}"/>
<delete file="${openapi.jar.file}"/>
<delete file="${stockmetrics.jar.file}"/>
<delete file="${stockmetrics.resources.jar.file}"/>
<delete file="${utils.jar.file}"/>
</target>
<target name="package" depends="create-openapi-jar, create-utils-jar, create-stockmetrics-jars, create-jars"
description="create zipfile for uploading to plugins.intellij.net">
<zip destfile="${dist.zip.file}">
<zipfileset file="${jar.file}" prefix="MetricsReloaded/lib"/>
<zipfileset file="${resources.jar.file}" prefix="MetricsReloaded/lib"/>
<zipfileset file="${utils.jar.file}" prefix="MetricsReloaded/lib"/>
<zipfileset file="${openapi.jar.file}" prefix="MetricsReloaded/lib"/>
<zipfileset file="${stockmetrics.jar.file}" prefix="MetricsReloaded/lib"/>
<zipfileset file="${stockmetrics.resources.jar.file}" prefix="MetricsReloaded/lib"/>
<zipfileset file="lib/jcommon-0.9.1.jar" prefix="MetricsReloaded/lib"/>
<zipfileset file="lib/jfreechart-0.9.16.jar" prefix="MetricsReloaded/lib"/>
<zipfileset file="lib/args4j-2.32.jar" prefix="MetricsReloaded/lib"/>
<zipfileset dir="license" prefix="MetricsReloaded/license"/>
<zipfileset file="${src.dir}/version.txt" prefix="MetricsReloaded"/>
</zip>
</target>
</project>