Skip to content

Commit 76aa4fb

Browse files
authored
Merge pull request #412 from jruby-gradle/master
Release 2.1.0-alpha.1
2 parents 226bb19 + 2019d0e commit 76aa4fb

98 files changed

Lines changed: 1235 additions & 503 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

HACKING.md renamed to HACKING.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ In a similar manner for integration tests one can do `./gradlew integrationTest
1919

2020
Go to `File` -> `Settings` -> `Build, Execution, Deployment` -> `Gradle` -> `Runner`, then check `Delete build/run actions to Gradle` and select `Platform Test Runner`.
2121

22-
On a Mac use `IntelliJ IDEA` -> `Preferences` instead of `File/Settings`.
22+
On a Mac use `IntelliJ IDEA` -> `Preferences` instead of `File/Settings`.

base-plugin/README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ image::https://api.bintray.com/packages/jruby-gradle/plugins/jruby-gradle-plugin
77

88
=== Compatibility
99

10-
This plugin requires link:http://gradle.org[Gradle] 4.0 or better
10+
This plugin requires link:http://gradle.org[Gradle] 4.9 or better
1111

1212
=== Installing
1313

base-plugin/build.gradle

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ project.afterEvaluate {
2222
// --- up to here
2323

2424
ext {
25-
olderJRubyVersion = '9.2.1.0'
2625
slimVersion = '2.0.2'
2726
leafyVersion = '0.4.0'
2827
}
@@ -48,31 +47,27 @@ dependencies {
4847
exclude group: 'org.codehaus.groovy'
4948
}
5049

51-
// NOTE: This is used by JRubyPrepareGemsIntegrationSpec
52-
integrationTestGems "rubygems:slim:${slimVersion}"
53-
54-
// NOTE: This is used by JRubyPrepareJarsIntegrationSpec
55-
integrationTestGems "rubygems:leafy-complete:${leafyVersion}"
56-
57-
// NOTE: If you change this, you will also need to update JRubyExecIntegrationSpec & JRubyExecExtensionIntegrationSpec
58-
integrationTestGems 'rubygems:credit_card_validator:1.1.0'
59-
60-
// NOTE: If you change this, you will also need to update JRubyExecIntegrationSpec
61-
integrationTestGems 'rubygems:rspec:3.1.0'
62-
63-
// NOTE: This should always be an older older version.
50+
// NOTE: This should always be an older older version.
6451
// It is used by JRubyExecIntegrationSpec
6552
integrationTestGems "org.jruby:jruby-complete:${olderJRubyVersion}"
6653

67-
// NOTE: older jruby versions needs this for exec to work properly
68-
integrationTestGems "rubygems:jar-dependencies:0.1.15"
69-
7054
// This is used by JRubyExecExtensionIntegrationSpec
7155
integrationTestGems "org.bouncycastle:bcprov-jdk15on:${bcprovVersion}"
7256

57+
// This is used by JRubyPrepareJarsIntegrationSpec
58+
integrationTestGems "io.dropwizard.metrics:metrics-core:${dropwizardMetricsCoreVersion}"
59+
7360
gradleTest "org.jruby:jruby-complete:${jrubyVersion}"
74-
gradleTest 'rubygems:credit_card_validator:1.1.0'
7561
gradleTest 'org.bouncycastle:bcprov-jdk15on:1.50'
62+
63+
// These are real GEMs which cannot currently be cached
64+
// gradleTest 'rubygems:credit_card_validator:1.1.0'
65+
// integrationTestGems "rubygems:slim:${slimVersion}"
66+
// integrationTestGems "rubygems:leafy-complete:${leafyVersion}"
67+
// integrationTestGems 'rubygems:credit_card_validator:1.1.0'
68+
// integrationTestGems 'rubygems:rspec:3.1.0'
69+
// integrationTestGems "rubygems:jar-dependencies:0.1.15"
70+
7671
}
7772

7873
generateTestConfig {
@@ -81,7 +76,10 @@ generateTestConfig {
8176
bcprovVersion: bcprovVersion,
8277
olderJRubyVersion: olderJRubyVersion,
8378
slimVersion: slimVersion,
84-
leafyVersion: leafyVersion
79+
leafyVersion: leafyVersion,
80+
creditCardValidatorVersion : '1.1.0',
81+
dropwizardMetricsCoreVersion : dropwizardMetricsCoreVersion,
82+
rspecVersion : '3.1.0'
8583
}
8684

8785
task copyIntegrationTestJRuby(type: Copy) {

base-plugin/src/gradleTest/jrubyExec/build.gradle

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@ configurations {
66
jrubyExec
77
}
88

9+
repositories {
10+
ruby.gems()
11+
}
12+
913
dependencies {
10-
jrubyExec ':credit_card_validator:1.1.0@gem'
14+
jrubyExec 'rubygems:credit_card_validator:1.1.0'
1115
}
1216

1317

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014-2019, R. Tyler Croy <rtyler@brokenco.de>,
2+
* Copyright (c) 2014-2020, R. Tyler Croy <rtyler@brokenco.de>,
33
* Schalk Cronje <ysb33r@gmail.com>, Christian Meier, Lookout, Inc.
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining
@@ -25,14 +25,16 @@ package com.github.jrubygradle
2525

2626
import com.github.jrubygradle.testhelper.IntegrationSpecification
2727
import org.gradle.testkit.runner.BuildResult
28+
import spock.lang.IgnoreIf
2829

2930
/**
3031
* @author Schalk W. Cronjé
3132
*/
33+
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
3234
class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification {
3335

34-
static final String DEFAULT_TASK_NAME = 'inlineJRubyExec'
35-
static final String BCPROV_NAME = 'bcprov-jdk15on'
36+
public static final String DEFAULT_TASK_NAME = 'inlineJRubyExec'
37+
public static final String BCPROV_NAME = 'bcprov-jdk15on'
3638

3739
void "Run a script with minimum parameters"() {
3840
setup:
@@ -147,7 +149,7 @@ class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification {
147149
@SuppressWarnings('BuilderMethodWithSideEffects')
148150
private void createJRubyExecProject(String preamble, String jrubyexecConfig) {
149151
buildFile.text = """
150-
${projectWithLocalRepo}
152+
${projectWithRubyGemsRepo}
151153
152154
${preamble}
153155

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014-2019, R. Tyler Croy <rtyler@brokenco.de>,
2+
* Copyright (c) 2014-2020, R. Tyler Croy <rtyler@brokenco.de>,
33
* Schalk Cronje <ysb33r@gmail.com>, Christian Meier, Lookout, Inc.
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining
@@ -151,6 +151,10 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification {
151151
script 'rspec'
152152
"""
153153

154+
File specDir = new File(projectDir,'spec')
155+
specDir.mkdirs()
156+
new File(specDir,'sample.rb').text = ''
157+
154158
when:
155159
BuildResult result = build()
156160

@@ -224,7 +228,7 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification {
224228
buildFile.text = """
225229
import com.github.jrubygradle.JRubyExec
226230
227-
${projectWithMavenRepo}
231+
${projectWithRubyGemsRepo}
228232
229233
${preamble ?: ''}
230234

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014-2019, R. Tyler Croy <rtyler@brokenco.de>,
2+
* Copyright (c) 2014-2020, R. Tyler Croy <rtyler@brokenco.de>,
33
* Schalk Cronje <ysb33r@gmail.com>, Christian Meier, Lookout, Inc.
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining
@@ -30,6 +30,7 @@ import spock.lang.IgnoreIf
3030
/**
3131
* @author Schalk W. Cronjé
3232
*/
33+
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
3334
class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification {
3435

3536
static final String DEFAULT_TASK_NAME = 'RubyWax'
@@ -40,7 +41,7 @@ class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification {
4041
buildFile.text = """
4142
import com.github.jrubygradle.GenerateGradleRb
4243
43-
${projectWithLocalRepo}
44+
${projectWithRubyGemsRepo}
4445
4546
task ${DEFAULT_TASK_NAME} (type: GenerateGradleRb) {
4647
gemInstallDir 'build/gems'

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014-2019, R. Tyler Croy <rtyler@brokenco.de>,
2+
* Copyright (c) 2014-2020, R. Tyler Croy <rtyler@brokenco.de>,
33
* Schalk Cronje <ysb33r@gmail.com>, Christian Meier, Lookout, Inc.
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining
@@ -30,12 +30,14 @@ import spock.lang.Issue
3030

3131
/**
3232
* @author Schalk W. Cronjé.
33+
* @author Guillaume Grossetie
3334
*/
35+
@IgnoreIf({ IntegrationSpecification.OFFLINE })
3436
class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
3537

3638
static final String DEFAULT_TASK_NAME = 'jrubyPrepare'
3739

38-
String repoSetup = projectWithLocalRepo
40+
String repoSetup = projectWithRubyGemsRepo
3941
String preamble
4042
String dependenciesConfig
4143

@@ -53,7 +55,6 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
5355
new File(projectDir, "gems/slim-${slimVersion}").exists()
5456
}
5557

56-
@IgnoreIf({ IntegrationSpecification.OFFLINE })
5758
void "Check if rack version gets resolved"() {
5859
setup:
5960
withPreamble """repositories.ruby.gems()
@@ -72,10 +73,29 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
7273
then:
7374
// since we need a version range in the setup the
7475
// resolved version here can vary over time
75-
new File(projectDir, "gems/rack-1.6.11").exists()
76+
new File(projectDir, "gems/rack-1.6.13").exists()
77+
}
78+
79+
void "Check if selenium-webdriver version gets resolved"() {
80+
setup:
81+
withPreamble """repositories.ruby.gems()
82+
jrubyPrepare.outputDir = '${pathAsUriStr(projectDir)}'.toURI()
83+
"""
84+
85+
withDependencies """
86+
gems 'rubygems:selenium-webdriver:3.142.6'
87+
gems 'rubygems:webdrivers:4.1.3'
88+
"""
89+
90+
when:
91+
build()
92+
93+
then:
94+
// since we need a version range in the setup the
95+
// resolved version here can vary over time
96+
new File(projectDir, "gems/selenium-webdriver-3.142.6").exists()
7697
}
7798

78-
@IgnoreIf({ IntegrationSpecification.OFFLINE })
7999
void "Check that GEM dependencies are locked"() {
80100
setup:
81101
File lockFile = new File(projectDir, 'gradle/dependency-locks/gems.lockfile')
@@ -117,7 +137,6 @@ rubygems:tilt:2.0.9
117137
new File(projectDir, "gems/rack-1.6.10").exists()
118138
}
119139

120-
@IgnoreIf({ IntegrationSpecification.OFFLINE })
121140
void "Check if prerelease gem gets resolved"() {
122141
setup:
123142
withDefaultRepositories()
@@ -134,7 +153,6 @@ rubygems:tilt:2.0.9
134153
}
135154

136155
@Issue('https://github.com/jruby-gradle/jruby-gradle-plugin/issues/341')
137-
@IgnoreIf({ IntegrationSpecification.OFFLINE })
138156
void "Make an install-time gem dependency available"() {
139157
setup:
140158
withRubyGemsRepository()

base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2014-2019, R. Tyler Croy <rtyler@brokenco.de>,
2+
* Copyright (c) 2014-2020, R. Tyler Croy <rtyler@brokenco.de>,
33
* Schalk Cronje <ysb33r@gmail.com>, Christian Meier, Lookout, Inc.
44
*
55
* Permission is hereby granted, free of charge, to any person obtaining
@@ -24,28 +24,35 @@
2424
package com.github.jrubygradle
2525

2626
import com.github.jrubygradle.testhelper.IntegrationSpecification
27+
import spock.lang.IgnoreIf
2728

2829
/**
2930
* @author Schalk W. Cronjé.
3031
* @author Christian Meier
3132
*/
33+
@IgnoreIf({ IntegrationSpecification.OFFLINE })
3234
class JRubyPrepareJarsIntegrationSpec extends IntegrationSpecification {
3335

3436
def "Check that default 'jrubyPrepare' uses the correct directory for the jars"() {
3537
given:
38+
String testVer = testProperties.dropwizardMetricsCoreVersion
3639
buildFile.text = """
37-
${projectWithLocalRepo}
40+
${projectWithRubyGemsRepo}
3841
3942
dependencies {
40-
gems 'io.dropwizard.metrics:metrics-core:3.1.0'
43+
gems "io.dropwizard.metrics:metrics-core:${testVer}"
4144
}
4245
"""
4346

4447
when:
4548
gradleRunner('jrubyPrepare', '-i').build()
4649

4750
then:
48-
new File(projectDir, 'build/.gems/Jars.lock').text.trim() == 'io.dropwizard.metrics:metrics-core:3.1.0:runtime:'
49-
new File(projectDir, 'build/.gems/jars/io/dropwizard/metrics/metrics-core/3.1.0/metrics-core-3.1.0.jar').exists()
51+
new File(projectDir, 'build/.gems/Jars.lock').text.trim() ==
52+
"io.dropwizard.metrics:metrics-core:${testProperties.dropwizardMetricsCoreVersion}:runtime:"
53+
new File(
54+
projectDir,
55+
"build/.gems/jars/io/dropwizard/metrics/metrics-core/${testVer}/metrics-core-${testVer}.jar"
56+
).exists()
5057
}
5158
}

0 commit comments

Comments
 (0)