comparison init.gradle @ 114:9ed6a36104ed

Improve dependency resolution performance: use gradle resolver instead of ivy and use new repo which does not cnotain snapshots
author smith@nwoca.org
date Fri, 26 Oct 2012 21:32:27 +0100
parents 029db4d977fe
children 8ddd1a6fa4ea
comparison
equal deleted inserted replaced
113:86fdadd7468a 114:9ed6a36104ed
3 3
4 ant.property(file: System.getProperty('user.home') + "/.ssdt/private.properties") 4 ant.property(file: System.getProperty('user.home') + "/.ssdt/private.properties")
5 gradle.ext.ivyUserDir = ant.properties['ivy.default.ivy.user.dir'] ?: System.getProperty('user.home') + "/.ivy2" 5 gradle.ext.ivyUserDir = ant.properties['ivy.default.ivy.user.dir'] ?: System.getProperty('user.home') + "/.ivy2"
6 6
7 loadEnvironments() 7 loadEnvironments()
8
8 9
9 gradle.addListener(new ArtifactoryGradleSettings()) 10 gradle.addListener(new ArtifactoryGradleSettings())
10 11
11 gradle.ext.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')} 12 gradle.ext.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')}
12 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild)" 13 logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild)"
41 project.repositories.any { it.name == 'local' } 42 project.repositories.any { it.name == 'local' }
42 } 43 }
43 44
44 } 45 }
45 46
47
46 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener { 48 class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener {
47 49
48 def void projectsEvaluated(Gradle gradle) { 50 def void projectsEvaluated(Gradle gradle) {
49 def ssdtArtifactory = 'http://repos.ssdt.nwoca.org/artifactory' 51 def ssdtArtifactory = 'http://repos.ssdt.nwoca.org/artifactory'
50 Project root = gradle.getRootProject() 52 Project root = gradle.getRootProject()
51 root.allprojects { 53 root.allprojects {
54
52 def thisProject = delegate 55 def thisProject = delegate
53 configurations.all { 56 configurations.all {
54 resolutionStrategy.cacheChangingModulesFor 60 * 60 * 8, 'seconds' 57 resolutionStrategy.cacheChangingModulesFor 60 * 60 * 8, 'seconds'
55 resolutionStrategy.cacheDynamicVersionsFor 60 * 60 * 8, 'seconds' 58 resolutionStrategy.cacheDynamicVersionsFor 60 * 60 * 8, 'seconds'
56 } 59 }
64 checkmodified = true 67 checkmodified = true
65 changingMatcher = 'regexp' 68 changingMatcher = 'regexp'
66 changingPattern = '.*SNAPSHOT' 69 changingPattern = '.*SNAPSHOT'
67 force = true 70 force = true
68 } 71 }
69 } 72 }
73
70 add(new org.apache.ivy.plugins.resolver.URLResolver()) { 74 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
71 name = 'ssdt-snapshots' 75 name = 'ssdt-snapshots'
72 m2compatible = true 76 m2compatible = true
73 def url = "${ssdtArtifactory}/ssdt-snapshots" 77 def url = "${ssdtArtifactory}/ssdt-snapshots"
74 addArtifactPattern("${url}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]") 78 addArtifactPattern("${url}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]")
75 addArtifactPattern("${url}/[organization]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]") 79 addArtifactPattern("${url}/[organization]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]")
76 addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml") 80 addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml")
77 checkmodified = true 81 checkmodified = true
78 changingMatcher = 'regexp' 82 changingMatcher = 'regexp'
79 changingPattern = '.*SNAPSHOT' 83 changingPattern = '.*SNAPSHOT'
80 } 84 }
81 add(new org.apache.ivy.plugins.resolver.URLResolver()) { 85
86 add(new org.apache.ivy.plugins.resolver.URLResolver()) {
82 name = 'ssdt-releases' 87 name = 'ssdt-releases'
83 m2compatible = false 88 m2compatible = false
84 def url = "${ssdtArtifactory}/ssdt-releases" 89 def url = "${ssdtArtifactory}/ssdt-releases"
85 addArtifactPattern("${url}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]") 90 addArtifactPattern("${url}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]")
86 addArtifactPattern("${url}/[organization]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]") 91 addArtifactPattern("${url}/[organization]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]")
87 addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml") 92 addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml")
88 } 93 }
89 mavenRepo name: 'ssdt-repo', url: "${ssdtArtifactory}/ssdt-repo" 94
90 95
96 maven {
97 name = 'ssdt-repository'
98 url = "${ssdtArtifactory}/repository"
99 }
100
101
91 } 102 }
92 103
93 if ( thisProject.repositories.find { it.name == 'local' } ) { 104 if ( thisProject.repositories.find { it.name == 'local' } ) {
94 uploadArchives { 105 uploadArchives {
95 repositories { 106 repositories {