plugins { id 'scala' id 'com.github.jruby-gradle.base' version '1.6.0' id 'com.github.johnrengelman.shadow' version '5.2.0' id 'cz.alenkacz.gradle.scalafmt' version '1.10.0' } import com.github.jrubygradle.JRubyExec configurations { provided } repositories { mavenCentral() mavenLocal() jcenter() } // Relocate Guava packages since it's incompatible with Guava's version from Embulk shadowJar { classifier 'shadow' dependencies { include dependency('com.google.guava:guava') include dependency('com.google.cloud:google-cloud-firestore') include dependency('com.google.firebase:firebase-admin') include dependency('com.syucream:firesql') include dependency('io.grpc:grpc-netty-shaded') include dependency('io.grpc:grpc-core') include dependency('io.grpc:grpc-api') } relocate 'com.google.common', 'relocated.com.google.common' } sourceCompatibility = 1.8 targetCompatibility = 1.8 dependencies { compile 'org.scala-lang:scala-library:2.12.3' compile 'org.embulk:embulk-core:0.9.12' provided 'org.embulk:embulk-core:0.9.12' // Should be shadowed compile 'com.google.firebase:firebase-admin:6.11.0' compile 'com.syucream:firesql:0.0.1' } task classpath(type: Copy, dependsOn: ['jar', 'shadowJar']) { doFirst { file('classpath').deleteDir() } from (configurations.runtime - configurations.provided + configurations.shadow - files(shadowJar.getIncludedDependencies()) + files(shadowJar.archiveFile)) into 'classpath' } clean { delete 'classpath' } task gem(type: JRubyExec, dependsOn: ['build', 'gemspec', 'classpath']) { script 'gem' scriptArgs 'build', 'build/gemspec' doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: 'pkg') } } task gemspec { doLast { file('build').mkdirs() file('build/gemspec').write($/ Gem::Specification.new do |spec| spec.name = "${project.name}" spec.version = "${project.version}" spec.authors = ["Ryo Okubo"] spec.summary = %[Cloud Firestoreinput plugin for Embulk] spec.description = %[Selects records from a table.] spec.email = ["syucream@gmail.com"] spec.licenses = ["Apache-2.0"] spec.homepage = "https://github.com/syucream/embulk-input-firestore" spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"] spec.test_files = spec.files.grep(%r"^(test|spec)/") spec.require_paths = ["lib"] end /$) } }