11// vim: et:ts=4:sw=4
22
33import boot .bin .ParentClassLoader ;
4+ import boot .bin .BootSnapshotVersionFetcher ;
45
56import java .io .*;
67import java .net .*;
@@ -182,7 +183,14 @@ public class Boot {
182183
183184 public static String
184185 downloadUrl (String version , String name ) throws Exception {
185- return String .format ("https://github.com/boot-clj/boot/releases/download/%s/%s" , version , name ); }
186+ System .out .println ("passed name " + name + " compare result " + version .compareTo ("2.8" ));
187+ if (0 < version .compareTo ("2.8" ) && name .equals ("boot.jar" )) {
188+ if (version .endsWith ("SNAPSHOT" )) {
189+ return String .format ("https://clojars.org/repo/boot/base/%s/base-%s.jar" , version , BootSnapshotVersionFetcher .lastSnapshot (version )); }
190+ else {
191+ return String .format ("https://clojars.org/repo/boot/base/%s/base-%s.jar" , version , version ); }
192+ } else { // 2.7.2 and lower download releases from github
193+ return String .format ("https://github.com/boot-clj/boot/releases/download/%s/%s" , version , name ); }}
186194
187195 public static File
188196 validateBinaryFile (File f ) throws Exception {
@@ -224,7 +232,9 @@ public class Boot {
224232 String v = p .getProperty (version );
225233 String vv = (v == null ) ? version : v ;
226234 String nn = "boot." + ((v == null ) ? "jar" : "sh" );
227- return download (downloadUrl (vv , nn ), binaryFileCreate (vv )); }
235+ String url = downloadUrl (vv , nn );
236+ System .out .println ("Downloading " + nn + " / " + vv + " from " + url );
237+ return download (url , binaryFileCreate (vv )); }
228238
229239 public static URLClassLoader
230240 loadJar (File jar ) throws Exception {
@@ -249,9 +259,16 @@ public class Boot {
249259 System .setProperty ("BOOT_VERSION" , initialVersion );
250260 System .err .println ("Running for the first time, BOOT_VERSION not set: updating to latest." ); }
251261
262+ // System.err.println("Fetching Jar from clojars");
263+ // System.out.println(downloadUrl("2.8.0-SNAPSHOT", "boot.jar"));
264+ // System.out.println(downloadUrl("2.7.2-SNAPSHOT", "boot.jar"));
265+ // System.out.println(downloadUrl("2.7.2", "boot.jar"));
266+ // BootSnapshotVersionFetcher.lastSnapshot("2.8.0-SNAPSHOT");
267+
252268 loadJar (f );
253269 tccl (loader );
254270 Class c = Class .forName ("boot.App" , true , loader );
255271 Method m = c .getMethod ("main" , String [].class );
256272
257- m .invoke (null , new Object []{a }); }}
273+ m .invoke (null , new Object []{a });
274+ }}
0 commit comments