Mercurial > public > develkit
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 | 1 |
74 | 2 logger.debug("applying SSDT artifactory Gradle Settings") |
73 | 3 |
4 gradle.addListener(new ArtifactoryGradleSettings()) | |
5 | |
77 | 6 gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} |
7 logger.info "bamboo build: $gradle.bambooBuild" | |
76 | 8 |
75 | 9 subprojects { |
10 | |
11 task cleanLocal << { | |
12 def local = project.repositories.find { it.name == 'local' } | |
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 | 18 } |
19 } | |
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 | 25 task publishLocal(dependsOn: 'uploadArchives') << { println "published to local repository" } |
26 | |
27 } | |
28 | |
29 | |
73 | 30 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener { |
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 | 47 def void projectsEvaluated(Gradle gradle) { |
75 | 48 |
73 | 49 Project root = gradle.getRootProject() |
78
e47f80ef056b
finish cleanLocal. start adding artifactory plugin
smith@nwoca.org
parents:
77
diff
changeset
|
50 |
75 | 51 root.subprojects { |
74 | 52 |
53 configurations.all { | |
54 resolutionStrategy.cacheChangingModulesFor 120, 'minutes' | |
55 resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes' | |
56 } | |
57 | |
73 | 58 repositories { |
74 | 59 |
77 | 60 if (!gradle.bambooBuild) { |
61 flatDir { | |
62 name "local" | |
63 dirs System.properties['user.home'] + "/.ssdt/local-repo" | |
64 } | |
65 } | |
75 | 66 |
74 | 67 add(new org.apache.ivy.plugins.resolver.URLResolver()) { |
68 name = 'ssdt-snapshots' | |
69 m2compatible = true | |
70 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]') | |
72 addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/ivy-[revision].xml') | |
73 checkmodified = true | |
74 changingMatcher = 'regexp' | |
75 changingPattern = '.*SNAPSHOT' | |
76 } | |
77 add(new org.apache.ivy.plugins.resolver.URLResolver()) { | |
78 name = 'ssdt-releases' | |
79 m2compatible = false | |
80 url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-releases' | |
81 addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]') | |
82 addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/ivy-[revision].xml') | |
83 } | |
73 | 84 mavenRepo name: 'ssdt-repo', url: 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo' |
75 | 85 |
86 } | |
87 | |
88 uploadArchives { | |
89 repositories { | |
90 if ( project.repositories.find { it.name == 'local' } ) { | |
91 add project.repositories.local | |
92 } | |
93 } | |
94 } | |
73 | 95 } |
96 } | |
97 } |