Skip to content

Commit 218b747

Browse files
authored
Merge pull request #424 from ysb33r/fix-codenarc
Adjust license to include 2021
2 parents 2304bd4 + 08751e9 commit 218b747

File tree

22 files changed

+63
-78
lines changed

22 files changed

+63
-78
lines changed

.github/workflows/build.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
- name: Build
5959
uses: eskatos/gradle-command-action@v1
6060
with:
61-
arguments: --console=plain --warning-mode=all -clean assemble
61+
arguments: --console=plain --warning-mode=all clean assemble
6262
# Test
6363
- name: UnitTest
6464
uses: eskatos/gradle-command-action@v1
@@ -79,6 +79,13 @@ jobs:
7979
uses: eskatos/gradle-command-action@v1
8080
with:
8181
arguments: --stop
82+
- name: Store reports
83+
uses: actions/upload-artifact@v2
84+
if: always()
85+
with:
86+
name: Test reports Windows
87+
path: "**/build/reports/**"
88+
retention-days: 5
8289
build:
8390
strategy:
8491
matrix:
@@ -109,17 +116,24 @@ jobs:
109116
with:
110117
arguments: -i -S --console=plain --no-build-cache assemble
111118
# Unit tests
112-
- name: UNit tests
119+
- name: Unit tests
113120
uses: eskatos/gradle-command-action@v1
114121
with:
115122
arguments: -i -s --console=plain --no-build-cache test
116123
# Integration tests
117-
- name: Integration tests (without slides)
124+
- name: Integration tests
118125
uses: eskatos/gradle-command-action@v1
119126
with:
120127
arguments: -i -s --console=plain --no-build-cache intTest
121128
# Gradle tests
122-
- name: Gradle tests
129+
- name: Compatibility tests
123130
uses: eskatos/gradle-command-action@v1
124131
with:
125132
arguments: -i -s --console=plain --no-build-cache gradleTest
133+
- name: Store reports
134+
uses: actions/upload-artifact@v2
135+
if: always()
136+
with:
137+
name: Test reports
138+
path: "**/build/reports/**"
139+
retention-days: 5

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import spock.lang.IgnoreIf
3030
/**
3131
* @author Schalk W. Cronjé
3232
*/
33-
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
33+
@IgnoreIf({ System.getProperty('TESTS_ARE_OFFLINE') })
3434
class JRubyExecExtensionIntegrationSpec extends IntegrationSpecification {
3535

3636
public static final String DEFAULT_TASK_NAME = 'inlineJRubyExec'

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ package com.github.jrubygradle
2525

2626
import com.github.jrubygradle.testhelper.IntegrationSpecification
2727
import org.gradle.testkit.runner.BuildResult
28-
import spock.lang.IgnoreIf
2928
import spock.lang.Issue
30-
import spock.lang.PendingFeature
31-
32-
import static com.github.jrubygradle.internal.JRubyExecUtils.DEFAULT_JRUBYEXEC_CONFIG
3329

3430
class JRubyExecIntegrationSpec extends IntegrationSpecification {
3531
static final String DEFAULT_TASK_NAME = 'RubyWax'
@@ -151,9 +147,9 @@ class JRubyExecIntegrationSpec extends IntegrationSpecification {
151147
script 'rspec'
152148
"""
153149

154-
File specDir = new File(projectDir,'spec')
150+
File specDir = new File(projectDir, 'spec')
155151
specDir.mkdirs()
156-
new File(specDir,'sample.rb').text = ''
152+
new File(specDir, 'sample.rb').text = ''
157153

158154
when:
159155
BuildResult result = build()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import spock.lang.IgnoreIf
3030
/**
3131
* @author Schalk W. Cronjé
3232
*/
33-
@IgnoreIf({System.getProperty('TESTS_ARE_OFFLINE')})
33+
@IgnoreIf({ System.getProperty('TESTS_ARE_OFFLINE') })
3434
class JRubyGenerateGradleRbIntegrationSpec extends IntegrationSpecification {
3535

3636
static final String DEFAULT_TASK_NAME = 'RubyWax'

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ class JRubyPrepareGemsIntegrationSpec extends IntegrationSpecification {
106106
lockAllConfigurations()
107107
}
108108
109-
110109
"""
111110
withDependencies """
112111
gems "rubygems:sinatra:1.4.5"

base-plugin/src/integTest/groovy/com/github/jrubygradle/testhelper/IntegrationSpecification.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
package com.github.jrubygradle.testhelper
2525

26-
2726
import org.gradle.testkit.runner.GradleRunner
2827
import org.junit.Rule
2928
import org.junit.rules.TemporaryFolder
@@ -55,7 +54,7 @@ class IntegrationSpecification extends Specification {
5554
Map artifactVersions
5655

5756
@Rule
58-
TemporaryFolder testFolder
57+
TemporaryFolder testFolder = new TemporaryFolder(new File(System.getProperty('TMP_FOLDER')))
5958

6059
File projectDir
6160
File buildFile
@@ -65,6 +64,7 @@ class IntegrationSpecification extends Specification {
6564
testProperties = loadTestProperties()
6665
flatRepoLocation = new File(testProperties.flatrepo)
6766
mavenRepoLocation = new File(testProperties.mavenrepo)
67+
new File(System.getProperty('TMP_FOLDER')).mkdirs()
6868

6969
artifactVersions = [
7070
'credit_card_validator': testProperties.creditCardValidatorVersion,
@@ -77,7 +77,7 @@ class IntegrationSpecification extends Specification {
7777
}
7878

7979
void setup() {
80-
projectDir = testFolder.root
80+
projectDir = testFolder.root.absoluteFile
8181
buildFile = new File(projectDir, 'build.gradle')
8282
settingsFile = new File(projectDir, 'settings.gradle')
8383

@@ -90,7 +90,7 @@ class IntegrationSpecification extends Specification {
9090
destination.text = this.class.getResource("/scripts/${name}").text
9191
}
9292

93-
93+
@SuppressWarnings('ThrowRuntimeException')
9494
String findDependency(final String organisation, final String artifact, final String extension) {
9595
String ver = artifactVersions[artifact]
9696
if (!ver) {

base-plugin/src/main/groovy/com/github/jrubygradle/JRubyExec.groovy

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,9 @@ import org.gradle.api.artifacts.Configuration
3232
import org.gradle.api.model.ReplacedBy
3333
import org.gradle.api.provider.Provider
3434
import org.gradle.api.tasks.Input
35-
import org.gradle.api.tasks.InputFile
35+
import org.gradle.api.tasks.Internal
3636
import org.gradle.api.tasks.JavaExec
3737
import org.gradle.api.tasks.LocalState
38-
import org.gradle.api.tasks.Optional
39-
import org.gradle.api.tasks.PathSensitive
40-
import org.gradle.api.tasks.PathSensitivity
4138
import org.gradle.api.tasks.TaskContainer
4239
import org.gradle.process.JavaExecSpec
4340
import org.gradle.util.GradleVersion
@@ -75,6 +72,16 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
7572
this.jruby = extensions.create(JRubyPluginExtension.NAME, JRubyPluginExtension, this)
7673
this.projectOperations = ProjectOperations.create(project)
7774
this.tasks = project.tasks
75+
this.inputs.property 'script-path', { scr ->
76+
File f = resolveScript(projectOperations, scr)
77+
if (!f) {
78+
''
79+
} else if (f.exists()) {
80+
f.text
81+
} else {
82+
stringize(scr)
83+
}
84+
}.curry(this.script)
7885

7986
inputs.property 'jrubyver', { JRubyPluginExtension jruby ->
8087
jruby.jrubyVersion
@@ -104,9 +111,10 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
104111
/** Script to execute.
105112
* @return The path to the script (or {@code null} if not set)
106113
*/
107-
@Optional
108-
@InputFile
109-
@PathSensitive(PathSensitivity.NONE)
114+
// @Optional
115+
// @InputFile
116+
// @PathSensitive(PathSensitivity.NONE)
117+
@Internal
110118
File getScript() {
111119
resolveScript(projectOperations, this.script)
112120
}

base-plugin/src/test/groovy/com/github/jrubygradle/JRubyExecTaskSpec.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
*/
2424
package com.github.jrubygradle
2525

26-
2726
import org.gradle.api.InvalidUserDataException
2827
import org.gradle.api.Project
2928
import org.gradle.api.artifacts.Configuration
@@ -80,7 +79,7 @@ class JRubyExecTaskSpec extends Specification {
8079
execTask.jruby.jrubyVersion != project.jruby.jrubyVersion
8180

8281
and: "jrubyConfigurationName must point to this new configuration"
83-
execTask.jruby.getGemConfiguration().name == configurationName
82+
execTask.jruby.gemConfiguration.name == configurationName
8483

8584
and: "configuration must exist"
8685
project.configurations.findByName(configurationName)
@@ -178,6 +177,6 @@ class JRubyExecTaskSpec extends Specification {
178177
}
179178

180179
then:
181-
execTask.jruby.getGemConfiguration().name == customConfig.name
180+
execTask.jruby.gemConfiguration.name == customConfig.name
182181
}
183182
}

base-plugin/src/test/groovy/com/github/jrubygradle/JRubyPluginSpec.groovy

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
package com.github.jrubygradle
2525

2626
import org.gradle.api.Project
27-
import org.gradle.api.artifacts.repositories.ArtifactRepository
28-
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
2927
import org.gradle.testfixtures.ProjectBuilder
3028
import spock.lang.Specification
3129

@@ -45,12 +43,4 @@ class JRubyPluginSpec extends Specification {
4543
then:
4644
project.jruby.defaultVersion == JRubyPluginExtension.DEFAULT_JRUBY_VERSION
4745
}
48-
49-
private Collection hasRepositoryUrl(Project p, String url) {
50-
p.repositories.findAll { ArtifactRepository r ->
51-
r instanceof IvyArtifactRepository
52-
}.findAll {
53-
it.ivyPattern.contains(url)
54-
}
55-
}
5646
}

base-plugin/src/test/groovy/com/github/jrubygradle/internal/JRubyExecUtilsSpec.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class JRubyExecUtilsSpec extends Specification {
115115

116116
void "Prepare a basic JRuby environment"() {
117117
when:
118-
Map preparedEnv = prepareJRubyEnvironment([:],false, new File('tmp/foo'))
118+
Map preparedEnv = prepareJRubyEnvironment([:], false, new File('tmp/foo'))
119119

120120
then:
121121
preparedEnv.size() > 0
@@ -128,7 +128,7 @@ class JRubyExecUtilsSpec extends Specification {
128128
'GEM_HOME' : '/tmp/spock',
129129
'RUBY_VERSION' : 'notaversion',
130130
'rvm_ruby_string': 'jruby-head',
131-
],false, gemWorkDir)
131+
], false, gemWorkDir)
132132

133133
then:
134134
preparedEnv['GEM_HOME'] == gemWorkDir.absolutePath

0 commit comments

Comments
 (0)