Moved code from jruby-gradle-plugin to here
This commit is contained in:
parent
00362abf0b
commit
eb8138334a
|
@ -1,3 +1,4 @@
|
||||||
.gradle
|
.gradle
|
||||||
build/
|
build/
|
||||||
*.sw*
|
*.sw*
|
||||||
|
*.iml
|
||||||
|
|
|
@ -8,7 +8,7 @@ buildscript {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.github.jruby-gradle'
|
group = 'com.github.jruby-gradle'
|
||||||
version = '0.1.0'
|
version = '0.1.1'
|
||||||
|
|
||||||
if (System.env.RELEASE != '1') {
|
if (System.env.RELEASE != '1') {
|
||||||
version = "${version}-SNAPSHOT"
|
version = "${version}-SNAPSHOT"
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.github.jrubygradle
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by schalkc on 27/08/2014.
|
||||||
|
*/
|
||||||
|
class JRubyWarPlugin {
|
||||||
|
void apply(Project project) {
|
||||||
|
// MIGHT NEED: project.apply plugin: 'java', 'java-base' or 'war'
|
||||||
|
|
||||||
|
project.configurations.create(JRubyWar.JRUBYWAR_CONFIG)
|
||||||
|
|
||||||
|
// TODO: Should probably check whether it exists before creating it
|
||||||
|
project.configurations {
|
||||||
|
jrubyEmbeds
|
||||||
|
}
|
||||||
|
|
||||||
|
project.dependencies {
|
||||||
|
jrubyEmbeds group: 'com.lookout', name: 'warbler-bootstrap', version: '1.+'
|
||||||
|
}
|
||||||
|
|
||||||
|
project.afterEvaluate {
|
||||||
|
JRubyWar.updateJRubyDependencies(project)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: jarcache should rather be inside buildDir
|
||||||
|
project.task('jrubyCacheJars', type: Copy) {
|
||||||
|
group TASK_GROUP_NAME
|
||||||
|
description 'Cache .jar-based dependencies into .jarcache/'
|
||||||
|
|
||||||
|
from project.configurations.jrubyWar
|
||||||
|
into ".jarcache"
|
||||||
|
include '**/*.jar'
|
||||||
|
}
|
||||||
|
|
||||||
|
project.task('jrubyPrepare') {
|
||||||
|
group TASK_GROUP_NAME
|
||||||
|
description 'Pre-cache and prepare all dependencies (jars and gems)'
|
||||||
|
dependsOn project.tasks.jrubyCacheJars, project.tasks.jrubyPrepareGems
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only jRubyWar will depend on jrubyPrepare. Other JRubyWar tasks created by
|
||||||
|
// build script authors will be under their own control
|
||||||
|
// jrubyWar task will use jrubyWar as configuration
|
||||||
|
project.task('jrubyWar', type: JRubyWar) {
|
||||||
|
group JRubyPlugin.TASK_GROUP_NAME
|
||||||
|
description 'Create a JRuby-based web archive'
|
||||||
|
dependsOn project.tasks.jrubyPrepare
|
||||||
|
classpath project.configurations.jrubyWar
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
package com.github.jrubygradle
|
||||||
|
|
||||||
|
import org.gradle.api.tasks.Delete
|
||||||
|
import org.gradle.testfixtures.ProjectBuilder
|
||||||
|
import org.junit.Test
|
||||||
|
import spock.lang.*
|
||||||
|
|
||||||
|
import static org.gradle.api.logging.LogLevel.LIFECYCLE
|
||||||
|
import static org.junit.Assert.assertTrue
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author R. Tyler Croy
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class JRubyWarPluginSpec extends Specification {
|
||||||
|
|
||||||
|
def project
|
||||||
|
def warTask
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
project = ProjectBuilder.builder().build()
|
||||||
|
project.buildDir = TESTROOT
|
||||||
|
project.logging.level = LIFECYCLE
|
||||||
|
project.apply plugin: 'com.github.jruby-gradle.war'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
def "basic sanity check"() {
|
||||||
|
expect:
|
||||||
|
project.tasks.jrubyWar.group == 'JRuby'
|
||||||
|
project.tasks.jrubyCacheJars instanceof AbstractCopyTask
|
||||||
|
project.tasks.jrubyPrepare instanceof Task
|
||||||
|
project.tasks.jrubyWar instanceof War
|
||||||
|
project.tasks.jrubyJar instanceof Jar
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue