annotate init.gradle @ 78:e47f80ef056b

finish cleanLocal. start adding artifactory plugin
author smith@nwoca.org
date Mon, 06 Feb 2012 18:40:34 -0500
parents e9605748e5ce
children f0c29c1ac1f4
rev   line source
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
1
74
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
2 logger.debug("applying SSDT artifactory Gradle Settings")
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
3
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
4 gradle.addListener(new ArtifactoryGradleSettings())
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
5
77
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
6 gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')}
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
7 logger.info "bamboo build: $gradle.bambooBuild"
76
15a5fd89d80b add display of envs for bamboo testing
smith@nwoca.org
parents: 75
diff changeset
8
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
9 subprojects {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
10
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
11 task cleanLocal << {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
12 def local = project.repositories.find { it.name == 'local' }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
13 if ( local ) {
78
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
14 local.dirs.each {
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
15 logger.info "removing local repo: $it"
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
16 it.deleteDir()
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
17 }
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
18 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
19 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
20
78
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
21 cleanLocal.onlyIf {
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
22 project.repositories.find { it.name == 'local' }?.dirs.any { it.exists() }
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
23 }
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
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 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
28
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
29
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
30 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener {
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
31
78
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
32 def void projectsLoaded(Gradle gradle) {
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
33
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
34 Project root = gradle.getRootProject()
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
35
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
36 root.allprojects {
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
37 buildscript {
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
38 repositories {
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
39 mavenRepo name: 'plugins-repo', url: "http://repos.ssdt.nwoca.org/artifactory/gradle-plugins"
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
40 }
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
41 dependencies {
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
42 classpath(group: 'org.jfrog.buildinfo', name: 'build-info-extractor-gradle', version: '2.0.10')
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
43 }
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
44 }
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
45 }
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
46 }
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
47 def void projectsEvaluated(Gradle gradle) {
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
48
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
49 Project root = gradle.getRootProject()
78
e47f80ef056b finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents: 77
diff changeset
50
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
51 root.subprojects {
74
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
52
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
53 configurations.all {
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
54 resolutionStrategy.cacheChangingModulesFor 120, 'minutes'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
55 resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
56 }
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
57
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
58 repositories {
74
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
59
77
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
60 if (!gradle.bambooBuild) {
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
61 flatDir {
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
62 name "local"
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
63 dirs System.properties['user.home'] + "/.ssdt/local-repo"
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
64 }
e9605748e5ce disable local publish for bamboo builds
smith@nwoca.org
parents: 76
diff changeset
65 }
75
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
66
74
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
67 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
68 name = 'ssdt-snapshots'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
69 m2compatible = true
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
70 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
71 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
72 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
73 checkmodified = true
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
74 changingMatcher = 'regexp'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
75 changingPattern = '.*SNAPSHOT'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
76 }
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
77 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
78 name = 'ssdt-releases'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
79 m2compatible = false
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
80 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-releases'
a622ec40a570 update repo definitions
smith@nwoca.org
parents: 73
diff changeset
81 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
82 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
83 }
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
84 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
85
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
86 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
87
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
88 uploadArchives {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
89 repositories {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
90 if ( project.repositories.find { it.name == 'local' } ) {
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
91 add project.repositories.local
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
92 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
93 }
02cc8e50945e allow local file repo for local builds
smith@nwoca.org
parents: 74
diff changeset
94 }
73
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
95 }
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
96 }
174b4bcfd2f2 fix gradle init script
smith@nwoca.org
parents:
diff changeset
97 }