Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: async
Fetching contributors…

Cannot retrieve contributors at this time

82 lines (73 sloc) 2.915 kB
/*
* Copyright 2011 SpringSource
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import groovy.xml.MarkupBuilder
import org.apache.commons.io.*
/**
* Refreshes application dependencies, installing any necessary plugins as necessary
*
* @author Graeme Rocher
*
* @since 1.2
*/
includeTargets << grailsScript("_PluginDependencies")
target(refreshDependencies:"Refreshes application dependencies, installing any necessary plugins as necessary") {
resolveDependencies()
if (argsMap.params) {
// write data to file
def f = new File(argsMap.params[0])
f.withWriter { writer ->
def xml = new MarkupBuilder(writer)
xml.dependencies {
xml.build {
handleArtifactReport(grailsSettings.buildResolveReport.resolvedArtifacts, xml)
}
xml.compile {
handleArtifactReport(grailsSettings.compileResolveReport.resolvedArtifacts, xml)
}
xml.test {
handleArtifactReport(grailsSettings.testResolveReport.resolvedArtifacts, xml)
}
xml.runtime {
handleArtifactReport(grailsSettings.runtimeResolveReport.resolvedArtifacts, xml)
}
xml.provided {
handleArtifactReport(grailsSettings.providedResolveReport.resolvedArtifacts, xml)
}
}
}
}
event "StatusFinal", ["Dependencies refreshed."]
}
private handleArtifactReport(allReports, xml) {
allReports.findAll { downloadReport ->
!downloadReport.file.name.endsWith("-sources.jar") && !downloadReport.file.name.endsWith("-javadoc.jar")
}.each { downloadReport ->
def mrid = downloadReport.dependency
xml.dependency(group:mrid.group, name:mrid.name, version:mrid.version) {
xml.jar downloadReport.file
def baseName = FilenameUtils.getBaseName(downloadReport.file.name)
def sourceJar = allReports.find { "$baseName-sources.jar" == it.file?.name}
if (sourceJar) {
xml.source sourceJar.file
}
def javadocJar = allReports.find { "$baseName-javadoc.jar" == it.file?.name}
if (javadocJar) {
xml.javadoc javadocJar.file
}
}
}
}
setDefaultTarget(refreshDependencies)
Jump to Line
Something went wrong with that request. Please try again.