forked from SIMRacingApps/SIMRacingApps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
217 lines (204 loc) · 13.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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="signed" name="SIMRacingApps-exe">
<property name="verboseFlag" value="0" />
<script language="javascript">
var logger = project.getBuildListeners().firstElement();
var verboseMode = project.getProperty( "verboseFlag" )
if ( ! "0".equals( verboseMode ) )
logger.setMessageOutputLevel( 9 );
</script>
<property environment="env" />
<property name="launch4j.dir" location="Launch4j" />
<property name="vap.version" value="2020.05.16" />
<property name="sign4j.exe" value="Launch4j/sign4j/sign4j.exe" />
<!-- get jsign from https://ebourg.github.io/jsign -->
<property name="jsign.jar" value="jsign-2.0.jar" />
<!--
To build your own signed exe, you must provide your own certificate.
Here are the steps to build one.
- To create a self signed certificate for testing, run this command (change to your stuff)
- It will prompt for a password that you will use later when building the exe
- This will be used at some point to generate a certificate request to send to a certificate authority
- to get a certified certificate. But, for now, this should at least prevent tampering with the exe file.
cd ${env.CertPath}
"C:\Program Files\Java\jre1.8.0_161\bin\keytool.exe" -genkey -dname "CN=Jeffrey Gilliam, L=Marietta, ST=GA, C=US, OU=, O=SIMRacingApps" -alias SIMRacingApps.com -keyalg RSA -destkeystore SIMRacingApps.pfx -keysize 2048 -storetype pkcs12
-->
<property name="key.store" value="${env.CertPath}/SIMRacingApps.pfx" />
<property name="key.alias" value="SIMRacingApps.com" />
<taskdef name="launch4j" classname="net.sf.launch4j.ant.Launch4jTask" classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/lib/xstream.jar" />
<property name="deployment.dir" value="${user.home}/Documents/SIMRacingApps" />
<property name="download.dir" value="O:/OneDrive/SIMRacingApps" />
<property name="SIMRacingAppsServer.location" value="../SIMRacingAppsServer" />
<property name="SIMRacingAppsWebContent.location" value="../SIMRacingAppsWebContent" />
<property name="SIMRacingAppsElectron.location" value="../SIMRacingAppsElectron" />
<property name="SIMRacingApps.github.io.location" value="../SIMRacingApps.github.io" />
<property name="SIMRacingAppsSIMPluginiRacing.location" value="../SIMRacingAppsSIMPluginiRacing" />
<property name="debuglevel" value="source,lines,vars" />
<target name="Server.jar">
<ant dir="${SIMRacingAppsServer.location}" target="jar" inheritAll="false" />
</target>
<target name="iRacing.sra">
<ant dir="${SIMRacingAppsSIMPluginiRacing.location}" target="sra" inheritAll="false" />
</target>
<target name="WebContent.jar">
<ant dir="${SIMRacingAppsWebContent.location}" target="jar" inheritAll="false" />
</target>
<target name="electron-apps.sra">
<ant dir="${SIMRacingAppsElectron.location}" target="sra" inheritAll="false" />
</target>
<target name="exe" description="Converts the jar files to an exe" depends="Server.jar,iRacing.sra,WebContent.jar,electron-apps.sra">
<sequential>
<property file="${SIMRacingAppsServer.location}/src/com/SIMRacingApps/version.properties" prefix="version" />
<property name="version" value="${version.major}.${version.minor}_Build_${version.build}" />
<echo message="Server Version: ${version}" />
<replaceregexp match="^Version.*$" replace="Version: ${version}" byline="true">
<fileset dir="documentation" includes="SIMRacingApps_ReleaseNotes.txt" />
</replaceregexp>
<replaceregexp match="^Version.*$" replace="Version: ${version}" byline="true">
<fileset dir="documentation" includes="SIMRacingApps_${version.prefix}ReleaseNotes.txt" />
</replaceregexp>
<echo message="Release Notes Updated to: ${version}" />
<property file="${SIMRacingAppsSIMPluginiRacing.location}/src/com/SIMRacingApps/SIMPlugins/iRacing/version.properties" prefix="iRacing" />
<property name="iRacing.version" value="${iRacing.major}.${iRacing.minor}_Build_${iRacing.build}" />
<echo message="iRacing Version: ${iRacing.version}" />
<copy overwrite="true" file="SIMRacingAppsServer.l4j.ini" tofile="${java.io.tmpdir}/SIMRacingAppsServer_${version}.l4j.ini" />
<jar destfile="${java.io.tmpdir}/SIMRacingApps.jar">
<manifest>
<attribute name="Manifest-Version" value="${version}" />
<attribute name="Created-By" value="Jeffrey Gilliam" />
<attribute name="Main-Class" value="com.SIMRacingApps.Server" />
</manifest>
<zipgroupfileset file="${java.io.tmpdir}/SIMRacingAppsServer.jar" />
<zipgroupfileset file="${java.io.tmpdir}/SIMRacingAppsPlugin-iRacing.sra" />
<zipgroupfileset file="${java.io.tmpdir}/SIMRacingAppsWebContent.jar" />
<zipgroupfileset file="${java.io.tmpdir}/electron-apps.sra" />
<fileset dir="${java.io.tmpdir}">
<include name="SIMRacingAppsServer_${version}.l4j.ini" />
</fileset>
<fileset dir=".">
<include name="documentation/**" />
</fileset>
<fileset dir=".">
<include name="COPYRIGHT.TXT" />
<include name="LICENSE.TXT" />
<include name="NOTICE.TXT" />
</fileset>
</jar>
<delete file="${java.io.tmpdir}/SIMRacingAppsServer_${version}.l4j.ini" />
<!-- get launch4j at http://launch4j.sourceforge.net -->
<launch4j>
<config headerType="console"
outfile="${java.io.tmpdir}/SIMRacingAppsServer.exe"
dontWrapJar="false"
stayalive="true"
jar="${java.io.tmpdir}/SIMRacingApps.jar"
errTitle="SIMRacingAppsServer"
downloadUrl="http://java.com/download"
icon="${SIMRacingAppsWebContent.location}/favicon.ico">
<classPath mainClass="com.SIMRacingApps.Server">
<!-- cp>%USERPROFILE%/Documents/SIMRacingApps</cp -->
<cp>%HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal%/SIMRacingApps</cp>
</classPath>
<jre minVersion="1.8.0"
bundledJre64Bit="false"
bundledJreAsFallback="false"
jdkPreference="preferJre"
runtimeBits="64/32"
initialHeapSize="256"
maxHeapSize="512">
<opt>-Djna.nosys=true</opt>
</jre>
<singleInstance mutexName="SIMRacingAppsServer" windowTitle="SIMRacingAppsServer" />
<versionInfo txtFileVersion="${version}" fileVersion="${version.major}.${version.minor}.${version.year}.${version.month}${version.day2}" fileDescription="SIMRacingAppsServer" txtProductVersion="${version}" productVersion="${version.major}.${version.minor}.0.0" productName="SIMRacingApps" internalName="SIMRacingApps" originalFilename="SIMRacingAppsServer.exe" copyright="${version.copyright}" />
<messages jreVersionErr="Requires a Java Runtime Environment Equal or Greater Than" />
</config>
</launch4j>
</sequential>
</target>
<target name="signed" depends="exe">
<!-- Set the environment variables CertPath and CertPass in the Ant build environment properties.
<echo message="Look for password prompt to continue..."/>
<input message="Certificate Password" addproperty="store.pass" />
-->
<property name="store.pass" value="${env.CertPass}" />
<property file="${SIMRacingAppsServer.location}/src/com/SIMRacingApps/version.properties" prefix="version" />
<property name="version" value="${version.major}.${version.minor}_Build_${version.build}" />
<echo message="Server Version: ${version}" />
<copy overwrite="true" file="${java.io.tmpdir}/SIMRacingAppsServer.exe" tofile="${java.io.tmpdir}/SIMRacingAppsServer-signed.exe" />
<echo message="If the sign4j process fails, sure to set the environment variables CertPath and CertPass in the Ant build environment properties"/>
<exec executable="${sign4j.exe}" resultProperty="sign4j.result" failonerror="true">
<arg line="javaw -jar ${jsign.jar} --alias '${key.alias}' --keystore '${key.store}' --storepass '${store.pass}' --storetype PKCS12 '${java.io.tmpdir}/SIMRacingAppsServer-signed.exe'"/>
</exec>
</target>
<target name="deploy" depends="signed">
<property file="${SIMRacingAppsServer.location}/src/com/SIMRacingApps/version.properties" prefix="version" />
<property name="version" value="${version.major}.${version.minor}_Build_${version.build}" />
<copy overwrite="true" file="${java.io.tmpdir}/SIMRacingAppsServer.exe" tofile="${deployment.dir}/SIMRacingAppsServer_${version}.exe" />
<copy overwrite="true" file="${java.io.tmpdir}/SIMRacingAppsServer.exe" tofile="${deployment.dir}/SIMRacingAppsServer.exe" />
<copy overwrite="true" file="${java.io.tmpdir}/SIMRacingAppsServer-signed.exe" tofile="${deployment.dir}/SIMRacingAppsServer_${version}-signed.exe" />
<copy overwrite="true" file="${java.io.tmpdir}/SIMRacingAppsServer-signed.exe" tofile="${deployment.dir}/SIMRacingAppsServer-signed.exe" />
<echo message="Remember to Tag all Git Repositories with: Version_${version}"/>
</target>
<target name="deploy_website">
<property file="${SIMRacingAppsServer.location}/src/com/SIMRacingApps/version.properties" prefix="version" />
<property name="docs" value="${SIMRacingApps.github.io.location}/docs" />
<delete dir="${docs}/documentation" />
<copy todir="${docs}/documentation">
<fileset dir="${SIMRacingAppsWebContent.location}/documentation" />
<fileset dir="documentation" />
</copy>
<delete dir="${docs}/JavaScriptDoc" />
<copy todir="${docs}/JavaScriptDoc">
<fileset dir="${deployment.dir}/JavaScriptDoc" />
</copy>
<delete dir="${docs}/JavaDoc" />
<copy todir="${docs}/JavaDoc">
<fileset dir="${deployment.dir}/JavaDoc" />
</copy>
<delete dir="${docs}/apps" />
<copy todir="${docs}/apps">
<fileset dir="${SIMRacingAppsWebContent.location}/apps">
<include name="**/icon.png" />
</fileset>
</copy>
<delete dir="${docs}/widgets" />
<copy todir="${docs}/widgets">
<fileset dir="${SIMRacingAppsWebContent.location}/widgets">
<include name="**/icon.png" />
</fileset>
</copy>
<copy overwrite="true" file="COPYRIGHT.TXT" tofile="${docs}/COPYRIGHT.TXT" />
<copy overwrite="true" file="LICENSE.TXT" tofile="${docs}/LICENSE.TXT" />
<copy overwrite="true" file="NOTICE.TXT" tofile="${docs}/NOTICE.TXT" />
<copy todir="${SIMRacingApps.github.io.location}">
<fileset dir="${SIMRacingAppsWebContent.location}">
<include name="SRA-Logo*.png" />
<include name="favicon.*" />
</fileset>
</copy>
<copy overwrite="true" file="COPYRIGHT.TXT" tofile="${SIMRacingApps.github.io.location}/COPYRIGHT.TXT" />
<copy overwrite="true" file="LICENSE.TXT" tofile="${SIMRacingApps.github.io.location}/LICENSE.TXT" />
<copy overwrite="true" file="NOTICE.TXT" tofile="${SIMRacingApps.github.io.location}/NOTICE.TXT" />
<echo
file="${SIMRacingApps.github.io.location}/${version.prefix}version.json"
message='{ "major": "${version.major}", "minor": "${version.minor}", "build": "${version.build}" }'
/>
</target>
<target name="release" depends="deploy_website">
<property file="${SIMRacingAppsServer.location}/src/com/SIMRacingApps/version.properties" prefix="version" />
<property name="version" value="${version.major}.${version.minor}_Build_${version.build}" />
<move todir="${download.dir}/archive">
<fileset dir="${download.dir}">
<include name="SIMRacingAppsServer_${version.major}.*.exe">
</include>
</fileset>
</move>
<copy overwrite="true" file="${deployment.dir}/SIMRacingAppsServer_${version}.exe" todir="${download.dir}"/>
<copy overwrite="true" file="${deployment.dir}/SIMRacingAppsServer_${version}-signed.exe" todir="${download.dir}"/>
<copy overwrite="true" file="documentation/SIMRacingApps_ReleaseNotes.txt" todir="${download.dir}" />
<copy overwrite="true" file="documentation/SIMRacingApps_${version.prefix}ReleaseNotes.txt" todir="${download.dir}" />
<copy overwrite="true" file="SIMRacingApps-VoiceAttack-Profile.vap" tofile="${download.dir}/SIMRacingApps-VoiceAttack-Profile-${vap.version}.vap" />
<copy overwrite="true" file="${SIMRacingAppsWebContent.location}/documentation/SIMRacingApps - Quick Start Guide/SIMRacingApps - Quick Start Guide.pdf" todir="${download.dir}" />
<echo message="Remember to Tag all Git Repositories with: Version_${version}"/>
</target>
</project>