| apply plugin: 'distribution' |
| apply plugin: 'maven-publish' |
| |
| jar.enabled = false |
| |
| configurations { |
| archives |
| } |
| |
| dependencies { |
| provided project(':gemfire-core') |
| |
| archives project(':gemfire-json') |
| archives project(':gemfire-joptsimple') |
| archives project(':gemfire-jgroups') |
| archives project(':gemfire-core') |
| archives project(':gemfire-web') |
| archives project(':gemfire-web-api') |
| } |
| |
| sourceSets { |
| // need to remove this since we use the dependencies jar out of the install dir |
| test.runtimeClasspath -= configurations.provided |
| } |
| |
| task defaultDistributionConfig(type: JavaExec, dependsOn: classes) { |
| outputs.file file("$buildDir/gemfire.properties") |
| main 'com.gemstone.gemfire.distributed.internal.DistributionConfigImpl' |
| classpath project(':gemfire-core').sourceSets.main.runtimeClasspath |
| workingDir buildDir |
| |
| doFirst { |
| buildDir.mkdirs() |
| } |
| } |
| |
| task defaultCacheConfig(type: JavaExec, dependsOn: classes) { |
| outputs.file file("$buildDir/cache.xml") |
| main 'com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator' |
| classpath project(':gemfire-core').sourceSets.main.runtimeClasspath |
| workingDir buildDir |
| |
| doFirst { |
| buildDir.mkdirs() |
| } |
| } |
| |
| // This closure sets the gemfire classpath. If we add another jar to the classpath it must |
| // be included in the filter logic below. |
| def cp = { |
| configurations.archives.dependencies.collect { it.dependencyProject } |
| .findAll { !it.name.contains('web') } |
| .collect { it.jar.archiveName } |
| .join(' ') + ' ' + |
| project(':gemfire-core').configurations.runtime.collect { it.getName() }.findAll { |
| it.contains('antlr') || |
| it.contains('commons-io') || |
| it.contains('commons-logging') || |
| it.contains('fastutil') || |
| it.contains('jackson-annotations') || |
| it.contains('jackson-core') || |
| it.contains('jackson-databind') || |
| it.contains('jansi') || |
| it.contains('javax.resource-api') || |
| it.contains('javax.servlet-api') || |
| it.contains('javax.transaction-api') || |
| it.contains('jetty-http') || |
| it.contains('jetty-io') || |
| it.contains('jetty-security') || |
| it.contains('jetty-server') || |
| it.contains('jetty-servlet') || |
| it.contains('jetty-webapp') || |
| it.contains('jetty-util') || |
| it.contains('jetty-xml') || |
| it.contains('jline') || |
| it.contains('jna') || |
| it.contains('log4j-api') || |
| it.contains('log4j-core') || |
| it.contains('log4j-jcl') || |
| it.contains('log4j-jul') || |
| it.contains('log4j-slf4j-impl') || |
| it.contains('lucene-analyzers-common') || |
| it.contains('lucene-core') || |
| it.contains('lucene-queries') || |
| it.contains('lucene-queryparser') || |
| it.contains('slf4j-api') || |
| it.contains('spring-core') || |
| it.contains('spring-shell') || |
| it.contains('snappy-java') || |
| it.contains('hbase') |
| }.join(' ') |
| } |
| |
| // Note: this dependency doesn't work if you change a library version from |
| // a dependent project. Please fix me. |
| task depsJar (type: Jar, dependsOn: ':gemfire-core:classes') { |
| description 'Assembles the jar archive that defines the gemfire classpath.' |
| archiveName 'gemfire-core-dependencies.jar' |
| doFirst { |
| manifest { |
| attributes("Class-Path": cp()) |
| } |
| } |
| } |
| |
| // Note: this dependency doesn't work if you change a library version from |
| // a dependent project. Please fix me. |
| task gfshDepsJar (type: Jar, dependsOn: ':gemfire-core:classes') { |
| description 'Assembles the jar archive that defines the gfsh classpath.' |
| def springWeb = configurations.runtime.collect { it.getName() }.find { it.contains('spring-web') } |
| archiveName 'gfsh-dependencies.jar' |
| doFirst { |
| manifest { |
| attributes("Class-Path": cp() + |
| ' ' + project(':gemfire-core').webJar.archiveName + |
| ' ' + springWeb |
| ) |
| } |
| } |
| } |
| |
| distributions { |
| main { |
| baseName = 'apache-geode' //TODO rootProject.name |
| contents { |
| duplicatesStrategy 'exclude' |
| |
| into ('config') { |
| from defaultCacheConfig |
| from defaultDistributionConfig |
| |
| from (project(':gemfire-core').sourceSets.main.resources.files.find { |
| it.name == 'log4j2-default.xml' |
| }) { |
| rename 'log4j2-default.xml', 'log4j2.xml' |
| } |
| } |
| |
| into ('lib') { |
| exclude 'annotation*.jar' |
| from project(":gemfire-jgroups").configurations.runtime |
| from project(":gemfire-jgroups").configurations.archives.allArtifacts.files |
| |
| from project(":gemfire-json").configurations.runtime |
| from project(":gemfire-json").configurations.archives.allArtifacts.files |
| |
| from project(":gemfire-joptsimple").configurations.runtime |
| from project(":gemfire-joptsimple").configurations.archives.allArtifacts.files |
| |
| from project(":gemfire-core").configurations.runtime |
| // Copying from provided configuration is only for supporting Spring Data GemFire. |
| // If there are more dependencies added to provided configuration, this will need |
| // to change |
| from (project(":gemfire-core").configurations.provided) { |
| include 'spring-data-gemfire-*' |
| } |
| from project(":gemfire-core").configurations.archives.allArtifacts.files |
| |
| // include this jar |
| from project(":gemfire-web-api").jar.outputs.files.getFiles() |
| |
| // dependency jars |
| from depsJar |
| from gfshDepsJar |
| } |
| |
| into ('tools/Extensions') { |
| from (project(":gemfire-web").configurations.archives.allArtifacts.files) { |
| exclude '*.jar' |
| } |
| from (project(":gemfire-web-api").configurations.archives.allArtifacts.files) { |
| exclude '*.jar' |
| } |
| } |
| } |
| } |
| } |
| |
| |
| // Repos to be added to POMs |
| def springReleaseRepo = [ id:'spring-release', name:'Spring Maven RELEASE Repository', url:'https://repo.spring.io/release' ] |
| def springMilestoneRepo = [ id:'spring-milestone', name:'Spring Maven MILESTONE Repository', url:'https://repo.spring.io/milestone' ] |
| def springSnapshotRepo = [ id:'spring-snapshot', name:'Spring Maven SNAPSHOT Repository', url:'https://repo.spring.io/snapshot' ] |
| def springLibsReleaseRepo = [ id:'libs-release', name:'Spring Maven libs-release Repository', url:'http://repo.spring.io/libs-release' ] |
| def springExtReleaseLocalRepo = [ id:'ext-release-local', name:'Spring Maven ext-release-local Repository', url:'http://repo.spring.io/ext-release-local' ] |
| |
| def MavenRepos = [ springReleaseRepo, springSnapshotRepo, springLibsReleaseRepo, springExtReleaseLocalRepo ] |
| |
| // Jars to be published via Maven |
| def coreJar = [publicationName:'coreJar', project:project(":gemfire-core").name] |
| def jgroupsJar = [publicationName:'jgroupsJar', project:project(":gemfire-jgroups").name] |
| def jsonJar = [publicationName:'jsonJar', project:project(":gemfire-json").name] |
| def joptsimpleJar = [publicationName:'joptsimpleJar', project:project(":gemfire-joptsimple").name] |
| def MavenJars = [ coreJar, jgroupsJar, jsonJar, joptsimpleJar ] |
| |
| afterEvaluate { |
| publishing { |
| publications { |
| MavenJars.each { |
| def publicationName = it.publicationName |
| def projectName = it.project |
| "$publicationName"(MavenPublication) { |
| artifactId projectName |
| artifact project(':' + projectName).jar |
| pom.withXml { |
| def repositoriesNode = asNode().appendNode('repositories') |
| MavenRepos.each { |
| def repositoryNode = repositoriesNode.appendNode('repository') |
| repositoryNode.appendNode('id', it.id) |
| repositoryNode.appendNode('name', it.name) |
| repositoryNode.appendNode('url', it.url) |
| } |
| def dependenciesNode = asNode().appendNode('dependencies') |
| //Iterate over the runtime dependencies |
| project(':' + projectName).configurations.runtime.allDependencies.each { |
| def dependencyNode = dependenciesNode.appendNode('dependency') |
| dependencyNode.appendNode('groupId', it.group) |
| dependencyNode.appendNode('artifactId', it.name) |
| dependencyNode.appendNode('version', it.version) |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| publishing { |
| repositories { |
| maven { |
| url "$buildDir/repo" |
| } |
| } |
| } |
| } |
| |
| artifacts { |
| archives depsJar, gfshDepsJar |
| } |
| |
| // Make build final task to generate all test and product resources |
| build.dependsOn installDist |