From 0d2ccce53e450ebe0287da72f4f9cf2460363de8 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Wed, 26 Jun 2019 13:08:01 +0200 Subject: [PATCH 01/21] Remove deprecation warnings related to Gradle 5 --- .../com/github/jrubygradle/api/gems/GemVersion.groovy | 7 ------- settings.gradle | 1 - 2 files changed, 8 deletions(-) diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy index 883d7f92..1eea3c39 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy @@ -470,13 +470,6 @@ class GemVersion implements Comparable { matcher[0][1] } -// private GemVersion(Boolean lowInclusive, String low, String high, Boolean highInclusive) { -// this.lowBoundary = lowInclusive ? INCLUSIVE : EXCLUSIVE -// this.low = low -// this.high = high -// this.highBoundary = highInclusive ? INCLUSIVE : EXCLUSIVE -// } - private GemVersion(Boundary pre, String low, String high, Boundary post) { this.lowBoundary = pre this.low = low diff --git a/settings.gradle b/settings.gradle index 2d7340a3..0edba7c3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -7,4 +7,3 @@ include 'docs' -enableFeaturePreview('STABLE_PUBLISHING') \ No newline at end of file From a8ffdf89549e8b289a21e801f2751e1bf892fbee Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Thu, 19 Dec 2019 23:28:05 +0100 Subject: [PATCH 02/21] Remove all dependency on Torquebox (#388) --- base-plugin/README.adoc | 2 +- base-plugin/build.gradle | 36 ++++++----- .../src/gradleTest/jrubyExec/build.gradle | 6 +- .../JRubyExecExtensionIntegrationSpec.groovy | 8 ++- .../JRubyExecIntegrationSpec.groovy | 6 +- ...RubyGenerateGradleRbIntegrationSpec.groovy | 3 +- .../JRubyPrepareGemsIntegrationSpec.groovy | 5 +- .../JRubyPrepareJarsIntegrationSpec.groovy | 15 +++-- .../IntegrationSpecification.groovy | 61 +++++++++++-------- .../com/github/jrubygradle/JRubyExec.groovy | 7 ++- .../jrubygradle/JRubyPluginExtension.groovy | 2 +- build.gradle | 13 +++- core-plugin/README.adoc | 5 ++ .../api/core/AbstractJRubyPrepare.groovy | 3 + .../core/RepositoryHandlerExtension.groovy | 7 ++- gradle.properties | 5 +- gradle/integration-tests.gradle | 2 +- jar-plugin/README.adoc | 2 +- jar-plugin/src/gradleTest/.gitkeep | 0 .../github/jrubygradle/jar/JRubyJar.groovy | 2 + war-plugin/build.gradle | 2 - 21 files changed, 120 insertions(+), 72 deletions(-) delete mode 100644 jar-plugin/src/gradleTest/.gitkeep diff --git a/base-plugin/README.adoc b/base-plugin/README.adoc index 04da40b3..78d984aa 100644 --- a/base-plugin/README.adoc +++ b/base-plugin/README.adoc @@ -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 diff --git a/base-plugin/build.gradle b/base-plugin/build.gradle index 6fa3450c..8ff77910 100644 --- a/base-plugin/build.gradle +++ b/base-plugin/build.gradle @@ -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) { diff --git a/base-plugin/src/gradleTest/jrubyExec/build.gradle b/base-plugin/src/gradleTest/jrubyExec/build.gradle index 62fa76a6..3c37198c 100644 --- a/base-plugin/src/gradleTest/jrubyExec/build.gradle +++ b/base-plugin/src/gradleTest/jrubyExec/build.gradle @@ -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' } diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy index 2219b4e0..db6382cb 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy @@ -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} diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy index c52f0162..50020bbd 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy @@ -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 ?: ''} diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy index 7491d7a2..550cb9bb 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy @@ -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' diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy index c50652c4..5f2bf79c 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy @@ -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 }) diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy index 3604e096..0475c9bc 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy @@ -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() } } diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy index ad856202..ede06d76 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy @@ -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 args) { GradleRunner.create() - .withProjectDir(projectDir) - .withDebug(true) - .withArguments(args) - .withPluginClasspath() - .forwardOutput() + .withProjectDir(projectDir) + .withDebug(true) + .withArguments(args) + .withPluginClasspath() + .forwardOutput() } GradleRunner gradleRunner(String... args) { diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy index c8aac46c..3ce79069 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy @@ -263,11 +263,12 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec { * * There are three modes of behaviour *
    - *
  • script set. no jrubyArgs, or jrubyArgs does not contain {@code -S} - Normal way to execute script. A check + *
  • 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. - *
  • script set. jrubyArgs contains {@code -S} - If script is not absolute, no check will be performed to see + *
  • 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. - *
  • script not set, but jrubyArgs set - Set up to execute jruby with no script. This should be a rarely used otion. + *
  • script not set, but jrubyArgs set: set up to execute jruby with no script. This should be a rarely used + * option. *
* * @throw {@code org.gradle.api.InvalidUserDataException} if mode of behaviour cannot be determined. diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy index bc562fdd..4e77e17f 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy @@ -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' diff --git a/build.gradle b/build.gradle index 8dbb16f4..0ff5aecf 100644 --- a/build.gradle +++ b/build.gradle @@ -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 } diff --git a/core-plugin/README.adoc b/core-plugin/README.adoc index 8528f6fa..b46e76dd 100644 --- a/core-plugin/README.adoc +++ b/core-plugin/README.adoc @@ -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 diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy index fe800d97..f11e5811 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy @@ -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 diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy index a59621d5..dfb4ff00 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy @@ -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') } diff --git a/gradle.properties b/gradle.properties index f09c5146..126972cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/gradle/integration-tests.gradle b/gradle/integration-tests.gradle index 4d181c9e..2a8420bd 100644 --- a/gradle/integration-tests.gradle +++ b/gradle/integration-tests.gradle @@ -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 { diff --git a/jar-plugin/README.adoc b/jar-plugin/README.adoc index 53183560..1b40c4db 100644 --- a/jar-plugin/README.adoc +++ b/jar-plugin/README.adoc @@ -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 diff --git a/jar-plugin/src/gradleTest/.gitkeep b/jar-plugin/src/gradleTest/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/jar-plugin/src/main/groovy/com/github/jrubygradle/jar/JRubyJar.groovy b/jar-plugin/src/main/groovy/com/github/jrubygradle/jar/JRubyJar.groovy index af36dffa..2bddc319 100644 --- a/jar-plugin/src/main/groovy/com/github/jrubygradle/jar/JRubyJar.groovy +++ b/jar-plugin/src/main/groovy/com/github/jrubygradle/jar/JRubyJar.groovy @@ -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 diff --git a/war-plugin/build.gradle b/war-plugin/build.gradle index 3f8d7887..2f2848b2 100644 --- a/war-plugin/build.gradle +++ b/war-plugin/build.gradle @@ -1,6 +1,4 @@ description = 'This plugin encapsulates web archive building functionality for JRuby Gradle projects' -group = rootProject.group -version = "${rootProject.version}-alpha" dependencies { From 44c14bb7f91bcd075465bb6b6c4b49e942fd72a8 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Thu, 19 Dec 2019 23:59:08 +0100 Subject: [PATCH 03/21] Update release process --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 0ff5aecf..aacefa0e 100644 --- a/build.gradle +++ b/build.gradle @@ -121,6 +121,6 @@ subprojects { task release(type: Exec) { description 'Create and upload a release' - dependsOn subprojects.collect { ":${it.name}:bintrayUpload" } + dependsOn subprojects.findAll { it.name != 'docs' }.collect { ":${it.name}:bintrayUpload" } commandLine 'git', 'tag', "v${project.version}" } From 00522b2cca27da31b95b702a324628b2ba4df268 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Fri, 20 Dec 2019 17:57:09 +0100 Subject: [PATCH 04/21] Always use the java version of a GEM (#391) --- build.gradle | 2 -- core-plugin/build.gradle | 1 - .../core/IvyXmlProxyServerIntegrationSpec.groovy | 15 +++++++++++++++ .../internal/core/DefaultRubyGemRestApi.groovy | 11 ++++++++++- .../jrubygradle/internal/gems/GemToIvy.groovy | 3 ++- gradle.properties | 2 +- 6 files changed, 28 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index aacefa0e..a1420692 100644 --- a/build.gradle +++ b/build.gradle @@ -107,10 +107,8 @@ subprojects { ideReport.enabled = true ideReport.destination = file( "${project.codenarc.reportsDir}/${reportName}.ide.txt") } - } - idea { module { downloadJavadoc = true diff --git a/core-plugin/build.gradle b/core-plugin/build.gradle index 272ce44d..8e886232 100644 --- a/core-plugin/build.gradle +++ b/core-plugin/build.gradle @@ -36,7 +36,6 @@ bintray { vcsTag = "v${project.version}" attributes = ['gradle-plugin': 'com.github.jruby-gradle.core:com.github.jruby-gradle:jruby-gradle-core-plugin'] desc = 'This plugin provides some core dependency resolution for JRuby/Gradle' - } } } diff --git a/core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy b/core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy index 77447baf..e606ceae 100644 --- a/core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy +++ b/core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy @@ -208,6 +208,21 @@ class IvyXmlProxyServerIntegrationSpec extends Specification { findFiles ~/^bibtex-ruby-4.4.7.gem$/ } + void 'Resolve a transitive dependency which is jruby-specific'() { + setup: + withBuildFile ''' + dependencies { + something 'rubygems:rubocop:0.77.0' + } + ''' + + when: + build() + + then: + findFiles ~/^jaro_winkler-1.5.\d+-java.gem$/ + } + private List findFiles(Pattern pat) { new File(projectDir, 'build/something').listFiles(new FilenameFilter() { @Override diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/DefaultRubyGemRestApi.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/DefaultRubyGemRestApi.groovy index 8ba807d4..f1af2eb1 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/DefaultRubyGemRestApi.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/DefaultRubyGemRestApi.groovy @@ -34,6 +34,7 @@ import groovyx.net.http.HttpBuilder import groovyx.net.http.HttpException import okhttp3.OkHttpClient +import static com.github.jrubygradle.internal.gems.GemToIvy.JAVA_PLATFORM import static groovyx.net.http.ContentTypes.JSON import static groovyx.net.http.NativeHandlers.Parsers.json import static groovyx.net.http.OkHttpBuilder.configure @@ -171,8 +172,16 @@ class DefaultRubyGemRestApi implements com.github.jrubygradle.api.core.RubyGemQu // licenses arrayList ) + if (metadata.platform != JAVA_PLATFORM) { + if (getData(V1, "versions/${metadata.name}").find { + it.number == metadata.version && it.platform == JAVA_PLATFORM + }) { + metadata.platform = JAVA_PLATFORM + } + } + if (jsonParser.dependencies?.runtime) { - metadata.dependencies.addAll( Transform.toList(jsonParser.dependencies.runtime) { + metadata.dependencies.addAll(Transform.toList(jsonParser.dependencies.runtime) { new DefaultGemDependency(name: it.name, requirements: it.requirements) }) } diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/GemToIvy.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/GemToIvy.groovy index 9d77651a..fc74b9ec 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/GemToIvy.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/GemToIvy.groovy @@ -41,6 +41,8 @@ import static com.github.jrubygradle.api.gems.GemVersion.singleGemVersionFromMul @CompileStatic class GemToIvy { + public static final String JAVA_PLATFORM = 'java' + /** Create a converter from GEM metadata to Ivy metadata. * * This constructor version assumes that the group is called {@code rubygems}. @@ -156,7 +158,6 @@ class GemToIvy { shaFile } - private static final String JAVA_PLATFORM = 'java' private final String serverUri private final String org = 'rubygems' } diff --git a/gradle.properties b/gradle.properties index 126972cf..f8a81287 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.0.0-alpha2 +version=2.0.0-alpha.3 group=com.github.jruby-gradle copyrightYear=2014-2019 From ac7db6fe24e4b99474e8cd2e12feb616fe2a32af Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Fri, 20 Dec 2019 18:06:40 +0100 Subject: [PATCH 05/21] Only initialise default jruby version in the project extension (#390) --- .../src/main/groovy/com/github/jrubygradle/JRubyExec.groovy | 2 +- .../groovy/com/github/jrubygradle/JRubyPluginExtension.groovy | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy index 3ce79069..af95f231 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy @@ -189,7 +189,7 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec { */ @Deprecated String getJrubyVersion() { - deprecated('Use jruby.getJrubyVersion rather getJrubyVersion()') + deprecated('Use jruby.getJrubyVersion() rather getJrubyVersion()') jruby.jrubyVersion } diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy index 4e77e17f..7d4605ec 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy @@ -60,6 +60,7 @@ class JRubyPluginExtension extends AbstractCombinedProjectTaskExtension { */ JRubyPluginExtension(Project p) { super(p) + this.jrubyVersion = DEFAULT_JRUBY_VERSION } /** Task extension constructor @@ -322,7 +323,7 @@ class JRubyPluginExtension extends AbstractCombinedProjectTaskExtension { } private static final String JRUBY_COMPLETE_DEPENDENCY = 'org.jruby:jruby-complete' - private Object jrubyVersion = DEFAULT_JRUBY_VERSION + private Object jrubyVersion private Provider gemConfiguration private String gemPrepareTaskName From 01c7f95c92521ffd4f401bee8e3894fbfc3fc531 Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Sun, 22 Dec 2019 10:56:52 +0100 Subject: [PATCH 06/21] HACKING file is an AsciiDoc document --- HACKING.md => HACKING.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename HACKING.md => HACKING.adoc (99%) diff --git a/HACKING.md b/HACKING.adoc similarity index 99% rename from HACKING.md rename to HACKING.adoc index 9a5a622b..b94e26e8 100644 --- a/HACKING.md +++ b/HACKING.adoc @@ -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`. \ No newline at end of file +On a Mac use `IntelliJ IDEA` -> `Preferences` instead of `File/Settings`. From 1545885ecfd27f490fe7361eba066b95787f6d2e Mon Sep 17 00:00:00 2001 From: Guillaume Grossetie Date: Sun, 22 Dec 2019 18:06:42 +0100 Subject: [PATCH 07/21] resolves #394 fix gem requirements resolution --- .../JRubyPrepareGemsIntegrationSpec.groovy | 21 ++++ .../jrubygradle/api/gems/GemVersion.groovy | 97 ++++++++----------- .../api/gems/GemVersionSpec.groovy | 26 +++-- 3 files changed, 81 insertions(+), 63 deletions(-) diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy index 5f2bf79c..00618560 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy @@ -76,6 +76,27 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification { new File(projectDir, "gems/rack-1.6.12").exists() } + @IgnoreIf({ IntegrationSpecification.OFFLINE }) + 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: diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy index 02688a14..286476f9 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy @@ -177,7 +177,7 @@ class GemVersion implements Comparable { gemVersions.first() } else { gemVersions[1..-1].inject(gemVersions.first()) { range, value -> - range.union(value) + range.intersect(value) } } } @@ -300,66 +300,53 @@ class GemVersion implements Comparable { * @since 2.0 */ GemVersion intersect(GemVersion other) { - Boundary newLowBoundary - String newLow - switch (compare(low, other.low)) { - case -1: - newLow = other.low - newLowBoundary = other.lowBoundary - break - case 0: - newLowBoundary = (lowBoundary == EXCLUSIVE || other.lowBoundary == EXCLUSIVE) ? EXCLUSIVE : INCLUSIVE - newLow = low - break - case 1: - newLow = low - newLowBoundary = lowBoundary + Tuple2 newLowVersionSpec = intersect(low, lowBoundary, other.low, other.lowBoundary, true) + Tuple2 newHighVersionSpec = intersect(high, highBoundary, other.high, other.highBoundary, false) + GemVersion intersection = new GemVersion(newLowVersionSpec.second, newLowVersionSpec.first, newHighVersionSpec.first, newHighVersionSpec.second) + if (intersection == this) { + // is other a subset of this? + if (compare(this.low, other.low) >= 0 && compare(other.low, this.high) < 0 && compare(this.high, other.high) <= 0) { + return intersection + } + return NO_VERSION } - - Boundary newHighBoundary - String newHigh - - if (!high && other.high) { - newHigh = other.high - newHighBoundary = other.highBoundary - } else if (high && !other.high) { - newHigh = high - newHighBoundary = highBoundary - } else if (!high && !other.high) { - newHigh = null - newHighBoundary = highBoundary - } else { - switch (compare(high, other.high)) { - case 1: - newHigh = other.high - newHighBoundary = other.highBoundary - break - case 0: - newHighBoundary = (highBoundary == EXCLUSIVE || other.highBoundary == EXCLUSIVE) ? EXCLUSIVE : INCLUSIVE - newHigh = high - break - case -1: - newHigh = high - newHighBoundary = highBoundary + if (intersection == other) { + // is this a subset of other? + if (compare(other.low, this.low) >= 0 && compare(this.low, other.high) < 0 && compare(other.high, this.high) <= 0) { + return intersection } + return NO_VERSION } - return new GemVersion(newLowBoundary, newLow, newHigh, newHighBoundary) + return intersection } - /** Creates a new GEM version requirement which that the lowest of two requirements and the highest - * of those same requirement - * - * @param other Other GEM to combine with - * @return New GEM version requirement. - * - * @since 2.0 - */ - GemVersion union(GemVersion other) { - List pair = [this, other] - GemVersion min = pair.min() - GemVersion max = pair.max() + Tuple2 intersect(String version, Boundary boundary, String otherVersion, Boundary otherBoundary, boolean low) { + Boundary newBoundary + String newVersion + if (!version && otherVersion) { + newVersion = otherVersion + newBoundary = otherBoundary + } else if (version && !otherVersion) { + newVersion = version + newBoundary = boundary + } else if (!version && !otherVersion) { + newVersion = null + newBoundary = boundary + } else { + int compareLow = low ? compare(version, otherVersion) : compare(otherVersion, version) + if (compareLow < 0) { + newVersion = otherVersion + newBoundary = otherBoundary + } else if (compareLow > 0) { + newVersion = version + newBoundary = boundary + } else { + newBoundary = (boundary == INCLUSIVE || otherBoundary == INCLUSIVE) ? INCLUSIVE : EXCLUSIVE + newVersion = version + } + } - new GemVersion(min.lowBoundary, min.low, max.high, max.highBoundary) + return new Tuple2(newVersion, newBoundary) } /** Allows for versions to be compared and sorted. diff --git a/core-plugin/src/test/groovy/com/github/jrubygradle/api/gems/GemVersionSpec.groovy b/core-plugin/src/test/groovy/com/github/jrubygradle/api/gems/GemVersionSpec.groovy index b713396d..42b067e1 100644 --- a/core-plugin/src/test/groovy/com/github/jrubygradle/api/gems/GemVersionSpec.groovy +++ b/core-plugin/src/test/groovy/com/github/jrubygradle/api/gems/GemVersionSpec.groovy @@ -23,7 +23,6 @@ */ package com.github.jrubygradle.api.gems -import com.github.jrubygradle.api.gems.GemVersion import spock.lang.Specification import spock.lang.Unroll @@ -77,7 +76,7 @@ class GemVersionSpec extends Specification { } @Unroll - void "Intersect: #ivyLeft ∩ #ivyRight ⇒ Gem #gemVer"() { + void "intersect: #ivyLeft ∩ #ivyRight ⇒ Gem #gemVer"() { when: GemVersion lhs = gemVersionFromGradleIvyRequirement(ivyLeft) GemVersion rhs = gemVersionFromGradleIvyRequirement(ivyRight) @@ -87,10 +86,10 @@ class GemVersionSpec extends Specification { where: ivyLeft | ivyRight | gemVer - '[1.2.1,1.2.4]' | ']1.2.1,1.2.4[' | ']1.2.1,1.2.4[' + '[1.2.1,1.2.4]' | ']1.2.1,1.2.4[' | '[1.2.1,1.2.4]' '[1.2.0,1.2.4]' | ']1.2.1,1.2.3[' | ']1.2.1,1.2.3[' '[1.2.0,1.2.4]' | '[1.2.1,1.2.3]' | '[1.2.1,1.2.3]' - ']1.2.0,1.2.4[' | '[1.2.0,1.2.4]' | ']1.2.0,1.2.4[' + ']1.2.0,1.2.4[' | '[1.2.0,1.2.4]' | '[1.2.0,1.2.4]' ']1.2.1,1.2.3[' | '[1.2.0,1.2.4]' | ']1.2.1,1.2.3[' '[1.2.1,1.2.3]' | '[1.2.0,1.2.4]' | '[1.2.1,1.2.3]' '[1.2.10,1.2.14]' | '[1.2.2,1.10.14]' | '[1.2.10,1.2.14]' @@ -100,9 +99,20 @@ class GemVersionSpec extends Specification { ']2.5.1.1,99999]' | ']2.5.1.1,)' | ']2.5.1.1,99999]' } - void 'Ivy union of < 3, >= 1.2'() { - expect: - singleGemVersionFromMultipleGemRequirements('< 3,>= 1.2').toString() == '[1.2,3[' + @Unroll + void '#gemRequirements (requirements) ⇒ #gemRequirement (requirement)'() { + when: + GemVersion subject = singleGemVersionFromMultipleGemRequirements(gemRequirements) + + then: + subject.toString() == gemRequirement + + where: + gemRequirements | gemRequirement + '< 3,>= 1.2' | '[1.2,3[' + '>= 3.0, < 4.0' | '[3.0,4.0[' + '< 4.0, >= 3.0' | '[3.0,4.0[' + '~> 2.2, >= 2.2.1' | '[2.2.1,3.0[' } void "intersects with conflict"() { @@ -110,7 +120,7 @@ class GemVersionSpec extends Specification { GemVersion subject = gemVersionFromGradleIvyRequirement('[1.2.1,1.2.3]') expect: - subject.intersect('[1.2.4, 1.2.4]').conflict() == true + subject.intersect('[1.2.4, 1.2.4]').conflict() } void "finds no conflicts in non-integer version ranges"() { From 7fe59b46216cd5d6d93d64556556c884bde54ff3 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Mon, 23 Dec 2019 13:53:05 +0100 Subject: [PATCH 08/21] Prepare to release 2.0.0-alpha.4 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f8a81287..3f0dcb65 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.0.0-alpha.3 +version=2.0.0-alpha.4 group=com.github.jruby-gradle copyrightYear=2014-2019 From d57e2f42def02672963dad13652626bf90b0f90f Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Tue, 24 Dec 2019 14:55:56 +0100 Subject: [PATCH 09/21] If the plugin version changes, resolve all dependencies again (#398) --- .../github/jrubygradle/JRubyPrepare.groovy | 20 ++++++- core-plugin/build.gradle | 8 +++ .../api/core/AbstractJRubyPrepare.groovy | 18 ++++-- .../core/IvyXmlGlobalProxyRegistry.groovy | 2 +- .../internal/core/PluginMetadata.groovy | 56 +++++++++++++++++++ .../jrubygradle/internal/gems/GemToIvy.groovy | 2 +- ...jrubygradle.core-plugin.version.properties | 25 +++++++++ gradle.properties | 2 +- 8 files changed, 124 insertions(+), 9 deletions(-) create mode 100644 core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/PluginMetadata.groovy create mode 100644 core-plugin/src/main/resources/META-INF/jruby-gradle/com.jrubygradle.core-plugin.version.properties diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPrepare.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPrepare.groovy index dc2149ec..9e96bf01 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPrepare.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPrepare.groovy @@ -26,6 +26,9 @@ package com.github.jrubygradle import com.github.jrubygradle.api.core.AbstractJRubyPrepare import com.github.jrubygradle.internal.JRubyExecUtils import groovy.transform.CompileStatic +import org.gradle.api.provider.Provider + +import java.util.concurrent.Callable /** Task for preparing a project-local installation of GEMs & JARs. * @@ -46,8 +49,21 @@ class JRubyPrepare extends AbstractJRubyPrepare { * @return Path on local filesystem */ @Override - protected File getJrubyJarLocation() { - JRubyExecUtils.jrubyJar(this.jruby.jrubyConfiguration) + protected Provider getJrubyJarLocation() { + project.provider({ JRubyPluginExtension jrubyExt -> + JRubyExecUtils.jrubyJar(jrubyExt.jrubyConfiguration) + }.curry(this.jruby) as Callable) + } + + /** Version of JRuby to be used. + * + * This method should not resolve any files to obtain the version. + * + * @return Intended version of JRuby. + */ + @Override + protected String getJrubyVersion() { + jruby.jrubyVersion } private final JRubyPluginExtension jruby diff --git a/core-plugin/build.gradle b/core-plugin/build.gradle index 8e886232..eb9da313 100644 --- a/core-plugin/build.gradle +++ b/core-plugin/build.gradle @@ -39,4 +39,12 @@ bintray { } } } + + +processResources { + filesMatching '**/com.jrubygradle.core-plugin.version.properties', { + expand VERSION : project.version + } +} + bintrayUpload.dependsOn assemble diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy index f11e5811..c65cc46a 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy @@ -29,10 +29,11 @@ import groovy.transform.CompileStatic import org.gradle.api.DefaultTask import org.gradle.api.artifacts.Configuration import org.gradle.api.file.FileCollection +import org.gradle.api.provider.Provider +import org.gradle.api.tasks.Input 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 @@ -102,13 +103,22 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas * * @return Path on local filesystem */ - @OutputFile - abstract protected File getJrubyJarLocation() + @Internal + abstract protected Provider getJrubyJarLocation() + + /** Version of JRuby to be used. + * + * This method should not resolve any files to obtain the version. + * + * @return Intended version of JRuby. + */ + @Input + abstract protected String getJrubyVersion() @TaskAction void exec() { File out = getOutputDir() - File jrubyJar = jrubyJarLocation + File jrubyJar = jrubyJarLocation.get() extractGems(project, jrubyJar, gemsAsFileCollection(), out, SKIP) dependencies.findAll { diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlGlobalProxyRegistry.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlGlobalProxyRegistry.groovy index bbd29c45..40e05b49 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlGlobalProxyRegistry.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlGlobalProxyRegistry.groovy @@ -44,7 +44,7 @@ class IvyXmlGlobalProxyRegistry { * @param project Associated project. */ IvyXmlGlobalProxyRegistry(Project project) { - rootCacheDir = new File(project.gradle.gradleUserHomeDir, 'rubygems-ivyxml-cache') + rootCacheDir = new File(project.gradle.gradleUserHomeDir, "rubygems-ivyxml-cache/${PluginMetadata.version()}") refresh = project.gradle.startParameter.refreshDependencies } diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/PluginMetadata.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/PluginMetadata.groovy new file mode 100644 index 00000000..f8a26b42 --- /dev/null +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/PluginMetadata.groovy @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2014-2019, R. Tyler Croy , + * Schalk Cronje , Christian Meier, Lookout, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.github.jrubygradle.internal.core + +import groovy.transform.CompileStatic + +/** Provides some metadata about this plugin + * + * @author Schalk W. Cronjé + * + * @since 2.0.0 + * + */ +@CompileStatic +class PluginMetadata { + + /** Plugin version + * + * @return Version of this plugin. + */ + static String version() { + METADATA['version'] + } + + private static Map loadProperties() { + final String location = 'META-INF/jruby-gradle/com.jrubygradle.core-plugin.version.properties' + final Properties props = new Properties() + PluginMetadata.classLoader.getResourceAsStream(location).withCloseable { strm -> + props.load(strm) + } + props as Map + } + + private static final Map METADATA = loadProperties() +} diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/GemToIvy.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/GemToIvy.groovy index fc74b9ec..14f75e74 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/GemToIvy.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/gems/GemToIvy.groovy @@ -147,7 +147,7 @@ class GemToIvy { writer.toString() } - /** Writes the SHA1 checksum of the {@code ivy.xmnl} file. + /** Writes the SHA1 checksum of the {@code ivy.xml} file. * * @param ivyXml Fle containing the {@code ivy.xml} content/ * @return Checksum file. diff --git a/core-plugin/src/main/resources/META-INF/jruby-gradle/com.jrubygradle.core-plugin.version.properties b/core-plugin/src/main/resources/META-INF/jruby-gradle/com.jrubygradle.core-plugin.version.properties new file mode 100644 index 00000000..86940e71 --- /dev/null +++ b/core-plugin/src/main/resources/META-INF/jruby-gradle/com.jrubygradle.core-plugin.version.properties @@ -0,0 +1,25 @@ +# +# Copyright (c) 2014-2019, R. Tyler Croy , +# Schalk Cronje , Christian Meier, Lookout, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be +# included in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +version=${VERSION} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 3f0dcb65..2365da2f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.0.0-alpha.4 +version=2.0.0-alpha.5 group=com.github.jruby-gradle copyrightYear=2014-2019 From 7e130116f1b4507074694579fa0c92da3a2a00bb Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Tue, 24 Dec 2019 16:14:31 +0100 Subject: [PATCH 10/21] Proposed JRuby version can be optional --- .../src/main/groovy/com/github/jrubygradle/JRubyExec.groovy | 4 ++-- .../com/github/jrubygradle/JRubyPluginExtension.groovy | 2 +- .../main/groovy/com/github/jrubygradle/JRubyPrepare.groovy | 2 +- .../groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy | 4 ++-- .../github/jrubygradle/api/core/AbstractJRubyPrepare.groovy | 6 ++++-- gradle.properties | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy index af95f231..a213c38b 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy @@ -184,12 +184,12 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec { /** If it is required that a JRubyExec task needs to be executed with a different version of JRuby that the * globally configured one, it can be done by setting it here. * - * @deprecated Use{@code jruby.getJrubyVersion( )} instead. + * @deprecated Use{@code jruby.getProposedJRubyVersion( )} instead. * */ @Deprecated String getJrubyVersion() { - deprecated('Use jruby.getJrubyVersion() rather getJrubyVersion()') + deprecated('Use jruby.getProposedJRubyVersion() rather getProposedJRubyVersion()') jruby.jrubyVersion } diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy index 7d4605ec..e5104843 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy @@ -111,7 +111,7 @@ class JRubyPluginExtension extends AbstractCombinedProjectTaskExtension { */ @Deprecated String getDefaultVersion() { - deprecated('Use getJrubyVersion() rather than getDefaultVersion()') + deprecated('Use getProposedJRubyVersion() rather than getDefaultVersion()') getJrubyVersion() } diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPrepare.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPrepare.groovy index 9e96bf01..6b193f83 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPrepare.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPrepare.groovy @@ -62,7 +62,7 @@ class JRubyPrepare extends AbstractJRubyPrepare { * @return Intended version of JRuby. */ @Override - protected String getJrubyVersion() { + protected String getProposedJRubyVersion() { jruby.jrubyVersion } diff --git a/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy b/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy index 720adb96..ea761972 100644 --- a/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy +++ b/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy @@ -72,12 +72,12 @@ class JRubyExecTaskSpec extends Specification { when: project.configure(execTask) { jruby.gemConfiguration configurationName - jruby.jrubyVersion newVersion + jruby.getProposedJRubyVersion newVersion } project.evaluate() then: - execTask.jruby.jrubyVersion != project.jruby.jrubyVersion + execTask.jruby.jrubyVersion != project.jruby.getProposedJRubyVersion and: "jrubyConfigurationName must point to this new configuration" execTask.jruby.getGemConfiguration().name == configurationName diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy index c65cc46a..28e037d8 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy @@ -110,10 +110,12 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas * * This method should not resolve any files to obtain the version. * - * @return Intended version of JRuby. + * @return Intended version of JRuby. Can be {@code null} if the version + * is indirectly inferred via configuration. */ @Input - abstract protected String getJrubyVersion() + @Optional + abstract protected String getProposedJRubyVersion() @TaskAction void exec() { diff --git a/gradle.properties b/gradle.properties index 2365da2f..29bf97a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.0.0-alpha.5 +version=2.0.0-alpha.6 group=com.github.jruby-gradle copyrightYear=2014-2019 From a32280d3e07eda3de3d4ee41369aa714d81622a1 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Tue, 24 Dec 2019 21:06:26 +0100 Subject: [PATCH 11/21] Revert accidental changed deprecation text messages --- .../src/main/groovy/com/github/jrubygradle/JRubyExec.groovy | 4 ++-- .../groovy/com/github/jrubygradle/JRubyPluginExtension.groovy | 2 +- .../groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy index a213c38b..8f4ff00b 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy @@ -184,12 +184,12 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec { /** If it is required that a JRubyExec task needs to be executed with a different version of JRuby that the * globally configured one, it can be done by setting it here. * - * @deprecated Use{@code jruby.getProposedJRubyVersion( )} instead. + * @deprecated Use {@code jruby.getJrubyVersion( )} instead. * */ @Deprecated String getJrubyVersion() { - deprecated('Use jruby.getProposedJRubyVersion() rather getProposedJRubyVersion()') + deprecated('Use jruby.getJrubyVersion() rather getJrubyVersion()') jruby.jrubyVersion } diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy index e5104843..7d4605ec 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyPluginExtension.groovy @@ -111,7 +111,7 @@ class JRubyPluginExtension extends AbstractCombinedProjectTaskExtension { */ @Deprecated String getDefaultVersion() { - deprecated('Use getProposedJRubyVersion() rather than getDefaultVersion()') + deprecated('Use getJrubyVersion() rather than getDefaultVersion()') getJrubyVersion() } diff --git a/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy b/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy index ea761972..720adb96 100644 --- a/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy +++ b/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy @@ -72,12 +72,12 @@ class JRubyExecTaskSpec extends Specification { when: project.configure(execTask) { jruby.gemConfiguration configurationName - jruby.getProposedJRubyVersion newVersion + jruby.jrubyVersion newVersion } project.evaluate() then: - execTask.jruby.jrubyVersion != project.jruby.getProposedJRubyVersion + execTask.jruby.jrubyVersion != project.jruby.jrubyVersion and: "jrubyConfigurationName must point to this new configuration" execTask.jruby.getGemConfiguration().name == configurationName From 836837ca4a6a4a4da6aa05f87bbdf72fe104ab87 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Tue, 24 Dec 2019 21:42:13 +0100 Subject: [PATCH 12/21] Static compile JRubyExec --- .../groovy/com/github/jrubygradle/JRubyExec.groovy | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy index 8f4ff00b..c47c39b9 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy @@ -26,6 +26,7 @@ package com.github.jrubygradle import com.github.jrubygradle.api.core.JRubyAwareTask import com.github.jrubygradle.api.core.JRubyExecSpec import com.github.jrubygradle.internal.JRubyExecUtils +import groovy.transform.CompileStatic import org.gradle.api.Task import org.gradle.api.artifacts.Configuration import org.gradle.api.provider.Provider @@ -48,6 +49,7 @@ import static org.ysb33r.grolifant.api.StringUtils.stringize * @author Christian Meier * */ +@CompileStatic class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec { public static final String MAIN_CLASS = 'org.jruby.Main' @@ -65,13 +67,13 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec { super.setMain MAIN_CLASS this.jruby = extensions.create(JRubyPluginExtension.NAME, JRubyPluginExtension, this) - inputs.property 'jrubyver', { + inputs.property 'jrubyver', { JRubyPluginExtension jruby -> jruby.jrubyVersion - } + }.curry(this.jruby) - inputs.property 'gemConfiguration', { + inputs.property 'gemConfiguration', { JRubyPluginExtension jruby -> jruby.gemConfiguration - } + }.curry(this.jruby) if (GradleVersion.current() >= GradleVersion.version('4.10')) { dependsOn(project.provider({ JRubyPluginExtension jpe -> @@ -85,7 +87,7 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec { } /** Script to execute. - * @return The path to the script (or nul if not set) + * @return The path to the script (or {@code null} if not set) */ @Optional @Input From 8f782494cb6d5ce61d81b5ca08a76f3ddc8edd69 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Tue, 24 Dec 2019 21:42:41 +0100 Subject: [PATCH 13/21] Add Guillaume Grossetie to author credits --- .../jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy | 8 ++------ .../com/github/jrubygradle/api/core/JRubyExecSpec.java | 8 ++++---- .../com/github/jrubygradle/api/gems/GemVersion.groovy | 1 + 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy index 00618560..87218748 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy @@ -30,8 +30,9 @@ import spock.lang.Issue /** * @author Schalk W. Cronjé. + * @author Guillaume Grossetie */ -@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')}) +@IgnoreIf({ IntegrationSpecification.OFFLINE }) class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification { static final String DEFAULT_TASK_NAME = 'jrubyPrepare' @@ -54,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() @@ -76,7 +76,6 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification { new File(projectDir, "gems/rack-1.6.12").exists() } - @IgnoreIf({ IntegrationSpecification.OFFLINE }) void "Check if selenium-webdriver version gets resolved"() { setup: withPreamble """repositories.ruby.gems() @@ -97,7 +96,6 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification { 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') @@ -139,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() @@ -156,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() diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyExecSpec.java b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyExecSpec.java index ee40717a..b33a16a0 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyExecSpec.java +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyExecSpec.java @@ -1,7 +1,7 @@ /** * Copyright (c) 2014-2019, R. Tyler Croy , - * Schalk Cronje , Christian Meier, Lookout, Inc. - * + * Schalk Cronje , Christian Meier, Lookout, Inc. + *

* Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -9,10 +9,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + *

* The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - * + *

* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy index 286476f9..15ee9329 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemVersion.groovy @@ -62,6 +62,7 @@ import static com.github.jrubygradle.api.gems.GemVersion.Boundary.OPEN_ENDED * * @author Christian Meier * @author Schalk W. Cronjé + * @author Guillaume Grossetie * * @since 2.0 (Moved here from base plugin where it existed since 0.4.0) */ From fb47d655cb238ed9132d9867d40d5cc8fda3b42a Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Tue, 24 Dec 2019 22:27:15 +0100 Subject: [PATCH 14/21] Remove Torquebox --- .../core/RepositoryHandlerExtension.groovy | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy index dfb4ff00..3b3b972e 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy @@ -87,25 +87,6 @@ class RepositoryHandlerExtension { bindRepositoryToProxyServer(project.uri(uri), group) } - /** Adds the legacy Torquebox Maven proxy to {@code rubygems.org}. - * - * Please note that this proxy is effectively unmaintained an no longer supported - * by the original creators. - * - * @return Maven artifact repository - */ - MavenArtifactRepository torquebox() { - Action mvnConfigurator = new Action() { - void execute(MavenArtifactRepository mvn) { - mvn.url = 'http://rubygems-proxy.torquebox.org/releases'.toURI() - } - } - (MavenArtifactRepository) restrictToGems( - this.project.repositories.maven(mvnConfigurator), - DEFAULT_GROUP_NAME - ) - } - private ArtifactRepository bindRepositoryToProxyServer( URI serverUri, String group From 6fdc2e28bc3a6996088367db5d8ace8d21782280 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Tue, 24 Dec 2019 23:45:27 +0100 Subject: [PATCH 15/21] Do not include pre-release GEMs by default (#393) --- .../IvyXmlProxyServerIntegrationSpec.groovy | 9 +- .../core/GemRepositoryConfiguration.groovy | 41 +++++++ .../jrubygradle/api/core/JRubyExecSpec.java | 8 +- .../core/RepositoryHandlerExtension.groovy | 110 +++++++++++++++++- .../api/core/RubyGemQueryRestApi.java | 23 +++- .../core/AbstractIvyXmlProxyServer.groovy | 15 ++- .../core/DefaultRubyGemRestApi.groovy | 60 ++++++++-- .../core/IvyXmlGlobalProxyRegistry.groovy | 24 +++- .../core/IvyXmlRatpackProxyServer.java | 11 +- .../api/core/IvyXmlProxyServerSpec.groovy | 7 +- gradle.properties | 2 +- 11 files changed, 271 insertions(+), 39 deletions(-) create mode 100644 core-plugin/src/main/groovy/com/github/jrubygradle/api/core/GemRepositoryConfiguration.groovy diff --git a/core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy b/core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy index e606ceae..00a4c66c 100644 --- a/core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy +++ b/core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy @@ -30,6 +30,7 @@ import org.junit.rules.TemporaryFolder import spock.lang.IgnoreIf import spock.lang.Issue import spock.lang.Specification +import spock.lang.Unroll import java.util.regex.Pattern @@ -185,7 +186,7 @@ class IvyXmlProxyServerIntegrationSpec extends Specification { build() then: - findFiles (~/^asciidoctor-pdf.*\.gem$/).size() == 3 + findFiles(~/^asciidoctor-pdf.*\.gem$/).size() == 3 } @Issue('https://github.com/jruby-gradle/jruby-gradle-plugin/issues/380') @@ -243,14 +244,16 @@ class IvyXmlProxyServerIntegrationSpec extends Specification { .build() } - private void withBuildFile(String content) { + private void withBuildFile(String content, boolean prerelease = false) { buildFile.text = """ plugins { id 'com.github.jruby-gradle.core' } repositories { - ruby.gems() + ruby.gems { + prerelease = ${prerelease} + } } configurations { diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/GemRepositoryConfiguration.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/GemRepositoryConfiguration.groovy new file mode 100644 index 00000000..548662bd --- /dev/null +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/GemRepositoryConfiguration.groovy @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2014-2019, R. Tyler Croy , + * Schalk Cronje , Christian Meier, Lookout, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +package com.github.jrubygradle.api.core + +import groovy.transform.CompileStatic + +/** Additional options for configuring a remote GEM repository + * + * @author Schalk W. Cronjé + * + * @since 2.0 + */ +@CompileStatic +class GemRepositoryConfiguration { + + /** Set whether pre-release GEMs should be considered. + * + */ + boolean prerelease = false +} diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyExecSpec.java b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyExecSpec.java index b33a16a0..ee40717a 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyExecSpec.java +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/JRubyExecSpec.java @@ -1,7 +1,7 @@ /** * Copyright (c) 2014-2019, R. Tyler Croy , - * Schalk Cronje , Christian Meier, Lookout, Inc. - *

+ * Schalk Cronje , Christian Meier, Lookout, Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -9,10 +9,10 @@ * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - *

+ * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. - *

+ * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy index 3b3b972e..a24e48d9 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy @@ -31,8 +31,8 @@ import org.gradle.api.Action import org.gradle.api.Project import org.gradle.api.artifacts.repositories.ArtifactRepository import org.gradle.api.artifacts.repositories.IvyArtifactRepository -import org.gradle.api.artifacts.repositories.MavenArtifactRepository import org.gradle.util.GradleVersion +import org.ysb33r.grolifant.api.ClosureUtils /** Extension which can be added to {@code project.repositories}. * @@ -60,7 +60,31 @@ class RepositoryHandlerExtension { * @return Artifact repository. */ ArtifactRepository gems() { - bindRepositoryToProxyServer('https://rubygems.org'.toURI(), DEFAULT_GROUP_NAME) + bindRepositoryToProxyServer( + RUBYGEMS_URI, + DEFAULT_GROUP_NAME, + new GemRepositoryConfiguration() + ) + } + + /** Create an artifact repository which will use {@link https://rubygems.org} and + * associate group {@code rubygems} with it. + * + * @param cfg GEM repository configuration + * @return Artifact repository. + */ + ArtifactRepository gems(@DelegatesTo(GemRepositoryConfiguration) Closure cfg) { + bindRepositoryToProxyServer(RUBYGEMS_URI, DEFAULT_GROUP_NAME, cfg) + } + + /** Create an artifact repository which will use {@link https://rubygems.org} and + * associate group {@code rubygems} with it. + * + * @param cfg GEM repository configuration + * @return Artifact repository. + */ + ArtifactRepository gems(Action cfg) { + bindRepositoryToProxyServer(RUBYGEMS_URI, DEFAULT_GROUP_NAME, cfg) } /** Create an artifact repository which will use specified URI and @@ -72,7 +96,33 @@ class RepositoryHandlerExtension { * @return Artifact repository. */ ArtifactRepository gems(Object uri) { - bindRepositoryToProxyServer(project.uri(uri), DEFAULT_GROUP_NAME) + bindRepositoryToProxyServer(project.uri(uri), DEFAULT_GROUP_NAME, new GemRepositoryConfiguration()) + } + + /** Create an artifact repository which will use specified URI and + * associate group {@code rubygems} with it. + * + * @param uri URI of remote repository that serves up Rubygems. Any object convertible + * with {@code project.uri} can be provided. + * @param cfg GEM repository configuration + * + * @return Artifact repository. + */ + ArtifactRepository gems(Object uri, @DelegatesTo(GemRepositoryConfiguration) Closure cfg) { + bindRepositoryToProxyServer(project.uri(uri), DEFAULT_GROUP_NAME, cfg) + } + + /** Create an artifact repository which will use specified URI and + * associate group {@code rubygems} with it. + * + * @param uri URI of remote repository that serves up Rubygems. Any object convertible + * with {@code project.uri} can be provided. + * @param cfg GEM repository configuration + * + * @return Artifact repository. + */ + ArtifactRepository gems(Object uri, Action cfg) { + bindRepositoryToProxyServer(project.uri(uri), DEFAULT_GROUP_NAME, cfg) } /** Create an artifact repository which will use specified URI and @@ -84,18 +134,65 @@ class RepositoryHandlerExtension { * @return Artifact repository. */ ArtifactRepository gems(String group, Object uri) { - bindRepositoryToProxyServer(project.uri(uri), group) + bindRepositoryToProxyServer(project.uri(uri), group, new GemRepositoryConfiguration()) + } + + /** Create an artifact repository which will use specified URI and + * associate a specified group with it. + * + * @param group Group to associate this server with. + * @param uri URI of remote repository that serves up Rubygems. Any object convertible + * with {@code project.uri} can be provided. + * @param cfg GEM repository configuration + * @return Artifact repository. + */ + ArtifactRepository gems(String group, Object uri, @DelegatesTo(GemRepositoryConfiguration) Closure cfg) { + bindRepositoryToProxyServer(project.uri(uri), group, cfg) + } + + /** Create an artifact repository which will use specified URI and + * associate a specified group with it. + * + * @param group Group to associate this server with. + * @param uri URI of remote repository that serves up Rubygems. Any object convertible + * with {@code project.uri} can be provided. + * @param cfg GEM repository configuration + * @return Artifact repository. + */ + ArtifactRepository gems(String group, Object uri, Action cfg) { + bindRepositoryToProxyServer(project.uri(uri), group, cfg) } private ArtifactRepository bindRepositoryToProxyServer( URI serverUri, - String group + String group, + GemRepositoryConfiguration cfg ) { - IvyXmlProxyServer proxy = ivyProxies.registerProxy(serverUri, group) + IvyXmlProxyServer proxy = ivyProxies.registerProxy(serverUri, group, cfg) project.extensions.getByType(GemResolverStrategy).addGemGroup(group) restrictToGems(createIvyRepo(serverUri, proxy.bindAddress), group) } + private ArtifactRepository bindRepositoryToProxyServer( + URI serverUri, + String group, + @DelegatesTo(GemRepositoryConfiguration) Closure cfg + ) { + GemRepositoryConfiguration grc = new GemRepositoryConfiguration() + ClosureUtils.configureItem(grc, cfg) + bindRepositoryToProxyServer(serverUri, group, grc) + } + + private ArtifactRepository bindRepositoryToProxyServer( + URI serverUri, + String group, + Action cfg + ) { + GemRepositoryConfiguration grc = new GemRepositoryConfiguration() + cfg.execute(grc) + bindRepositoryToProxyServer(serverUri, group, grc) + } + @CompileDynamic private IvyArtifactRepository createIvyRepo(URI server, URI bindAddress) { this.project.repositories.ivy { @@ -122,4 +219,5 @@ class RepositoryHandlerExtension { 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') + private static final URI RUBYGEMS_URI = 'https://rubygems.org'.toURI() } diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RubyGemQueryRestApi.java b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RubyGemQueryRestApi.java index 0ba83bd9..73cf0046 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RubyGemQueryRestApi.java +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RubyGemQueryRestApi.java @@ -33,9 +33,10 @@ * * @since 2.0. * - * @see https://guides.rubygems.org/rubygems-org-api + * @see {@link https://guides.rubygems.org/rubygems-org-api} */ public interface RubyGemQueryRestApi { + /** * Return all published versions for a specific GEM * @@ -45,6 +46,16 @@ public interface RubyGemQueryRestApi { */ List allVersions(String gemName) throws ApiException; + /** + * Return all published versions for a specific GEM + * + * @param gemName Name of GEM. + * @param includePrelease Whether pre-release versions should be included. + * @return List of versions. Can be empty if the GEM does not have any versions. Never {@code null}. + * @throws {@link ApiException} if a networking or parser error occurs. + */ + List allVersions(String gemName, boolean includePrelease) throws ApiException; + /** * Return latest published version of GEM. * @@ -54,6 +65,16 @@ public interface RubyGemQueryRestApi { */ String latestVersion(String gemName) throws ApiException; + /** + * Return latest published version of GEM. + * + * @param gemName Name of GEM. + * @param allowPrerelease Whether a prereleased version can be considered a latest version. + * @return Version of GEM + * @throws {@link ApiException} if GEM does not exist. + */ + String latestVersion(String gemName, boolean allowPrerelease) throws ApiException; + /** Returns the basic metadata for a GEM. * * @param gemName Name of GEM. diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/AbstractIvyXmlProxyServer.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/AbstractIvyXmlProxyServer.groovy index d25746c7..94d9496b 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/AbstractIvyXmlProxyServer.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/AbstractIvyXmlProxyServer.groovy @@ -24,6 +24,7 @@ package com.github.jrubygradle.internal.core import com.github.jrubygradle.api.core.ApiException +import com.github.jrubygradle.api.core.GemRepositoryConfiguration import com.github.jrubygradle.api.core.IvyXmlProxyServer import com.github.jrubygradle.api.core.RubyGemQueryRestApi import com.github.jrubygradle.api.gems.GemInfo @@ -94,12 +95,19 @@ abstract class AbstractIvyXmlProxyServer implements IvyXmlProxyServer { * @param cache Root directory for local Ivy XML cache. * @param serverUri URI of remote Rubygems proxy. * @param group Group that will be associated with the Rubygems proxy. + * @param grc Additional configuration regarding remote GEM server */ - protected AbstractIvyXmlProxyServer(File cache, URI serverUri, String group) { + protected AbstractIvyXmlProxyServer( + File cache, + URI serverUri, + String group, + GemRepositoryConfiguration grc + ) { localCachePath = cache gemToIvy = new GemToIvy(serverUri) api = new DefaultRubyGemRestApi(serverUri) this.group = group + this.configuration = grc } @Synchronized @@ -170,7 +178,7 @@ abstract class AbstractIvyXmlProxyServer implements IvyXmlProxyServer { protected String getDirectoryListing(String grp, String name) throws NotFound { if (inGroups(grp)) { debug "Request to find all versions for ${grp}:${name}" - List versions = api.allVersions(name) + List versions = api.allVersions(name, configuration.prerelease) debug "Got versions ${versions.join(', ')}" revisionsAsHtmlDirectoryListing(versions) } else { @@ -185,7 +193,7 @@ abstract class AbstractIvyXmlProxyServer implements IvyXmlProxyServer { private String getGemQueryRevisionFromIvy(String gemName, String revisionPattern) { GemVersion version = gemVersionFromGradleIvyRequirement(revisionPattern) - version.highOpenEnded ? api.latestVersion(gemName) : version.high + version.highOpenEnded ? api.latestVersion(gemName, configuration.prerelease) : version.high } private void debug(String text) { @@ -203,4 +211,5 @@ abstract class AbstractIvyXmlProxyServer implements IvyXmlProxyServer { private final GemToIvy gemToIvy private final RubyGemQueryRestApi api private final String group + private final GemRepositoryConfiguration configuration } diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/DefaultRubyGemRestApi.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/DefaultRubyGemRestApi.groovy index f1af2eb1..e0ac5817 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/DefaultRubyGemRestApi.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/DefaultRubyGemRestApi.groovy @@ -23,6 +23,7 @@ */ package com.github.jrubygradle.internal.core +import com.github.jrubygradle.api.core.ApiException import com.github.jrubygradle.api.gems.GemInfo import com.github.jrubygradle.api.gems.JarDependency import com.github.jrubygradle.internal.gems.DefaultGemDependency @@ -33,6 +34,7 @@ import groovy.transform.CompileStatic import groovyx.net.http.HttpBuilder import groovyx.net.http.HttpException import okhttp3.OkHttpClient +import org.gradle.util.GradleVersion import static com.github.jrubygradle.internal.gems.GemToIvy.JAVA_PLATFORM import static groovyx.net.http.ContentTypes.JSON @@ -51,7 +53,7 @@ class DefaultRubyGemRestApi implements com.github.jrubygradle.api.core.RubyGemQu /** Creates a client from a URI * - * @param serverUri URI as a String. ONly the scheme plus host + * @param serverUri URI as a String. Only the scheme plus host * parts should be provided. */ DefaultRubyGemRestApi(final String serverUri) { @@ -74,12 +76,25 @@ class DefaultRubyGemRestApi implements com.github.jrubygradle.api.core.RubyGemQu * @throw {@link com.github.jrubygradle.api.core.ApiException} if a networking error occurred. */ @Override - @SuppressWarnings('CatchThrowable') List allVersions(String gemName) { + allVersions(gemName, false) + } + + /** + * Return all published versions for a specific GEM + * + * @param gemName Name of GEM. + * @param includePrelease Whether pre-release versions should be included. + * @return List of versions. Can be empty if the GEM does not have any versions. Never {@code null}. + * @throws {@link ApiException} if a networking or parser error occurs. + */ + @Override + @SuppressWarnings('CatchThrowable') + List allVersions(String gemName, boolean includePrelease) { try { - extractVersions(getData(V1, "versions/${gemName}")) + extractVersions(getData(V1, "versions/${gemName}"), includePrelease) } catch (Throwable e) { - throw new com.github.jrubygradle.api.core.ApiException("Count not retrieve list of versions for ${gemName}", e) + throw new ApiException("Count not retrieve list of versions for ${gemName}", e) } } @@ -90,16 +105,33 @@ class DefaultRubyGemRestApi implements com.github.jrubygradle.api.core.RubyGemQu * @throw {@link com.github.jrubygradle.api.core.ApiException} if a networking error occurred or the GEM does not exist. */ @Override - @SuppressWarnings('CatchThrowable') String latestVersion(String gemName) { + latestVersion(gemName, false) + } + + /** + * Return latest published version of GEM. + * + * @param gemName Name of GEM. + * @param allowPrerelease Whether a prereleased version can be considered a latest version. + * @return Version of GEM + * @throws {@link ApiException} if GEM does not exist. + */ + @Override + @SuppressWarnings('CatchThrowable') + String latestVersion(String gemName, boolean allowPrerelease) { String version try { - version = extractVersion(getData(V1, "versions/${gemName}/latest")) + if (allowPrerelease) { + version = allVersions(gemName, allowPrerelease).collect { GradleVersion.version(it) }.max().toString() + } else { + version = extractVersion(getData(V1, "versions/${gemName}/latest")) + } } catch (Throwable e) { - throw new com.github.jrubygradle.api.core.ApiException("Failed to retrieve latest version of ${gemName}", e) + throw new ApiException("Failed to retrieve latest version of ${gemName}", e) } if (version == 'unknown') { - throw new com.github.jrubygradle.api.core.ApiException("Cound not retrieve latest version of ${gemName}. Maybe it does not exist") + throw new ApiException("Cound not retrieve latest version of ${gemName}. Maybe it does not exist") } version } @@ -117,9 +149,9 @@ class DefaultRubyGemRestApi implements com.github.jrubygradle.api.core.RubyGemQu try { extractMetadata(getData(V2, "rubygems/${gemName}/versions/${gemVersion}")) } catch (HttpException e) { - throw new com.github.jrubygradle.api.core.ApiException(":${gemName}:${gemVersion} not found", e) + throw new ApiException(":${gemName}:${gemVersion} not found", e) } catch (Throwable e) { - throw new com.github.jrubygradle.api.core.ApiException("Could not obtain information for :${gemName}:${gemVersion}.", e) + throw new ApiException("Could not obtain information for :${gemName}:${gemVersion}.", e) } } @@ -148,8 +180,12 @@ class DefaultRubyGemRestApi implements com.github.jrubygradle.api.core.RubyGemQu } @CompileDynamic - private List extractVersions(Object jsonParser) { - jsonParser*.number + private List extractVersions(Object jsonParser, boolean includePrerelease) { + if (includePrerelease) { + jsonParser*.number + } else { + jsonParser.findAll { !it.prerelease }*.number + } } @CompileDynamic diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlGlobalProxyRegistry.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlGlobalProxyRegistry.groovy index 40e05b49..8077d48f 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlGlobalProxyRegistry.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlGlobalProxyRegistry.groovy @@ -23,6 +23,7 @@ */ package com.github.jrubygradle.internal.core +import com.github.jrubygradle.api.core.GemRepositoryConfiguration import groovy.transform.CompileStatic import org.gradle.api.Project @@ -54,8 +55,17 @@ class IvyXmlGlobalProxyRegistry { * @param group Group name for GEMs that will be fected from the remote. * @return Access to a proxy sever. If the server does not exist it will be created. */ - com.github.jrubygradle.api.core.IvyXmlProxyServer registerProxy(URI remoteURI, String group) { - com.github.jrubygradle.api.core.IvyXmlProxyServer proxy = getOrCreateServer(remoteURI, group, new File(rootCacheDir, uriHash(remoteURI))) + com.github.jrubygradle.api.core.IvyXmlProxyServer registerProxy( + URI remoteURI, + String group, + GemRepositoryConfiguration grc + ) { + com.github.jrubygradle.api.core.IvyXmlProxyServer proxy = getOrCreateServer( + remoteURI, + group, + new File(rootCacheDir, uriHash(remoteURI)), + grc + ) proxy.refreshDependencies = refresh proxy } @@ -68,10 +78,11 @@ class IvyXmlGlobalProxyRegistry { static private com.github.jrubygradle.api.core.IvyXmlProxyServer getOrCreateServer( URI uri, String group, - File cacheDir + File cacheDir, + GemRepositoryConfiguration grc ) { SERVER_MAP.computeIfAbsent(uri, { - com.github.jrubygradle.api.core.IvyXmlProxyServer server = createProxyServer(uri, group, cacheDir) + com.github.jrubygradle.api.core.IvyXmlProxyServer server = createProxyServer(uri, group, cacheDir, grc) server.run() server }) @@ -80,9 +91,10 @@ class IvyXmlGlobalProxyRegistry { static private com.github.jrubygradle.api.core.IvyXmlProxyServer createProxyServer( URI uri, String group, - File cacheDir + File cacheDir, + GemRepositoryConfiguration grc ) { - new IvyXmlRatpackProxyServer(cacheDir, uri, group) + new IvyXmlRatpackProxyServer(cacheDir, uri, group, grc) } static private final ConcurrentMap SERVER_MAP = new ConcurrentHashMap<>() diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlRatpackProxyServer.java b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlRatpackProxyServer.java index c4204dbf..150b312f 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlRatpackProxyServer.java +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/internal/core/IvyXmlRatpackProxyServer.java @@ -23,6 +23,7 @@ */ package com.github.jrubygradle.internal.core; +import com.github.jrubygradle.api.core.GemRepositoryConfiguration; import ratpack.server.RatpackServer; import java.io.File; @@ -46,9 +47,15 @@ public class IvyXmlRatpackProxyServer extends AbstractIvyXmlProxyServer { * @param cache Root directory for local Ivy XML cache. * @param serverUri URI of remote Rubygems proxy. * @param group Group that will be associated with the Rubygems proxy. + * @param grc Additional configuration regarding remote GEM server */ - public IvyXmlRatpackProxyServer(File cache, URI serverUri, String group) { - super(cache, serverUri, group); + public IvyXmlRatpackProxyServer( + File cache, + URI serverUri, + String group, + GemRepositoryConfiguration grc + ) { + super(cache, serverUri, group, grc); } /** diff --git a/core-plugin/src/test/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerSpec.groovy b/core-plugin/src/test/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerSpec.groovy index 449ffc1b..9ab04fd8 100644 --- a/core-plugin/src/test/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerSpec.groovy +++ b/core-plugin/src/test/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerSpec.groovy @@ -42,7 +42,12 @@ class IvyXmlProxyServerSpec extends Specification { TemporaryFolder projectRoot void setup() { - server = new IvyXmlRatpackProxyServer(projectRoot.root, 'https://rubygems.org'.toURI(), 'rubygems') + server = new IvyXmlRatpackProxyServer( + projectRoot.root, + 'https://rubygems.org'.toURI(), + 'rubygems', + new GemRepositoryConfiguration() + ) server.run() httpBuilder = OkHttpBuilder.configure { request.uri = server.bindAddress diff --git a/gradle.properties b/gradle.properties index 29bf97a0..f0bbf264 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.0.0-alpha.6 +version=2.0.0-alpha.7 group=com.github.jruby-gradle copyrightYear=2014-2019 From 60829c7ce438ddd87e229adc7960b24c411b4ec3 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Fri, 17 Jan 2020 18:55:48 +0100 Subject: [PATCH 16/21] Support JRuby Maven GEM proxy (#401) --- core-plugin/README.adoc | 25 +++++++++ .../core/RepositoryHandlerExtension.groovy | 52 +++++++++++++++++++ .../RepositoryHandlerExtensionSpec.groovy | 29 +++++++++++ 3 files changed, 106 insertions(+) create mode 100644 core-plugin/src/test/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtensionSpec.groovy diff --git a/core-plugin/README.adoc b/core-plugin/README.adoc index b46e76dd..2169d422 100644 --- a/core-plugin/README.adoc +++ b/core-plugin/README.adoc @@ -13,3 +13,28 @@ This plugin offers the following functionality: === Compatibility This plugin requires link:http://gradle.org[Gradle] 4.3 or better + +=== Installing + +.build.gradle +[source, groovy] +---- +plugins { + id 'com.github.jruby-gradle.core' version 'VERSION-OF-PLUGIN' +} +---- + +=== Adding repositories + +.build.gradle +[source,groovy] +---- +repositories { + ruby.mavengems() // <1> + ruby.mavengems('https://foo.bar') // <2> + ruby.mavengems('https://foo.bar', 'acme-rubygems') // <3> +} +---- +<1> Adds a Maven repository that uses the one official supported by the JRuby group. In order to use this, GEM dependencies should all be placed in the `rubygems` group. +<2> Adds a custom Maven repository that will proxy a GEMs repository. In order to use this, GEM dependencies should all be placed in the `rubygems` group. +<3> Adds a custom Maven repository that will proxy a GEMs repository, but allocate a custom dedicated Maven group. This is useful where you would want to use both the public repository and your own, but you want to save network query traffic, by only query repositories where you know the dependencies should exist. \ No newline at end of file diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy index a24e48d9..8059782e 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtension.groovy @@ -31,6 +31,7 @@ import org.gradle.api.Action import org.gradle.api.Project import org.gradle.api.artifacts.repositories.ArtifactRepository import org.gradle.api.artifacts.repositories.IvyArtifactRepository +import org.gradle.api.artifacts.repositories.MavenArtifactRepository import org.gradle.util.GradleVersion import org.ysb33r.grolifant.api.ClosureUtils @@ -163,6 +164,56 @@ class RepositoryHandlerExtension { bindRepositoryToProxyServer(project.uri(uri), group, cfg) } + /** Adds the Maven-GEMs proxy that is supported by the JRuby group. + * + * For supporting Gradle versions, this repository will only be consulted for artifacts that are in the + * {@code rubygems} group. + * + * @return Maven repository + */ + MavenArtifactRepository mavengems() { + bindToMavenRepository(MAVENGEMS_URI, DEFAULT_GROUP_NAME) + } + + /** Adds a remote Maven-GEMs proxy. + * + * For supporting Gradle versions, this repository will only be consulted for artifacts that are in the + * {@code rubygems} group. + * + * @param uri Remote Maven-GEMs proxy + * @return Maven repository + */ + MavenArtifactRepository mavengems(Object uri) { + bindToMavenRepository(project.uri(uri), DEFAULT_GROUP_NAME) + } + + /** Adds a remote Maven-GEMs proxy anbd allocate a dedicated group for it. + * + * For supporting Gradle versions, this repository will only be consulted for artifacts that are in the + * specified group. + * + * @param group Maven group name + * @param uri Remote Maven-GEMs proxy + * @return Maven repository + */ + MavenArtifactRepository mavengems(String group, Object uri) { + bindToMavenRepository(project.uri(uri), group) + } + + private MavenArtifactRepository bindToMavenRepository( + URI serverUri, + String group + ) { + MavenArtifactRepository repo = project.repositories.maven(new Action() { + @Override + void execute(MavenArtifactRepository mvn) { + mvn.url = serverUri + } + }) + restrictToGems(repo, group) + repo + } + private ArtifactRepository bindRepositoryToProxyServer( URI serverUri, String group, @@ -220,4 +271,5 @@ class RepositoryHandlerExtension { 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') private static final URI RUBYGEMS_URI = 'https://rubygems.org'.toURI() + private static final URI MAVENGEMS_URI = 'https://mavengems.jruby.org'.toURI() } diff --git a/core-plugin/src/test/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtensionSpec.groovy b/core-plugin/src/test/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtensionSpec.groovy new file mode 100644 index 00000000..30cd076b --- /dev/null +++ b/core-plugin/src/test/groovy/com/github/jrubygradle/api/core/RepositoryHandlerExtensionSpec.groovy @@ -0,0 +1,29 @@ +package com.github.jrubygradle.api.core + +import org.gradle.api.Project +import org.gradle.testfixtures.ProjectBuilder +import spock.lang.Specification + + +class RepositoryHandlerExtensionSpec extends Specification { + + Project project = ProjectBuilder.builder().build() + + void 'Add Maven repository'() { + when: + project.allprojects { + apply plugin : JRubyCorePlugin + + repositories { + ruby { + mavengems() + mavengems('https://goo1') + mavengems('goo2','https://goo2') + } + } + } + + then: + project.repositories.size() == 3 + } +} \ No newline at end of file From 6e1be93181c0c82f370570a88f586b7b4651f315 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Fri, 17 Jan 2020 19:19:04 +0100 Subject: [PATCH 17/21] Describe repositories and GEM resolver strategy customisation (#378) --- core-plugin/README.adoc | 36 +++++++++++++++++-- .../api/gems/GemResolverStrategy.groovy | 2 +- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/core-plugin/README.adoc b/core-plugin/README.adoc index 2169d422..eb16eeb3 100644 --- a/core-plugin/README.adoc +++ b/core-plugin/README.adoc @@ -32,9 +32,41 @@ plugins { repositories { ruby.mavengems() // <1> ruby.mavengems('https://foo.bar') // <2> - ruby.mavengems('https://foo.bar', 'acme-rubygems') // <3> + ruby.mavengems('acme-rubygems', 'https://foo.bar') // <3> + + ruby.gems() // <4> + ruby.gems { // <5> + prerelease = true + } + ruby.gems('https://foo.bar') // <6> + ruby.gems('acme-rubygems', 'https://foo.bar') // <7> } ---- <1> Adds a Maven repository that uses the one official supported by the JRuby group. In order to use this, GEM dependencies should all be placed in the `rubygems` group. <2> Adds a custom Maven repository that will proxy a GEMs repository. In order to use this, GEM dependencies should all be placed in the `rubygems` group. -<3> Adds a custom Maven repository that will proxy a GEMs repository, but allocate a custom dedicated Maven group. This is useful where you would want to use both the public repository and your own, but you want to save network query traffic, by only query repositories where you know the dependencies should exist. \ No newline at end of file +<3> Adds a custom Maven repository that will proxy a GEMs repository, but allocate a custom dedicated Maven group. This is useful where you would want to use both the public repository and your own, but you want to save network query traffic, by only query repositories where you know the dependencies should exist. +<4> Proxy rubygems.org directly and use `rubygems` as the Maven coordinate group. +<5> Proxy rubygems.org directly and allow prerelease GEMs to be considered. Use `rubygems` as the Maven coordinate group. +<6> Proxy a custom rubygems repository. +<7> Proxy a custom rubygems repository and assign a custom Maven coordinate group. + +== Advanced + +=== Customising GEM resolving + +By default the `rubygems` configuration and others added via `ruby.mavengems()` and `ruby.gems()` will have additional resolving strategies applied that mimicks GEM behaviour rather then Gradle behaviour. It is possible to customise this behaviour. + +.build.gradle +[source,groovy] +---- +gemResolverStrategy { + excludeConfigurations 'foo', 'bar' // <1> + excludeModule 'foo.*' // <2> + excludeModule 'foo.*', /1\.2.*/ // <3> + useGemVersionResolver 'gems2' +} +---- +<1> Exclude configurations `foo` and `bar` from being considered for GEM resolver strategies. +<2> Exclude module that matches regular expression from GEM resolver strategies. +<3> Exclude module and version that matches regular expression from GEM resolver strategies. +<4> Apply GEM resolver strategies to a specific configuration. \ No newline at end of file diff --git a/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemResolverStrategy.groovy b/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemResolverStrategy.groovy index bfb990b3..8d44112f 100644 --- a/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemResolverStrategy.groovy +++ b/core-plugin/src/main/groovy/com/github/jrubygradle/api/gems/GemResolverStrategy.groovy @@ -102,7 +102,7 @@ class GemResolverStrategy { /** Whether the GEM version resolving strategy should be applied for a specific module. * - * In most cases this will alsways be {@code true} unless a specific rule excludes it. + * In most cases this will always be {@code true} unless a specific rule excludes it. * * @param mvs Module version selector * @return Whether the Bundler-like version selector atregty may be applied From 593f096279a6eee815a2487a4e0f1a9f54a0ebb2 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Fri, 17 Jan 2020 19:23:26 +0100 Subject: [PATCH 18/21] Set version to 2.0.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index f0bbf264..1f4757c0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=2.0.0-alpha.7 +version=2.0.0 group=com.github.jruby-gradle copyrightYear=2014-2019 From d764de4e8e0083a8a7f8c68d5c3a663a3c3e5554 Mon Sep 17 00:00:00 2001 From: Schalk Cronje Date: Fri, 17 Jan 2020 19:23:57 +0100 Subject: [PATCH 19/21] Update license headers --- .../JRubyExecExtensionIntegrationSpec.groovy | 2 +- .../JRubyExecIntegrationSpec.groovy | 2 +- ...RubyGenerateGradleRbIntegrationSpec.groovy | 2 +- .../JRubyPrepareGemsIntegrationSpec.groovy | 2 +- .../JRubyPrepareJarsIntegrationSpec.groovy | 2 +- .../IntegrationSpecification.groovy | 2 +- .../testhelper/VersionFinder.groovy | 2 +- .../src/integTest/resources/logback-test.xml | 2 +- .../integTest/resources/scripts/envVars.rb | 2 +- .../integTest/resources/scripts/helloName.rb | 2 +- .../integTest/resources/scripts/helloWorld.rb | 2 +- .../resources/scripts/require-a-gem.rb | 2 +- .../resources/scripts/requiresGem.rb | 2 +- .../jrubygradle/GenerateGradleRb.groovy | 2 +- .../com/github/jrubygradle/JRubyExec.groovy | 2 +- .../com/github/jrubygradle/JRubyPlugin.groovy | 2 +- .../jrubygradle/JRubyPluginExtension.groovy | 2 +- .../github/jrubygradle/JRubyPrepare.groovy | 2 +- .../UninitialisedParameterException.groovy | 2 +- .../internal/JRubyExecDelegate.groovy | 2 +- .../internal/JRubyExecUtils.groovy | 2 +- .../internal/JRubyPrepareUtils.groovy | 2 +- .../com.github.jruby-gradle.base.properties | 2 +- .../jrubygradle/JRubyExecTaskSpec.groovy | 2 +- .../JRubyPluginExtensionSpec.groovy | 2 +- .../github/jrubygradle/JRubyPluginSpec.groovy | 2 +- .../internal/JRubyExecUtilsSpec.groovy | 2 +- base-plugin/src/test/resources/helloWorld.rb | 2 +- .../src/test/resources/logback-test.xml | 2 +- .../IvyXmlProxyServerIntegrationSpec.groovy | 2 +- .../api/core/AbstractJRubyPrepare.groovy | 2 +- .../jrubygradle/api/core/ApiException.groovy | 2 +- .../core/GemRepositoryConfiguration.groovy | 2 +- .../api/core/IvyXmlProxyServer.java | 2 +- .../jrubygradle/api/core/JRubyAwareTask.java | 2 +- .../api/core/JRubyCorePlugin.groovy | 2 +- .../jrubygradle/api/core/JRubyExecSpec.java | 2 +- .../core/RepositoryHandlerExtension.groovy | 2 +- .../api/core/RubyGemQueryRestApi.java | 2 +- .../jrubygradle/api/gems/GemDependency.java | 2 +- .../jrubygradle/api/gems/GemGroups.groovy | 2 +- .../github/jrubygradle/api/gems/GemInfo.java | 2 +- .../api/gems/GemInstallException.groovy | 2 +- .../api/gems/GemOverwriteAction.groovy | 2 +- .../api/gems/GemResolverStrategy.groovy | 2 +- .../jrubygradle/api/gems/GemUtils.groovy | 2 +- .../jrubygradle/api/gems/GemVersion.groovy | 2 +- .../api/gems/GemVersionException.groovy | 2 +- .../jrubygradle/api/gems/JarDependency.java | 2 +- .../core/AbstractIvyXmlProxyServer.groovy | 2 +- .../core/DefaultRubyGemRestApi.groovy | 2 +- .../jrubygradle/internal/core/IvyUtils.groovy | 2 +- .../core/IvyXmlGlobalProxyRegistry.groovy | 2 +- .../core/IvyXmlRatpackProxyServer.java | 2 +- .../internal/core/PluginMetadata.groovy | 2 +- .../internal/core/Transform.groovy | 2 +- .../internal/gems/DefaultGemDependency.groovy | 2 +- .../internal/gems/DefaultGemInfo.groovy | 2 +- .../internal/gems/DefaultJarDependency.groovy | 2 +- .../jrubygradle/internal/gems/GemToIvy.groovy | 2 +- .../internal/gems/GemVersionResolver.groovy | 2 +- .../com.github.jruby-gradle.core.properties | 2 +- ...jrubygradle.core-plugin.version.properties | 2 +- .../api/core/IvyXmlProxyServerSpec.groovy | 2 +- .../RepositoryHandlerExtensionSpec.groovy | 23 +++++++++++++++++++ .../api/core/RubyGemQueryRestApiSpec.groovy | 2 +- .../jrubygradle/api/gems/GemUtilsSpec.groovy | 2 +- .../api/gems/GemVersionSpec.groovy | 2 +- .../internal/gems/GemToIvySpec.groovy | 2 +- gradle.properties | 2 +- .../jar/JRubyJarIntegrationSpec.groovy | 2 +- .../jar/JRubyJarTestKitSpec.groovy | 2 +- .../helpers/IntegrationSpecification.groovy | 2 +- .../github/jrubygradle/jar/JRubyJar.groovy | 2 +- .../jrubygradle/jar/JRubyJarPlugin.groovy | 2 +- .../jar/internal/JRubyDirInfo.groovy | 2 +- .../internal/JRubyDirInfoTransformer.groovy | 2 +- .../jar/internal/JRubyJarCopyAction.groovy | 2 +- .../com.github.jruby-gradle.jar.properties | 2 +- .../jrubygradle/jar/JRubyJarPluginSpec.groovy | 2 +- .../jrubygradle/jar/JRubyJarSpec.groovy | 2 +- .../src/test/resources/logback-test.xml | 2 +- .../github/jrubygradle/war/JRubyWar.groovy | 2 +- .../jrubygradle/war/JRubyWarPlugin.groovy | 2 +- .../com.github.jruby-gradle.war.properties | 2 +- .../jrubygradle/war/JRubyWarPluginSpec.groovy | 2 +- .../jrubygradle/war/JRubyWarSpec.groovy | 2 +- 87 files changed, 109 insertions(+), 86 deletions(-) diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy index db6382cb..964679a9 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, R. Tyler Croy , + * Copyright (c) 2014-2020, R. Tyler Croy , * Schalk Cronje , Christian Meier, Lookout, Inc. * * Permission is hereby granted, free of charge, to any person obtaining diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy index 50020bbd..ec3e07d8 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, R. Tyler Croy , + * Copyright (c) 2014-2020, R. Tyler Croy , * Schalk Cronje , Christian Meier, Lookout, Inc. * * Permission is hereby granted, free of charge, to any person obtaining diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy index 550cb9bb..4c0e2de6 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, R. Tyler Croy , + * Copyright (c) 2014-2020, R. Tyler Croy , * Schalk Cronje , Christian Meier, Lookout, Inc. * * Permission is hereby granted, free of charge, to any person obtaining diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy index 87218748..ca6c9164 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, R. Tyler Croy , + * Copyright (c) 2014-2020, R. Tyler Croy , * Schalk Cronje , Christian Meier, Lookout, Inc. * * Permission is hereby granted, free of charge, to any person obtaining diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy index 0475c9bc..86dcee48 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareJarsIntegrationSpec.groovy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, R. Tyler Croy , + * Copyright (c) 2014-2020, R. Tyler Croy , * Schalk Cronje , Christian Meier, Lookout, Inc. * * Permission is hereby granted, free of charge, to any person obtaining diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy index ede06d76..79e14a6d 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, R. Tyler Croy , + * Copyright (c) 2014-2020, R. Tyler Croy , * Schalk Cronje , Christian Meier, Lookout, Inc. * * Permission is hereby granted, free of charge, to any person obtaining diff --git a/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/VersionFinder.groovy b/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/VersionFinder.groovy index ecc9dcb8..7b79ea76 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/VersionFinder.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/VersionFinder.groovy @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2019, R. Tyler Croy , + * Copyright (c) 2014-2020, R. Tyler Croy , * Schalk Cronje , Christian Meier, Lookout, Inc. * * Permission is hereby granted, free of charge, to any person obtaining diff --git a/base-plugin/src/integTest/resources/logback-test.xml b/base-plugin/src/integTest/resources/logback-test.xml index 945e5c98..f8d45322 100644 --- a/base-plugin/src/integTest/resources/logback-test.xml +++ b/base-plugin/src/integTest/resources/logback-test.xml @@ -1,6 +1,6 @@