Permalink
Browse files

adds a build configuration for deploying repositories

  • Loading branch information...
1 parent 30dcc0e commit 9886fef9b8eaea8e919d7ccf89316040a4493c94 @literalice committed Dec 9, 2012
Showing with 36 additions and 0 deletions.
  1. +36 −0 grails-app/conf/BuildConfig.groovy
@@ -2,6 +2,42 @@ grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
+grails.release.scm.enabled = false
+
+private repositoryConfigLoader(name, path) {
+ def centralCredentialLocation = System.getProperty(path)
+ if (centralCredentialLocation) {
+ def credentialFile = new File(centralCredentialLocation)
+ if (credentialFile.canRead()) {
+ def credential = new Properties()
+ //noinspection GroovyMissingReturnStatement
+ credentialFile.withReader {
+ credential.load(it)
+ }
+
+ for (param in ["url", "username", "password", "type", "portal"]) {
+ if (credential.get(param)) {
+ grails.project.repos."${name}"."${param}" = credential.get(param)
+ }
+ }
+ println "Repository Configuration $name correctly loaded."
+ } else {
+ throw new IllegalStateException("Grails Central Credential File couldn't be read.")
+ }
+ }
+}
+
+for (repositoryName in ["releaseRepository", "snapshotRepository"]) {
+ repositoryConfigLoader(repositoryName, "${repositoryName}.credential.properties")
+ for (param in ["url", "type", "portal"]) {
+ if (grails.project.repos."${repositoryName}"."${param}") {
+ print "$repositoryName / $param : "
+ print "$repositoryName / $param : "
+ println grails.project.repos."${repositoryName}"."${param}"
+ }
+ }
+}
+
grails.project.dependency.resolution = {
inherits("global") {}

0 comments on commit 9886fef

Please sign in to comment.