Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch '2.2.x'

Conflicts:
	grails-plugin-url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/RegexUrlMapping.java
  • Loading branch information...
commit e0a1f21cc00fdc8fb5a48aef89e0791e12640a3e 2 parents 9703038 + 2f0f515
@graemerocher graemerocher authored
View
70 buildSrc/src/main/groovy/org/grails/gradle/GrailsBuildPlugin.groovy
@@ -17,45 +17,49 @@ class GrailsBuildPlugin implements Plugin<Project> {
// Add utility for getting sources, returns a configuration containing the source jar versions
// of the dependencies in the given configuration(s)
- project.ext.sourcesFor = { configurations ->
-
- // We can't use varargs for the closure signature due to an issue in the mixin mechanism in this
- // version of Gradle.
- if (configurations instanceof Configuration) {
- configurations = [configurations]
- }
-
- def addChildren
- addChildren = { Collection deps, Set allDeps = new LinkedHashSet() ->
- deps.each { ResolvedDependency resolvedDependency ->
- def notSeenBefore = allDeps.add(resolvedDependency)
- if (notSeenBefore) { // defend against circular dependencies
- addChildren(resolvedDependency.children, allDeps)
- }
- }
- allDeps
- }
+ project.ext {
+ sourcesFor = { configurations -> classifiedDependencies(project, configurations, "sources") }
+ javadocFor = { configurations -> classifiedDependencies(project, configurations, "javadoc") }
+ }
+ }
- def dependencies = new LinkedHashSet()
- for (configuration in configurations) {
- addChildren(configuration.resolvedConfiguration.getFirstLevelModuleDependencies({ it instanceof ExternalDependency } as Spec), dependencies)
- }
+ private Configuration classifiedDependencies(project, configurations, String targetClassifier) {
+ // We can't use varargs for the closure signature due to an issue in the mixin mechanism in this
+ // version of Gradle.
+ if (configurations instanceof Configuration) {
+ configurations = [configurations]
+ }
- def sourceDependencies = dependencies.collect { ResolvedDependency resolvedDependency ->
- def dependency = new DefaultExternalModuleDependency(resolvedDependency.moduleGroup, resolvedDependency.moduleName, resolvedDependency.moduleVersion,
- resolvedDependency.configuration)
- dependency.transitive = false
- dependency.artifact { artifact ->
- artifact.name = dependency.name
- artifact.type = 'source'
- artifact.extension = 'jar'
- artifact.classifier = 'sources'
+ def addChildren
+ addChildren = { Collection deps, Set allDeps = new LinkedHashSet() ->
+ deps.each { ResolvedDependency resolvedDependency ->
+ def notSeenBefore = allDeps.add(resolvedDependency)
+ if (notSeenBefore) { // defend against circular dependencies
+ addChildren(resolvedDependency.children, allDeps)
}
- dependency
}
+ allDeps
+ }
+
+ def dependencies = new LinkedHashSet()
+ for (configuration in configurations) {
+ addChildren(configuration.resolvedConfiguration.getFirstLevelModuleDependencies({ it instanceof ExternalDependency } as Spec), dependencies)
+ }
- project.configurations.detachedConfiguration(sourceDependencies as Dependency[])
+ def sourceDependencies = dependencies.collect { ResolvedDependency resolvedDependency ->
+ def dependency = new DefaultExternalModuleDependency(resolvedDependency.moduleGroup, resolvedDependency.moduleName, resolvedDependency.moduleVersion,
+ resolvedDependency.configuration)
+ dependency.transitive = false
+ dependency.artifact { artifact ->
+ artifact.name = dependency.name
+ artifact.type = targetClassifier
+ artifact.extension = 'jar'
+ artifact.classifier = targetClassifier
+ }
+ dependency
}
+
+ project.configurations.detachedConfiguration(sourceDependencies as Dependency[])
}
}
View
12 gradle/assemble.gradle
@@ -48,13 +48,15 @@ task configurePopulateDependencies << {
ext {
baseCachesDir = "$gradle.gradleUserHomeDir/caches"
- cacheDir = "$baseCachesDir/artifacts-8"
+ cacheDir = "$baseCachesDir/artifacts-14"
metadata = "$cacheDir/module-metadata"
filestore = "$cacheDir/filestore"
}
def seen = []
libsConfigurations.each { configuration ->
+ def sourceArtifacts = sourcesFor(configuration).resolvedConfiguration.lenientConfiguration.getArtifacts(Specs.satisfyAll()).groupBy { it.moduleVersion.id }
+ def javadocArtifacts = javadocFor(configuration).resolvedConfiguration.lenientConfiguration.getArtifacts(Specs.satisfyAll()).groupBy { it.moduleVersion.id }
for (artifact in configuration.resolvedConfiguration.resolvedArtifacts) {
if (artifact in seen) continue
seen << artifact
@@ -62,6 +64,14 @@ task configurePopulateDependencies << {
if (!projectNames.contains(dependency.name)) {
populateDependencies.into("$dependency.group/$dependency.name/jars") {
from artifact.file // this will trigger the actual download if necessary
+ def sourceJar = sourceArtifacts[dependency]
+ if (sourceJar) {
+ from sourceJar.file
+ }
+ def javadocJar = javadocArtifacts[dependency]
+ if (javadocJar) {
+ from javadocJar.file
+ }
}
populateDependencies.from ("${metadata}/${dependency.group}/${dependency.name}/${dependency.version}") {
View
3  ...trap/src/main/groovy/org/codehaus/groovy/grails/resolve/AbstractIvyDependencyManager.java
@@ -680,7 +680,8 @@ private void addDefaultModuleConfigurations(EnhancedDefaultDependencyDescriptor
return;
}
- if (!pluginDep && !"org.grails".equals(descriptor.getDependencyId().getOrganisation())) {
+ String org = descriptor.getDependencyId().getOrganisation();
+ if(!pluginDep && !"org.grails".equals(org) && !"org.springframework.uaa".equals(org)) {
mappings = new ArrayList<String>(mappings);
if (includeJavadoc) {
View
2  ...-bootstrap/src/main/groovy/org/codehaus/groovy/grails/resolve/GrailsCoreDependencies.java
@@ -88,7 +88,6 @@ public Object doCall() {
rootDelegate.log("warn");
// Repositories
-
rootDelegate.repositories(new Closure(this, GrailsCoreDependencies.this) {
public Object doCall() {
RepositoriesConfigurer repositoriesDelegate = (RepositoriesConfigurer)getDelegate();
@@ -99,7 +98,6 @@ public Object doCall() {
return null;
}
});
-
// Dependencies
rootDelegate.dependencies(new Closure(this, GrailsCoreDependencies.this) {
View
36 ...-url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/RegexUrlMapping.java
@@ -16,23 +16,6 @@
import grails.util.GrailsWebUtil;
import groovy.lang.Closure;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URLEncoder;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.regex.PatternSyntaxException;
-
-import javax.servlet.ServletContext;
-
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -47,6 +30,16 @@
import org.springframework.validation.MapBindingResult;
import org.springframework.web.context.request.RequestContextHolder;
+import javax.servlet.ServletContext;
+import java.io.UnsupportedEncodingException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
/**
* <p>A UrlMapping implementation that takes a Grails URL pattern and turns it into a regex matcher so that
* URLs can be matched and information captured from the match.</p>
@@ -261,21 +254,18 @@ else if (value == null) {
// get rid of leading slash
v = v.substring(SLASH.length());
}
- String[] segs = v.split(SLASH);
- for (String segment : segs) {
- uri.append(SLASH).append(URLEncoder.encode(segment, encoding));
- }
+ uri.append(SLASH).append(new URI(null, null, v, null).toString());
}
else if (v.length() > 0) {
// original behavior
- uri.append(SLASH).append(URLEncoder.encode(v, encoding));
+ uri.append(SLASH).append(new URI(null, null, v, null).toString());
}
else {
// Stop processing tokens once we hit an empty one.
break;
}
}
- catch (UnsupportedEncodingException e) {
+ catch (URISyntaxException e) {
throw new ControllerExecutionException("Error creating URL for parameters [" +
paramValues + "], problem encoding URL part [" + buf + "]: " + e.getMessage(), e);
}
Please sign in to comment.
Something went wrong with that request. Please try again.