Skip to content

Commit 9387814

Browse files
committed
Partially deal with != in ranges, by ignoring the version (#290)
1 parent c92c9a8 commit 9387814

File tree

16 files changed

+140
-106
lines changed

16 files changed

+140
-106
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ class GenerateGradleRb extends DefaultTask implements JRubyAwareTask {
6565

6666
@TaskAction
6767
@CompileDynamic
68+
@SuppressWarnings('DuplicateStringLiteral')
6869
void generate() {
6970
Object source = getSourceFromResource()
7071
File destination = destinationFile().parentFile

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
3030
* system Ruby environment.
3131
*/
3232
@Input
33-
boolean InheritRubyEnv = false
33+
boolean inheritRubyEnv = false
3434

3535
JRubyExec() {
3636
super()
@@ -155,7 +155,7 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
155155
*/
156156
@Deprecated
157157
String getJrubyVersion() {
158-
deprecated("Use jruby.getJrubyVersion rather getJrubyVersion()")
158+
deprecated('Use jruby.getJrubyVersion rather getJrubyVersion()')
159159
jruby.jrubyVersion
160160
}
161161

@@ -172,7 +172,7 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
172172
*/
173173
@Deprecated
174174
void jrubyVersion(final String ver) {
175-
deprecated("Use jruby.jrubyVersion rather jrubyVersion")
175+
deprecated('Use jruby.jrubyVersion rather jrubyVersion')
176176
jruby.jrubyVersion(ver)
177177
}
178178

@@ -184,7 +184,7 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
184184
*/
185185
@Deprecated
186186
void configuration(Configuration newConfiguration) {
187-
deprecated("Use jruby.setGemConfiguration() rather than configuration()")
187+
deprecated('Use jruby.setGemConfiguration() rather than configuration()')
188188
jruby.gemConfiguration(newConfiguration)
189189
}
190190

@@ -196,7 +196,7 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
196196
*/
197197
@Deprecated
198198
void configuration(String newConfiguration) {
199-
deprecated("Use jruby.setGemConfiguration() rather than configuration()")
199+
deprecated('Use jruby.setGemConfiguration(newConfiguration) rather than configuration(newConfiguration)')
200200
jruby.gemConfiguration(newConfiguration)
201201
}
202202

@@ -211,15 +211,15 @@ class JRubyExec extends JavaExec implements JRubyAwareTask, JRubyExecSpec {
211211
*/
212212
@Deprecated
213213
void setJrubyVersion(final String version) {
214-
deprecated("Use jruby.setJrubyVersion rather setJrubyVersion")
214+
deprecated('Use jruby.setJrubyVersion rather setJrubyVersion')
215215
jruby.jrubyVersion(version)
216216
}
217217

218218
@Override
219219
@SuppressWarnings('UnnecessaryGetter')
220220
void exec() {
221221
File gemDir = getGemWorkDir().get()
222-
setEnvironment prepareJRubyEnvironment(this.environment, inheritRubyEnv, gemDir)
222+
setEnvironment prepareJRubyEnvironment(this.environment, this.inheritRubyEnv, gemDir)
223223
super.classpath jruby.jrubyConfiguration
224224
super.setArgs(getArgs())
225225
super.exec()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ class JRubyPluginExtension extends AbstractCombinedProjectTaskExtension {
316316
if (taskResolutionStrategiesOnly) {
317317
this.resolutionsStrategies
318318
} else {
319-
getExtFromProject().allResolutionStrategyActions + this.resolutionsStrategies
319+
extFromProject.allResolutionStrategyActions + this.resolutionsStrategies
320320
}
321321
} else {
322322
this.resolutionsStrategies

base-plugin/src/main/groovy/com/github/jrubygradle/internal/JRubyExecDelegate.groovy

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class JRubyExecDelegate {
9696
notSupported(USE_ARGS_ALTERNATIVES)
9797
}
9898

99+
@SuppressWarnings('UnusedMethodParameter')
99100
JavaExecSpec setArgs(Object... a) {
100101
notSupported(USE_ARGS_ALTERNATIVES)
101102
}
@@ -157,27 +158,8 @@ class JRubyExecDelegate {
157158
this.jrubyArgs
158159
}
159160

160-
// JavaExecSpec copyTo(JavaExecSpec execSpec) {
161-
// delegate.copyTo(execSpec)
162-
//
163-
// execSpec.workingDir = delegate.workingDir
164-
// execSpec.args = delegate.getArgs()
165-
// execSpec.classpath = delegate.jruby.jrubyConfiguration
166-
// execSpec.main = delegate.main
167-
//
168-
// execSpec.errorOutput = delegate.errorOutput
169-
// execSpec.standardOutput = delegate.standardOutput
170-
// execSpec.standardInput = delegate.standardInput
171-
// execSpec.ignoreExitValue = delegate.ignoreExitValue
172-
//
173-
// execSpec.environment = prepareJRubyEnvironment(
174-
// delegate.environment, delegate.inheritRubyEnv, delegate.gemWorkDir.get()
175-
// )
176-
// }
177-
178-
179161
private void notSupported(final String msg) {
180-
throw new UnsupportedOperationException()
162+
throw new UnsupportedOperationException(msg)
181163
}
182164

183165
private static final String USE_ARGS_ALTERNATIVES = 'Use jrubyArgs/scriptArgs instead of `args`'

core-plugin/src/integTest/groovy/com/github/jrubygradle/api/core/IvyXmlProxyServerIntegrationSpec.groovy

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import org.gradle.testkit.runner.BuildResult
44
import org.gradle.testkit.runner.GradleRunner
55
import org.junit.Rule
66
import org.junit.rules.TemporaryFolder
7+
import spock.lang.IgnoreIf
8+
import spock.lang.Issue
79
import spock.lang.Specification
810

911
import java.util.regex.Pattern
1012

11-
13+
@IgnoreIf({ System.getProperty('TESTS_ARE_OFFLINE') })
1214
class IvyXmlProxyServerIntegrationSpec extends Specification {
1315

1416
@Rule
@@ -52,7 +54,7 @@ class IvyXmlProxyServerIntegrationSpec extends Specification {
5254
.withProjectDir(projectDir)
5355
.withPluginClasspath()
5456
.withTestKitDir(testKitDir)
55-
.withArguments(['dependencies', '--configuration=something', '-i', '-s'])
57+
.withArguments(['dependencies', '--configuration=something', '-i', '-s'])
5658
.forwardOutput()
5759
.withDebug(true)
5860
.build()
@@ -74,8 +76,8 @@ class IvyXmlProxyServerIntegrationSpec extends Specification {
7476
build()
7577

7678
then:
77-
new File(projectDir,'build/something/credit_card_validator-1.3.2.gem').exists()
78-
new File(projectDir,'build/something/base_app-1.0.6.gem').exists()
79+
new File(projectDir, 'build/something/credit_card_validator-1.3.2.gem').exists()
80+
new File(projectDir, 'build/something/base_app-1.0.6.gem').exists()
7981
}
8082

8183

@@ -110,8 +112,24 @@ class IvyXmlProxyServerIntegrationSpec extends Specification {
110112
findFiles ~/^rake-.*gem$/
111113
}
112114

115+
@Issue('https://github.com/jruby-gradle/jruby-gradle-plugin/issues/290')
116+
void 'Resolve ranges with =, != and non-dotted versions'() {
117+
setup:
118+
withBuildFile '''
119+
dependencies {
120+
something 'rubygems:github-pages:106'
121+
}
122+
'''
123+
124+
when:
125+
build()
126+
127+
then:
128+
findFiles ~/^github-pages-106.gem$/
129+
}
130+
113131
private List<File> findFiles(Pattern pat) {
114-
new File(projectDir,'build/something').listFiles( new FilenameFilter() {
132+
new File(projectDir, 'build/something').listFiles(new FilenameFilter() {
115133
@Override
116134
boolean accept(File dir, String name) {
117135
name =~ pat

core-plugin/src/main/groovy/com/github/jrubygradle/api/core/AbstractJRubyPrepare.groovy

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,5 +95,3 @@ abstract class AbstractJRubyPrepare extends DefaultTask implements JRubyAwareTas
9595
private Object outputDir = { -> "${project.buildDir}/.gems" }
9696
}
9797

98-
99-

0 commit comments

Comments
 (0)