Skip to content

Commit

Permalink
Merge pull request #412 from jruby-gradle/master
Browse files Browse the repository at this point in the history
Release 2.1.0-alpha.1
  • Loading branch information
ysb33r authored Oct 30, 2020
2 parents 226bb19 + 2019d0e commit 76aa4fb
Show file tree
Hide file tree
Showing 98 changed files with 1,235 additions and 503 deletions.
2 changes: 1 addition & 1 deletion HACKING.md → HACKING.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ In a similar manner for integration tests one can do `./gradlew integrationTest

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

On a Mac use `IntelliJ IDEA` -> `Preferences` instead of `File/Settings`.
On a Mac use `IntelliJ IDEA` -> `Preferences` instead of `File/Settings`.
2 changes: 1 addition & 1 deletion base-plugin/README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ image::https://api.bintray.com/packages/jruby-gradle/plugins/jruby-gradle-plugin

=== Compatibility

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

=== Installing

Expand Down
36 changes: 17 additions & 19 deletions base-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ project.afterEvaluate {
// --- up to here

ext {
olderJRubyVersion = '9.2.1.0'
slimVersion = '2.0.2'
leafyVersion = '0.4.0'
}
Expand All @@ -48,31 +47,27 @@ dependencies {
exclude group: 'org.codehaus.groovy'
}

// NOTE: This is used by JRubyPrepareGemsIntegrationSpec
integrationTestGems "rubygems:slim:${slimVersion}"

// NOTE: This is used by JRubyPrepareJarsIntegrationSpec
integrationTestGems "rubygems:leafy-complete:${leafyVersion}"

// NOTE: If you change this, you will also need to update JRubyExecIntegrationSpec & JRubyExecExtensionIntegrationSpec
integrationTestGems 'rubygems:credit_card_validator:1.1.0'

// NOTE: If you change this, you will also need to update JRubyExecIntegrationSpec
integrationTestGems 'rubygems:rspec:3.1.0'

// NOTE: This should always be an older older version.
// NOTE: This should always be an older older version.
// It is used by JRubyExecIntegrationSpec
integrationTestGems "org.jruby:jruby-complete:${olderJRubyVersion}"

// NOTE: older jruby versions needs this for exec to work properly
integrationTestGems "rubygems:jar-dependencies:0.1.15"

// This is used by JRubyExecExtensionIntegrationSpec
integrationTestGems "org.bouncycastle:bcprov-jdk15on:${bcprovVersion}"

// This is used by JRubyPrepareJarsIntegrationSpec
integrationTestGems "io.dropwizard.metrics:metrics-core:${dropwizardMetricsCoreVersion}"

gradleTest "org.jruby:jruby-complete:${jrubyVersion}"
gradleTest 'rubygems:credit_card_validator:1.1.0'
gradleTest 'org.bouncycastle:bcprov-jdk15on:1.50'

// These are real GEMs which cannot currently be cached
// gradleTest 'rubygems:credit_card_validator:1.1.0'
// integrationTestGems "rubygems:slim:${slimVersion}"
// integrationTestGems "rubygems:leafy-complete:${leafyVersion}"
// integrationTestGems 'rubygems:credit_card_validator:1.1.0'
// integrationTestGems 'rubygems:rspec:3.1.0'
// integrationTestGems "rubygems:jar-dependencies:0.1.15"

}

generateTestConfig {
Expand All @@ -81,7 +76,10 @@ generateTestConfig {
bcprovVersion: bcprovVersion,
olderJRubyVersion: olderJRubyVersion,
slimVersion: slimVersion,
leafyVersion: leafyVersion
leafyVersion: leafyVersion,
creditCardValidatorVersion : '1.1.0',
dropwizardMetricsCoreVersion : dropwizardMetricsCoreVersion,
rspecVersion : '3.1.0'
}

task copyIntegrationTestJRuby(type: Copy) {
Expand Down
6 changes: 5 additions & 1 deletion base-plugin/src/gradleTest/jrubyExec/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ configurations {
jrubyExec
}

repositories {
ruby.gems()
}

dependencies {
jrubyExec ':credit_card_validator:1.1.0@gem'
jrubyExec 'rubygems:credit_card_validator:1.1.0'
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019, R. Tyler Croy <[email protected]>,
* Copyright (c) 2014-2020, R. Tyler Croy <[email protected]>,
* Schalk Cronje <[email protected]>, Christian Meier, Lookout, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
Expand All @@ -25,14 +25,16 @@ package com.github.jrubygradle

import com.github.jrubygradle.testhelper.IntegrationSpecification
import org.gradle.testkit.runner.BuildResult
import spock.lang.IgnoreIf

/**
* @author Schalk W. Cronjé
*/
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification {

static final String DEFAULT_TASK_NAME = 'inlineJRubyExec'
static final String BCPROV_NAME = 'bcprov-jdk15on'
public static final String DEFAULT_TASK_NAME = 'inlineJRubyExec'
public static final String BCPROV_NAME = 'bcprov-jdk15on'

void "Run a script with minimum parameters"() {
setup:
Expand Down Expand Up @@ -147,7 +149,7 @@ class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification {
@SuppressWarnings('BuilderMethodWithSideEffects')
private void createJRubyExecProject(String preamble, String jrubyexecConfig) {
buildFile.text = """
${projectWithLocalRepo}
${projectWithRubyGemsRepo}
${preamble}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019, R. Tyler Croy <[email protected]>,
* Copyright (c) 2014-2020, R. Tyler Croy <[email protected]>,
* Schalk Cronje <[email protected]>, Christian Meier, Lookout, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
Expand Down Expand Up @@ -151,6 +151,10 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification {
script 'rspec'
"""

File specDir = new File(projectDir,'spec')
specDir.mkdirs()
new File(specDir,'sample.rb').text = ''

when:
BuildResult result = build()

Expand Down Expand Up @@ -224,7 +228,7 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification {
buildFile.text = """
import com.github.jrubygradle.JRubyExec
${projectWithMavenRepo}
${projectWithRubyGemsRepo}
${preamble ?: ''}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019, R. Tyler Croy <[email protected]>,
* Copyright (c) 2014-2020, R. Tyler Croy <[email protected]>,
* Schalk Cronje <[email protected]>, Christian Meier, Lookout, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
Expand Down Expand Up @@ -30,6 +30,7 @@ import spock.lang.IgnoreIf
/**
* @author Schalk W. Cronjé
*/
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification {

static final String DEFAULT_TASK_NAME = 'RubyWax'
Expand All @@ -40,7 +41,7 @@ class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification {
buildFile.text = """
import com.github.jrubygradle.GenerateGradleRb
${projectWithLocalRepo}
${projectWithRubyGemsRepo}
task ${DEFAULT_TASK_NAME} (type: GenerateGradleRb) {
gemInstallDir 'build/gems'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019, R. Tyler Croy <[email protected]>,
* Copyright (c) 2014-2020, R. Tyler Croy <[email protected]>,
* Schalk Cronje <[email protected]>, Christian Meier, Lookout, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
Expand Down Expand Up @@ -30,12 +30,14 @@ import spock.lang.Issue

/**
* @author Schalk W. Cronjé.
* @author Guillaume Grossetie
*/
@IgnoreIf({ IntegrationSpecification.OFFLINE })
class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {

static final String DEFAULT_TASK_NAME = 'jrubyPrepare'

String repoSetup = projectWithLocalRepo
String repoSetup = projectWithRubyGemsRepo
String preamble
String dependenciesConfig

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

@IgnoreIf({ IntegrationSpecification.OFFLINE })
void "Check if rack version gets resolved"() {
setup:
withPreamble """repositories.ruby.gems()
Expand All @@ -72,10 +73,29 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
then:
// since we need a version range in the setup the
// resolved version here can vary over time
new File(projectDir, "gems/rack-1.6.11").exists()
new File(projectDir, "gems/rack-1.6.13").exists()
}

void "Check if selenium-webdriver version gets resolved"() {
setup:
withPreamble """repositories.ruby.gems()
jrubyPrepare.outputDir = '${pathAsUriStr(projectDir)}'.toURI()
"""

withDependencies """
gems 'rubygems:selenium-webdriver:3.142.6'
gems 'rubygems:webdrivers:4.1.3'
"""

when:
build()

then:
// since we need a version range in the setup the
// resolved version here can vary over time
new File(projectDir, "gems/selenium-webdriver-3.142.6").exists()
}

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

@IgnoreIf({ IntegrationSpecification.OFFLINE })
void "Check if prerelease gem gets resolved"() {
setup:
withDefaultRepositories()
Expand All @@ -134,7 +153,6 @@ rubygems:tilt:2.0.9
}

@Issue('https://github.com/jruby-gradle/jruby-gradle-plugin/issues/341')
@IgnoreIf({ IntegrationSpecification.OFFLINE })
void "Make an install-time gem dependency available"() {
setup:
withRubyGemsRepository()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2019, R. Tyler Croy <[email protected]>,
* Copyright (c) 2014-2020, R. Tyler Croy <[email protected]>,
* Schalk Cronje <[email protected]>, Christian Meier, Lookout, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
Expand All @@ -24,28 +24,35 @@
package com.github.jrubygradle

import com.github.jrubygradle.testhelper.IntegrationSpecification
import spock.lang.IgnoreIf

/**
* @author Schalk W. Cronjé.
* @author Christian Meier
*/
@IgnoreIf({ IntegrationSpecification.OFFLINE })
class JRubyPrepareJarsIntegrationSpec extends IntegrationSpecification {

def "Check that default 'jrubyPrepare' uses the correct directory for the jars"() {
given:
String testVer = testProperties.dropwizardMetricsCoreVersion
buildFile.text = """
${projectWithLocalRepo}
${projectWithRubyGemsRepo}
dependencies {
gems 'io.dropwizard.metrics:metrics-core:3.1.0'
gems "io.dropwizard.metrics:metrics-core:${testVer}"
}
"""

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

then:
new File(projectDir, 'build/.gems/Jars.lock').text.trim() == 'io.dropwizard.metrics:metrics-core:3.1.0:runtime:'
new File(projectDir, 'build/.gems/jars/io/dropwizard/metrics/metrics-core/3.1.0/metrics-core-3.1.0.jar').exists()
new File(projectDir, 'build/.gems/Jars.lock').text.trim() ==
"io.dropwizard.metrics:metrics-core:${testProperties.dropwizardMetricsCoreVersion}:runtime:"
new File(
projectDir,
"build/.gems/jars/io/dropwizard/metrics/metrics-core/${testVer}/metrics-core-${testVer}.jar"
).exists()
}
}
Loading

0 comments on commit 76aa4fb

Please sign in to comment.