diff --git a/build.gradle b/build.gradle index 7e849f4b..e24083c0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,18 +1,65 @@ apply plugin: 'groovy' apply plugin: BuildGradle +apply plugin: 'maven' + +configurations { + deployerJars +} + +repositories { + mavenCentral() +} + dependencies { compile gradleApi() compile localGroovy() + + deployerJars 'org.apache.maven.wagon:wagon-ssh:2.2' +} + +group = "jaci.openrio.gradle" +archivesBaseName = "GradleRIO" +version = "1.0.1" + +ext.mavenProps = file "../maven.properties" +mavenProps.withReader { + def prop = new Properties() + prop.load(it) + project.ext.mavenProps = new ConfigSlurper().parse prop +} + +processResources { + ant.replace(file: 'release/build.gradle', token: "{GRADLERIO_VERSION}", value: version) +} + +uploadArchives { + repositories.mavenDeployer { + configuration = configurations.deployerJars + repository(url: mavenProps.jaci.url) { + authentication(userName: mavenProps.jaci.user, password: mavenProps.jaci.auth) + } + + pom { + groupId = project.group + version = project.version + artifactId = project.archivesBaseName + project { + name project.archivesBaseName + packaging 'jar' + description 'GradleRIO Build Plugin ' + } + } + } } class BuildGradle implements Plugin { void apply(Project project) { project.task('release', dependsOn: 'build') << { - ant.copy(file:"build/libs/GradleRIO.jar", - todir: "release/gradle/libs") + //ant.copy(file:"build/libs/GradleRIO.jar", + // todir: "release/gradle/libs") - ant.zip(destfile: "releases/GradleRIO.zip", + ant.zip(destfile: "releases/GradleRIO-${project.version}.zip", basedir: "release") } } diff --git a/release/build.gradle b/release/build.gradle index 89f70579..7afedcd1 100644 --- a/release/build.gradle +++ b/release/build.gradle @@ -5,14 +5,18 @@ Template file for classes using GradleRIO buildscript { repositories { - flatDir name: 'libs', dirs: 'gradle/libs' + mavenCentral() + maven { + name = "GradleRIO" + url = "http://dev.sourcecoded.info/jaci/maven" + } } dependencies { - classpath group: 'jaci.openrio.gradle', name: 'GradleRIO', version: '0.1.0' + classpath group: 'jaci.openrio.gradle', name: 'GradleRIO', version: '1.0.1' //Change this line if you wish to Update GradleRIO } } -apply plugin: "GradleRIO" //Apply the GradleRIO plugin +apply plugin: 'GradleRIO' //Apply the GradleRIO plugin apply plugin: 'java' apply plugin: 'idea' apply plugin: 'eclipse' diff --git a/src/main/groovy/jaci/openrio/gradle/GradleRIO.groovy b/src/main/groovy/jaci/openrio/gradle/GradleRIO.groovy index 42404f77..51b46274 100644 --- a/src/main/groovy/jaci/openrio/gradle/GradleRIO.groovy +++ b/src/main/groovy/jaci/openrio/gradle/GradleRIO.groovy @@ -40,7 +40,7 @@ class GradleRIO implements Plugin { def wpiTask = project.task('wpi') << { println "Downloading WPILib..." String pluginDest = System.getProperty("user.home") + "/wpilib/java/plugin/current/" - String from = "http://first.wpi.edu/FRC/roborio/release/eclipse/plugins/edu.wpi.first.wpilib.plugins.java_0.1.0.201501011639.jar" + String from = "http://first.wpi.edu/FRC/roborio/release/eclipse/plugins/edu.wpi.first.wpilib.plugins.java_0.1.0.201501221609.jar" download(pluginDest, from, "plugin.jar") println "Extracting WPILib..." @@ -59,9 +59,11 @@ class GradleRIO implements Plugin { def deployTask = project.task('deploy') << { try { deploy(rioHost(project)) + restartCode(rioHost(project)) } catch (Exception e) { println "RoboRIO not available... Falling back to IP..." deploy(rioIP(project)) + restartCode(rioIP(project)) } } deployTask.dependsOn 'build'