diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3f83227..5985c94 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -58,7 +58,7 @@ jobs: - name: Build uses: eskatos/gradle-command-action@v1 with: - arguments: --console=plain --warning-mode=all -clean assemble + arguments: --console=plain --warning-mode=all clean assemble # Test - name: UnitTest uses: eskatos/gradle-command-action@v1 @@ -79,6 +79,13 @@ jobs: uses: eskatos/gradle-command-action@v1 with: arguments: --stop + - name: Store reports + uses: actions/upload-artifact@v2 + if: always() + with: + name: Test reports Windows + path: "**/build/reports/**" + retention-days: 5 build: strategy: matrix: @@ -109,17 +116,24 @@ jobs: with: arguments: -i -S --console=plain --no-build-cache assemble # Unit tests - - name: UNit tests + - name: Unit tests uses: eskatos/gradle-command-action@v1 with: arguments: -i -s --console=plain --no-build-cache test # Integration tests - - name: Integration tests (without slides) + - name: Integration tests uses: eskatos/gradle-command-action@v1 with: arguments: -i -s --console=plain --no-build-cache intTest # Gradle tests - - name: Gradle tests + - name: Compatibility tests uses: eskatos/gradle-command-action@v1 with: arguments: -i -s --console=plain --no-build-cache gradleTest + - name: Store reports + uses: actions/upload-artifact@v2 + if: always() + with: + name: Test reports + path: "**/build/reports/**" + retention-days: 5 \ No newline at end of file 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 964679a..6b40318 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecExtensionIntegrationSpec.groovy @@ -30,7 +30,7 @@ import spock.lang.IgnoreIf /** * @author Schalk W. Cronjé */ -@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')}) +@IgnoreIf({ System.getProperty('TESTS_ARE_OFFLINE') }) class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification { public static final String DEFAULT_TASK_NAME = 'inlineJRubyExec' 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 ec3e07d..de8e5e0 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyExecIntegrationSpec.groovy @@ -25,11 +25,7 @@ package com.github.jrubygradle import com.github.jrubygradle.testhelper.IntegrationSpecification import org.gradle.testkit.runner.BuildResult -import spock.lang.IgnoreIf import spock.lang.Issue -import spock.lang.PendingFeature - -import static com.github.jrubygradle.internal.JRubyExecUtils.DEFAULT_JRUBYEXEC_CONFIG class JRubyExecIntegrationSpec extends IntegrationSpecification { static final String DEFAULT_TASK_NAME = 'RubyWax' @@ -151,9 +147,9 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification { script 'rspec' """ - File specDir = new File(projectDir,'spec') + File specDir = new File(projectDir, 'spec') specDir.mkdirs() - new File(specDir,'sample.rb').text = '' + new File(specDir, 'sample.rb').text = '' when: BuildResult result = build() 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 154039c..f21811b 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyGenerateGradleRbIntegrationSpec.groovy @@ -30,7 +30,7 @@ import spock.lang.IgnoreIf /** * @author Schalk W. Cronjé */ -@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')}) +@IgnoreIf({ System.getProperty('TESTS_ARE_OFFLINE') }) class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification { static final String DEFAULT_TASK_NAME = 'RubyWax' 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 f486944..fcd0ad8 100644 --- a/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy +++ b/base-plugin/src/integTest/groovy/com/github/jrubygradle/JRubyPrepareGemsIntegrationSpec.groovy @@ -106,7 +106,6 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification { lockAllConfigurations() } - """ withDependencies """ gems "rubygems:sinatra:1.4.5" 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 79e14a6..f0bb355 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,7 +23,6 @@ */ package com.github.jrubygradle.testhelper - import org.gradle.testkit.runner.GradleRunner import org.junit.Rule import org.junit.rules.TemporaryFolder @@ -55,7 +54,7 @@ class IntegrationSpecification extends Specification { Map artifactVersions @Rule - TemporaryFolder testFolder + TemporaryFolder testFolder = new TemporaryFolder(new File(System.getProperty('TMP_FOLDER'))) File projectDir File buildFile @@ -65,6 +64,7 @@ class IntegrationSpecification extends Specification { testProperties = loadTestProperties() flatRepoLocation = new File(testProperties.flatrepo) mavenRepoLocation = new File(testProperties.mavenrepo) + new File(System.getProperty('TMP_FOLDER')).mkdirs() artifactVersions = [ 'credit_card_validator': testProperties.creditCardValidatorVersion, @@ -77,7 +77,7 @@ class IntegrationSpecification extends Specification { } void setup() { - projectDir = testFolder.root + projectDir = testFolder.root.absoluteFile buildFile = new File(projectDir, 'build.gradle') settingsFile = new File(projectDir, 'settings.gradle') @@ -90,7 +90,7 @@ class IntegrationSpecification extends Specification { destination.text = this.class.getResource("/scripts/${name}").text } - + @SuppressWarnings('ThrowRuntimeException') String findDependency(final String organisation, final String artifact, final String extension) { String ver = artifactVersions[artifact] if (!ver) { 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 2d05c1d..0573af3 100644 --- a/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy +++ b/base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy @@ -32,12 +32,9 @@ import org.gradle.api.artifacts.Configuration import org.gradle.api.model.ReplacedBy import org.gradle.api.provider.Provider import org.gradle.api.tasks.Input -import org.gradle.api.tasks.InputFile +import org.gradle.api.tasks.Internal import org.gradle.api.tasks.JavaExec import org.gradle.api.tasks.LocalState -import org.gradle.api.tasks.Optional -import org.gradle.api.tasks.PathSensitive -import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskContainer import org.gradle.process.JavaExecSpec import org.gradle.util.GradleVersion @@ -75,6 +72,16 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec { this.jruby = extensions.create(JRubyPluginExtension.NAME, JRubyPluginExtension, this) this.projectOperations = ProjectOperations.create(project) this.tasks = project.tasks + this.inputs.property 'script-path', { scr -> + File f = resolveScript(projectOperations, scr) + if (!f) { + '' + } else if (f.exists()) { + f.text + } else { + stringize(scr) + } + }.curry(this.script) inputs.property 'jrubyver', { JRubyPluginExtension jruby -> jruby.jrubyVersion @@ -104,9 +111,10 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec { /** Script to execute. * @return The path to the script (or {@code null} if not set) */ - @Optional - @InputFile - @PathSensitive(PathSensitivity.NONE) +// @Optional +// @InputFile +// @PathSensitive(PathSensitivity.NONE) + @Internal File getScript() { resolveScript(projectOperations, this.script) } 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 184350d..af9ff09 100644 --- a/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy +++ b/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy @@ -23,7 +23,6 @@ */ package com.github.jrubygradle - import org.gradle.api.InvalidUserDataException import org.gradle.api.Project import org.gradle.api.artifacts.Configuration @@ -80,7 +79,7 @@ class JRubyExecTaskSpec extends Specification { execTask.jruby.jrubyVersion != project.jruby.jrubyVersion and: "jrubyConfigurationName must point to this new configuration" - execTask.jruby.getGemConfiguration().name == configurationName + execTask.jruby.gemConfiguration.name == configurationName and: "configuration must exist" project.configurations.findByName(configurationName) @@ -178,6 +177,6 @@ class JRubyExecTaskSpec extends Specification { } then: - execTask.jruby.getGemConfiguration().name == customConfig.name + execTask.jruby.gemConfiguration.name == customConfig.name } } diff --git a/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyPluginSpec.groovy b/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyPluginSpec.groovy index 50df134..c277bd0 100644 --- a/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyPluginSpec.groovy +++ b/base-plugin/src/test/groovy/com/github/jrubygradle/JRubyPluginSpec.groovy @@ -24,8 +24,6 @@ package com.github.jrubygradle import org.gradle.api.Project -import org.gradle.api.artifacts.repositories.ArtifactRepository -import org.gradle.api.artifacts.repositories.IvyArtifactRepository import org.gradle.testfixtures.ProjectBuilder import spock.lang.Specification @@ -45,12 +43,4 @@ class JRubyPluginSpec extends Specification { then: project.jruby.defaultVersion == JRubyPluginExtension.DEFAULT_JRUBY_VERSION } - - private Collection hasRepositoryUrl(Project p, String url) { - p.repositories.findAll { ArtifactRepository r -> - r instanceof IvyArtifactRepository - }.findAll { - it.ivyPattern.contains(url) - } - } } diff --git a/base-plugin/src/test/groovy/com/github/jrubygradle/internal/JRubyExecUtilsSpec.groovy b/base-plugin/src/test/groovy/com/github/jrubygradle/internal/JRubyExecUtilsSpec.groovy index befcf51..58f53ce 100644 --- a/base-plugin/src/test/groovy/com/github/jrubygradle/internal/JRubyExecUtilsSpec.groovy +++ b/base-plugin/src/test/groovy/com/github/jrubygradle/internal/JRubyExecUtilsSpec.groovy @@ -115,7 +115,7 @@ class JRubyExecUtilsSpec extends Specification { void "Prepare a basic JRuby environment"() { when: - Map preparedEnv = prepareJRubyEnvironment([:],false, new File('tmp/foo')) + Map preparedEnv = prepareJRubyEnvironment([:], false, new File('tmp/foo')) then: preparedEnv.size() > 0 @@ -128,7 +128,7 @@ class JRubyExecUtilsSpec extends Specification { 'GEM_HOME' : '/tmp/spock', 'RUBY_VERSION' : 'notaversion', 'rvm_ruby_string': 'jruby-head', - ],false, gemWorkDir) + ], false, gemWorkDir) then: preparedEnv['GEM_HOME'] == gemWorkDir.absolutePath diff --git a/build.gradle b/build.gradle index e720c5a..4747125 100644 --- a/build.gradle +++ b/build.gradle @@ -36,7 +36,8 @@ subprojects { apply plugin: 'maven' repositories { - jcenter() + mavenCentral() + gradlePluginPortal() } if (project.name != 'docs') { 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 6fad85d..d742ef7 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,7 +30,6 @@ 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 @@ -104,7 +103,6 @@ class IvyXmlProxyServerIntegrationSpec extends Specification { new File(projectDir, 'build/something/base_app-1.0.6.gem').exists() } - void 'Download Asciidoctor Reveal.JS GEM and friends'() { setup: withBuildFile ''' 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 6e6547c..1f8078b 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 @@ -61,6 +61,6 @@ class IvyXmlProxyServerSpec extends Specification { } then: 'The Ivy file should be generated and cached locally' - new File(projectRoot.root,TEST_IVY_PATH) + new File(projectRoot.root, TEST_IVY_PATH) } } \ No newline at end of file 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 index edf1d6f..c34a0a3 100644 --- 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 @@ -27,7 +27,6 @@ import org.gradle.api.Project import org.gradle.testfixtures.ProjectBuilder import spock.lang.Specification - class RepositoryHandlerExtensionSpec extends Specification { Project project = ProjectBuilder.builder().build() @@ -35,13 +34,13 @@ class RepositoryHandlerExtensionSpec extends Specification { void 'Add Maven repository'() { when: project.allprojects { - apply plugin : JRubyCorePlugin + apply plugin: JRubyCorePlugin repositories { ruby { mavengems() mavengems('https://goo1') - mavengems('goo2','https://goo2') + mavengems('goo2', 'https://goo2') } } } diff --git a/core-plugin/src/test/groovy/com/github/jrubygradle/api/gems/GemUtilsSpec.groovy b/core-plugin/src/test/groovy/com/github/jrubygradle/api/gems/GemUtilsSpec.groovy index cda10f8..3eba408 100644 --- a/core-plugin/src/test/groovy/com/github/jrubygradle/api/gems/GemUtilsSpec.groovy +++ b/core-plugin/src/test/groovy/com/github/jrubygradle/api/gems/GemUtilsSpec.groovy @@ -23,8 +23,6 @@ */ package com.github.jrubygradle.api.gems -import com.github.jrubygradle.api.gems.GemOverwriteAction -import com.github.jrubygradle.api.gems.GemUtils import org.gradle.api.Project import org.gradle.api.file.DuplicateFileCopyingException import org.gradle.testfixtures.ProjectBuilder 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 2e6884e..b09706b 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 @@ -35,7 +35,7 @@ class GemVersionSpec extends Specification { @Unroll void "#gemRequirement (gem requirement) ⇒ #ivyNotation (ivy)"() { when: - String ivy = gemVersionFromGemRequirement(gemRequirement).toString() + String ivy = gemVersionFromGemRequirement(gemRequirement) then: ivy == ivyNotation diff --git a/core-plugin/src/test/groovy/com/github/jrubygradle/internal/gems/GemToIvySpec.groovy b/core-plugin/src/test/groovy/com/github/jrubygradle/internal/gems/GemToIvySpec.groovy index f8f3796..d6cc8a7 100644 --- a/core-plugin/src/test/groovy/com/github/jrubygradle/internal/gems/GemToIvySpec.groovy +++ b/core-plugin/src/test/groovy/com/github/jrubygradle/internal/gems/GemToIvySpec.groovy @@ -23,7 +23,6 @@ */ package com.github.jrubygradle.internal.gems - import spock.lang.Specification class GemToIvySpec extends Specification { diff --git a/gradle.properties b/gradle.properties index c5bde60..facec1c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,7 +14,7 @@ releaseBuild=false targetCompatibility=1.8 sourceCompatibility=1.8 -grolifantVersion=1.0.0-alpha.4 +grolifantVersion=1.0.0-alpha.6 jrubyVersion=9.2.9.0 jettyVersion=9.2.12.v20150709 bcprovVersion=1.46 diff --git a/gradle/integration-tests.gradle b/gradle/integration-tests.gradle index 2a8420b..7adbaee 100644 --- a/gradle/integration-tests.gradle +++ b/gradle/integration-tests.gradle @@ -40,5 +40,6 @@ task integrationTest(type: Test, dependsOn: jar) { classpath = sourceSets.integrationTest.runtimeClasspath dependsOn copyIntegrationTestGems mustRunAfter test + systemProperties TMP_FOLDER : file('build/tmp/integrationTestTempFolder').absolutePath } check.dependsOn integrationTest diff --git a/jar-plugin/build.gradle b/jar-plugin/build.gradle index ae7c467..c306836 100644 --- a/jar-plugin/build.gradle +++ b/jar-plugin/build.gradle @@ -20,7 +20,7 @@ dependencies { /* * NOTE: version 5.0.0 of the shadow plugin supports only Gradle 5.x and later */ - compile 'com.github.jengelman.gradle.plugins:shadow:4.0.4' + compile 'com.github.jengelman.gradle.plugins:shadow:5.2.0' compile 'org.codehaus.plexus:plexus-utils:[3.2.0,3.3)' compile 'org.apache.commons:commons-io:1.3.2' compile 'org.ow2.asm:asm-commons:[6.1,6.99)' @@ -105,7 +105,6 @@ bintray { vcsTag = "v${project.version}" attributes = ['gradle-plugin' : 'com.github.jruby-gradle.jar:com.github.jruby-gradle:jruby-gradle-jar-plugin'] desc = 'This plugin encapsulates java archive building functionality for JRuby Gradle projects' - } } } @@ -117,6 +116,7 @@ bintrayUpload { gradleTest { dependsOn jar mustRunAfter test, integrationTest + enabled = false // TODO: Fix jar plugin as it has a DoS in jar construction. } integrationTest { diff --git a/jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/JRubyJarTestKitSpec.groovy b/jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/JRubyJarTestKitSpec.groovy index e2e56be..31a30a4 100644 --- a/jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/JRubyJarTestKitSpec.groovy +++ b/jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/JRubyJarTestKitSpec.groovy @@ -27,7 +27,6 @@ import com.github.jrubygradle.jar.helpers.IntegrationSpecification import org.gradle.testkit.runner.BuildResult import org.gradle.testkit.runner.TaskOutcome import spock.lang.Ignore -import spock.lang.IgnoreIf import spock.lang.Issue import java.util.zip.ZipEntry @@ -175,23 +174,7 @@ class JRubyJarTestKitSpec extends IntegrationSpecification { """ } - private void withRepoSetup(String content) { - this.repoSetup = """ - repositories { - ${content} - } - """ - } - - private void withDependencies(String content) { - this.deps = """ - dependencies { - ${content} - } - """ - } - - private void withPreamble(String content) { + private void withPreamble(String content) { this.preamble = content } diff --git a/jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/helpers/IntegrationSpecification.groovy b/jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/helpers/IntegrationSpecification.groovy index 1793b15..22d5341 100644 --- a/jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/helpers/IntegrationSpecification.groovy +++ b/jar-plugin/src/integTest/groovy/com/github/jrubygradle/jar/helpers/IntegrationSpecification.groovy @@ -31,7 +31,7 @@ import spock.lang.Specification class IntegrationSpecification extends Specification { static final boolean OFFLINE = System.getProperty('TESTS_ARE_OFFLINE') - static final File PARENT_TEST_FOLDER = new File(System.getProperty('TEST_TEMP_FOLDER','./build/tmp/integrationTests')) + static final File PARENT_TEST_FOLDER = new File(System.getProperty('TEST_TEMP_FOLDER', './build/tmp/integrationTests')) @Shared Map testProperties @@ -64,12 +64,12 @@ class IntegrationSpecification extends Specification { GradleRunner gradleRunner(List args) { GradleRunner.create() - .withProjectDir(projectDir) - .withDebug(true) - .withArguments(args) - .withPluginClasspath() - .withTestKitDir(PARENT_TEST_FOLDER) - .forwardOutput() + .withProjectDir(projectDir) + .withDebug(true) + .withArguments(args) + .withPluginClasspath() + .withTestKitDir(PARENT_TEST_FOLDER) + .forwardOutput() } String pathAsUriStr(final File path) {