view init.gradle @ 92:90325a10fe95

correct develkit location
author smith@nwoca.org
date Wed, 22 Feb 2012 04:50:48 +0000
parents b72ba5cb5c53
children 1290b23e7b76
line wrap: on
line source

gradle.ssdtDevelkitLocation = gradle.hasProperty('ssdtDevelkitLocation') ? gradle.ssdtDevelkitLocation : 'http://hg.ssdt-ohio.org/browse/public/develkit'

gradle.addListener(new ArtifactoryGradleSettings())

gradle.bambooBuild = System.getenv().any { it.key.startsWith('BAMBOO')}
logger.info "applying SSDT artifactory Gradle Settings (bamboo: $gradle.bambooBuild)"

if (gradle.bambooBuild) {
   gradle.ssdtGradlekitLocation = gradle.hasProperty('ssdtGradlekitLocation') ? gradle.ssdtGradlekitLocation : 'http://hg.ssdt-ohio.org/ssdt/gradlekit/raw-file/tip'
   apply from: "${gradle.ssdtGradlekitLocation}/artifactory.gradle" 
}


apply from: "${gradle.ssdtDevelkitLocation}/metrics.gradle"   

task wrapper(type: Wrapper) {
    gradleVersion = '1.0-milestone-7'
}

wrapper << {
    // patch wrapper path for 1.0-milestone-7 (http://issues.gradle.org/browse/GRADLE-1823)
    ant.replace(file: 'gradlew', token: '\\wrapper\\gradle-wrapper.jar',value:'/wrapper/gradle-wrapper.jar')
}

allprojects {

    task cleanLocal(description: "removes all artifacts from developer's local repository") << {

        def local = project.repositories.find { it.name == 'local' } 
        if ( local ) {                  
            logger.info "removing local repo: $it"
            new File(System.properties['user.home'] + "/.ssdt/local-repo").deleteDir() 
        }
    }    
    
    cleanLocal.onlyIf { 
        project.repositories.any { it.name == 'local' }
    }    
    
}

class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener {
    
    def void projectsEvaluated(Gradle gradle) {
        def ssdtArtifactory = 'http://repos.ssdt.nwoca.org/artifactory'
        Project root = gradle.getRootProject()       
        root.allprojects {
            def thisProject = delegate        
            configurations.all {
                resolutionStrategy.cacheChangingModulesFor 120, 'minutes'
                resolutionStrategy.cacheDynamicVersionsFor 120, 'minutes'
            }        
            repositories {
                if (!gradle.bambooBuild) {                         
                    add(new org.apache.ivy.plugins.resolver.FileSystemResolver()) {
                        name = 'local'
                        addIvyPattern System.properties['user.home'] + "/.ssdt/local-repo/[module]-ivy-[revision].xml"
                        addArtifactPattern System.properties['user.home'] + "/.ssdt/local-repo/[module]-[revision](-[classifier]).[ext]"
                        descriptor = 'optional'
                        checkmodified = true
                    }                       
                }                
                add(new org.apache.ivy.plugins.resolver.URLResolver()) {
                    name = 'ssdt-snapshots'
                    m2compatible =  true
                    url = "${ssdtArtifactory}/ssdt-snapshots"
                    addArtifactPattern("${url}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]")
                    addIvyPattern("${url}/[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 = "${ssdtArtifactory}/ssdt-releases"
                    addArtifactPattern("${url}/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]")
                    addIvyPattern("${url}/[organization]/[module]/ivy-[revision].xml")                   
                }
                mavenRepo name: 'ssdt-repo', url: "${ssdtArtifactory}/ssdt-repo"
                 
            }           
            
            if ( thisProject.repositories.find { it.name == 'local' } ) {
                uploadArchives {
                   repositories {                     
                         add thisProject.repositories.local
                    }
                }
                
                thisProject.tasks.add("publishLocal") {
                    description = "Publishes this projects artifacts to developer's local repository"
                    dependsOn = ["uploadArchives"]
                }
            }          
        }
    }
}