|
1 | 1 | plugins { |
2 | | - id "com.jfrog.bintray" version "1.1" |
3 | | - id "com.github.jruby-gradle.base" version "0.1.5" |
4 | 2 | id "java" |
| 3 | + id "maven-publish" |
| 4 | + id "signing" |
| 5 | + id "org.embulk.embulk-plugins" version "0.7.0" |
5 | 6 | } |
6 | | -import com.github.jrubygradle.JRubyExec |
7 | 7 | repositories { |
8 | 8 | mavenCentral() |
9 | | - jcenter() |
10 | 9 | } |
| 10 | + |
| 11 | +group = "org.embulk" |
| 12 | +version = "0.2.0-SNAPSHOT" |
| 13 | +description = "Executes commands and writes files to STDIN." |
| 14 | + |
11 | 15 | configurations { |
12 | | - provided |
| 16 | + compileClasspath.resolutionStrategy.activateDependencyLocking() |
| 17 | + runtimeClasspath.resolutionStrategy.activateDependencyLocking() |
13 | 18 | } |
14 | 19 |
|
15 | | -version = "0.2.0-SNAPSHOT" |
| 20 | +tasks.withType(JavaCompile) { |
| 21 | + options.compilerArgs << "-Xlint:deprecation" << "-Xlint:unchecked" |
| 22 | + options.encoding = "UTF-8" |
| 23 | +} |
| 24 | + |
| 25 | +java { |
| 26 | + toolchain { |
| 27 | + languageVersion = JavaLanguageVersion.of(8) |
| 28 | + } |
| 29 | + |
| 30 | + withJavadocJar() |
| 31 | + withSourcesJar() |
| 32 | +} |
16 | 33 |
|
17 | 34 | dependencies { |
18 | | - compile "org.embulk:embulk-core:0.7.0" |
19 | | - provided "org.embulk:embulk-core:0.7.0" |
| 35 | + compileOnly "org.embulk:embulk-spi:0.11" |
| 36 | + implementation "org.embulk:embulk-util-config:0.5.0" |
| 37 | + implementation "org.embulk:embulk-util-file:0.2.0" |
20 | 38 | // compile "YOUR_JAR_DEPENDENCY_GROUP:YOUR_JAR_DEPENDENCY_MODULE:YOUR_JAR_DEPENDENCY_VERSION" |
21 | | - testCompile "junit:junit:4.+" |
22 | | - testCompile 'org.embulk:embulk-core:0.7.+:tests' |
23 | | -} |
24 | | - |
25 | | -task classpath(type: Copy, dependsOn: ["jar"]) { |
26 | | - doFirst { file("classpath").deleteDir() } |
27 | | - from (configurations.runtime - configurations.provided + files(jar.archivePath)) |
28 | | - into "classpath" |
29 | | -} |
30 | | -clean { delete 'classpath' } |
31 | | - |
32 | | -task gem(type: JRubyExec, dependsOn: ["build", "gemspec", "classpath"]) { |
33 | | - jrubyArgs "-rrubygems/gem_runner", "-eGem::GemRunner.new.run(ARGV)", "build" |
34 | | - script "build/gemspec" |
35 | | - doLast { ant.move(file: "${project.name}-${project.version}.gem", todir: "pkg") } |
36 | | -} |
37 | | - |
38 | | -task gemspec << { file("build/gemspec").write($/ |
39 | | -Gem::Specification.new do |spec| |
40 | | - spec.name = "${project.name}" |
41 | | - spec.version = "${project.version}" |
42 | | - spec.authors = ["Sadayuki Furuhashi"] |
43 | | - spec.summary = %[Command file output plugin for Embulk] |
44 | | - spec.description = %[Executes commands and writes files to STDIN.] |
45 | | - spec.email = ["frsyuki@gmail.com"] |
46 | | - spec.licenses = ["Apache 2.0"] |
47 | | - spec.homepage = "https://github.com/embulk/embulk-output-command" |
48 | | - |
49 | | - spec.files = `git ls-files`.split("\n") + Dir["classpath/*.jar"] |
50 | | - spec.test_files = spec.files.grep(%r"^(test|spec)/") |
51 | | - spec.require_paths = ["lib"] |
52 | | - |
53 | | - #spec.add_dependency 'YOUR_GEM_DEPENDENCY', ['~> YOUR_GEM_DEPENDENCY_VERSION'] |
54 | | - spec.add_development_dependency 'bundler', ['~> 1.0'] |
55 | | - spec.add_development_dependency 'rake', ['>= 10.0'] |
56 | | -end |
57 | | -/$) |
| 39 | + |
| 40 | + testImplementation "junit:junit:4.13.2" |
| 41 | + testImplementation "org.embulk:embulk-core:0.11.3" |
| 42 | + testImplementation "org.embulk:embulk-deps:0.11.3" |
| 43 | + testImplementation "org.embulk:embulk-junit4:0.11.3" |
| 44 | +} |
| 45 | + |
| 46 | +embulkPlugin { |
| 47 | + mainClass = "org.embulk.output.CommandFileOutputPlugin" |
| 48 | + category = "output" |
| 49 | + type = "command" |
| 50 | +} |
| 51 | + |
| 52 | +gem { |
| 53 | + authors = [ "Sadayuki Furuhashi" ] |
| 54 | + email = [ "frsyuki@gmail.com" ] |
| 55 | + // "description" of the gem is copied from "description" of your Gradle project. |
| 56 | + summary = "Command file output plugin for Embulk" |
| 57 | + homepage = "https://github.com/embulk/embulk-output-command" |
| 58 | + licenses = [ "Apache-2.0" ] |
| 59 | + |
| 60 | + from rootProject.file("LICENSE") |
| 61 | +} |
| 62 | + |
| 63 | +gemPush { |
| 64 | + host = "https://rubygems.org" |
| 65 | +} |
| 66 | + |
| 67 | +jar { |
| 68 | + metaInf { |
| 69 | + from rootProject.file("LICENSE") |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +sourcesJar { |
| 74 | + metaInf { |
| 75 | + from rootProject.file("LICENSE") |
| 76 | + } |
| 77 | +} |
| 78 | + |
| 79 | +// A safer and strict alternative to: "dependencies" (and "dependencies --write-locks") |
| 80 | +// |
| 81 | +// This task fails explicitly when the specified dependency is not available. |
| 82 | +// In contrast, "dependencies (--write-locks)" does not fail even when a part the dependencies are unavailable. |
| 83 | +// |
| 84 | +// https://docs.gradle.org/8.7/userguide/dependency_locking.html#generating_and_updating_dependency_locks |
| 85 | +task checkDependencies { |
| 86 | + notCompatibleWithConfigurationCache("The task \"checkDependencies\" filters configurations at execution time.") |
| 87 | + doLast { |
| 88 | + configurations.findAll { it.canBeResolved }.each { it.resolve() } |
| 89 | + } |
| 90 | +} |
| 91 | + |
| 92 | +publishing { |
| 93 | + publications { |
| 94 | + maven(MavenPublication) { |
| 95 | + groupId = project.group |
| 96 | + artifactId = project.name |
| 97 | + |
| 98 | + from components.java |
| 99 | + // javadocJar and sourcesJar are added by java.withJavadocJar() and java.withSourcesJar() above. |
| 100 | + // See: https://docs.gradle.org/current/javadoc/org/gradle/api/plugins/JavaPluginExtension.html |
| 101 | + |
| 102 | + pom { // https://central.sonatype.org/pages/requirements.html |
| 103 | + packaging "jar" |
| 104 | + |
| 105 | + name = project.name |
| 106 | + description = project.description |
| 107 | + url = "https://www.embulk.org/" |
| 108 | + |
| 109 | + licenses { |
| 110 | + license { |
| 111 | + // http://central.sonatype.org/pages/requirements.html#license-information |
| 112 | + name = "The Apache License, Version 2.0" |
| 113 | + url = "https://www.apache.org/licenses/LICENSE-2.0.txt" |
| 114 | + distribution = "repo" |
| 115 | + } |
| 116 | + } |
| 117 | + |
| 118 | + developers { |
| 119 | + developer { |
| 120 | + name = "Sadayuki Furuhashi" |
| 121 | + email = "frsyuki@gmail.com" |
| 122 | + } |
| 123 | + } |
| 124 | + |
| 125 | + scm { |
| 126 | + connection = "scm:git:git://github.com/embulk/embulk-output-command.git" |
| 127 | + developerConnection = "scm:git:git@github.com:embulk/embulk-output-command.git" |
| 128 | + url = "https://github.com/embulk/embulk-output-command" |
| 129 | + } |
| 130 | + } |
| 131 | + } |
| 132 | + } |
| 133 | + |
| 134 | + repositories { |
| 135 | + maven { // publishMavenPublicationToMavenCentralRepository |
| 136 | + name = "mavenCentral" |
| 137 | + if (project.version.endsWith("-SNAPSHOT")) { |
| 138 | + url "https://oss.sonatype.org/content/repositories/snapshots" |
| 139 | + } else { |
| 140 | + url "https://oss.sonatype.org/service/local/staging/deploy/maven2" |
| 141 | + } |
| 142 | + |
| 143 | + credentials { |
| 144 | + username = project.hasProperty("ossrhUsername") ? ossrhUsername : "" |
| 145 | + password = project.hasProperty("ossrhPassword") ? ossrhPassword : "" |
| 146 | + } |
| 147 | + } |
| 148 | + } |
| 149 | +} |
| 150 | + |
| 151 | +signing { |
| 152 | + if (project.hasProperty("signingKey") && project.hasProperty("signingPassword")) { |
| 153 | + logger.lifecycle("Signing with an in-memory key.") |
| 154 | + useInMemoryPgpKeys(signingKey, signingPassword) |
| 155 | + } |
| 156 | + sign publishing.publications.maven |
| 157 | +} |
| 158 | + |
| 159 | +test { |
| 160 | + testLogging { |
| 161 | + events "passed", "skipped", "failed", "standardOut", "standardError" |
| 162 | + exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL |
| 163 | + showCauses = true |
| 164 | + showExceptions = true |
| 165 | + showStackTraces = true |
| 166 | + showStandardStreams = true |
| 167 | + outputs.upToDateWhen { false } |
| 168 | + } |
58 | 169 | } |
0 commit comments