plugins { id 'com.jfrog.bintray' version '1.1' id 'com.github.ben-manes.versions' version '0.7' id 'com.github.jruby-gradle.base' version '0.1.5' id 'com.github.johnrengelman.shadow' version '1.2.0' id 'java' } allprojects { group = 'org.embulk' version = '0.4.0' } subprojects { apply plugin: 'maven' // install jar files to the local repo: $ gradle install apply plugin: 'java' apply plugin: 'findbugs' apply plugin: 'jacoco' repositories { mavenCentral() jcenter() } compileJava.options.encoding = 'UTF-8' // source encoding sourceCompatibility = 1.7 targetCompatibility = 1.7 configurations { // guice depends on asm and cglib but version of the libraries conflict // with ones bundled in jruby-complete and cause bytecode compatibility error compile.exclude group: 'asm', module: 'asm' compile.exclude group: 'org.sonatype.sisu.inject', module: 'cglib' } // determine which dependencies have updates: $ gradle dependencyUpdates dependencies { compile 'com.google.guava:guava:18.0' compile 'com.google.inject:guice:3.0' compile 'com.google.inject.extensions:guice-multibindings:3.0' compile 'javax.inject:javax.inject:1' compile 'com.fasterxml.jackson.core:jackson-annotations:2.5.0' compile 'com.fasterxml.jackson.core:jackson-core:2.5.0' compile 'com.fasterxml.jackson.core:jackson-databind:2.5.0' compile 'com.fasterxml.jackson.datatype:jackson-datatype-guava:2.5.0' compile 'com.fasterxml.jackson.datatype:jackson-datatype-joda:2.5.0' compile 'com.fasterxml.jackson.module:jackson-module-guice:2.5.0' compile 'log4j:log4j:1.2.17' compile 'org.slf4j:slf4j-api:1.7.10' compile 'org.slf4j:slf4j-log4j12:1.7.10' compile 'org.jruby:jruby-complete:1.7.19' compile 'com.google.code.findbugs:annotations:3.0.0' compile 'org.yaml:snakeyaml:1.14' compile 'javax.validation:validation-api:1.1.0.Final' compile 'org.apache.bval:bval-jsr303:0.5' compile 'io.airlift:slice:0.9' compile 'joda-time:joda-time:2.7' compile 'io.netty:netty-buffer:5.0.0.Alpha1' compile 'com.ibm.icu:icu4j:54.1.1' testCompile 'junit:junit:4.12' } gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" //<< "-Xlint:deprecation" } tasks.withType(FindBugs) { reports { xml.enabled = false html.enabled = true } } } findbugs { ignoreFailures = true } // add javadoc/source jar tasks as artifacts to be released task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' from sourceSets.main.allSource } task javadocJar(type: Jar, dependsOn: javadoc) { classifier = 'javadoc' from javadoc.destinationDir } artifacts { archives sourcesJar, javadocJar } javadoc { options { locale = 'en_US' encoding = 'UTF-8' } } // upload artifacts to Bintray: $ gradle bintrayUpload bintray { // write at your bintray user name and api key to ~/.gradle/gradle.properties file: // bintray_user=frsyuki // bintray_api_key=xxxxxxxxxxx user = project.hasProperty('bintray_user') ? bintray_user : '' key = project.hasProperty('bintray_api_key') ? bintray_api_key : '' publications = ['mavenJava'] dryRun = false publish = false // TODO automate uploading embulk.jar and make this true pkg { userOrg = 'embulk' repo = 'maven' name = 'embulk' desc = 'Embulk, a plugin-based parallel bulk data loader' websiteUrl = 'https://github.com/embulk/embulk' issueTrackerUrl = 'https://github.com/embulk/embulk/issues' vcsUrl = 'https://github.com/embulk/embulk.git' licenses = ['Apache-2.0'] labels = ['embulk', 'ruby', 'java'] publicDownloadNumbers = true version { name = project.version // TODO //mavenCentralSync { // sync = true // user = 'userToken' // password = 'paasword' // close = '1' //} } } } } project(':embulk-cli') { apply plugin: 'com.github.johnrengelman.shadow' shadowJar { manifest { attributes 'Implementation-Title': project.name, 'Implementation-Version': project.version, 'Implementation-Vendor-Id': project.group, 'Specification-Title': project.name, 'Specification-Version': project.version, 'Main-Class': 'org.embulk.cli.Main' } append("${parent.projectDir}/COPYING") } task classpath(type: Copy) { doFirst { file("${parent.projectDir}/classpath").mkdirs() } from configurations.runtime into "${parent.projectDir}/classpath" } } task classpath(dependsOn: ['build', ':embulk-cli:classpath']) << { } clean { delete 'classpath' } task cli(dependsOn: ':embulk-cli:shadowJar') << { file('pkg').mkdirs() File f = file("pkg/embulk-${project.version}.jar") f.write('''\ #!/bin/sh exec java -jar "$0" "$@" exit 127 ''') f.append(file("embulk-cli/build/libs/embulk-cli-${project.version}-all.jar").readBytes()) f.setExecutable(true) } import com.github.jrubygradle.JRubyExec task gem(type: JRubyExec) { jrubyArgs '-rrubygems/gem_runner', '-eGem::GemRunner.new.run(ARGV)', 'build' script 'build/gemspec' doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") } } gem.dependsOn('gemspec') gem.dependsOn('classpath') task releaseCheck << { if (!file("lib/embulk/version.rb").getText().contains("${project.version}")) { throw new GradleException("lib/embulk/version.rb doesn't include ${project.version}") } String date = new Date().format("yyyy-MM-dd") if (!file("embulk-docs/src/release/release-${project.version}.rst").getText().contains(date)) { throw new GradleException("ChangeLog doesn't include entry for ${project.version}") } println "Ready. Run ./gradlew release" } task release(dependsOn: ["cli", "gem"]) << { println """ manual operations: git commit -a -m v${project.version} git tag v${project.version} gem push pkg/embulk-${project.version}.gem" ./gradlew bintrayUpload open "https://bintray.com/embulk/maven/embulk/${project.version}/view" # and upload pkg/embulk-${project.version}.jar """ } task gemspec << { file('build').mkdirs() file('build/gemspec').write($/ Gem::Specification.new do |gem| gem.name = "embulk" gem.version = "${project.version}" gem.summary = "Embulk, a plugin-based parallel bulk data loader" gem.description = "Embulk is an open-source, plugin-based bulk data loader to scale and simplify data management across heterogeneous data stores. It can collect and ship any kinds of data in high throughput with transaction control." gem.authors = ["Sadayuki Furuhashi"] gem.email = ["frsyuki@gmail.com"] gem.license = "Apache 2.0" gem.homepage = "https://github.com/embulk/embulk" gem.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"] gem.test_files = gem.files.grep(%r"^(test|spec)/") gem.executables = gem.files.grep(%r"^bin/").map{ |f| File.basename(f) } gem.require_paths = ["lib"] gem.has_rdoc = false gem.add_development_dependency "bundler", [">= 1.0"] gem.add_development_dependency "rake", [">= 0.10.0"] gem.add_development_dependency "rspec", ["~> 2.11"] gem.add_development_dependency "json", ["~> 1.7"] gem.add_development_dependency "yard", ["~> 0.8.7"] gem.add_development_dependency "kramdown", ["~> 1.5.0"] end /$) }