Resolved merge conflict in build.gradle

This commit is contained in:
Schalk W. Cronjé 2014-08-28 21:52:25 +01:00
commit 684d451fff
3 changed files with 42 additions and 1 deletions

View File

@ -24,7 +24,7 @@ dependencies {
compile gradleApi()
compile localGroovy()
compile group: 'com.github.jruby-gradle', name: 'jruby-gradle-plugin', version: '0.1.2-SNAPSHOT'
compile group: 'com.github.jruby-gradle', name: 'jruby-gradle-plugin', version: '0.1.+'
testCompile ("org.spockframework:spock-core:0.7-groovy-${gradle.gradleVersion.startsWith('1.')?'1.8':'2.0'}") {
exclude module : 'groovy-all'

View File

@ -4,6 +4,7 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.bundling.War
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.Delete
import com.github.jrubygradle.internal.WarblerBootstrap
import com.github.jrubygradle.JRubyPlugin
@ -13,6 +14,7 @@ import com.github.jrubygradle.JRubyPlugin
*/
class JRubyWarPlugin implements Plugin<Project> {
void apply(Project project) {
project.apply plugin: 'war'
project.apply plugin: 'com.github.jruby-gradle.base'
project.configurations.create(JRubyWar.JRUBYWAR_CONFIG)
project.configurations.maybeCreate('jrubyEmbeds')
@ -41,5 +43,17 @@ class JRubyWarPlugin implements Plugin<Project> {
into ".jarcache"
include '**/*.jar'
}
// Add our dependency onto jrubyPrepare so it will serve our needs too
project.tasks.jrubyPrepare.dependsOn project.tasks.jrubyCacheJars
project.task('jrubyCleanJars', type: Delete) {
group JRubyPlugin.TASK_GROUP_NAME
description 'Clean up the temporary dirs created by the jrubyCacheJars task'
delete '.jarcache/'
}
// Add our dependency onto clean so it will clean up after us too
project.tasks.clean.dependsOn project.tasks.jrubyCleanJars
}
}

View File

@ -1,6 +1,7 @@
package com.github.jrubygradle.war
import org.gradle.api.Task
import org.gradle.api.tasks.*
import org.gradle.api.tasks.bundling.War
import org.gradle.testfixtures.ProjectBuilder
import org.junit.Test
@ -28,5 +29,31 @@ class JRubyWarPluginSpec extends Specification {
expect:
project.tasks.jrubyWar.group == 'JRuby'
project.tasks.jrubyWar instanceof War
project.tasks.jrubyCacheJars instanceof Copy
project.tasks.jrubyCleanJars instanceof Delete
}
def "jrubyPrepare should depend on jrubyCacheJars"() {
expect:
assertTrue(taskContainsDependency(project.tasks.jrubyPrepare,
'jrubyCacheJars'))
}
def 'clean should depend on jrubyCleanJars'() {
expect:
assertTrue(taskContainsDependency(project.tasks.clean, 'jrubyCleanJars'))
}
private Boolean taskContainsDependency(Task task, String taskName) {
Boolean status = false
task.taskDependencies.values.each {
if (it instanceof Task) {
if (taskName == it.name) {
status = true
}
}
}
return status
}
}