comparison init.gradle @ 79:f0c29c1ac1f4

finish gradle to artifactory publishing
author smith@nwoca.org
date Tue, 07 Feb 2012 22:21:53 -0500
parents e47f80ef056b
children 647840c0753d
comparison
equal deleted inserted replaced
78:e47f80ef056b 79:f0c29c1ac1f4
1 1
2 logger.debug("applying SSDT artifactory Gradle Settings")
3 2
4 gradle.addListener(new ArtifactoryGradleSettings()) 3 gradle.addListener(new ArtifactoryGradleSettings())
5 4
6 gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} 5 gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')}
7 logger.info "bamboo build: $gradle.bambooBuild" 6 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild)"
7
8 if (gradle.bambooBuild) {
9 apply from: "${gradle.hasProperty('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation :'http://hg.ssdt-ohio.org/browse/ssdt/gradlekit'}/artifactory.gradle"
10 }
8 11
9 subprojects { 12 subprojects {
10
11 task cleanLocal << { 13 task cleanLocal << {
12 def local = project.repositories.find { it.name == 'local' } 14 def local = project.repositories.find { it.name == 'local' }
13 if ( local ) { 15 if ( local ) {
14 local.dirs.each { 16 local.dirs.each {
15 logger.info "removing local repo: $it" 17 logger.info "removing local repo: $it"
16 it.deleteDir() 18 it.deleteDir()
17 } 19 }
18 } 20 }
19 } 21 }
20
21 cleanLocal.onlyIf { 22 cleanLocal.onlyIf {
22 project.repositories.find { it.name == 'local' }?.dirs.any { it.exists() } 23 project.repositories.find { it.name == 'local' }?.dirs.any { it.exists() }
23 } 24 }
24
25 task publishLocal(dependsOn: 'uploadArchives') << { println "published to local repository" } 25 task publishLocal(dependsOn: 'uploadArchives') << { println "published to local repository" }
26
27 } 26 }
28
29 27
30 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener { 28 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener {
31 29
32 def void projectsLoaded(Gradle gradle) {
33
34 Project root = gradle.getRootProject()
35
36 root.allprojects {
37 buildscript {
38 repositories {
39 mavenRepo name: 'plugins-repo', url: "http://repos.ssdt.nwoca.org/artifactory/gradle-plugins"
40 }
41 dependencies {
42 classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.10')
43 }
44 }
45 }
46 }
47 def void projectsEvaluated(Gradle gradle) { 30 def void projectsEvaluated(Gradle gradle) {
48 31
49 Project root = gradle.getRootProject() 32 Project root = gradle.getRootProject()
50
51 root.subprojects { 33 root.subprojects {
52 34
53 configurations.all { 35 configurations.all {
54 resolutionStrategy.cacheChangingModulesFor 120, 'minutes' 36 resolutionStrategy.cacheChangingModulesFor 120, 'minutes'
55 resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes' 37 resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes'
56 } 38 }
57
58 repositories { 39 repositories {
59
60 if (!gradle.bambooBuild) { 40 if (!gradle.bambooBuild) {
61 flatDir { 41 flatDir {
62 name "local" 42 name "local"
63 dirs System.properties['user.home'] + "/.ssdt/local-repo" 43 dirs System.properties['user.home'] + "/.ssdt/local-repo"
64 } 44 }
65 } 45 }
66
67 add(new org.apache.ivy.plugins.resolver.URLResolver()) { 46 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
68 name = 'ssdt-snapshots' 47 name = 'ssdt-snapshots'
69 m2compatible = true 48 m2compatible = true
70 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots' 49 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots'
71 addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]') 50 addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]')