import java.text.SimpleDateFormat defaultTasks "clean", "release" apply plugin: 'base' archivesBaseName = 'elasticsearch' buildTime = new Date() SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); buildTimeStr = sdf.format(buildTime) versionNumber = '0.9.0-SNAPSHOT' explodedDistDir = new File(distsDir, 'exploded') explodedDistLibDir = new File(explodedDistDir, 'lib') explodedDistBinDir = new File(explodedDistDir, 'bin') explodedDistConfigDir = new File(explodedDistDir, 'config') //mavenRepoUrl = "file://localhost/" + projectDir.absolutePath + "/build/maven/repository" //mavenSnapshotRepoUrl = "file://localhost/" + projectDir.absolutePath + "/build/maven/snapshotRepository" mavenRepoUrl = "http://oss.sonatype.org/service/local/staging/deploy/maven2/" mavenSnapshotRepoUrl = "http://oss.sonatype.org/content/repositories/snapshots" mavenRepoUser = "kimchy" mavenRepoPass = System.getenv("REPO_PASS") jarjarArchivePath = project(":jarjar").file("build/libs/jarjar-$versionNumber" + ".jar").absolutePath allprojects { group = 'org.elasticsearch' version = versionNumber plugins.withType(JavaPlugin).whenPluginAdded { sourceCompatibility = 1.6 targetCompatibility = 1.6 } repositories { mavenCentral() mavenRepo urls: 'https://repository.jboss.org/nexus/content/groups/public' mavenRepo urls: 'http://repository.codehaus.org/' mavenRepo urls: 'http://elasticsearch.googlecode.com/svn/maven' mavenRepo urls: 'http://oss.sonatype.org/content/repositories/releases' } } configurations { dists distLib { visible = false } } dependencies { distLib project(':elasticsearch') } task explodedDist(dependsOn: [configurations.distLib], description: 'Builds a minimal distribution image') << { ant.delete(dir: explodedDistDir) // clean the exploded dir [explodedDistDir, explodedDistLibDir, explodedDistBinDir, explodedDistConfigDir]*.mkdirs() // remove old elasticsearch files ant.delete { fileset(dir: explodedDistLibDir, includes: "$archivesBaseName-*.jar") } copy { from configurations.distLib into explodedDistLibDir } copy { from('bin'); into explodedDistBinDir } copy { from('config'); into explodedDistConfigDir } copy { from('lib'); into explodedDistLibDir } copy { from('.') into explodedDistDir include 'LICENSE.txt' include 'NOTICE.txt' include 'README.textile' } ant.delete { fileset(dir: explodedDistLibDir, includes: "$archivesBaseName-*-javadoc.jar") } ant.delete { fileset(dir: explodedDistLibDir, includes: "$archivesBaseName-*-sources.jar") } ant.delete { fileset(dir: explodedDistLibDir, includes: "slf4j-*.jar") } // no need for slf4j ant.delete { fileset(dir: explodedDistLibDir, includes: "jarjar-*.jar") } // no need jackson, we jarjar it ant.delete { fileset(dir: explodedDistLibDir, includes: "sigar-*.jar") } // no need sigar directly under lib... ant.chmod(dir: "$explodedDistDir/bin", perm: "ugo+rx", includes: "**/*") } task zip(type: Zip, dependsOn: ['explodedDist']) { zipRootFolder = "$archivesBaseName-${-> version}" from(explodedDistDir) { into zipRootFolder exclude 'bin/elasticsearch' exclude 'bin/plugin' exclude 'bin/service/elasticsearch' exclude 'bin/service/elasticsearch32' exclude 'bin/service/elasticsearch64' exclude 'bin/service/exec/**' } from(explodedDistDir) { into zipRootFolder include 'bin/elasticsearch' include 'bin/plugin' include 'bin/service/elasticsearch' include 'bin/service/elasticsearch32' include 'bin/service/elasticsearch64' include 'bin/service/exec/**' fileMode = 0755 } } task release(dependsOn: [zip]) << { ant.delete(dir: explodedDistDir) } task wrapper(type: Wrapper) { gradleVersion = '0.9-preview-3' jarPath = 'gradle' }