Mercurial > public > develkit
comparison 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 |
comparison
equal
deleted
inserted
replaced
80:647840c0753d | 81:36b2fd9e3861 |
---|---|
1 | |
2 | 1 |
3 gradle.addListener(new ArtifactoryGradleSettings()) | 2 gradle.addListener(new ArtifactoryGradleSettings()) |
4 | 3 |
5 gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} | 4 gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} |
6 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild)" | 5 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild)" |
7 | 6 |
8 if (gradle.bambooBuild) { | 7 if (gradle.bambooBuild) { |
9 apply from: "${gradle.hasProperty('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation :'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip'}/artifactory.gradle" | 8 apply from: "${gradle.hasProperty('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation :'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip'}/artifactory.gradle" |
10 } | 9 } |
11 | 10 |
12 subprojects { | 11 task wrapper(type: Wrapper) { |
12 gradleVersion = '1.0-milestone-7' | |
13 } | |
14 | |
15 wrapper << { | |
16 // patch wrapper path for 1.0-milestone-7 bug (http://issues.gradle.org/browse/GRADLE-1823) | |
17 ant.replace(file: 'gradlew', token: '\\wrapper\\gradle-wrapper.jar',value:'/wrapper/gradle-wrapper.jar') | |
18 } | |
19 | |
20 | |
21 allprojects { | |
13 task cleanLocal << { | 22 task cleanLocal << { |
14 def local = project.repositories.find { it.name == 'local' } | 23 def local = project.repositories.find { it.name == 'local' } |
15 if ( local ) { | 24 if ( local ) { |
16 local.dirs.each { | 25 logger.info "removing local repo: $it" |
17 logger.info "removing local repo: $it" | 26 new File(System.properties['user.home'] + "/.ssdt/local-repo").deleteDir() |
18 it.deleteDir() | |
19 } | |
20 } | 27 } |
21 } | 28 } |
22 cleanLocal.onlyIf { | 29 cleanLocal.onlyIf { |
23 project.repositories.find { it.name == 'local' }?.dirs.any { it.exists() } | 30 project.repositories.any { it.name == 'local' } |
24 } | 31 } |
25 task publishLocal(dependsOn: 'uploadArchives') << { println "published to local repository" } | 32 task publishLocal(dependsOn: 'uploadArchives') << { println "published to local repository" } |
33 | |
34 task repositories << { | |
35 repositories.each { | |
36 println " $it.name" | |
37 } | |
38 } | |
26 } | 39 } |
27 | 40 |
28 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener { | 41 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener { |
29 | 42 |
30 def void projectsEvaluated(Gradle gradle) { | 43 def void projectsEvaluated(Gradle gradle) { |
31 | |
32 Project root = gradle.getRootProject() | 44 Project root = gradle.getRootProject() |
33 root.subprojects { | 45 root.allprojects { |
46 def thisProject = delegate | |
34 | 47 |
35 configurations.all { | 48 configurations.all { |
36 resolutionStrategy.cacheChangingModulesFor 120, 'minutes' | 49 resolutionStrategy.cacheChangingModulesFor 120, 'minutes' |
37 resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes' | 50 resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes' |
38 } | 51 } |
39 repositories { | 52 repositories { |
40 if (!gradle.bambooBuild) { | 53 if (!gradle.bambooBuild) { |
41 flatDir { | 54 add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) { |
42 name "local" | 55 name = 'local' |
43 dirs System.properties['user.home'] + "/.ssdt/local-repo" | 56 addIvyPattern System.properties['user.home'] + "/.ssdt/local-repo/[module]-ivy-[revision].xml" |
44 } | 57 addArtifactPattern System.properties['user.home'] + "/.ssdt/local-repo/[module]-[revision](-[classifier]).[ext]" |
58 descriptor = 'optional' | |
59 checkmodified = true | |
60 } | |
45 } | 61 } |
46 add(new org.apache.ivy.plugins.resolver.URLResolver()) { | 62 add(new org.apache.ivy.plugins.resolver.URLResolver()) { |
47 name = 'ssdt-snapshots' | 63 name = 'ssdt-snapshots' |
48 m2compatible = true | 64 m2compatible = true |
49 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots' | 65 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots' |
61 addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/ivy-[revision].xml') | 77 addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/ivy-[revision].xml') |
62 } | 78 } |
63 mavenRepo name: 'ssdt-repo', url: 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' | 79 mavenRepo name: 'ssdt-repo', url: 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' |
64 | 80 |
65 } | 81 } |
66 | 82 |
67 uploadArchives { | 83 if ( thisProject.repositories.find { it.name == 'local' } ) { |
68 repositories { | 84 uploadArchives { |
69 if ( project.repositories.find { it.name == 'local' } ) { | 85 repositories { |
70 add project.repositories.local | 86 add thisProject.repositories.local |
71 } | 87 } |
72 } | 88 } |
73 } | 89 } |
74 } | 90 } |
75 } | 91 } |