Skip to content

Commit

Permalink
Revert "Revert "introduce new configuration option that disables pars…
Browse files Browse the repository at this point in the history
…ing of dependencies.groovy completely so that only POM data is used. Parsing dependencies.groovy is disabled by default for new applications.""

This reverts commit 2758a05.
  • Loading branch information
Jeff Brown committed Dec 7, 2012
1 parent 2758a05 commit fcdafd5
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1342,11 +1342,14 @@ class BuildSettings extends AbstractBuildSettings {
try {
Script script = gcl.parseClass(pluginDependencyDescriptor)?.newInstance()
def pluginConfig = pluginSlurper.parse(script)
def pluginDependencyConfig = pluginConfig.grails.project.dependency.resolution
if (pluginDependencyConfig instanceof Closure) {
def excludeRules = pdd ? pdd.getExcludeRules(dependencyManager.configurationNames) : [] as ExcludeRule[]

dependencyManager.parseDependencies(pluginName, pluginDependencyConfig, excludeRules)
if(dependencyManager.isLegacyResolve()) {
def pluginDependencyConfig = pluginConfig.grails.project.dependency.resolution
if (pluginDependencyConfig instanceof Closure) {
def excludeRules = pdd ? pdd.getExcludeRules(dependencyManager.configurationNames) : [] as ExcludeRule[]

dependencyManager.parseDependencies(pluginName, pluginDependencyConfig, excludeRules)
}
}

def inlinePlugins = getInlinePluginsFromConfiguration(pluginConfig, dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public abstract class AbstractIvyDependencyManager {
protected final IvySettings ivySettings;
protected final BuildSettings buildSettings;
protected final Metadata metadata;
protected boolean legacyResolve = true;
private boolean offline;

private ChainResolver chainResolver;
Expand All @@ -168,6 +169,19 @@ public AbstractIvyDependencyManager(IvySettings ivySettings, BuildSettings build
updateChangingPattern();
}

/**
* Whether the legacy approach of parsing dependencies.groovy in addition to pom.xml should be used during dependency resolution
*
* @return True if it should
*/
public boolean isLegacyResolve() {
return legacyResolve;
}

public void setLegacyResolve(boolean legacyResolve) {
this.legacyResolve = legacyResolve;
}

public ResolveEngine getResolveEngine() {
return resolveEngine;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,13 @@ You cannot upgrade a plugin that is configured via BuildConfig.groovy, remove th
}

protected void resolvePluginJarDependencies(fullPluginName, pluginName, pluginInstallPath, Map runtimeDependencies = [:]) {
IvyDependencyManager dependencyManager = settings.dependencyManager
if(!dependencyManager.isLegacyResolve()) return;
def pluginDependencyDescriptor = new File("$pluginInstallPath/dependencies.groovy")
if (pluginDependencyDescriptor.exists() && !settings.isDependenciesExternallyConfigured()) {
eventHandler "StatusUpdate", "Resolving plugin JAR dependencies"
def callable = settings.pluginDependencyHandler()
callable.call(new File("$pluginInstallPath"))
IvyDependencyManager dependencyManager = settings.dependencyManager
dependencyManager.resetGrailsPluginsResolver()

def dependencyConfigurationsToAdd = [IvyDependencyManager.RUNTIME_CONFIGURATION, IvyDependencyManager.BUILD_CONFIGURATION, IvyDependencyManager.PROVIDED_CONFIGURATION]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class DependencyConfigurationConfigurer extends AbstractDependencyManagementConf

boolean pluginMode = false
boolean repositoryMode = false
boolean legacyResolve = true

DependencyConfigurationConfigurer(DependencyConfigurationContext context) {
super(context)
Expand All @@ -40,6 +41,10 @@ class DependencyConfigurationConfigurer extends AbstractDependencyManagementConf
dependencyManager.ivySettings.setVariable("ivy.checksums", checksumConfig)
}

void legacyResolve(boolean lr) {
dependencyManager.setLegacyResolve(lr)
}

void checksums(boolean enable) {
if (!enable) {
dependencyManager.ivySettings.setVariable("ivy.checksums", "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ grails.project.dependency.resolution = {
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility

repositories {
inherits true // Whether to inherit repository definitions from plugins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ grails.project.dependency.resolution = {
// excludes 'ehcache'
}
log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
grailsCentral()
// uncomment the below to enable remote dependency resolution
Expand Down

0 comments on commit fcdafd5

Please sign in to comment.