Mercurial > public > develkit
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 | 1 |
2 | |
3 gradle.addListener(new ArtifactoryGradleSettings()) | |
4 | |
77 | 5 gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} |
79 | 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 } | |
76 | 11 |
75 | 12 subprojects { |
13 task cleanLocal << { | |
14 def local = project.repositories.find { it.name == 'local' } | |
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 | 20 } |
79 | 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 | 24 } |
75 | 25 task publishLocal(dependsOn: 'uploadArchives') << { println "published to local repository" } |
26 } | |
27 | |
73 | 28 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener { |
79 | 29 |
73 | 30 def void projectsEvaluated(Gradle gradle) { |
75 | 31 |
79 | 32 Project root = gradle.getRootProject() |
75 | 33 root.subprojects { |
74 | 34 |
35 configurations.all { | |
36 resolutionStrategy.cacheChangingModulesFor 120, 'minutes' | |
37 resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes' | |
79 | 38 } |
73 | 39 repositories { |
77 | 40 if (!gradle.bambooBuild) { |
41 flatDir { | |
42 name "local" | |
43 dirs System.properties['user.home'] + "/.ssdt/local-repo" | |
44 } | |
79 | 45 } |
74 | 46 add(new org.apache.ivy.plugins.resolver.URLResolver()) { |
47 name = 'ssdt-snapshots' | |
48 m2compatible = true | |
49 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots' | |
50 addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]') | |
51 addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/ivy-[revision].xml') | |
52 checkmodified = true | |
53 changingMatcher = 'regexp' | |
54 changingPattern = '.*SNAPSHOT' | |
55 } | |
56 add(new org.apache.ivy.plugins.resolver.URLResolver()) { | |
57 name = 'ssdt-releases' | |
58 m2compatible = false | |
59 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-releases' | |
60 addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]') | |
61 addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/ivy-[revision].xml') | |
62 } | |
73 | 63 mavenRepo name: 'ssdt-repo', url: 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' |
75 | 64 |
65 } | |
66 | |
67 uploadArchives { | |
68 repositories { | |
69 if ( project.repositories.find { it.name == 'local' } ) { | |
70 add project.repositories.local | |
71 } | |
72 } | |
73 } | |
73 | 74 } |
75 } | |
76 } |