|
| 1 | +description = 'Spring Integration IP Extensions' |
| 2 | + |
| 3 | +buildscript { |
| 4 | + repositories { |
| 5 | + maven { url 'https://repo.springsource.org/plugins-snapshot' } |
| 6 | + } |
| 7 | + dependencies { |
| 8 | + classpath 'org.springframework.build.gradle:docbook-reference-plugin:0.1.5' |
| 9 | + } |
| 10 | +} |
| 11 | + |
| 12 | +apply plugin: 'java' |
| 13 | +apply from: "${rootProject.projectDir}/publish-maven.gradle" |
| 14 | +apply plugin: 'eclipse' |
| 15 | +apply plugin: 'idea' |
| 16 | + |
| 17 | +group = 'org.springintegration.ip.extensions' |
| 18 | + |
| 19 | +repositories { |
| 20 | + maven { url 'http://repo.springsource.org/libs-milestone' } |
| 21 | + maven { url 'http://repo.springsource.org/plugins-release' } // for bundlor |
| 22 | +} |
| 23 | + |
| 24 | +sourceCompatibility=1.6 |
| 25 | +targetCompatibility=1.6 |
| 26 | + |
| 27 | +ext { |
| 28 | + aspectjVersion = '1.6.8' |
| 29 | + cglibVersion = '2.2' |
| 30 | + commonsNetVersion = '3.0.1' |
| 31 | + javaxActivationVersion = '1.1.1' |
| 32 | + junitVersion = '4.10' |
| 33 | + log4jVersion = '1.2.12' |
| 34 | + mockitoVersion = '1.9.0' |
| 35 | + springVersion = '3.1.3.RELEASE' |
| 36 | + springIntegrationVersion = '2.2.0.RELEASE' |
| 37 | +} |
| 38 | + |
| 39 | +eclipse { |
| 40 | + project { |
| 41 | + natures += 'org.springframework.ide.eclipse.core.springnature' |
| 42 | + } |
| 43 | +} |
| 44 | + |
| 45 | +sourceSets { |
| 46 | + test { |
| 47 | + resources { |
| 48 | + srcDirs = ['src/test/resources', 'src/test/java'] |
| 49 | + } |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +// See http://www.gradle.org/docs/current/userguide/dependency_management.html#sub:configurations |
| 54 | +// and http://www.gradle.org/docs/current/dsl/org.gradle.api.artifacts.ConfigurationContainer.html |
| 55 | +configurations { |
| 56 | + jacoco //Configuration Group used by Sonar to provide Code Coverage using JaCoCo |
| 57 | +} |
| 58 | + |
| 59 | +dependencies { |
| 60 | + compile "org.springframework.integration:spring-integration-ip:$springIntegrationVersion" |
| 61 | + compile "commons-codec:commons-codec:1.5" |
| 62 | + testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion" |
| 63 | + testCompile "junit:junit-dep:$junitVersion" |
| 64 | + testCompile "log4j:log4j:$log4jVersion" |
| 65 | + testCompile "org.mockito:mockito-all:$mockitoVersion" |
| 66 | + testCompile "org.springframework:spring-test:$springVersion" |
| 67 | + jacoco group: "org.jacoco", name: "org.jacoco.agent", version: "0.5.6.201201232323", classifier: "runtime" |
| 68 | +} |
| 69 | + |
| 70 | +// enable all compiler warnings; individual projects may customize further |
| 71 | +ext.xLintArg = '-Xlint:all' |
| 72 | +[compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg] |
| 73 | + |
| 74 | +test { |
| 75 | + // suppress all console output during testing unless running `gradle -i` |
| 76 | + logging.captureStandardOutput(LogLevel.INFO) |
| 77 | + jvmArgs "-javaagent:${configurations.jacoco.asPath}=destfile=${buildDir}/jacoco.exec,includes=*" |
| 78 | +} |
| 79 | + |
| 80 | +task sourcesJar(type: Jar) { |
| 81 | + classifier = 'sources' |
| 82 | + from sourceSets.main.allJava |
| 83 | +} |
| 84 | + |
| 85 | +task javadocJar(type: Jar) { |
| 86 | + classifier = 'javadoc' |
| 87 | + from javadoc |
| 88 | +} |
| 89 | + |
| 90 | +artifacts { |
| 91 | + archives sourcesJar |
| 92 | + archives javadocJar |
| 93 | +} |
| 94 | + |
| 95 | +apply plugin: 'sonar' |
| 96 | + |
| 97 | +sonar { |
| 98 | + |
| 99 | + if (rootProject.hasProperty('sonarHostUrl')) { |
| 100 | + server.url = rootProject.sonarHostUrl |
| 101 | + } |
| 102 | + |
| 103 | + database { |
| 104 | + if (rootProject.hasProperty('sonarJdbcUrl')) { |
| 105 | + url = rootProject.sonarJdbcUrl |
| 106 | + } |
| 107 | + if (rootProject.hasProperty('sonarJdbcDriver')) { |
| 108 | + driverClassName = rootProject.sonarJdbcDriver |
| 109 | + } |
| 110 | + if (rootProject.hasProperty('sonarJdbcUsername')) { |
| 111 | + username = rootProject.sonarJdbcUsername |
| 112 | + } |
| 113 | + if (rootProject.hasProperty('sonarJdbcPassword')) { |
| 114 | + password = rootProject.sonarJdbcPassword |
| 115 | + } |
| 116 | + } |
| 117 | + |
| 118 | + project { |
| 119 | + dynamicAnalysis = "reuseReports" |
| 120 | + withProjectProperties { props -> |
| 121 | + props["sonar.core.codeCoveragePlugin"] = "jacoco" |
| 122 | + props["sonar.jacoco.reportPath"] = "${buildDir.name}/jacoco.exec" |
| 123 | + } |
| 124 | + } |
| 125 | + |
| 126 | + logger.info("Sonar parameters used: server.url='${server.url}'; database.url='${database.url}'; database.driverClassName='${database.driverClassName}'; database.username='${database.username}'") |
| 127 | +} |
| 128 | + |
| 129 | +task api(type: Javadoc) { |
| 130 | + group = 'Documentation' |
| 131 | + description = 'Generates aggregated Javadoc API documentation.' |
| 132 | + title = "${rootProject.description} ${version} API" |
| 133 | + options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED |
| 134 | + options.author = true |
| 135 | + options.header = rootProject.description |
| 136 | + options.overview = 'src/api/overview.html' |
| 137 | + |
| 138 | + source = sourceSets.main.allJava |
| 139 | + classpath = project.sourceSets.main.compileClasspath |
| 140 | + destinationDir = new File(buildDir, "api") |
| 141 | +} |
| 142 | + |
| 143 | +task docsZip(type: Zip) { |
| 144 | + group = 'Distribution' |
| 145 | + classifier = 'docs' |
| 146 | + description = "Builds -${classifier} archive containing api and reference " + |
| 147 | + "for deployment at static.springframework.org/spring-integration/docs." |
| 148 | + |
| 149 | + from (api) { |
| 150 | + into 'api' |
| 151 | + } |
| 152 | + |
| 153 | +} |
| 154 | + |
| 155 | +task distZip(type: Zip, dependsOn: [docsZip]) { |
| 156 | + group = 'Distribution' |
| 157 | + classifier = 'dist' |
| 158 | + description = "Builds -${classifier} archive, containing all jars and docs, " + |
| 159 | + "suitable for community download page." |
| 160 | + |
| 161 | + ext.baseDir = "${project.name}-${project.version}"; |
| 162 | + |
| 163 | + from('src/dist') { |
| 164 | + include 'readme.txt' |
| 165 | + include 'license.txt' |
| 166 | + include 'notice.txt' |
| 167 | + into "${baseDir}" |
| 168 | + } |
| 169 | + |
| 170 | + from(zipTree(docsZip.archivePath)) { |
| 171 | + into "${baseDir}/docs" |
| 172 | + } |
| 173 | + |
| 174 | + into ("${baseDir}/libs") { |
| 175 | + from project.jar |
| 176 | + from project.sourcesJar |
| 177 | + from project.javadocJar |
| 178 | + } |
| 179 | +} |
| 180 | + |
| 181 | +// Create an optional "with dependencies" distribution. |
| 182 | +// Not published by default; only for use when building from source. |
| 183 | +task depsZip(type: Zip, dependsOn: distZip) { zipTask -> |
| 184 | + group = 'Distribution' |
| 185 | + classifier = 'dist-with-deps' |
| 186 | + description = "Builds -${classifier} archive, containing everything " + |
| 187 | + "in the -${distZip.classifier} archive plus all dependencies." |
| 188 | + |
| 189 | + from zipTree(distZip.archivePath) |
| 190 | + |
| 191 | + gradle.taskGraph.whenReady { taskGraph -> |
| 192 | + if (taskGraph.hasTask(":${zipTask.name}")) { |
| 193 | + def projectName = rootProject.name |
| 194 | + def artifacts = new HashSet() |
| 195 | + |
| 196 | + rootProject.configurations.runtime.resolvedConfiguration.resolvedArtifacts.each { artifact -> |
| 197 | + def dependency = artifact.moduleVersion.id |
| 198 | + if (!projectName.equals(dependency.name)) { |
| 199 | + artifacts << artifact.file |
| 200 | + } |
| 201 | + } |
| 202 | + |
| 203 | + zipTask.from(artifacts) { |
| 204 | + into "${distZip.baseDir}/deps" |
| 205 | + } |
| 206 | + } |
| 207 | + } |
| 208 | +} |
| 209 | + |
| 210 | +artifacts { |
| 211 | + archives distZip |
| 212 | + archives docsZip |
| 213 | +} |
| 214 | + |
| 215 | +task dist(dependsOn: assemble) { |
| 216 | + group = 'Distribution' |
| 217 | + description = 'Builds -dist, -docs and -schema distribution archives.' |
| 218 | +} |
| 219 | + |
| 220 | +task wrapper(type: Wrapper) { |
| 221 | + description = 'Generates gradlew[.bat] scripts' |
| 222 | + gradleVersion = '1.3' |
| 223 | +} |
0 commit comments