Mercurial > public > develkit
diff init.gradle @ 81:36b2fd9e3861
fix handling of multi-project artifacts and local repos
author | smith@nwoca.org |
---|---|
date | Thu, 09 Feb 2012 15:07:00 -0500 |
parents | 647840c0753d |
children | c7cbf5e9db74 |
line wrap: on
line diff
--- a/init.gradle Tue Feb 07 22:54:05 2012 -0500 +++ b/init.gradle Thu Feb 09 15:07:00 2012 -0500 @@ -1,4 +1,3 @@ - gradle.addListener(new ArtifactoryGradleSettings()) @@ -9,39 +8,56 @@ apply from: "${gradle.hasProperty('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation :'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip'}/artifactory.gradle" } -subprojects { +task wrapper(type: Wrapper) { + gradleVersion = '1.0-milestone-7' +} + +wrapper << { + // patch wrapper path for 1.0-milestone-7 bug (http://issues.gradle.org/browse/GRADLE-1823) + ant.replace(file: 'gradlew', token: '\\wrapper\\gradle-wrapper.jar',value:'/wrapper/gradle-wrapper.jar') +} + + +allprojects { task cleanLocal << { def local = project.repositories.find { it.name == 'local' } - if ( local ) { - local.dirs.each { - logger.info "removing local repo: $it" - it.deleteDir() - } + if ( local ) { + logger.info "removing local repo: $it" + new File(System.properties['user.home'] + "/.ssdt/local-repo").deleteDir() } } cleanLocal.onlyIf { - project.repositories.find { it.name == 'local' }?.dirs.any { it.exists() } + project.repositories.any { it.name == 'local' } } task publishLocal(dependsOn: 'uploadArchives') << { println "published to local repository" } + + task repositories << { + repositories.each { + println " $it.name" + } + } } class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener { def void projectsEvaluated(Gradle gradle) { - Project root = gradle.getRootProject() - root.subprojects { + root.allprojects { + def thisProject = delegate configurations.all { resolutionStrategy.cacheChangingModulesFor 120, 'minutes' resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes' } repositories { - if (!gradle.bambooBuild) { - flatDir { - name "local" - dirs System.properties['user.home'] + "/.ssdt/local-repo" - } + if (!gradle.bambooBuild) { + add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) { + name = 'local' + addIvyPattern System.properties['user.home'] + "/.ssdt/local-repo/[module]-ivy-[revision].xml" + addArtifactPattern System.properties['user.home'] + "/.ssdt/local-repo/[module]-[revision](-[classifier]).[ext]" + descriptor = 'optional' + checkmodified = true + } } add(new org.apache.ivy.plugins.resolver.URLResolver()) { name = 'ssdt-snapshots' @@ -63,11 +79,11 @@ mavenRepo name: 'ssdt-repo', url: 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' } - - uploadArchives { - repositories { - if ( project.repositories.find { it.name == 'local' } ) { - add project.repositories.local + + if ( thisProject.repositories.find { it.name == 'local' } ) { + uploadArchives { + repositories { + add thisProject.repositories.local } } }