|
6 | 6 | </classpath>
|
7 | 7 | </taskdef>
|
8 | 8 |
|
| 9 | + <!-- ===================================================================== --> |
| 10 | + <!-- Steps to do before generating the build scripts. --> |
| 11 | + <!-- ===================================================================== --> |
| 12 | + <target name="preGenerate"> |
| 13 | + <!-- Need to grab version qualifier for scripting plugin, we do that by cloning and checking |
| 14 | + last commit of each bundle vs last commit of plugin. This MUST be done before the generateScript target |
| 15 | + or else the qualifier we insert into build.properties is ignored. --> |
| 16 | + <property name="scripting.plugin.dir" location="${buildDirectory}/plugins/com.aptana.ruby.core"/> |
| 17 | + <property name="bundle.timestamps.file" location="${scripting.plugin.dir}/bundle_timestamps.txt"/> |
| 18 | + |
| 19 | + <!-- Find latest commit date between this plugin and every bundle and use that as the build qualifier! --> |
| 20 | + <exec executable="/bin/bash" dir="${scripting.plugin.dir}" append="true" output="${bundle.timestamps.file}"> |
| 21 | + <arg value="-c" /> |
| 22 | + <arg value="git log --max-count=1 --pretty=format:'%ct' ." /> |
| 23 | + </exec> |
| 24 | + <echo append="true" file="${bundle.timestamps.file}" message="," /> |
| 25 | + <!-- Grab the pre-defined set of bundles --> |
| 26 | + <antcall target="clone-bundle"> |
| 27 | + <param name="bundle.name" value="ruby.ruble" /> |
| 28 | + <param name="bundle.dir.name" value="ruby.ruble" /> |
| 29 | + <param name="bundle.branch" value="${scs.branch.name}" /> |
| 30 | + </antcall> |
| 31 | + <antcall target="clone-bundle"> |
| 32 | + <param name="bundle.name" value="rails.ruble" /> |
| 33 | + <param name="bundle.dir.name" value="rails.ruble" /> |
| 34 | + <param name="bundle.branch" value="${scs.branch.name}" /> |
| 35 | + </antcall> |
| 36 | + <antcall target="clone-bundle"> |
| 37 | + <param name="bundle.name" value="haml.ruble" /> |
| 38 | + <param name="bundle.dir.name" value="haml.ruble" /> |
| 39 | + <param name="bundle.branch" value="${scs.branch.name}" /> |
| 40 | + </antcall> |
| 41 | + <antcall target="clone-bundle"> |
| 42 | + <param name="bundle.name" value="sass.ruble" /> |
| 43 | + <param name="bundle.dir.name" value="sass.ruble" /> |
| 44 | + <param name="bundle.branch" value="${scs.branch.name}" /> |
| 45 | + </antcall> |
| 46 | + <antcall target="clone-bundle"> |
| 47 | + <param name="bundle.name" value="rspec.ruble" /> |
| 48 | + <param name="bundle.dir.name" value="rspec.ruble" /> |
| 49 | + <param name="bundle.branch" value="${scs.branch.name}" /> |
| 50 | + </antcall> |
| 51 | + <antcall target="clone-bundle"> |
| 52 | + <param name="bundle.name" value="cucumber.ruble" /> |
| 53 | + <param name="bundle.dir.name" value="cucumber.ruble" /> |
| 54 | + <param name="bundle.branch" value="${scs.branch.name}" /> |
| 55 | + </antcall> |
| 56 | + <antcall target="clone-bundle"> |
| 57 | + <param name="bundle.name" value="capistrano.ruble" /> |
| 58 | + <param name="bundle.dir.name" value="capistrano.ruble" /> |
| 59 | + <param name="bundle.branch" value="${scs.branch.name}" /> |
| 60 | + </antcall> |
| 61 | + <antcall target="clone-bundle"> |
| 62 | + <param name="bundle.name" value="heroku.ruble" /> |
| 63 | + <param name="bundle.dir.name" value="heroku.ruble" /> |
| 64 | + <param name="bundle.branch" value="${scs.branch.name}" /> |
| 65 | + </antcall> |
| 66 | + <antcall target="clone-bundle"> |
| 67 | + <param name="bundle.name" value="engineyard.ruble" /> |
| 68 | + <param name="bundle.dir.name" value="engineyard.ruble" /> |
| 69 | + <param name="bundle.branch" value="${scs.branch.name}" /> |
| 70 | + </antcall> |
| 71 | + <!-- Now grab the max value of lastmods in bundle_timestamps.txt file and use that as qualifier! --> |
| 72 | + <script language="javascript"> |
| 73 | + <![CDATA[ |
| 74 | + importPackage(java.lang, java.util, java.io); |
| 75 | +
|
| 76 | + // The main method (called from the bottom of the file). |
| 77 | + function main() { |
| 78 | + var basedir = project.getProperty("scripting.plugin.dir"); |
| 79 | +
|
| 80 | + var timestamps = new File(basedir, "bundle_timestamps.txt"); |
| 81 | + var reader = new BufferedReader(new FileReader(timestamps)); |
| 82 | + var line = reader.readLine(); |
| 83 | + System.out.println(line); |
| 84 | + reader.close(); |
| 85 | + var max = 0; |
| 86 | + var numbers = line.split(","); |
| 87 | + for (var i = 0; i < numbers.length; i++) { |
| 88 | + new_number = parseInt(numbers[i]); |
| 89 | + if (new_number > max) |
| 90 | + { |
| 91 | + max = new_number; |
| 92 | + } |
| 93 | + } |
| 94 | + System.out.println("Max timestamp of scripting plugin and bundles: " + max); |
| 95 | + // Write the max number into the qualifier! |
| 96 | + var writer = new FileWriter(new File(basedir, "build.properties"), true); |
| 97 | + writer.write("qualifier = " + max + "\n"); |
| 98 | + writer.close(); |
| 99 | + } |
| 100 | +
|
| 101 | + main(); |
| 102 | + ]]> |
| 103 | + </script> |
| 104 | + </target> |
| 105 | + |
| 106 | + <target name="clone-bundle"> |
| 107 | + <delete dir="${scripting.plugin.dir}/bundles/${bundle.dir.name}" failonerror="true" /> |
| 108 | + <echo message="git clone git://github.com/aptana/${bundle.name}.git ${bundle.dir.name}"> |
| 109 | + </echo> |
| 110 | + <exec executable="/bin/bash" dir="${scripting.plugin.dir}/bundles" failonerror="true"> |
| 111 | + <arg value="-c" /> |
| 112 | + <arg value="git clone git://github.com/aptana/${bundle.name}.git ${bundle.dir.name}" /> |
| 113 | + </exec> |
| 114 | + <!-- Checkout the specified branch --> |
| 115 | + <echo message="git checkout ${bundle.branch}"> |
| 116 | + </echo> |
| 117 | + <exec executable="/bin/bash" dir="${scripting.plugin.dir}/bundles/${bundle.dir.name}" failonerror="true"> |
| 118 | + <arg value="-c" /> |
| 119 | + <arg value="git checkout ${bundle.branch}" /> |
| 120 | + </exec> |
| 121 | + <!-- Grab lastmod and append it to file containing all of the lastmods for each packaged ruble --> |
| 122 | + <exec executable="/bin/bash" dir="${scripting.plugin.dir}/bundles/${bundle.dir.name}" append="true" output="${bundle.timestamps.file}" failonerror="true"> |
| 123 | + <arg value="-c" /> |
| 124 | + <arg value="git log --max-count=1 --pretty=format:'%ct' ." /> |
| 125 | + </exec> |
| 126 | + |
| 127 | + <echo append="true" file="${bundle.timestamps.file}" message="," /> |
| 128 | + <!-- Now remove the .git subdirectory --> |
| 129 | + <delete dir="${scripting.plugin.dir}/bundles/${bundle.dir.name}/.git" quiet="true" /> |
| 130 | + </target> |
| 131 | + |
9 | 132 | <!-- ===================================================================== -->
|
10 | 133 | <!-- Steps to do before the repositories are being processed -->
|
11 | 134 | <!-- ===================================================================== -->
|
|
0 commit comments