view init.gradle @ 75:02cc8e50945e

allow local file repo for local builds
author smith@nwoca.org
date Sun, 05 Feb 2012 15:44:08 -0500
parents a622ec40a570
children 15a5fd89d80b
line wrap: on
line source

logger.debug("applying SSDT artifactory Gradle Settings")

gradle.addListener(new ArtifactoryGradleSettings())

subprojects {

    task cleanLocal << {
        def local = project.repositories.find { it.name == 'local' } 
        println local
        if ( local ) {                

        }
    }
    
    task publishLocal(dependsOn: 'uploadArchives')  << { println "published to local repository" }

}
    

class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener {

    def void projectsEvaluated(Gradle gradle) {
        
        Project root = gradle.getRootProject()
        root.subprojects {
        
            configurations.all {
                resolutionStrategy.cacheChangingModulesFor 120, 'minutes'
                resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes'
            }
        
            buildscript {
                repositories {
                    mavenRepo name: 'plugins-repo', url: "http://repos.ssdt.nwoca.org/artifactory/gradle-plugins"
                }
            }
            
            repositories {

                flatDir {
                    name "local"
                    dirs System.properties['user.home'] + "/.ssdt/local-repo"
                }    
                
                add(new org.apache.ivy.plugins.resolver.URLResolver()) {
                  name = 'ssdt-snapshots'
                  m2compatible =  true
                  url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots'
                  addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]')
                  addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-snapshots/[organization]/[module]/ivy-[revision].xml')
                  checkmodified = true
                  changingMatcher = 'regexp'
                  changingPattern = '.*SNAPSHOT'                  
                }
                add(new org.apache.ivy.plugins.resolver.URLResolver()) {
                  name = 'ssdt-releases'
                  m2compatible = false
                  url = 'http://repos.ssdt.nwoca.org/artifactory/ssdt-releases'
                  addArtifactPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]')
                  addIvyPattern('http://repos.ssdt.nwoca.org/artifactory/ssdt-releases/[organization]/[module]/ivy-[revision].xml')
                }
                mavenRepo name: 'ssdt-repo', url: 'http://repos.ssdt.nwoca.org/artifactory/ssdt-repo'
                 
            }           
              
            uploadArchives {
                repositories {
                    if ( project.repositories.find { it.name == 'local' } ) {                
                        add project.repositories.local
                    }
                }
            }          
        }
    }
}