mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 15:37:52 +01:00
Wabt has a slow release cycle then we can use ever the cached version.
This commit is contained in:
parent
6c0939f341
commit
ec96a8c9f8
@ -27,6 +27,8 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import org.apache.commons.compress.archivers.ArchiveEntry;
|
import org.apache.commons.compress.archivers.ArchiveEntry;
|
||||||
import org.apache.commons.compress.archivers.ArchiveInputStream;
|
import org.apache.commons.compress.archivers.ArchiveInputStream;
|
||||||
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
|
||||||
@ -40,7 +42,9 @@ import org.junit.Assert;
|
|||||||
*/
|
*/
|
||||||
class Wat2Wasm {
|
class Wat2Wasm {
|
||||||
|
|
||||||
private String command;
|
private String command;
|
||||||
|
|
||||||
|
private IOException error;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if there is a new version of the script engine
|
* Check if there is a new version of the script engine
|
||||||
@ -77,9 +81,9 @@ class Wat2Wasm {
|
|||||||
System.out.println( "\tDownload: " + url );
|
System.out.println( "\tDownload: " + url );
|
||||||
|
|
||||||
conn = (HttpURLConnection)url.openConnection();
|
conn = (HttpURLConnection)url.openConnection();
|
||||||
if( target.exists() ) {
|
// if( target.exists() ) {
|
||||||
conn.setIfModifiedSince( target.lastModified() );
|
// conn.setIfModifiedSince( target.lastModified() );
|
||||||
}
|
// }
|
||||||
|
|
||||||
input = conn.getInputStream();
|
input = conn.getInputStream();
|
||||||
if( conn.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED ) {
|
if( conn.getResponseCode() == HttpURLConnection.HTTP_NOT_MODIFIED ) {
|
||||||
@ -113,7 +117,7 @@ class Wat2Wasm {
|
|||||||
file.setExecutable( true );
|
file.setExecutable( true );
|
||||||
} while( true );
|
} while( true );
|
||||||
|
|
||||||
target.setLastModified( lastModfied );
|
// target.setLastModified( lastModfied );
|
||||||
System.out.println( "\tUse Version from " + Instant.ofEpochMilli( lastModfied ) );
|
System.out.println( "\tUse Version from " + Instant.ofEpochMilli( lastModfied ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,11 +152,26 @@ class Wat2Wasm {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* if any I/O error occur
|
* if any I/O error occur
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
public String getCommand() throws IOException {
|
public String getCommand() throws IOException {
|
||||||
|
if( error != null ) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
if( command == null ) {
|
if( command == null ) {
|
||||||
File target = new File( System.getProperty( "java.io.tmpdir" ) + "/wabt" );
|
try {
|
||||||
download( target );
|
File target = new File( System.getProperty( "java.io.tmpdir" ) + "/wabt" );
|
||||||
searchExecuteable( target );
|
searchExecuteable( target );
|
||||||
|
if( command == null ) {
|
||||||
|
download( target );
|
||||||
|
searchExecuteable( target );
|
||||||
|
if( command == null ) {
|
||||||
|
throw new IOException("Wabt was not download or sved to: " + target );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch( IOException ex ) {
|
||||||
|
error = ex;
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user