This repository was archived by the owner on May 19, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +112
-1
lines changed
main/groovy/com/github/jrubygradle
test/groovy/com/github/jrubygradle Expand file tree Collapse file tree 5 files changed +112
-1
lines changed Original file line number Diff line number Diff line change 1
1
.gradle
2
2
build /
3
3
* .sw *
4
+ * .iml
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ buildscript {
8
8
}
9
9
10
10
group = ' com.github.jruby-gradle'
11
- version = ' 0.1.0 '
11
+ version = ' 0.1.1 '
12
12
13
13
if (System . env. RELEASE != ' 1' ) {
14
14
version = " ${ version} -SNAPSHOT"
Original file line number Diff line number Diff line change
1
+ package com.github.jrubygradle
2
+
3
+ import org.gradle.api.Project
4
+ import org.gradle.api.tasks.bundling.Jar
5
+
6
+ /**
7
+ *
8
+ * @author R. Tyler Croy
9
+ */
10
+ class JRubyJar extends Jar {
11
+
12
+ static final String mainClass = ' com.lookout.jruby.JarMain'
13
+ static final String JRUBYJAR_CONFIG = ' jrubyJar'
14
+
15
+ JRubyJar () {
16
+ super ()
17
+ description ' Create a JRuby-based .jar file'
18
+
19
+ // Bring in any compiled classes from our project
20
+ from " $project . buildDir /classes/main"
21
+
22
+ // By adding the JarMain class as the main-class we can have a
23
+ // runnable jar
24
+ manifest {
25
+ attributes ' Main-Class' : mainClass
26
+ }
27
+ }
28
+
29
+ /* * Update dependencies on the project to include those necessary for
30
+ * building JRubyJar's
31
+ */
32
+ static void updateJRubyDependencies (Project project ) {
33
+ project. dependencies {
34
+ jrubyJar group : ' org.jruby' , name : ' jruby-complete' , version : project. jruby. defaultVersion
35
+ }
36
+ }
37
+ }
Original file line number Diff line number Diff line change
1
+ package com.github.jrubygradle
2
+
3
+ /**
4
+ * Created by schalkc on 27/08/2014.
5
+ */
6
+ class JRubyJarPlugin {
7
+ void apply (Project project ) {
8
+ // MIGHT NEED: project.apply plugin: 'java', 'java-base'
9
+
10
+ project. configurations. create(JRubyWar . JRUBYWAR_CONFIG )
11
+
12
+ // TODO: Should probably check whether it exists before creating it
13
+ project. configurations {
14
+ jrubyEmbeds
15
+ }
16
+
17
+ project. dependencies {
18
+ jrubyEmbeds group : ' com.lookout' , name : ' warbler-bootstrap' , version : ' 1.+'
19
+ }
20
+
21
+ // TODO: This will depend on which plugin we pull in
22
+ // // In order to update the testing cycle we need to tell unit tests where to
23
+ // // find GEMs. We are assuming that if someone includes this plugin, that they
24
+ // // will be writing tests that includes jruby and that they might need some
25
+ // // GEMs as part of the tests.
26
+ // project.tasks.test {
27
+ // environment GEM_HOME : project.extensions.getByName('jruby').gemInstallDir
28
+ // dependsOn 'jrubyPrepareGems'
29
+ // }
30
+
31
+ project. task(' jrubyJar' , type : JRubyJar ) {
32
+ group JRubyPlugin . TASK_GROUP_NAME
33
+ dependsOn project. tasks. jrubyPrepare
34
+ dependsOn project. tasks. classes
35
+ }
36
+
37
+ }
38
+
39
+
40
+ }
Original file line number Diff line number Diff line change
1
+ package com.github.jrubygradle
2
+
3
+ import org.gradle.testfixtures.ProjectBuilder
4
+ import spock.lang.*
5
+ import static org.gradle.api.logging.LogLevel.*
6
+
7
+ /**
8
+ * @author R. Tyler Croy
9
+ *
10
+ */
11
+ class JRubyJarSpec extends Specification {
12
+ static final File TEST_SCRIPT_DIR = new File ( System . getProperty(' TEST_SCRIPT_DIR' ) ?: ' src/test/resources/scripts' )
13
+ static final File TESTROOT = new File (System . getProperty(' TESTROOT' ) ?: ' build/tmp/test/unittests' )
14
+ static final String TASK_NAME = ' JarJar'
15
+
16
+ def project
17
+ def jarTask
18
+
19
+ void setup () {
20
+ project = ProjectBuilder . builder(). build()
21
+ project. buildDir = TESTROOT
22
+ project. logging. level = LIFECYCLE
23
+ project. apply plugin : ' com.github.jruby-gradle.base'
24
+ jarTask = project. task(TASK_NAME , type : JRubyJar )
25
+
26
+ }
27
+
28
+ def " basic sanity check" () {
29
+ expect : " jarTask to be an instance"
30
+ jarTask instanceof JRubyJar
31
+ project. tasks. jrubyJar. group == ' JRuby'
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments