Skip to content

Commit 4bff1f9

Browse files
author
pdavidc
committed
Automated Web Start publication and SDK archive publication, for #73 and #74
1 parent 2ab2f84 commit 4bff1f9

File tree

3 files changed

+105
-85
lines changed

3 files changed

+105
-85
lines changed

build.xml

Lines changed: 78 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,8 @@
2828
<delete file="${basedir}/worldwindx.jar"/>
2929
</target>
3030

31-
<target name="assemble" depends="assembleDebug, assembleRelease, assembleJavadoc"
32-
description="Assembles JAR libraries for all build types and assembles the project documentation.">
33-
<copy file="${worldwind.jar.dir}/worldwind-release.jar" tofile="${basedir}/worldwind.jar"/>
34-
<copy file="${worldwind.jar.dir}/worldwindx-release.jar" tofile="${basedir}/worldwindx.jar"/>
35-
</target>
31+
<target name="assemble" depends="assembleDebug, assembleRelease, assembleJavadoc, assembleWebStart, assembleSdkArchive"
32+
description="Assembles JAR libraries for all build types and assembles the project documentation."/>
3633

3734
<!-- Targets for compiling Java sources and bundling JAR libraries. -->
3835

@@ -76,6 +73,8 @@
7673
<mkdir dir="${worldwind.jar.dir}"/>
7774
<bundleJarFiles srcdir="${worldwind.src.dir}" classdir="${worldwind.classes.dir}/release"
7875
destdir="${worldwind.jar.dir}" type="release"/>
76+
<copy file="${worldwind.jar.dir}/worldwind-release.jar" tofile="${basedir}/worldwind.jar"/>
77+
<copy file="${worldwind.jar.dir}/worldwindx-release.jar" tofile="${basedir}/worldwindx.jar"/>
7978
</target>
8079

8180
<!-- Targets for compiling and bundling the project documentation. -->
@@ -116,63 +115,6 @@
116115
</zip>
117116
</target>
118117

119-
<!-- Targets for testing the project sources. -->
120-
121-
<target name="test" depends="unitTest"
122-
description="Runs all project tests. Exits with status code 1 if any test fails.">
123-
<fail if="unitTest.failure" message="Unit tests FAILED" status="1"/>
124-
</target>
125-
126-
<target name="unitTest" depends="assembleDebug, compileUnitTestSources, runUnitTest"/>
127-
128-
<target name="compileUnitTestSources">
129-
<mkdir dir="${worldwind.classes.dir}/test"/>
130-
<compileJava srcdir="${worldwind.test.dir}" classdir="${worldwind.classes.dir}/test" type="debug"
131-
jdk="${worldwind.jdk}">
132-
<pathelements>
133-
<pathelement location="${worldwind.jar.dir}/worldwind-debug.jar"/>
134-
<pathelement location="${worldwind.jar.dir}/worldwindx-debug.jar"/>
135-
<pathelement location="${basedir}/jogl-all.jar"/>
136-
<pathelement location="${basedir}/gluegen-rt.jar"/>
137-
<pathelement location="${basedir}/gdal.jar"/>
138-
<pathelement location="${basedir}/junit-4.5.jar"/>
139-
</pathelements>
140-
</compileJava>
141-
</target>
142-
143-
<target name="runUnitTest">
144-
<delete dir="${worldwind.test.results.dir}"/>
145-
<mkdir dir="${worldwind.test.results.dir}"/>
146-
<junit failureproperty="unitTest.failure"
147-
fork="on"
148-
forkmode="once"
149-
maxmemory="1024m">
150-
<classpath>
151-
<pathelement location="${worldwind.classes.dir}/test"/>
152-
<pathelement location="${worldwind.jar.dir}/worldwind-debug.jar"/>
153-
<pathelement location="${worldwind.jar.dir}/worldwindx-debug.jar"/>
154-
<pathelement location="${basedir}/jogl-all.jar"/>
155-
<pathelement location="${basedir}/gluegen-rt.jar"/>
156-
<pathelement location="${basedir}/gdal.jar"/>
157-
<pathelement location="${basedir}/junit-4.5.jar"/>
158-
</classpath>
159-
<batchtest todir="${worldwind.test.results.dir}"
160-
skipnontests="true">
161-
<fileset dir="${worldwind.classes.dir}/test">
162-
<include name="**/*"/>
163-
</fileset>
164-
</batchtest>
165-
<formatter type="brief" usefile="no"/>
166-
<formatter type="xml" usefile="yes"/>
167-
</junit>
168-
<junitreport todir="${worldwind.test.results.dir}">
169-
<fileset dir="${worldwind.test.results.dir}">
170-
<include name="TEST-*.xml"/>
171-
</fileset>
172-
<report todir="${worldwind.test.results.dir}" format="noframes"/>
173-
</junitreport>
174-
</target>
175-
176118
<!-- Tasks for assembling the project Web Start package. -->
177119

178120
<target name="assembleWebStart"
@@ -344,6 +286,80 @@
344286
<available property="keystore.isAvailable" file="${basedir}/keystore.properties"/>
345287
</target>
346288

289+
<!-- Targets for assembling the project SDK archive. -->
290+
291+
<target name="assembleSdkArchive">
292+
<zip destfile="${worldwind.build.dir}/worldwind.zip">
293+
<fileset dir="${basedir}">
294+
<include name="**/*"/>
295+
<exclude name="build/**"/>
296+
<exclude name="classes/**"/>
297+
<exclude name="testClasses/**"/>
298+
<exclude name="keystore.properties"/>
299+
<exclude name="keystore.tar"/>
300+
<exclude name="wwstore"/>
301+
<type type="file"/>
302+
</fileset>
303+
</zip>
304+
</target>
305+
306+
<!-- Targets for testing the project sources. -->
307+
308+
<target name="test" depends="unitTest"
309+
description="Runs all project tests. Exits with status code 1 if any test fails.">
310+
<fail if="unitTest.failure" message="Unit tests FAILED" status="1"/>
311+
</target>
312+
313+
<target name="unitTest" depends="assembleDebug, compileUnitTestSources, runUnitTest"/>
314+
315+
<target name="compileUnitTestSources">
316+
<mkdir dir="${worldwind.classes.dir}/test"/>
317+
<compileJava srcdir="${worldwind.test.dir}" classdir="${worldwind.classes.dir}/test" type="debug"
318+
jdk="${worldwind.jdk}">
319+
<pathelements>
320+
<pathelement location="${worldwind.jar.dir}/worldwind-debug.jar"/>
321+
<pathelement location="${worldwind.jar.dir}/worldwindx-debug.jar"/>
322+
<pathelement location="${basedir}/jogl-all.jar"/>
323+
<pathelement location="${basedir}/gluegen-rt.jar"/>
324+
<pathelement location="${basedir}/gdal.jar"/>
325+
<pathelement location="${basedir}/junit-4.5.jar"/>
326+
</pathelements>
327+
</compileJava>
328+
</target>
329+
330+
<target name="runUnitTest">
331+
<delete dir="${worldwind.test.results.dir}"/>
332+
<mkdir dir="${worldwind.test.results.dir}"/>
333+
<junit failureproperty="unitTest.failure"
334+
fork="on"
335+
forkmode="once"
336+
maxmemory="1024m">
337+
<classpath>
338+
<pathelement location="${worldwind.classes.dir}/test"/>
339+
<pathelement location="${worldwind.jar.dir}/worldwind-debug.jar"/>
340+
<pathelement location="${worldwind.jar.dir}/worldwindx-debug.jar"/>
341+
<pathelement location="${basedir}/jogl-all.jar"/>
342+
<pathelement location="${basedir}/gluegen-rt.jar"/>
343+
<pathelement location="${basedir}/gdal.jar"/>
344+
<pathelement location="${basedir}/junit-4.5.jar"/>
345+
</classpath>
346+
<batchtest todir="${worldwind.test.results.dir}"
347+
skipnontests="true">
348+
<fileset dir="${worldwind.classes.dir}/test">
349+
<include name="**/*"/>
350+
</fileset>
351+
</batchtest>
352+
<formatter type="brief" usefile="no"/>
353+
<formatter type="xml" usefile="yes"/>
354+
</junit>
355+
<junitreport todir="${worldwind.test.results.dir}">
356+
<fileset dir="${worldwind.test.results.dir}">
357+
<include name="TEST-*.xml"/>
358+
</fileset>
359+
<report todir="${worldwind.test.results.dir}" format="noframes"/>
360+
</junitreport>
361+
</target>
362+
347363
<!-- Tasks for assembling the MIL-STD-2525 symbology package. Rasterizes MIL-STD-2525 SVG image files into PNG image
348364
files. The maxwidth and height parameters control the PNG image dimensions, where the width varies depending on
349365
the SVG image's aspect ratio. PNG files are written to the destination directory according to their relative

travis/update_release.sh

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ fi
4343
# with the tag, thus the TRAVIS_BRANCH var reflects the tag name, not "master" or "develop" like you might expect.
4444
if [[ "${TRAVIS_TAG}" == "daily"* ]]; then # daily build associated with a tag in the format daily/YYYYMMDD
4545
RELEASE_NAME="Daily Build"
46+
RELEASE_SUFFIX="daily"
4647
DRAFT="false"
4748
PRERELEASE="true"
4849
elif [[ -n $TRAVIS_TAG ]]; then # manually created tag; prepare a draft release
4950
RELEASE_NAME=$TRAVIS_TAG
51+
RELEASE_SUFFIX=$TRAVIS_TAG
5052
DRAFT="true"
5153
PRERELEASE="false"
5254
else # build is not associated with a tag; exit quietly without error
@@ -120,10 +122,13 @@ fi
120122
# Release Artifacts
121123
# =================
122124

125+
# Copy and rename build assets that are to be deployed.
126+
cp -f ${TRAVIS_BUILD_DIR}/builds/worldwind.zip ${TRAVIS_BUILD_DIR}/worldwind-${RELEASE_SUFFIX}.zip
127+
cp -f ${TRAVIS_BUILD_DIR}/builds/doc/worldwind-javadoc.zip ${TRAVIS_BUILD_DIR}/worldwind-javadoc-${RELEASE_SUFFIX}.zip
128+
cp -f ${TRAVIS_BUILD_DIR}/builds/webstart/worldwind-webstart.zip ${TRAVIS_BUILD_DIR}/worldwind-webstart-${RELEASE_SUFFIX}.zip
129+
123130
# Define the file names that are to be deployed
124-
JAR_FILES=( build/worldwind-debug.jar build/worldwindx-debug.jar build/worldwind-release.jar build/worldwindx-release.jar )
125-
ZIP_FILES=( build/doc/worldwind-javadoc.zip )
126-
ALL_FILES=( "${JAR_FILES[@]}" "${ZIP_FILES[@]}" )
131+
ALL_FILES=( worldwind-${RELEASE_SUFFIX}.zip worldwind-javadoc-${RELEASE_SUFFIX}.zip worldwind-webstart-${RELEASE_SUFFIX}.zip )
127132

128133
# Emit a log message for the updated release
129134
echo "Uploading release assets for ${RELEASE_NAME}"
@@ -144,19 +149,7 @@ do
144149
fi
145150
done
146151

147-
# Upload the release artifacts
148-
for FILENAME in ${JAR_FILES[*]}
149-
do
150-
echo "Posting ${FILENAME}"
151-
curl --silent \
152-
--header "Authorization: token ${GITHUB_API_KEY}" \
153-
--header "Content-Type: application/java-archive" \
154-
--header "Accept: application/json" \
155-
--data-binary @${TRAVIS_BUILD_DIR}/${FILENAME} \
156-
--request POST ${UPLOADS_URL}/${RELEASE_ID}/assets?name=${FILENAME} > /dev/null
157-
done
158-
159-
for FILENAME in ${ZIP_FILES[*]}
152+
for FILENAME in ${ALL_FILES[*]}
160153
do
161154
echo "Posting ${FILENAME}"
162155
curl --silent \
Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
# ======================================================================================================================
3-
# Updates the GitHub Pages website with the updated javadoc from the build. Clones the GitHub Pages to the local
4-
# filesystem, deletes the javadoc for the current build, copies the new javadoc, then commits and pushes the changes.
3+
# Updates the GitHub Pages website with updated build assets. Clones the GitHub Pages to the local filesystem, deletes
4+
# the assets for the current build, copies the new assets, then commits and pushes the changes.
55
#
66
# Uses Git to update tags in the repo. Git commands using authentication are redirected to /dev/null to prevent leaking
77
# the access token into the log.
@@ -27,14 +27,16 @@ fi
2727
# expect.
2828
if [[ "${TRAVIS_TAG}" == "daily"* ]]; then # daily build associated with a tag in the format daily/YYYYMMDD
2929
FOLDER="daily"
30+
elif [[ -n $TRAVIS_TAG ]]; then # manually created tag; draft release
31+
FOLDER="${TRAVIS_TAG}"
3032
elif [[ "${TRAVIS_BRANCH}" == "master" ]]; then # latest stable build from the master branch
3133
FOLDER="latest"
3234
else # all other build types; exit quietly without error
3335
exit 0
3436
fi
3537

36-
# Emit a log message for the javadoc update
37-
echo "Updating JavaDoc at ${GH_PAGES_REPO}/assets/java/${FOLDER}/javadoc"
38+
# Emit a log message for the update
39+
echo "Updating assets to ${GH_PAGES_REPO}/assets/java/${FOLDER}"
3840

3941
# Configure the user to be associated with commits to the GitHub pages
4042
git config --global user.email "[email protected]"
@@ -45,14 +47,23 @@ GH_PAGES_DIR=${HOME}/gh_pages
4547
git clone --quiet --branch=master https://${GITHUB_API_KEY}@${GH_PAGES_REPO} $GH_PAGES_DIR > /dev/null
4648
cd $GH_PAGES_DIR
4749

48-
# Remove existing javadocs from the repository
49-
git rm -rfq --ignore-unmatch ./assets/java/${FOLDER}/javadoc
50+
# Remove existing build assets from the repository, if any
51+
git rm -rfq --ignore-unmatch ./assets/java/${FOLDER}
5052

5153
# Copy new javadocs to the repository
5254
mkdir -p ./assets/java/${FOLDER}/javadoc
5355
cp -Rf ${TRAVIS_BUILD_DIR}/build/doc/javadoc/* ./assets/java/${FOLDER}/javadoc
5456

57+
# Copy new Web Start binaries to the repository
58+
mkdir -p ./assets/java/${FOLDER}/webstart
59+
cp -Rf ${TRAVIS_BUILD_DIR}/build/webstart/jar/* ./assets/java/${FOLDER}/webstart
60+
cp -Rf ${TRAVIS_BUILD_DIR}/build/webstart/jnlp/* ./assets/java/${FOLDER}/webstart
61+
62+
# Copy new Web Start demos to the repository
63+
mkdir -p ./assets/java/${FOLDER}/demos
64+
cp -Rf ${TRAVIS_BUILD_DIR}/demos/* ./assets/java/${FOLDER}/demos
65+
5566
# Commit and push the changes (quietly)
5667
git add -f .
57-
git commit -m "Updated javadoc from successful travis build $TRAVIS_BUILD_NUMBER in $TRAVIS_BRANCH"
68+
git commit -m "Updated assets from successful travis build $TRAVIS_BUILD_NUMBER in $TRAVIS_BRANCH"
5869
git push -fq origin master > /dev/null

0 commit comments

Comments
 (0)