forked from codeminders/javahidapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
executable file
·187 lines (161 loc) · 7.14 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build" name="hidapi" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.3.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.6"/>
<property name="source" value="1.6"/>
<property name="src" location="src" />
<property name="build" location="build" />
<property name="dist" location="dist" />
<!-- define Maven coordinates -->
<property name="groupId" value="com.codeminders" />
<property name="artifactId" value="hidapi" />
<property name="version" value="1.1" />
<!-- define artifacts' name, which follows the convention of Maven -->
<property name="maven-jar" value="${dist}/lib/${artifactId}-${version}.jar" />
<property name="maven-javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" />
<property name="maven-sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" />
<!-- defined maven snapshots and staging repository id and url -->
<property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots" />
<property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots" />
<property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<path id="hidapi.classpath">
<pathelement location="bin"/>
<pathelement location="${ANT_HOME}"/>
</path>
<target name="init">
<mkdir dir="${build}" />
<mkdir dir="${dist}/lib" />
<copy includeemptydirs="false" todir="${build}">
<fileset dir="src">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
<target depends="clean" name="cleanall"/>
<target depends="build-subprojects,build-project" name="build"/>
<target name="build-subprojects"/>
<target depends="init" name="build-project">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac includeantruntime="true" debug="true" debuglevel="${debuglevel}" destdir="${build}" source="${source}" target="${target}">
<src path="src"/>
<classpath refid="hidapi.classpath"/>
</javac>
</target>
<target name="jni-stubs" depends="build-project">
<javah destdir="jni-stubs" classpath="bin">
<class name="com.codeminders.hidapi.HIDManager"/>
<class name="com.codeminders.hidapi.HIDDevice"/>
<class name="com.codeminders.hidapi.HIDDeviceInfo"/>
</javah>
</target>
<target name="print-jni-types" depends="build-project">
<exec executable="javap">
<arg value="-private" />
<arg value="-s" />
<arg value="-classpath" />
<arg value="${build}" />
<arg value="com.codeminders.hidapi.HIDDevice" />
</exec>
<exec executable="javap">
<arg value="-private" />
<arg value="-s" />
<arg value="-classpath" />
<arg value="${build}" />
<arg value="com.codeminders.hidapi.HIDManager" />
</exec>
<exec executable="javap">
<arg value="-private" />
<arg value="-s" />
<arg value="-classpath" />
<arg value="${build}" />
<arg value="com.codeminders.hidapi.HIDDeviceInfo" />
</exec>
</target>
<target name="run" depends="build-project">
<java classname="com.codeminders.hidapi.HIDAPITest" failonerror="true" fork="yes">
<classpath refid="hidapi.classpath"/>
<jvmarg value="-Djava.library.path=${basedir}/mac"/>
</java>
</target>
<target name="dist" depends="build-project" description="generate the distribution">
<javadoc
destdir="${dist}/javadoc"
author="true"
version="true"
use="true"
windowtitle="HID API">
<fileset dir="src" defaultexcludes="yes">
<include name="com/codeminders/hidapi/**"/>
<exclude name="com/codeminders/hidapi/*Test*"/>
</fileset>
</javadoc>
<jar jarfile="${dist}/lib/${artifactId}-${version}-javadoc.jar">
<fileset dir="${dist}/javadoc" />
</jar>
<!-- build the main artifact -->
<jar destfile="${dist}/lib/${artifactId}-${version}.jar"
basedir="${build}"
includes="com/codeminders/hidapi/**"
excludes="**/HIDAPITest.class"
>
<fileset dir="${basedir}/lib">
<exclude name="*.jar"/>
</fileset>
</jar>
<!-- build the sources artifact -->
<jar destfile="${dist}/lib/${artifactId}-${version}-sources.jar">
<fileset dir="src" includes="**/*.java"/>
</jar>
</target>
<target name="deploy" depends="dist" description="deploy snapshot version to Maven snapshot repository">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-deploy-plugin:2.6:deploy-file" />
<arg value="-Durl=${maven-snapshots-repository-url}" />
<arg value="-DrepositoryId=${maven-snapshots-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-jar}" />
</artifact:mvn>
</target>
<!-- before this, update project version (both build.xml and pom.xml) from SNAPSHOT to RELEASE -->
<target name="stage" depends="dist" description="deploy release version to Maven staging repository">
<!-- sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-jar}" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-sources-jar}" />
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=pom.xml" />
<arg value="-Dfile=${maven-javadoc-jar}" />
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
</project>