Skip to content

Commit

Permalink
Merge branch '3.0.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed Nov 27, 2015
2 parents 9d72317 + d3a38f4 commit 445f520
Show file tree
Hide file tree
Showing 57 changed files with 981 additions and 290 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ env:
- secure: X0fScDRO+fo4P4/xUvRmMhpNVqqPrIACIfnywXkUhl4gC/JyxBTfZmw+V6zsnNbyAW8AqJoejB3c709xyqdURXMy89Ect+lY/tei7ah5uZpgv82MhZsGCVaplPJiPDNGPHanqRynIv5brBodZuq0sohKxGRlcoSqChq4ZlY2HII=
- secure: M2WGEzaA4K64HCuNaXbEsg9aKg9Uo5VJOUBSiNmBQQfracqDWoPW6BlC+uD8dqBkFG4z3L4rJWnPoUNDZrqIUmInNLXGQrlkmfHTrAvCs6V+Jj4ilIRfc/bZnasoTmLxT4PPFZGCLcRJ3QwAJ+36EOZPDcXPXpN0hw4hB1hOx9Q=
- secure: Frvf9gLJ/pfy3SWMm9LXdprO/snMFfDO9pTd1bl2GN3QBmkF40G20NzoFI6jbYeyg+gwJQmnC6NVi/KDAkJ/EBO05Xk/qMKwWWsASgdDzdnUNTynFPH0zcnv64d6qZAaLWeH/gWQPZ+99zmbVzFqSNDggEo+cPBm9QjqJ608Yx4=
- secure: JM8mzEz6+UtRnG68vbitVoPzcrSHbEIa0z7Nfhu3RKMDOmQgfGNIF+ZDZPAa/tYpNBTJWKjeIJc8opCfd1p1+s6ISc7B29ymulQ3ztwFWcetunrSmxl8H96aqzjc+82DO6huj4Tzi0u2MADnh9wVm+A1+tcqLjpaLGmskMlvdbw=
script: ./travis-build.sh
install: /bin/true
after_failure: ./travis-after-failure.sh
Expand All @@ -39,6 +40,8 @@ deploy:
all_branches: true
after_deploy:
- ./gradlew sdkMajorRelease
after_success:
- ./trigger-dependent-build.sh
cache:
directories:
- $HOME/.gradle
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ext {
springVersion = "4.2.3.RELEASE"
ehcacheVersion = "2.4.6"
junitVersion = "4.12"
concurrentlinkedhashmapVersion = "1.4"
concurrentlinkedhashmapVersion = "1.4.2"
cglibVersion = "2.2.2"
objenesisVersion = "1.4"
tomcatVersion = "8.0.26"
Expand Down
20 changes: 13 additions & 7 deletions grails-bootstrap/src/main/groovy/grails/io/IOUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package grails.io

import grails.util.BuildSettings
import groovy.transform.CompileStatic
import org.grails.io.support.Resource
import groovy.transform.Memoized
import org.grails.io.support.SpringIOUtils
import org.grails.io.support.UrlResource

Expand Down Expand Up @@ -155,6 +155,7 @@ class IOUtils extends SpringIOUtils {
return null
}

@Memoized
public static File findApplicationDirectoryFile() {
def directory = findApplicationDirectory()
if(directory) {
Expand All @@ -167,6 +168,7 @@ class IOUtils extends SpringIOUtils {
return null
}

@Memoized
public static String findApplicationDirectory() {
if(applicationDirectory) {
return applicationDirectory
Expand All @@ -176,18 +178,22 @@ class IOUtils extends SpringIOUtils {
try {
String mainClassName = System.getProperty(BuildSettings.MAIN_CLASS_NAME)
if(!mainClassName) {
def stackTraceElements = Thread.currentThread().getStackTrace()
def stackTraceElements = Arrays.asList( Thread.currentThread().getStackTrace() ).reverse()
if(stackTraceElements) {
def lastElement = stackTraceElements[-1]
def className = lastElement.className
def methodName = lastElement.methodName
if(className.endsWith(".Application") && methodName == '<clinit>') {
mainClassName = className
for(lastElement in stackTraceElements) {

def className = lastElement.className
def methodName = lastElement.methodName
if(className.endsWith(".Application") && methodName == '<clinit>') {
mainClassName = className
break
}
}
}
}
if(mainClassName) {


final Class<?> mainClass = Thread.currentThread().contextClassLoader.loadClass(mainClassName)
final URL classResource = mainClass ? findClassResource(mainClass) : null
if(classResource) {
Expand Down
2 changes: 2 additions & 0 deletions grails-bootstrap/src/main/groovy/grails/util/BuildScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ public String toString() {
/**
* Returns the current Scope object based on the currently set "grails.scope" System property
* @return The Scope object
* @deprecated Relates to old Grails 2.x build system, do not use
*/
@Deprecated
public static BuildScope getCurrent() {
String key = System.getProperty(KEY);
if (key == null) {
Expand Down
18 changes: 16 additions & 2 deletions grails-bootstrap/src/main/groovy/grails/util/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import groovy.lang.MissingMethodException;
import org.codehaus.groovy.control.MultipleCompilationErrorsException;
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
import org.grails.io.support.GrailsResourceUtils;

import java.io.File;
import java.net.URL;
import java.util.Locale;
import java.util.Map;

Expand Down Expand Up @@ -192,19 +192,33 @@ public static Environment getCurrentEnvironment() {

/**
* Returns true if the application is running in development mode (within grails run-app)
*
* @return true if the application is running in development mode
*/

public static boolean isDevelopmentMode() {
return DEVELOPMENT_MODE;
}

/**
* This method will return true if the 'grails-app' directory was found, regardless of whether reloading is active or not
*
* @return True if the development sources are present
*/
public static boolean isDevelopmentEnvironmentAvailable() {
return BuildSettings.GRAILS_APP_DIR_PRESENT ;
}
/**
* Check whether the application is deployed
* @return true if is
*/
public static boolean isWarDeployed() {
return Metadata.getCurrent().isWarDeployed();
URL loadedLocation = Environment.class.getClassLoader().getResource(Metadata.FILE);
if(loadedLocation != null && loadedLocation.getPath().contains("/WEB-INF/classes")) {
return true;
}
return false;

}

/**
Expand Down
Loading

0 comments on commit 445f520

Please sign in to comment.