Skip to content
This repository
tree: 9ab78ddbbc
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 201 lines (160 sloc) 5.322 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
buildscript {
    repositories {
        maven { url 'http://repo.springsource.org/plugins-release' }
    }
    dependencies {
        classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.5'
    }
}

description = 'Spring Shell'
group = 'org.springframework.shell'

repositories {
  maven { url "http://repo.springsource.org/libs-snapshot" }
  maven { url "http://repo.springsource.org/plugins-release" }
  maven { url "http://spring-roo-repository.springsource.org/release" }
}

apply plugin: "java"
apply plugin: 'eclipse'
apply plugin: 'idea'
apply from: "$rootDir/maven.gradle"
apply plugin: 'docbook-reference'
apply plugin: 'application'

[compileJava, compileTestJava]*.options*.compilerArgs = ["-Xlint:-serial", "-Xlint:unchecked", "-Xlint:rawtypes"]

dependencies {
    compile "org.springframework:spring-core:$springVersion"
    compile "org.springframework:spring-context-support:$springVersion"
    compile "commons-io:commons-io:$commonsioVersion"
    compile "net.sourceforge.jline:jline:$jlineVersion"
    compile "org.fusesource.jansi:jansi:$jansiVersion"
    compile "cglib:cglib:$cglibVersion"

    
    // Testing
    testCompile "junit:junit:$junitVersion"
    testCompile "org.mockito:mockito-core:$mockitoVersion"
}

sourceCompatibility = 1.5
targetCompatibility = 1.5

javadoc {
  ext.srcDir = file("${projectDir}/docs/src/api")
  destinationDir = file("${buildDir}/api")
  ext.tmpDir = file("${buildDir}/api-work")
  
  configure(options) {
      stylesheetFile = file("${srcDir}/spring-javadoc.css")
      overview = "${srcDir}/overview.html"
      docFilesSubDirs = true
      outputLevel = org.gradle.external.javadoc.JavadocOutputLevel.QUIET
      breakIterator = true
      showFromProtected()
      groups = [
        'Spring Shell' : ['org.springframework.shell*'],
      ]
  
     links = [
        "http://static.springframework.org/spring/docs/3.1.x/javadoc-api",
        "http://download.oracle.com/javase/6/docs/api",
     ]
     
     //exclude "org/springframework/data/redis/config/**"
  }
    
  title = "${rootProject.description} ${version} API"
}

jar {
    manifest.attributes['Implementation-Title'] = 'spring-shell'
    manifest.attributes['Implementation-Version'] = project.version

    from("$rootDir/docs/src/info") {
        include "license.txt"
        include "notice.txt"
        into "META-INF"
        expand(copyright: new Date().format('yyyy'), version: project.version)
    }
}

task sourcesJar(type: Jar, dependsOn:classes) {
    classifier = 'sources'
    from sourceSets.main.allJava
}

task javadocJar(type: Jar) {
    classifier = 'javadoc'
    from javadoc
}

reference {
    sourceDir = file('docs/src/reference/docbook')
}


task docsZip(type: Zip) {
    group = 'Distribution'
    classifier = 'docs'
    description = "Builds -${classifier} archive containing api and reference for deployment"

    from('docs/src/info') {
        include 'changelog.txt'
    }

    from (javadoc) {
        into 'api'
    }

    from (reference) {
        into 'reference'
    }
}

task schemaZip(type: Zip) {
    group = 'Distribution'
    classifier = 'schema'
    description = "Builds -${classifier} archive containing all XSDs for deployment"

    def Properties schemas = new Properties();
    
    sourceSets.main.resources.find {
        it.path.endsWith('META-INF' + File.separator + 'spring.schemas')
    }?.withInputStream { schemas.load(it) }

    ext.paths = [] as Set
    
    for (def key : schemas.keySet()) {
        def shortName = key.replaceAll(/http.*schema.(.*).spring-.*/, '$1')
        assert shortName != key
        File xsdFile = sourceSets.main.resources.find {
            it.path.replace('\\', '/').endsWith(schemas.get(key))
        }
        assert xsdFile != null
        def input = xsdFile.path

        if (!paths.contains(input)) {
            paths.add(input)
            into (shortName) {
               from input
            }
        }
    }
}

task distroZip(type: Zip, dependsOn: [jar, docsZip, sourcesJar, javadocJar]) {
    group = 'Distribution'
    classifier = 'dist'
    description = "Builds -${classifier} archive, containing all jars and docs, " +
                  "suitable for community download page."

    ext.zipRootDir = "${project.name}-${project.version}"

    into (zipRootDir) {
        from('docs/src/info') {
            include 'readme.txt'
            include 'license.txt'
            include 'notice.txt'
            expand(copyright: new Date().format('yyyy'), version: project.version)
        }

        from('samples/') {
            into 'samples'
            exclude '.gradle/'
            exclude 'build/'
        }
        
        from(zipTree(docsZip.archivePath)) {
            into "docs"
        }

// from(zipTree(schemaZip.archivePath)) {
// into "schema"
// }
        into ("dist") {
            from rootProject.collect { project -> project.libsDir }
        }
    }
}

artifacts {
    archives sourcesJar
    archives javadocJar

    archives docsZip
// archives schemaZip
    archives distroZip
}

task wrapper(type: Wrapper) {
    description = 'Generates gradlew[.bat] scripts'
    gradleVersion = '1.2'
}


mainClassName = "org.springframework.shell.Bootstrap"

assemble.dependsOn = ['jar', 'sourcesJar']
defaultTasks 'build'
Something went wrong with that request. Please try again.