mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
Replace the github API for downloading WABT with web GUI because it is limit from Travis.
This commit is contained in:
parent
9bcc7347c1
commit
f08b3d0869
@ -45,6 +45,8 @@ class Wat2Wasm {
|
|||||||
/**
|
/**
|
||||||
* Check if there is a new version of the script engine
|
* Check if there is a new version of the script engine
|
||||||
*
|
*
|
||||||
|
* @param target
|
||||||
|
* the target directory
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* if any error occur
|
* if any error occur
|
||||||
*/
|
*/
|
||||||
@ -62,17 +64,19 @@ class Wat2Wasm {
|
|||||||
throw new IllegalStateException( "Unknown OS: " + os );
|
throw new IllegalStateException( "Unknown OS: " + os );
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpURLConnection conn = (HttpURLConnection)new URL( "https://api.github.com/repos/WebAssembly/wabt/releases/latest" ).openConnection();
|
URL url = new URL( "https://github.com/WebAssembly/wabt/releases/latest" );
|
||||||
|
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
||||||
InputStream input = conn.getInputStream();
|
InputStream input = conn.getInputStream();
|
||||||
String json = WasmRule.readStream( input );
|
String data = WasmRule.readStream( input );
|
||||||
|
|
||||||
Pattern pattern = Pattern.compile( "https://github.com/WebAssembly/wabt/releases/download/[0-9.]*/wabt-[0-9.]*-" + fileName );
|
Pattern pattern = Pattern.compile( "/WebAssembly/wabt/releases/download/[0-9.]*/wabt-[0-9.]*-" + fileName );
|
||||||
Matcher matcher = pattern.matcher( json );
|
Matcher matcher = pattern.matcher( data );
|
||||||
Assert.assertTrue( matcher.find() );
|
Assert.assertTrue( matcher.find() );
|
||||||
String downloadUrl = matcher.group();
|
String downloadUrl = matcher.group();
|
||||||
System.out.println( "\tDownload: " + downloadUrl );
|
url = new URL( url, downloadUrl );
|
||||||
|
System.out.println( "\tDownload: " + url );
|
||||||
|
|
||||||
conn = (HttpURLConnection)new URL( downloadUrl ).openConnection();
|
conn = (HttpURLConnection)url.openConnection();
|
||||||
if( target.exists() ) {
|
if( target.exists() ) {
|
||||||
conn.setIfModifiedSince( target.lastModified() );
|
conn.setIfModifiedSince( target.lastModified() );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user