Skip to content

Commit 1ae728a

Browse files
committed
Merge branch '2.3.x' of github.com:grails/grails-core into 2.3.x
Conflicts: grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/fork/ForkedGrailsProcess.groovy
2 parents 0f3a777 + f2309ab commit 1ae728a

File tree

51 files changed

+713
-128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+713
-128
lines changed

build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ ext.providedDeps = []
1818

1919
ext.provided = { providedDeps << it }
2020
ext {
21-
grailsVersion = '2.3.9.BUILD-SNAPSHOT'
21+
grailsVersion = '2.3.10.BUILD-SNAPSHOT'
2222
isBuildSnapshot = grailsVersion.endsWith(".BUILD-SNAPSHOT")
2323
antTraxVersion = "1.7.1"
2424
antVersion = "1.8.4"
@@ -28,20 +28,20 @@ ext {
2828
commonsCollectionsVersion = "3.2.1"
2929
commonsIOVersion = "2.2"
3030
commonsLangVersion = "2.6"
31-
datastoreVersion = "3.0.6.RELEASE"
31+
datastoreVersion = "3.1.0.RELEASE"
3232
gantVersion = "1.9.6"
3333
gdocEngineVersion = "1.0.1"
3434
groovyVersion = "2.1.9"
3535
ivyVersion = "2.3.0"
3636
jansiVersion = "1.11"
37-
jlineVersion = "2.11"
37+
jlineVersion = "2.12"
3838
jnaVersion = "4.0.0"
3939
slf4jVersion = "1.7.5"
4040

4141
spockVersion = '0.7-groovy-2.0'
4242
springLoadedVersion = "1.2.0.RELEASE"
4343
springLoadedCommonOptions = "-noverify -Dspringloaded.synchronize=true -Djdk.reflect.allowGetCallerClass=true"
44-
springVersion = "3.2.8.RELEASE"
44+
springVersion = "3.2.9.RELEASE"
4545
ehcacheVersion = "2.4.6"
4646
junitVersion = "4.11"
4747
concurrentlinkedhashmapVersion = "1.3.1"

build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
grails.version=2.3.9.BUILD-SNAPSHOT
1+
grails.version=2.3.10.BUILD-SNAPSHOT
22

buildSrc/src/main/groovy/org/grails/gradle/GrailsBuildPlugin.groovy

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class GrailsBuildPlugin implements Plugin<Project> {
1919
// of the dependencies in the given configuration(s)
2020
project.ext {
2121
sourcesFor = { configurations -> classifiedDependencies(project, configurations, "sources") }
22+
pomFor = { configurations -> classifiedDependencies(project, configurations, "pom") }
2223
javadocFor = { configurations -> classifiedDependencies(project, configurations, "javadoc") }
2324
}
2425
}
@@ -53,8 +54,13 @@ class GrailsBuildPlugin implements Plugin<Project> {
5354
dependency.artifact { artifact ->
5455
artifact.name = dependency.name
5556
artifact.type = targetClassifier
56-
artifact.extension = 'jar'
57-
artifact.classifier = targetClassifier
57+
if('pom' == targetClassifier) {
58+
artifact.extension = 'pom'
59+
}
60+
else {
61+
artifact.extension = 'jar'
62+
artifact.classifier = targetClassifier
63+
}
5864
}
5965
dependency
6066
}

gradle/assemble.gradle

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ task configurePopulateDependencies << {
5656
libsConfigurations.each { configuration ->
5757
def sourceArtifacts = sourcesFor(configuration).resolvedConfiguration.lenientConfiguration.getArtifacts(Specs.satisfyAll()).groupBy { it.moduleVersion.id }
5858
def javadocArtifacts = javadocFor(configuration).resolvedConfiguration.lenientConfiguration.getArtifacts(Specs.satisfyAll()).groupBy { it.moduleVersion.id }
59+
def pomArtifacts = pomFor(configuration).resolvedConfiguration.lenientConfiguration.getArtifacts(Specs.satisfyAll()).groupBy { it.moduleVersion.id }
60+
5961
for (artifact in configuration.resolvedConfiguration.resolvedArtifacts) {
6062
if (artifact in seen) continue
6163
seen << artifact
@@ -73,6 +75,25 @@ task configurePopulateDependencies << {
7375
}
7476
}
7577

78+
populateDependencies.into("$dependency.group/$dependency.name/jars") {
79+
from artifact.file // this will trigger the actual download if necessary
80+
def sourceJar = sourceArtifacts[dependency]
81+
if (sourceJar) {
82+
from sourceJar.file
83+
}
84+
def javadocJar = javadocArtifacts[dependency]
85+
if (javadocJar) {
86+
from javadocJar.file
87+
}
88+
}
89+
90+
populateDependencies.into("$dependency.group/$dependency.name") {
91+
def pomFile = pomArtifacts[dependency]
92+
if(pomFile) {
93+
from pomFile.file
94+
}
95+
}
96+
7697
populateDependencies.from ("${metadata}/${dependency.group}/${dependency.name}/${dependency.version}") {
7798
include "**/*ivy.xml"
7899
eachFile { it.path = "$dependency.group/$dependency.name/ivy-${dependency.version}.xml" }
@@ -100,11 +121,11 @@ task pluginsFromRepo {
100121
ext.plugins = [
101122
cache: "1.1.2",
102123
'database-migration': "1.4.0",
103-
hibernate: "3.6.10.13",
124+
hibernate: "3.6.10.15",
104125
jquery: "1.11.1",
105126
resources: "1.2.7",
106127
scaffolding: "2.0.3",
107-
tomcat: "7.0.52.1",
128+
tomcat: "7.0.53",
108129
webxml: "1.4.1"
109130
]
110131

@@ -115,9 +136,9 @@ task pluginsFromRepo {
115136
mkdir(dir: dir)
116137
plugins.each { name, version ->
117138
def versionTag = version.replaceAll(/\./, '_').toUpperCase()
118-
get(src: "http://grails.org/plugins/grails-${name}/tags/RELEASE_${versionTag}/grails-${name}-${version}.zip",
139+
get(src: "http://repo.grails.org/grails/plugins/org/grails/plugins/${name}/${version}/${name}-${version}.zip",
119140
dest: dir, verbose: true, usetimestamp: true)
120-
get(src: "http://grails.org/plugins/grails-${name}/tags/RELEASE_${versionTag}/grails-${name}-${version}.pom",
141+
get(src: "http://repo.grails.org/grails/plugins/org/grails/plugins/${name}/${version}/${name}-${version}.pom",
121142
dest: dir, verbose: true, usetimestamp: true)
122143
}
123144
}

grails-aether/src/main/groovy/org/codehaus/groovy/grails/resolve/maven/aether/AetherDependencyManager.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import org.codehaus.groovy.grails.resolve.ExcludeResolver
3737
import org.codehaus.groovy.grails.resolve.maven.aether.config.AetherDsl
3838
import org.codehaus.groovy.grails.resolve.maven.aether.config.DependencyConfiguration
3939
import org.codehaus.groovy.grails.resolve.maven.aether.support.GrailsConsoleLoggerManager
40+
import org.codehaus.groovy.grails.resolve.maven.aether.support.GrailsHomeWorkspaceReader
4041
import org.codehaus.groovy.grails.resolve.maven.aether.support.GrailsModelResolver
4142
import org.codehaus.groovy.grails.resolve.maven.aether.support.MultipleTopLevelJavaScopeSelector
4243
import org.codehaus.groovy.grails.resolve.maven.aether.support.ScopeAwareNearestVersionSelector
@@ -120,6 +121,7 @@ class AetherDependencyManager implements DependencyManager {
120121
String checksumPolicy = RepositoryPolicy.CHECKSUM_POLICY_IGNORE
121122
boolean readPom
122123
boolean defaultDependenciesProvided
124+
boolean offline
123125
boolean java5compatible
124126

125127
Map<String, Closure> inheritedDependencies = [:]
@@ -172,6 +174,7 @@ class AetherDependencyManager implements DependencyManager {
172174

173175
session.setProxySelector(new DefaultProxySelector())
174176
session.setMirrorSelector(new DefaultMirrorSelector())
177+
session.setWorkspaceReader(new GrailsHomeWorkspaceReader())
175178
}
176179
finally {
177180
currentThread.setContextClassLoader(contextLoader)
@@ -352,7 +355,7 @@ class AetherDependencyManager implements DependencyManager {
352355
attachmentRequests << new ArtifactRequest(new DefaultArtifact(
353356
artifact.groupId, artifact.artifactId, "javadoc", artifact.extension, artifact.version), repositories, null)
354357
}
355-
if (includeJavadoc) {
358+
if (includeSource) {
356359
attachmentRequests << new ArtifactRequest(new DefaultArtifact(
357360
artifact.groupId, artifact.artifactId, "sources", artifact.extension, artifact.version), repositories, null)
358361
}
@@ -447,6 +450,7 @@ class AetherDependencyManager implements DependencyManager {
447450
protected DependencyNode collectDependencies(String scope) {
448451
SettingsBuildingResult result = settingsBuilder.build(new DefaultSettingsBuildingRequest())
449452
settings = result.getEffectiveSettings()
453+
settings.offline = offline
450454
final proxyHost = System.getProperty("http.proxyHost")
451455
final proxyPort = System.getProperty("http.proxyPort")
452456
if (proxyHost && proxyPort) {
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
package org.codehaus.groovy.grails.resolve.maven.aether.support
2+
3+
import groovy.transform.CompileStatic
4+
import org.eclipse.aether.artifact.Artifact
5+
import org.eclipse.aether.repository.WorkspaceReader
6+
import org.eclipse.aether.repository.WorkspaceRepository
7+
8+
/**
9+
* A {@link WorkspaceReader} that resolves dependencies from GRAILS_HOME
10+
*
11+
* @author Graeme Rocher
12+
* @since 2.3.10
13+
*/
14+
@CompileStatic
15+
class GrailsHomeWorkspaceReader implements WorkspaceReader{
16+
17+
String grailsHome
18+
19+
GrailsHomeWorkspaceReader() {
20+
this(System.getProperty('grails.home') ?: System.getenv('GRAILS_HOME'))
21+
}
22+
23+
GrailsHomeWorkspaceReader(String grailsHome ) {
24+
this.grailsHome = grailsHome
25+
}
26+
27+
@Override
28+
WorkspaceRepository getRepository() {
29+
return new WorkspaceRepository("grailsHome")
30+
}
31+
32+
@Override
33+
File findArtifact(Artifact artifact) {
34+
File artifactFile = null
35+
if(grailsHome) {
36+
def pomsParent = new File(grailsHome, "lib/${artifact.groupId}/${artifact.artifactId}")
37+
def jarsParent = new File(grailsHome, "lib/${artifact.groupId}/${artifact.artifactId}/jars")
38+
39+
if(artifact.extension == "pom") {
40+
artifactFile = resolveFile(artifact, pomsParent, "pom")
41+
}
42+
else if(artifact.extension == 'jar') {
43+
artifactFile = resolveFile(artifact, jarsParent, "jar")
44+
}
45+
}
46+
return artifactFile
47+
}
48+
49+
protected File resolveFile(Artifact artifact, File parentDir, String fileType) {
50+
File artifactFile = null
51+
def pomFileName = "${artifact.artifactId}-${artifact.version}.$fileType"
52+
def grailsHomePom = new File(parentDir, pomFileName)
53+
if (grailsHomePom.exists()) {
54+
artifactFile = grailsHomePom
55+
} else if (artifact.groupId == 'org.grails') {
56+
grailsHomePom = new File(grailsHome, "dist/$pomFileName")
57+
if (grailsHomePom.exists()) {
58+
artifactFile = grailsHomePom
59+
}
60+
}
61+
artifactFile
62+
}
63+
64+
@Override
65+
List<String> findVersions(Artifact artifact) {
66+
// only support explicit version from GRAILS_HOME
67+
return Collections.emptyList()
68+
}
69+
}

grails-aether/src/test/groovy/org/codehaus/groovy/grails/resolve/maven/AetherDependencyManagerSpec.groovy

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import org.eclipse.aether.resolution.DependencyResult
2828
import spock.lang.Ignore
2929
import spock.lang.Issue
3030
import spock.lang.Specification
31+
import spock.lang.Unroll
3132

3233
/**
3334
* @author Graeme Rocher
@@ -290,11 +291,10 @@ class AetherDependencyManagerSpec extends Specification {
290291
files.size() == 1
291292
}
292293

294+
@Unroll
293295
void "Test resolve with source and javadocs"() {
294296
given: "A dependency manager instance"
295297
def dependencyManager = new AetherDependencyManager()
296-
dependencyManager.includeJavadoc = true
297-
dependencyManager.includeSource = true
298298
dependencyManager.parseDependencies {
299299
repositories {
300300
mavenCentral()
@@ -306,17 +306,25 @@ class AetherDependencyManagerSpec extends Specification {
306306
}
307307

308308
when: "A dependency is resolved"
309+
dependencyManager.includeJavadoc = includeJavadoc
310+
dependencyManager.includeSource = includeSource
309311
def report = dependencyManager.resolve("compile")
310-
println report.files.size()
311-
println report.files
312+
312313
then: "The dependencies are resolved"
313-
314-
report.files.find { it.name.contains('grails-bootstrap-2.2.0')}
315-
report.files.find { it.name.contains('grails-bootstrap-2.2.0-sources')}
316-
report.files.find { it.name.contains('grails-bootstrap-2.2.0-javadoc')}
317-
report.files.find { it.name.contains('jline-1.0')}
318-
report.files.find { it.name.contains('jline-1.0-sources')}
319-
report.files.find { it.name.contains('jline-1.0-javadoc')}
314+
dependencyResolved == report.files.any { it.name.contains('grails-bootstrap-2.2.0')}
315+
sourceResolved == report.files.any { it.name.contains('grails-bootstrap-2.2.0-sources')}
316+
javadocResolved == report.files.any { it.name.contains('grails-bootstrap-2.2.0-javadoc')}
317+
dependencyResolved == report.files.any { it.name.contains('jline-1.0')}
318+
sourceResolved == report.files.any { it.name.contains('jline-1.0-sources')}
319+
javadocResolved == report.files.any { it.name.contains('jline-1.0-javadoc')}
320+
321+
where:
322+
includeJavadoc | includeSource | dependencyResolved | javadocResolved | sourceResolved
323+
false | false | true | false | false
324+
true | false | true | true | false
325+
false | true | true | false | true
326+
true | true | true | true | true
327+
320328
}
321329

322330
void "Test simple dependency resolve"() {

grails-bootstrap/src/main/groovy/grails/build/logging/GrailsConsole.java

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,28 @@
2020
import static org.fusesource.jansi.Ansi.Color.RED;
2121
import static org.fusesource.jansi.Ansi.Color.YELLOW;
2222
import static org.fusesource.jansi.Ansi.Erase.FORWARD;
23+
import grails.util.Environment;
2324

2425
import java.io.File;
26+
import java.io.Flushable;
2527
import java.io.IOException;
2628
import java.io.InputStream;
2729
import java.io.OutputStream;
28-
import java.io.OutputStreamWriter;
2930
import java.io.PrintStream;
3031
import java.io.PrintWriter;
3132
import java.io.StringWriter;
3233
import java.util.List;
3334
import java.util.Stack;
3435

35-
import grails.util.Environment;
3636
import jline.Terminal;
3737
import jline.TerminalFactory;
38+
import jline.UnixTerminal;
3839
import jline.console.ConsoleReader;
3940
import jline.console.history.FileHistory;
4041
import jline.console.history.History;
4142
import jline.internal.ShutdownHooks;
43+
import jline.internal.TerminalLineSettings;
44+
4245
import org.apache.tools.ant.BuildException;
4346
import org.codehaus.groovy.grails.cli.ScriptExitException;
4447
import org.codehaus.groovy.grails.cli.interactive.CandidateListCompletionHandler;
@@ -179,7 +182,7 @@ public void setOut(PrintStream out) {
179182
this.out = out;
180183
}
181184

182-
private boolean isInteractiveEnabled() {
185+
public boolean isInteractiveEnabled() {
183186
return readPropOrTrue(ENABLE_INTERACTIVE);
184187
}
185188

@@ -251,11 +254,7 @@ public static synchronized GrailsConsole getInstance() {
251254
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
252255
@Override
253256
public void run() {
254-
try {
255-
console.terminal.restore();
256-
} catch (Exception e) {
257-
// ignore
258-
}
257+
console.beforeShutdown();
259258
}
260259
}));
261260
}
@@ -266,6 +265,38 @@ public void run() {
266265
return instance;
267266
}
268267

268+
public void beforeShutdown() {
269+
persistHistory();
270+
restoreTerminal();
271+
}
272+
273+
protected void restoreTerminal() {
274+
try {
275+
terminal.restore();
276+
} catch (Exception e) {
277+
// ignore
278+
}
279+
if(terminal instanceof UnixTerminal) {
280+
// workaround for GRAILS-11494
281+
try {
282+
new TerminalLineSettings().set("sane");
283+
} catch (Exception e) {
284+
// ignore
285+
}
286+
}
287+
}
288+
289+
protected void persistHistory() {
290+
if(history instanceof Flushable) {
291+
try {
292+
((Flushable)history).flush();
293+
}
294+
catch (IOException e) {
295+
// ignore exception
296+
}
297+
}
298+
}
299+
269300
public static void setInstance(GrailsConsole newConsole) {
270301
instance = newConsole;
271302
if (!(System.out instanceof GrailsConsolePrintStream)) {

0 commit comments

Comments
 (0)