Skip to content

Commit 8d693e8

Browse files
committed
2 parents 7175ae4 + 9a08537 commit 8d693e8

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

jruby-gradle-base-plugin/src/main/groovy/com/github/jrubygradle/internal/GemVersionResolver.groovy

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@ package com.github.jrubygradle.internal
22

33
import org.gradle.api.GradleException
44
import org.gradle.api.Project
5-
import org.gradle.api.artifacts.DependencyResolveDetails
65
import org.gradle.api.artifacts.Configuration
6+
import org.gradle.api.artifacts.DependencyResolveDetails
77
import org.gradle.api.logging.Logger
88
import org.gradle.api.logging.Logging
99

1010
/**
1111
* Resolver to compute gem versions
1212
*/
1313
class GemVersionResolver {
14+
private static final String DBG_SEPARATOR = ' ------------------------'
1415
Map versions
1516
private final Configuration configuration
1617
private final Logger logger
@@ -24,8 +25,13 @@ class GemVersionResolver {
2425
GemVersionResolver(Logger logger, Configuration configuration) {
2526
this.logger = logger
2627
this.configuration = configuration
27-
configuration.resolutionStrategy {
28-
eachDependency { this.resolve(it) }
28+
try {
29+
configuration.resolutionStrategy {
30+
eachDependency { this.resolve(it) }
31+
}
32+
} catch (GradleException e) {
33+
logger.debug("${configuration.name}\n${DBG_SEPARATOR}\n" +
34+
" can not be a gem\n${DBG_SEPARATOR}")
2935
}
3036
}
3137

@@ -36,10 +42,8 @@ class GemVersionResolver {
3642

3743
// keep it not private for testing
3844
void firstRun() {
39-
logger.debug("${configuration.name}\n" +
40-
' --------------------------\n' +
41-
' collect version range info\n' +
42-
' --------------------------')
45+
logger.debug("${configuration.name}\n${DBG_SEPARATOR}\n" +
46+
" collect version range info\n${DBG_SEPARATOR}")
4347
Object config = configuration.copyRecursive()
4448
versions = [:]
4549

@@ -49,10 +53,8 @@ class GemVersionResolver {
4953

5054
config.resolvedConfiguration
5155

52-
logger.debug("${configuration.name}\n" +
53-
' ------------------------\n' +
54-
' apply version range info\n' +
55-
' ------------------------')
56+
logger.debug("${configuration.name}\n${DBG_SEPARATOR}\n" +
57+
" apply version range info\n${DBG_SEPARATOR}")
5658
}
5759

5860
void resolve(DependencyResolveDetails details) {

0 commit comments

Comments
 (0)