Skip to content

Commit b10f475

Browse files
committed
Merge remote-tracking branch 'upstream/3.1.x' into 3.1.x
2 parents 5865b2b + 87a7e6b commit b10f475

File tree

35 files changed

+510
-1057
lines changed

35 files changed

+510
-1057
lines changed

build.gradle

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,10 @@ ext {
3232
commonsCollectionsVersion = "3.2.1"
3333
commonsIOVersion = "2.2"
3434
commonsLangVersion = "2.6"
35-
//datastoreVersion = "5.0.1.RELEASE"
36-
datastoreVersion = "5.0.2.BUILD-SNAPSHOT"
35+
datastoreVersion = "5.0.2.RELEASE"
3736
gantVersion = "1.9.6"
3837
gdocEngineVersion = "1.0.1"
39-
groovyVersion = System.getenv('CI_GROOVY_VERSION') ?: "2.4.5"
38+
groovyVersion = System.getenv('CI_GROOVY_VERSION') ?: "2.4.6"
4039
ivyVersion = "2.3.0"
4140
jansiVersion = "1.11"
4241
jlineVersion = "2.12"

grails-bom/plugins.properties

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
hibernate=4.3.10.7
2-
hibernate3=5.0.1
3-
hibernate4=5.0.1
4-
hibernate5=5.0.1
5-
mongodb=5.0.1
6-
cassandra=5.0.1
7-
neo4j=5.0.1
2+
hibernate3=5.0.2
3+
hibernate4=5.0.2
4+
hibernate5=5.0.2
5+
mongodb=5.0.2
6+
cassandra=5.0.2
7+
neo4j=5.0.2
88
cache=3.0.2
99
asset-pipeline=3.0.15
10-
scaffolding=3.2.0
10+
scaffolding=3.2.1
1111
fields=2.1.2
1212
geb=1.0.1
13-
views-json=1.0.1
14-
views-markup=1.0.1
13+
views-json=1.0.3
14+
views-markup=1.0.3

grails-bootstrap/src/main/groovy/grails/codegen/model/ModelBuilder.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ trait ModelBuilder {
111111

112112
@Override
113113
Map<String, Object> asMap() {
114-
[ className: className, fullName: fullName, propertyName: propertyName, modelName: propertyName, packageName: packageName, packagePath: packagePath, simpleName: simpleName, lowerCaseName: lowerCaseName]
114+
(Map<String,Object>) [ className: className, fullName: fullName, propertyName: propertyName, modelName: propertyName, packageName: packageName, packagePath: packagePath, simpleName: simpleName, lowerCaseName: lowerCaseName]
115115
}
116116
}
117117

grails-bootstrap/src/main/groovy/grails/io/IOUtils.groovy

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,16 @@ class IOUtils extends SpringIOUtils {
248248
def rootResource = findRootResource(targetClass)
249249
if(rootResource != null) {
250250

251-
def rootFile = new UrlResource(rootResource).file.canonicalFile
251+
try {
252+
def rootFile = new UrlResource(rootResource).file.canonicalFile
253+
def rootPath = rootFile.path
254+
def buildClassespath = BuildSettings.BUILD_CLASSES_PATH.replace('/', File.separator)
255+
if(rootPath.contains(buildClassespath)) {
256+
return new File(rootPath - buildClassespath)
252257

253-
def rootPath = rootFile.path
254-
if(rootPath.contains(BuildSettings.BUILD_CLASSES_PATH)) {
255-
return new File(rootPath - BuildSettings.BUILD_CLASSES_PATH)
258+
}
259+
} catch (FileNotFoundException fnfe) {
260+
return null
256261
}
257262
}
258263
return null
@@ -289,8 +294,10 @@ class IOUtils extends SpringIOUtils {
289294
if(classResource) {
290295
def file = new UrlResource(classResource).getFile()
291296
def path = file.canonicalPath
292-
if(path.contains(BuildSettings.BUILD_CLASSES_PATH)) {
293-
location = path.substring(0, path.indexOf(BuildSettings.BUILD_CLASSES_PATH) - 1)
297+
298+
def buildClassespath = BuildSettings.BUILD_CLASSES_PATH.replace('/', File.separator)
299+
if(path.contains(buildClassespath)) {
300+
location = path.substring(0, path.indexOf(buildClassespath) - 1)
294301
}
295302
}
296303
}

grails-bootstrap/src/main/groovy/grails/util/Environment.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,11 @@ public static boolean isWarDeployed() {
292292
if(loadedLocation != null && loadedLocation.getPath().contains("/WEB-INF/classes")) {
293293
return true;
294294
}
295+
// Workaround for weblogic who repacks files from 'classes' into a new jar under lib/
296+
if (loadedLocation != null && loadedLocation.getPath().contains("_wl_cls_gen.jar!/")) {
297+
return true;
298+
}
295299
return false;
296-
297300
}
298301

299302
/**

grails-core/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ dependencies {
1616
compile("org.springframework:spring-context:${springVersion}") {
1717
exclude group: 'commons-logging', module:'commons-logging'
1818
}
19+
testCompile("org.springframework:spring-jdbc:${springVersion}") {
20+
exclude group: 'commons-logging', module:'commons-logging'
21+
}
22+
testRuntime 'com.h2database:h2:1.3.176'
23+
1924
provided("org.springframework:spring-test:${springVersion}") {
2025
exclude group: 'commons-logging', module:'commons-logging'
2126
}

grails-core/src/main/groovy/grails/boot/GrailsApp.groovy

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ class GrailsApp extends SpringApplication {
120120
@Override
121121
void onNew(File file, List<String> extensions) {
122122
changedFiles << file.canonicalFile
123+
// For some bizarro reason Windows fires onNew events even for files that have
124+
// just been modified and not created
125+
if(System.getProperty("os.name").toLowerCase().indexOf("windows") != -1) {
126+
return
127+
}
123128
newFiles << file.canonicalFile
124129
}
125130
})
@@ -129,7 +134,7 @@ class GrailsApp extends SpringApplication {
129134
directoryWatcher.addListener(pluginManagerListener)
130135

131136
File baseDir = new File(location).canonicalFile
132-
137+
String baseDirPath = baseDir.canonicalPath
133138
List<File> watchBaseDirectories = [baseDir]
134139
for(GrailsPlugin plugin in pluginManager.allPlugins) {
135140
if(plugin instanceof BinaryGrailsPlugin) {
@@ -151,8 +156,18 @@ class GrailsApp extends SpringApplication {
151156
boolean first = true
152157
for(watchBase in watchBaseDirectories) {
153158
if(!first) {
154-
// the base project will already been in the list of watch patterns, but we add any subprojects here
155-
plugin.watchedResourcePatterns.add(new WatchPattern(directory: watchBase, extension: wp.extension))
159+
if(wp.file != null) {
160+
String relativePath = wp.file.canonicalPath - baseDirPath
161+
File watchFile = new File(watchBase, relativePath)
162+
// the base project will already been in the list of watch patterns, but we add any subprojects here
163+
plugin.watchedResourcePatterns.add(new WatchPattern(file: watchFile, extension: wp.extension))
164+
}
165+
else if(wp.directory != null) {
166+
String relativePath = wp.directory.canonicalPath - baseDirPath
167+
File watchDir = new File(watchBase, relativePath)
168+
// the base project will already been in the list of watch patterns, but we add any subprojects here
169+
plugin.watchedResourcePatterns.add(new WatchPattern(directory: watchDir, extension: wp.extension))
170+
}
156171
}
157172
first = false
158173
if(wp.file) {
@@ -198,7 +213,8 @@ class GrailsApp extends SpringApplication {
198213
def changedFile = uniqueChangedFiles[0]
199214
changedFile = changedFile.canonicalFile
200215
// Groovy files within the 'conf' directory are not compiled
201-
if(changedFile.path.contains('/grails-app/conf/')) {
216+
String confPath = "${File.pathSeparator}grails-app${File.pathSeparator}conf${File.pathSeparator}"
217+
if(changedFile.path.contains(confPath)) {
202218
pluginManager.informOfFileChange(changedFile)
203219
}
204220
else {
@@ -239,8 +255,10 @@ class GrailsApp extends SpringApplication {
239255
protected void recompile(File changedFile, CompilerConfiguration compilerConfig, String location) {
240256
File appDir = null
241257
def changedPath = changedFile.path
242-
if (changedPath.contains('/grails-app')) {
243-
appDir = new File(changedPath.substring(0, changedPath.indexOf('/grails-app')))
258+
259+
String grailsAppDir = "${File.separator}grails-app"
260+
if (changedPath.contains(grailsAppDir)) {
261+
appDir = new File(changedPath.substring(0, changedPath.indexOf(grailsAppDir)))
244262
}
245263
def baseFileLocation = appDir?.absolutePath ?: location
246264
compilerConfig.setTargetDirectory(new File(baseFileLocation, BuildSettings.BUILD_CLASSES_PATH))

grails-core/src/main/groovy/grails/boot/config/GrailsAutoConfiguration.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ class GrailsAutoConfiguration implements GrailsApplicationClass, ApplicationCont
118118
*/
119119
Collection<Package> packages() {
120120
def thisPackage = getClass().package
121-
thisPackage ? [ thisPackage ] : []
121+
thisPackage ? [ thisPackage ] : new ArrayList<Package>()
122122
}
123123

124124
/**

grails-core/src/main/groovy/grails/plugins/Plugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,6 @@ abstract class Plugin implements GrailsApplicationLifeCycle, GrailsApplicationAw
165165
def bb = new BeanBuilder(null, grailsApplication.classLoader)
166166
bb.beans beanDefinitions
167167
bb.registerBeans((BeanDefinitionRegistry)applicationContext)
168-
new MapBasedSmartPropertyOverrideConfigurer(grailsApplication).postProcessBeanFactory(((ConfigurableApplicationContext)applicationContext).beanFactory)
168+
new MapBasedSmartPropertyOverrideConfigurer(grailsApplication: grailsApplication).postProcessBeanFactory(((ConfigurableApplicationContext)applicationContext).beanFactory)
169169
}
170170
}

grails-core/src/main/groovy/org/grails/config/yaml/YamlPropertySourceLoader.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,4 @@ class YamlPropertySourceLoader extends YamlProcessor implements PropertySourceLo
113113
return null
114114
}
115115

116-
117116
}

0 commit comments

Comments
 (0)