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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions gradlew.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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
Copy Markdown
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"))
}
}