Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ More options:
warnAsError = [105, 110, 120]

// Other ikvmc options can be set:
// fileVersion, target, main, classloader, delaySign, compressResources, removeAssertions, srcPath ...
// fileVersion, target, main, classloader, delaySign, compressResources, removeAssertions, srcPath, reference ...
}

## Usage
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies {
compile fileTree(dir: "${gradle.gradleHomeDir}/lib/plugins", include: "gradle-plugins-*.jar")
compile getTools()
compile 'org.apache.commons:commons-lang3:3.4'
compile 'commons-io:commons-io:2.5'
compile 'commons-codec:commons-codec:1.10'
testCompile 'junit:junit:4.8.2'
}
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Dec 27 15:48:48 CET 2014
#Fri Jul 22 16:37:54 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
52 changes: 26 additions & 26 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,30 @@
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

Expand All @@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,31 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -90,7 +89,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand All @@ -114,6 +113,7 @@ fi
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
Expand Down
8 changes: 4 additions & 4 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

Expand Down Expand Up @@ -46,7 +46,7 @@ echo location of your Java installation.
goto fail

:init
@rem Get command-line arguments, handling Windowz variants
@rem Get command-line arguments, handling Windows variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
Expand Down
4 changes: 4 additions & 0 deletions src/main/groovy/com/ullink/Ikvm.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Ikvm extends ConventionTask {
String target
String main
String platform
String reference
def warnAsError

Ikvm() {
Expand Down Expand Up @@ -204,6 +205,9 @@ class Ikvm extends ConventionTask {
if (platform) {
commandLineArgs += "-platform:${platform}"
}
if (reference) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason not to use the supported list of references (through the configuration)? (maybe lack of documentation on how to use it ?) - see getReferences()

commandLineArgs += "-reference:${reference}"
}
if (main) {
commandLineArgs += "-target:${main}"
}
Expand Down
17 changes: 15 additions & 2 deletions src/main/groovy/com/ullink/IkvmBasePlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,29 @@ import org.gradle.api.Plugin
import org.gradle.api.Project

class IkvmBasePlugin implements Plugin<Project> {

void apply(Project project) {
project.tasks.withType(Ikvm).whenTaskAdded { Ikvm task ->
task.conventionMapping.map "ikvmVersion", { '7.2.4630.5' }
task.conventionMapping.map "ikvmHome", {
if (System.getenv()['IKVM_HOME']) {
return System.getenv()['IKVM_HOME']
}
def version = task.getIkvmVersion()
return "http://downloads.sourceforge.net/project/ikvm/ikvm/${version}/ikvmbin-${version}.zip"
return tryToFindUrl(task.getIkvmVersion())
}
}
}

String tryToFindUrl(String version){
String defaultUrl = "http://downloads.sourceforge.net/project/ikvm/ikvm/${version}/ikvmbin-${version}.zip"
String betaUrl = "http://www.frijters.net/ikvmbin-${version}.zip"

HttpURLConnection connection = new URL(defaultUrl).openConnection()
connection.setRequestMethod("HEAD")
if (connection.responseCode == 200) {
return defaultUrl
}else{
return betaUrl
}
}
}
21 changes: 21 additions & 0 deletions src/test/groovy/com/ullink/IkvmBasePluginTest.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.ullink

import junit.framework.Assert;
import org.junit.Test;

public class IkvmBasePluginTest {

@Test
public void tryToFindUrlDefault() throws Exception {
IkvmBasePlugin ikvmBasePlugin = new IkvmBasePlugin();
String foundUrl = ikvmBasePlugin.tryToFindUrl("7.2.4630.5")
Assert.assertTrue(foundUrl.contains("sourceforge"))
}

@Test
public void tryToFindUrlAlternative() throws Exception {
IkvmBasePlugin ikvmBasePlugin = new IkvmBasePlugin()
String foundUrl = ikvmBasePlugin.tryToFindUrl("8.1.5717.0")
Assert.assertTrue(foundUrl.contains("frijters"))
}
}