Remove all dependency on Torquebox (#388)

This commit is contained in:
Schalk Cronje 2019-12-19 23:28:05 +01:00
parent a7d119e7a4
commit a8ffdf8954
21 changed files with 120 additions and 72 deletions

View File

@ -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

View File

@ -22,7 +22,6 @@ project.afterEvaluate {
// --- up to here
ext {
olderJRubyVersion = '9.2.1.0'
slimVersion = '2.0.2'
leafyVersion = '0.4.0'
}
@ -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 {
@ -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) {

View File

@ -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'
}

View File

@ -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:
@ -147,7 +149,7 @@ class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification {
@SuppressWarnings('BuilderMethodWithSideEffects')
private void createJRubyExecProject(String preamble, String jrubyexecConfig) {
buildFile.text = """
${projectWithLocalRepo}
${projectWithRubyGemsRepo}
${preamble}

View File

@ -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()
@ -224,7 +228,7 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification {
buildFile.text = """
import com.github.jrubygradle.JRubyExec
${projectWithMavenRepo}
${projectWithRubyGemsRepo}
${preamble ?: ''}

View File

@ -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'
@ -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'

View File

@ -31,11 +31,12 @@ import spock.lang.Issue
/**
* @author Schalk W. Cronjé.
*/
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
static final String DEFAULT_TASK_NAME = 'jrubyPrepare'
String repoSetup = projectWithLocalRepo
String repoSetup = projectWithRubyGemsRepo
String preamble
String dependenciesConfig
@ -72,7 +73,7 @@ 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.12").exists()
}
@IgnoreIf({ IntegrationSpecification.OFFLINE })

View File

@ -24,20 +24,23 @@
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}"
}
"""
@ -45,7 +48,11 @@ class JRubyPrepareJarsIntegrationSpec extends IntegrationSpecification {
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()
}
}

View File

@ -23,29 +23,37 @@
*/
package com.github.jrubygradle.testhelper
import org.gradle.testkit.runner.GradleRunner
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import spock.lang.Shared
import spock.lang.Specification
import static com.github.jrubygradle.JRubyExecExtensionIntegrationSpec.BCPROV_NAME
class IntegrationSpecification extends Specification {
static final boolean OFFLINE = System.getProperty('TESTS_ARE_OFFLINE')
public static final boolean OFFLINE = System.getProperty('TESTS_ARE_OFFLINE')
static final String HELLO_WORLD = 'helloWorld.rb'
static final String HELLO_NAME = 'helloName.rb'
static final String REQUIRES_GEM = 'requiresGem.rb'
static final String REQUIRE_THE_A_GEM = 'require-a-gem.rb'
static final String ENV_VARS = 'envVars.rb'
public static final String HELLO_WORLD = 'helloWorld.rb'
public static final String HELLO_NAME = 'helloName.rb'
public static final String REQUIRES_GEM = 'requiresGem.rb'
public static final String REQUIRE_THE_A_GEM = 'require-a-gem.rb'
public static final String ENV_VARS = 'envVars.rb'
@Shared
Map testProperties
@Shared
File flatRepoLocation
@Shared
File mavenRepoLocation
@Shared
Map artifactVersions
@Rule
TemporaryFolder testFolder
@ -57,6 +65,15 @@ class IntegrationSpecification extends Specification {
testProperties = loadTestProperties()
flatRepoLocation = new File(testProperties.flatrepo)
mavenRepoLocation = new File(testProperties.mavenrepo)
artifactVersions = [
'credit_card_validator': testProperties.creditCardValidatorVersion,
'rspec' : testProperties.rspecVersion,
'rspec-core' : testProperties.rspecVersion,
'rspec-support' : testProperties.rspecVersion,
'metrics-core' : testProperties.dropwizardMetricsCoreVersion,
(BCPROV_NAME) : testProperties.bcprovVersion
]
}
void setup() {
@ -73,28 +90,19 @@ class IntegrationSpecification extends Specification {
destination.text = this.class.getResource("/scripts/${name}").text
}
String findDependency(final String organisation, final String artifact, final String extension) {
"'${VersionFinder.findDependency(flatRepoLocation, organisation, artifact, extension)}'"
String ver = artifactVersions[artifact]
if (!ver) {
throw new RuntimeException("No version specified for ${artifact}")
}
"'${organisation ?: 'rubygems'}:${artifact}:${ver}@${extension}'"
}
String pathAsUriStr(final File path) {
path.absoluteFile.toURI().toString()
}
String getProjectWithLocalRepo() {
"""
plugins {
id 'com.github.jruby-gradle.base'
}
repositories {
flatDir {
dirs '${pathAsUriStr(flatRepoLocation)}'.toURI()
}
}
"""
}
String getProjectWithMavenRepo() {
"""
plugins {
@ -138,13 +146,14 @@ class IntegrationSpecification extends Specification {
}
"""
}
GradleRunner gradleRunner(List<String> args) {
GradleRunner.create()
.withProjectDir(projectDir)
.withDebug(true)
.withArguments(args)
.withPluginClasspath()
.forwardOutput()
.withProjectDir(projectDir)
.withDebug(true)
.withArguments(args)
.withPluginClasspath()
.forwardOutput()
}
GradleRunner gradleRunner(String... args) {

View File

@ -263,11 +263,12 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
*
* There are three modes of behaviour
* <ul>
* <li> script set. no jrubyArgs, or jrubyArgs does not contain {@code -S} - Normal way to execute script. A check
* <li> script set. no jrubyArgs, or jrubyArgs does not contain {@code -S}: normal way to execute script. A check
* whether the script exists will be performed.
* <li> script set. jrubyArgs contains {@code -S} - If script is not absolute, no check will be performed to see
* <li> script set. jrubyArgs contains {@code -S}: if script is not absolute, no check will be performed to see
* if the script exists and will be assumed that the script can be found using the default ruby path mechanism.
* <li> script not set, but jrubyArgs set - Set up to execute jruby with no script. This should be a rarely used otion.
* <li> script not set, but jrubyArgs set: set up to execute jruby with no script. This should be a rarely used
* option.
* </ul>
*
* @throw {@code org.gradle.api.InvalidUserDataException} if mode of behaviour cannot be determined.

View File

@ -50,7 +50,7 @@ import static org.ysb33r.grolifant.api.StringUtils.stringize
*/
@CompileStatic
class JRubyPluginExtension extends AbstractCombinedProjectTaskExtension {
public static final String DEFAULT_JRUBY_VERSION = '9.2.7.0'
public static final String DEFAULT_JRUBY_VERSION = '9.2.9.0'
public static final String NAME = 'jruby'

View File

@ -25,6 +25,7 @@ allprojects {
targetCompatibility = '1.8'
ext {
olderJRubyVersion = '9.2.1.0'
spockVersion = "org.spockframework:spock-core:1.2-groovy-2.4"
pluginExtraText = (version.contains('-alpha') || version.contains('-beta')) ?
'(If you need a production-ready version of the JRuby/Gradle plugin use a 1.7.x release instead)': ''
@ -37,7 +38,6 @@ subprojects {
repositories {
jcenter()
maven { url torqueboxProxy }
}
if (project.name != 'docs') {
@ -79,10 +79,17 @@ subprojects {
gradleTest {
// https://github.com/jruby-gradle/jruby-gradle-plugin/issues/346
if (JavaVersion.current().java11) {
versions '5.0', '5.4.1'
versions '5.0', '5.4.1', '6.0.1'
} else {
versions '4.2', '4.10.2', '5.3.1'
versions '4.10.2', '5.3.1', '6.0.1'
if(project.name == 'jruby-gradle-core-plugin' ) {
versions '4.3'
} else {
versions '4.9'
}
}
dependsOn jar
}

View File

@ -8,3 +8,8 @@ This plugin offers the following functionality:
* Conversion between GEM-style and Ivy-style dependencies notations.
* An abstract task class (`AbstractJRubyPrepare`) for preparing local GEM + JAR installations.
== Getting Started
=== Compatibility
This plugin requires link:http://gradle.org[Gradle] 4.3 or better

View File

@ -32,6 +32,7 @@ import org.gradle.api.file.FileCollection
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.Optional
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import static com.github.jrubygradle.api.gems.GemOverwriteAction.SKIP
@ -55,6 +56,7 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas
/** Target directory for GEMs. Extracted GEMs will end up in {@code outputDir + "/gems"}
*/
@Internal
File getOutputDir() {
project.file(this.outputDir)
}
@ -100,6 +102,7 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas
*
* @return Path on local filesystem
*/
@OutputFile
abstract protected File getJrubyJarLocation()
@TaskAction

View File

@ -100,7 +100,7 @@ class RepositoryHandlerExtension {
mvn.url = 'http://rubygems-proxy.torquebox.org/releases'.toURI()
}
}
(MavenArtifactRepository)restrictToGems(
(MavenArtifactRepository) restrictToGems(
this.project.repositories.maven(mvnConfigurator),
DEFAULT_GROUP_NAME
)
@ -120,6 +120,10 @@ class RepositoryHandlerExtension {
this.project.repositories.ivy {
artifactPattern "${server}/downloads/[artifact]-[revision](-[classifier]).gem"
ivyPattern "${bindAddress}/[organisation]/[module]/[revision]/ivy.xml"
if (HAS_SECURE_PROTOCOL_FEATURE) {
allowInsecureProtocol = true
}
}
}
@ -136,4 +140,5 @@ class RepositoryHandlerExtension {
private final Project project
private final IvyXmlGlobalProxyRegistry ivyProxies
private static final boolean HAS_CONTENT_FEATURE = GradleVersion.current() >= GradleVersion.version('5.1')
private static final boolean HAS_SECURE_PROTOCOL_FEATURE = GradleVersion.current() >= GradleVersion.version('6.0')
}

View File

@ -1,4 +1,4 @@
version=2.0.0-alpha1
version=2.0.0-alpha2
group=com.github.jruby-gradle
copyrightYear=2014-2019
@ -14,10 +14,11 @@ releaseBuild=false
targetCompatibility=1.8
sourceCompatibility=1.8
jrubyVersion=9.2.7.0
jrubyVersion=9.2.9.0
jettyVersion=9.2.12.v20150709
bcprovVersion=1.46
httpbuilderNgVersion=1.0.3
dropwizardMetricsCoreVersion=3.1.0
torqueboxProxy=http://rubygems-proxy.torquebox.org/releases
ratpackVersion=1.6.1
# unit test / integration test only

View File

@ -17,7 +17,7 @@ dependencies {
/* We want to cache jruby-complete at this alternative version which we use
* in many places
*/
integrationTestGems 'org.jruby:jruby-complete:1.7.11'
integrationTestGems "org.jruby:jruby-complete:${olderJRubyVersion}"
}
sourceSets {

View File

@ -7,7 +7,7 @@ image::https://api.bintray.com/packages/jruby-gradle/plugins/jruby-gradle-jar-pl
=== Compatibility
This plugin requires link::http://gradle.org[Gradle] 2.0 or better
This plugin requires link::http://gradle.org[Gradle] 4.9 or better
=== Installing

View File

@ -71,6 +71,7 @@ class JRubyJar extends Jar {
/**
* @return Directory that the dependencies for this project will be staged into
*/
@Internal
File getGemDir() {
return prepareTask.outputDir
}
@ -83,6 +84,7 @@ class JRubyJar extends Jar {
* modifies the jrubyVersion on the project after we have instantiated, that we still
* respect this setting
* */
@Input
String getJrubyVersion() {
if (embeddedJRubyVersion == null) {
return project.jruby.defaultVersion

View File

@ -1,6 +1,4 @@
description = 'This plugin encapsulates web archive building functionality for JRuby Gradle projects'
group = rootProject.group
version = "${rootProject.version}-alpha"
dependencies {