-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.xml
186 lines (164 loc) · 6.47 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
<project name="javacup" default ="dist" basedir="." xmlns:resolver="antlib:org.apache.maven.resolver.ant">
<property name="etc" location="etc" />
<property name="bin" location="bin" />
<property name="lib" location="lib" />
<property name="src" location="src" />
<property name="java" location="java" />
<property name="classes" location="classes" />
<property name="bootstrap" location="bootstrap" />
<property name="dist" location="dist" />
<property name="flex" location="flex" />
<property name="cup" location="cup" />
<property name="package" value="com/github/jhoenicke/javacup" />
<property name="version" value="1.2"/>
<property name="jar" value="jh-javacup-${version}"/>
<property name="runtimejar" value="${jar}-runtime"/>
<!-- initialize the workspace -->
<target name="init">
<tstamp />
<mkdir dir="${classes}" />
<mkdir dir="${dist}" />
</target>
<property environment="env" />
<path id="libraries">
<pathelement location="${src}" />
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
<path id="binaries">
<fileset dir="${bin}">
<include name="**/*.jar" />
</fileset>
</path>
<target name="clean">
<delete dir="${java}" />
<delete dir="${bootstrap}" />
<delete dir="${classes}" />
<delete dir="${dist}" />
</target>
<taskdef name="jflex" classname="JFlex.anttask.JFlexTask" classpath="JFlex.jar" />
<target name="bootstrap" depends="init">
<mkdir dir="${bootstrap}" />
<javac includeantruntime="false" srcdir="${src}" destdir="${bootstrap}" source="8" target="8">
<exclude name="${package}/anttask/**"/>
</javac>
<mkdir dir="${java}" />
<copy todir="${java}">
<fileset dir="${src}">
<exclude name="${package}/Parser.java"/>
<exclude name="${package}/Lexer.java"/>
<exclude name="${package}/sym.java"/>
</fileset>
</copy>
<java fork="true" classpath="${bootstrap}" classname="com.github.jhoenicke.javacup.Main">
<arg value="-destdir"/>
<arg value="${java}/${package}"/>
<arg value="${cup}/parser.cup"/>
</java>
<jflex file="${flex}/Lexer.jflex" destdir="${java}" />
</target>
<target name="compile" depends="bootstrap">
<javac includeantruntime="true" srcdir="${java}" destdir="${classes}" source="8" target="8" />
</target>
<target name="dist" depends="compile">
<jar jarfile="${dist}/${jar}.jar" basedir="${classes}">
<manifest>
<attribute name="Main-Class" value="${package}/Main" />
</manifest>
</jar>
<jar jarfile="${dist}/${runtimejar}.jar" basedir="${classes}"
includes="${package}/runtime/*">
</jar>
</target>
<target name="test" depends="dist">
<java jar="${dist}/${jar}.jar" fork="true">
<arg value="${cup}/parser.cup" />
</java>
</target>
<target name="javadoc">
<javadoc access="protected" author="true"
classpath="${bootstrap}"
destdir="javadoc"
Doctitle="Java Cup Public API"
nodeprecated="false"
nodeprecatedlist="false"
noindex="false"
nonavbar="false"
notree="false"
source="8"
splitindex="true"
use="true"
version="true"
Windowtitle="Java Cup Public API">
<fileset dir="." defaultexcludes="yes">
<include name="src/${package}/runtime/**" />
</fileset>
</javadoc>
<echo message="Generated JavaDOC API under ${basedir}/javadoc/index.html" />
</target>
<!-- Create a source jar -->
<target name="dist_src" depends="javadoc">
<mkdir dir="${dist}"/>
<jar destfile="${dist}/${jar}-sources.jar">
<zipfileset dir="." prefix="jh-javacup-${version}">
<include name="src/**" />
<include name="cup/**" />
<include name="flex/**" />
<include name="META-INF/**" />
<include name="JFlex.jar" />
<include name="build.xml" />
<include name="pom_template.xml" />
<include name="manual.html" />
<include name="cup_logo.gif" />
<include name="changelog.txt" />
<include name="README.md" />
</zipfileset>
</jar>
<jar destfile="${dist}/${jar}-javadoc.jar">
<zipfileset dir="javadoc" />
</jar>
</target>
<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml"
classpath="maven-resolver-ant-tasks-1.3.1-uber.jar" />
<resolver:remoterepo id="ossrh-snap" url="https://oss.sonatype.org/content/repositories/snapshots/" type="default" releases="false" snapshots="true" updates="always" checksums="fail"/>
<resolver:remoterepo id="ossrh" url="https://oss.sonatype.org/service/local/staging/deploy/maven2" type="default" releases="true" snapshots="false" updates="always" checksums="fail"/>
<target name="maven" depends="dist,dist_src">
<copy file="pom_template.xml" tofile="${dist}/pom.xml"/>
<replace file="${dist}/pom.xml" token="VERSION" value="${version}"/>
<echo>
Now sign all jar files and pom.xml in ${dist}:
for i in ${dist}/{pom.xml,*.jar}; do gpg --detach-sig -a --sign -u 5ef57534 $i; done
Then run `ant deploy`.
</echo>
</target>
<target name="deploy">
<echo>
Uploading artifacts using ~/.m2/settings.xml. I hope you have the
permissions to do this.
</echo>
<resolver:pom file="${dist}/pom.xml" id="pom"/>
<resolver:artifacts id="output">
<artifact file="${dist}/${jar}.jar" />
<artifact type="jar.asc" file="${dist}/${jar}.jar.asc" />
<artifact classifier="runtime" file="${dist}/${runtimejar}.jar" />
<artifact classifier="runtime" type="jar.asc" file="${dist}/${runtimejar}.jar.asc" />
<artifact classifier="sources" file="${dist}/${jar}-sources.jar" />
<artifact classifier="sources" type="jar.asc" file="${dist}/${jar}-sources.jar.asc" />
<artifact classifier="javadoc" file="${dist}/${jar}-javadoc.jar" />
<artifact classifier="javadoc" type="jar.asc" file="${dist}/${jar}-javadoc.jar.asc" />
<artifact type="pom.asc" file="${dist}/pom.xml.asc" />
</resolver:artifacts>
<resolver:deploy artifactsref="output">
<remoterepo refid="ossrh"/>
</resolver:deploy>
<echo>
Log into https://oss.sonatype.org as jhoenicke.
Click "Staging Repository", scroll down to com.github.jhoenicke...
Select it, check contents.
Click Close above the list of repositories.
Click Refresh (after a few seconds).
Click Release.
</echo>
</target>
</project>