annotate 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
rev   line source
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
1
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
2
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
3 gradle.addListener(new ArtifactoryGradleSettings())
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
4
77
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
5 gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')}
79
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
6 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild)"
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
7
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
8 if (gradle.bambooBuild) {
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
9 apply from: "${gradle.hasProperty('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation :'http://hg.ssdt-ohio.org/browse/ssdt/gradlekit'}/artifactory.gradle"
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
10 }
76
15a5fd89d80b add display of envs for bamboo testing
smith@nwoca.org
parents: 75
diff changeset
11
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
12 subprojects {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
13 task cleanLocal << {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
14 def local = project.repositories.find { it.name == 'local' }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
15 if ( local ) {
78
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
16 local.dirs.each {
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
17 logger.info "removing local repo: $it"
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
18 it.deleteDir()
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
19 }
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
20 }
79
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
21 }
78
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
22 cleanLocal.onlyIf {
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
23 project.repositories.find { it.name == 'local' }?.dirs.any { it.exists() }
79
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
24 }
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
25 task publishLocal(dependsOn: 'uploadArchives') << { println "published to local repository" }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
26 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
27
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
28 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener {
79
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
29
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
30 def void projectsEvaluated(Gradle gradle) {
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
31
79
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
32 Project root = gradle.getRootProject()
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
33 root.subprojects {
74
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
34
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
35 configurations.all {
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
36 resolutionStrategy.cacheChangingModulesFor 120, 'minutes'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
37 resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes'
79
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
38 }
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
39 repositories {
77
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
40 if (!gradle.bambooBuild) {
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
41 flatDir {
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
42 name "local"
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
43 dirs System.properties['user.home'] + "/.ssdt/local-repo"
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
44 }
79
f0c29c1ac1f4 finish gradle to artifactory publishing
smith@nwoca.org
parents: 78
diff changeset
45 }
74
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
46 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
47 name = 'ssdt-snapshots'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
48 m2compatible = true
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
49 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
50 addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]')
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
51 addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/ivy-[revision].xml')
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
52 checkmodified = true
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
53 changingMatcher = 'regexp'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
54 changingPattern = '.*SNAPSHOT'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
55 }
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
56 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
57 name = 'ssdt-releases'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
58 m2compatible = false
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
59 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-releases'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
60 addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]')
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
61 addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/ivy-[revision].xml')
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
62 }
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
63 mavenRepo name: 'ssdt-repo', url: 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo'
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
64
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
65 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
66
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
67 uploadArchives {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
68 repositories {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
69 if ( project.repositories.find { it.name == 'local' } ) {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
70 add project.repositories.local
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
71 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
72 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
73 }
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
74 }
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
75 }
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
76 }