Skip to content

Commit

Permalink
Use 'repos' folder to cache large downloads (Eclipse, JRE, NSIS)
Browse files Browse the repository at this point in the history
  • Loading branch information
howlger committed Apr 30, 2018
1 parent 9cc7f66 commit 3073923
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 37 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/out/
/repos/
/temp/
/sample-files-for-testing/
/eclipse-as-editor-*_setup.exe
15 changes: 15 additions & 0 deletions .settings/Build 'Eclipse as editor'.launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntLaunchConfigurationType">
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/Eclipse-as-editor/build.xml"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Eclipse-as-editor"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/Eclipse-as-editor/build.xml}"/>
<stringAttribute key="process_factory_id" value="org.eclipse.ant.ui.remoteAntProcessFactory"/>
</launchConfiguration>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
84 changes: 47 additions & 37 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ and with no claim as to its suitability for any purpose. -->
net.resheim.eclipse.timekeeper.feature.group
"/>

<!-- temp (working) and output directories -->
<!-- directories: temp (working), repository (for caching) and output -->
<property name="temp.dir" location="temp"/>
<property name="repos.dir" location="repos"/>
<property name="out.dir" location="out"/>

<!-- full build -->
Expand Down Expand Up @@ -172,17 +173,19 @@ and with no claim as to its suitability for any purpose. -->
replace="${line.separator} \1="/>
</filterchain>
</move>
<loadfile property="tmLanguages.desc"
srcfile="${temp.dir}/tmLanguages/description.txt">
<filterchain><replaceregex pattern="^, " replace=""/></filterchain>
</loadfile>
<loadfile property="tmLanguages.license"
srcfile="${temp.dir}/tmLanguages/license.txt"/>
<replace>
<fileset dir="${temp.dir}/tmLanguages"
includes="**/content.xml, **/feature.xml"/>
<replacefilter token="&lt;&lt;DESCRIPTION>>" value="Eclipse TM4E (http://eclipse.org/tm4e) definition for following languages (file extensions): ${tmLanguages.desc}"/>
<replacefilter token="&lt;&lt;LICENSE>>" value="See licenses for the individual grammar files on their web pages: ${tmLanguages.license}"/>
<loadfile property="tmLanguages.desc"
srcfile="${temp.dir}/tmLanguages/description.txt">
<filterchain><replaceregex pattern="^, " replace=""/></filterchain>
</loadfile>
<loadfile property="tmLanguages.license"
srcfile="${temp.dir}/tmLanguages/license.txt"/>
<replace>
<fileset dir="${temp.dir}/tmLanguages"
includes="**/content.xml, **/feature.xml"/>
<replacefilter token="&lt;&lt;DESCRIPTION>>"
value="Eclipse TM4E (http://eclipse.org/tm4e) definition for following languages (file extensions): ${tmLanguages.desc}"/>
<replacefilter token="&lt;&lt;LICENSE>>"
value="See licenses for the individual grammar files on their web pages: ${tmLanguages.license}"/>
</replace>

<!-- create update site -->
Expand Down Expand Up @@ -299,15 +302,15 @@ and with no claim as to its suitability for any purpose. -->
<target name="build" depends="init"
description="builds the Eclipse application into the ${out.dir}">
<condition property="eclipse.available">
<available file="${temp.dir}/eclipse/eclipse/eclipse.ini"/>
<available file="${repos.dir}/eclipse/eclipse.ini"/>
</condition>
<sequential unless:set="eclipse.available">
<delete dir="${temp.dir}/eclipse"/>
<mkdir dir="${temp.dir}/eclipse"/>
<get src="http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/R-4.7.3a-201803300640/eclipse-platform-4.7.3a-win32-x86_64.zip&amp;mirror_id=1"
dest="${temp.dir}/eclipse/eclipse.zip"/>
<unzip src="${temp.dir}/eclipse/eclipse.zip"
dest="${temp.dir}/eclipse"/>
<mkdir dir="${repos.dir}"/>
<unzip src="${temp.dir}/eclipse/eclipse.zip" dest="${repos.dir}"/>
<delete file="${temp.dir}/eclipse/eclipse.zip"/>
</sequential>
<macrodef name="to-comma-separated">
Expand Down Expand Up @@ -342,14 +345,15 @@ and with no claim as to its suitability for any purpose. -->
</condition>

<!-- see http://help.eclipse.org/topic/org.eclipse.platform.doc.isv/guide/p2_director.html -->
<delete file="${temp.dir}/eclipse/eclipse/_workspace/.metadata/.log"/>
<delete file="${repos.dir}/eclipse/_workspace/.metadata/.log"/>
<delete dir="${out.dir}"/>
<exec executable="${temp.dir}/eclipse/eclipse/eclipsec${exec.extension}"
failonerror="yes"
dir="${temp.dir}/eclipse/eclipse">
<exec executable="${repos.dir}/eclipse/eclipsec${exec.extension}"
failonerror="yes" taskname="p2 director"
dir="${repos.dir}/eclipse">
<arg line="-nosplash"/>
<arg line="-configuration _config"/>
<arg line="-data _workspace"/>
<arg line="-vm ../JREs/OpenJDK10-OPENJ9/jre/bin/javaw.exe"/>
<arg line="-application org.eclipse.equinox.p2.director"/>
<arg value="-repository"/>
<arg value="${repositories.comma-separated}${and.tmLanguages}"/>
Expand Down Expand Up @@ -384,7 +388,7 @@ and with no claim as to its suitability for any purpose. -->

<!-- JRE -->
<copy todir="${out.dir}/jre">
<fileset dir="${temp.dir}/openj9/jre"/>
<fileset dir="${repos.dir}/JREs/OpenJDK10-OPENJ9/jre"/>
</copy>

<!-- eclipse.ini -->
Expand All @@ -404,14 +408,16 @@ and with no claim as to its suitability for any purpose. -->
description="create Windows installer (via NSIS)">
<property name="nsis.version" value="3.03"/>
<condition property="nsis.available">
<available file="${temp.dir}/nsis/nsis-${nsis.version}"/>
<available file="${repos.dir}/nsis/nsis-${nsis.version}"/>
</condition>
<sequential unless:set="nsis.available">
<delete dir="${temp.dir}/nsis"/>
<mkdir dir="${temp.dir}/nsis"/>
<get src="https://downloads.sourceforge.net/project/nsis/NSIS%203/${nsis.version}/nsis-${nsis.version}.zip"
dest="${temp.dir}/nsis/nsis-${nsis.version}.zip"/>
<unzip src="${temp.dir}/nsis/nsis-${nsis.version}.zip" dest="${temp.dir}/nsis"/>
<delete dir="${repos.dir}/nsis"/>
<unzip src="${temp.dir}/nsis/nsis-${nsis.version}.zip"
dest="${repos.dir}/nsis"/>
</sequential>
<length property="install.size.bytes">
<fileset dir="${out.dir}"/>
Expand All @@ -422,8 +428,8 @@ and with no claim as to its suitability for any purpose. -->
Math.round(sizeInBytes / 1024));
]]></script>
<delete file="${app.subfolder}-${date}_setup.exe"/>
<exec executable="${temp.dir}/nsis/nsis-${nsis.version}/makensis${exec.extension}"
failonerror="yes">
<exec executable="${repos.dir}/nsis/nsis-${nsis.version}/makensis${exec.extension}"
failonerror="yes" taskname="NSIS">
<arg value="/DAPPNAME=${app.name}"/>
<arg value="/DFOLDER_NAME=${app.subfolder}"/>
<arg value="/DPUBLISHER=${app.provider}"/>
Expand All @@ -439,36 +445,40 @@ and with no claim as to its suitability for any purpose. -->

<target name="get-openj9-jre"
description="get latest 'OpenJDK 10 with Eclipse OpenJ9' nightly build">
<delete file="${temp.dir}/openj9/releases.html"/>
<mkdir dir="${temp.dir}/openj9"/>
<delete file="${temp.dir}/JREs/OpenJDK10-OPENJ9/releases.html"/>
<mkdir dir="${repos.dir}/JREs/OpenJDK10-OPENJ9"/>
<delete dir="${temp.dir}/JREs/OpenJDK10-OPENJ9"/>
<mkdir dir="${temp.dir}/JREs/OpenJDK10-OPENJ9"/>
<get src="https://github.com/AdoptOpenJDK/openjdk10-openj9-nightly/releases/"
dest="${temp.dir}/openj9/releases.html"/>
<loadfile property="openj9.download.url" srcfile="${temp.dir}/openj9/releases.html">
dest="${temp.dir}/JREs/OpenJDK10-OPENJ9/releases.html"/>
<loadfile property="openj9.download.url"
srcfile="${temp.dir}/JREs/OpenJDK10-OPENJ9/releases.html">
<filterchain>
<replaceregex byline="no" flags="i"
pattern="^[\s\S]*?\Whref=&quot;([^&quot;]*OpenJDK10-OPENJ9_x64_Win_[0-9]*\.zip)&quot;[\s\S]++$$"
replace="\1"/>
</filterchain>
</loadfile>
<echo level="info" message="OpenJ9 download URL: ${openj9.download.url}"/>
<touch file="${temp.dir}/openj9/download-url.txt"/>
<touch file="${repos.dir}/JREs/OpenJDK10-OPENJ9/download-url.txt"/>
<loadfile property="openj9.download.url.old"
srcfile="${temp.dir}/openj9/download-url.txt"/>
srcfile="${repos.dir}/JREs/OpenJDK10-OPENJ9/download-url.txt"/>
<condition property="openj9.available">
<equals arg1="${openj9.download.url}"
arg2="${openj9.download.url.old}"/>
</condition>
<sequential unless:set="openj9.available">
<delete file="${temp.dir}/openj9/jre.zip"/>
<delete dir="${temp.dir}/JREs/OpenJDK10-OPENJ9"/>
<mkdir dir="${temp.dir}/JREs/OpenJDK10-OPENJ9"/>
<get src="http://github.com${openj9.download.url}"
dest="${temp.dir}/openj9/jre.zip"/>
<delete dir="${temp.dir}/openj9/jre"/>
<unzip src="${temp.dir}/openj9/jre.zip"
dest="${temp.dir}/openj9/jre">
dest="${temp.dir}/JREs/OpenJDK10-OPENJ9/jre.zip"/>
<delete dir="${repos.dir}/JREs/OpenJDK10-OPENJ9/jre"/>
<unzip src="${temp.dir}/JREs/OpenJDK10-OPENJ9/jre.zip"
dest="${repos.dir}/JREs/OpenJDK10-OPENJ9/jre">
<regexpmapper from="^[^/]++/(.*)$$" to="\1" handledirsep="yes"/>
</unzip>
<delete file="${temp.dir}/openj9/jre.zip"/>
<concat destfile="${temp.dir}/openj9/download-url.txt"
<delete file="${temp.dir}/JREs/OpenJDK10-OPENJ9/jre.zip"/>
<concat destfile="${repos.dir}/JREs/OpenJDK10-OPENJ9/download-url.txt"
overwrite="yes">${openj9.download.url}</concat>
</sequential>
</target>
Expand Down

0 comments on commit 3073923

Please sign in to comment.