1- import org.gradle.api.tasks.testing.logging.TestExceptionFormat
2- import org.gradle.api.tasks.testing.logging.TestLogEvent
3-
41plugins {
52 id ' java'
63 id " maven-publish"
74 id " signing"
85 id ' checkstyle'
9- id " org.embulk.embulk-plugins" version " 0.5.5 " apply false
6+ id " org.embulk.embulk-plugins" version " 0.6.1 " apply false
107}
118
129allprojects {
@@ -28,17 +25,20 @@ subprojects {
2825
2926 configurations {
3027 defaultJdbcDriver
28+ compileClasspath. resolutionStrategy. activateDependencyLocking()
29+ runtimeClasspath. resolutionStrategy. activateDependencyLocking()
3130 }
3231
33- sourceCompatibility = 1.8
34- targetCompatibility = 1.8
35-
3632 tasks. withType(JavaCompile ) {
37- options. compilerArgs << " -Xlint:unchecked " << " -Xlint:deprecation "
33+ options. compilerArgs << " -Xlint:deprecation " << " -Xlint:unchecked "
3834 options. encoding = " UTF-8"
3935 }
4036
4137 java {
38+ toolchain {
39+ languageVersion = JavaLanguageVersion . of(8 )
40+ }
41+
4242 withJavadocJar()
4343 withSourcesJar()
4444 }
@@ -47,7 +47,7 @@ subprojects {
4747 compileOnly " org.embulk:embulk-api:0.10.36"
4848 compileOnly " org.embulk:embulk-spi:0.10.36"
4949
50- compile (" org.embulk:embulk-util-config:0.3.2" ) {
50+ implementation (" org.embulk:embulk-util-config:0.3.2" ) {
5151 // They conflict with embulk-core. They are once excluded here,
5252 // and added explicitly with versions exactly the same with older embulk-core (until v0.10.31).
5353 exclude group : " com.fasterxml.jackson.core" , module : " jackson-annotations"
@@ -59,18 +59,18 @@ subprojects {
5959
6060 // They are once excluded from transitive dependencies of other dependencies,
6161 // and added explicitly with versions exactly the same with older embulk-core (until 0.10.31).
62- compile " com.fasterxml.jackson.core:jackson-annotations:2.6.7"
63- compile " com.fasterxml.jackson.core:jackson-core:2.6.7"
64- compile " com.fasterxml.jackson.core:jackson-databind:2.6.7"
65- compile " com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7"
66- compile " javax.validation:validation-api:1.1.0.Final"
62+ implementation " com.fasterxml.jackson.core:jackson-annotations:2.6.7"
63+ implementation " com.fasterxml.jackson.core:jackson-core:2.6.7"
64+ implementation " com.fasterxml.jackson.core:jackson-databind:2.6.7"
65+ implementation " com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7"
66+ implementation " javax.validation:validation-api:1.1.0.Final"
6767
68- compile " org.embulk:embulk-util-json:0.1.1"
69- compile " org.embulk:embulk-util-timestamp:0.2.1"
68+ implementation " org.embulk:embulk-util-json:0.1.1"
69+ implementation " org.embulk:embulk-util-timestamp:0.2.1"
7070
71- testCompile " org.embulk:embulk-junit4:0.10.36"
72- testCompile " org.embulk:embulk-core:0.10.36"
73- testCompile " org.embulk:embulk-deps:0.10.36"
71+ testImplementation " org.embulk:embulk-junit4:0.10.36"
72+ testImplementation " org.embulk:embulk-core:0.10.36"
73+ testImplementation " org.embulk:embulk-deps:0.10.36"
7474 }
7575
7676 javadoc {
@@ -80,73 +80,23 @@ subprojects {
8080 }
8181 }
8282
83- test {
84- // JDBC input plugins depend on local time zone to parse timestamp without time stamp and datetime types.
85- jvmArgs " -Duser.country=FI" , " -Duser.timezone=Europe/Helsinki"
86- environment " TZ" , " Europe/Helsinki"
87- }
88-
89- tasks. withType(Test ) {
90- testLogging {
91- // set options for log level LIFECYCLE
92- events TestLogEvent . FAILED ,
93- TestLogEvent . PASSED ,
94- TestLogEvent . SKIPPED ,
95- TestLogEvent . STANDARD_OUT
96- exceptionFormat TestExceptionFormat . FULL
97- showExceptions true
98- showCauses true
99- showStackTraces true
100-
101- afterSuite { desc , result ->
102- if (! desc. parent) { // will match the outermost suite
103- def output = " Results: ${ result.resultType} (${ result.testCount} tests, ${ result.successfulTestCount} passed, ${ result.failedTestCount} failed, ${ result.skippedTestCount} skipped)"
104- def startItem = ' | ' , endItem = ' |'
105- def repeatLength = startItem. length() + output. length() + endItem. length()
106- println (' \n ' + (' -' * repeatLength) + ' \n ' + startItem + output + endItem + ' \n ' + (' -' * repeatLength))
107- }
108- }
109- }
110- }
111-
112- checkstyle {
113- configFile = file(" ${ project.rootDir} /config/checkstyle/checkstyle.xml" )
114- toolVersion = ' 6.14.1'
115- }
116- checkstyleMain {
117- configFile = file(" ${ project.rootDir} /config/checkstyle/default.xml" )
118- ignoreFailures = true
119- }
120- checkstyleTest {
121- configFile = file(" ${ project.rootDir} /config/checkstyle/default.xml" )
122- ignoreFailures = true
123- }
124- task checkstyle(type : Checkstyle ) {
125- classpath = sourceSets. main. output + sourceSets. test. output
126- source = sourceSets. main. allJava + sourceSets. test. allJava
127- }
128-
129- gem {
130- authors = [ " Sadayuki Furuhashi" ]
131- email = [ " frsyuki@gmail.com" ]
132- summary = " JDBC input plugin for Embulk"
133- homepage = " https://github.com/embulk/embulk-input-jdbc"
134- licenses = [ " Apache-2.0" ]
135-
136- into(" default_jdbc_driver" ) {
137- from configurations. defaultJdbcDriver
83+ // A safer and strict alternative to: "dependencies" (and "dependencies --write-locks")
84+ //
85+ // This task fails explicitly when the specified dependency is not available.
86+ // In contrast, "dependencies (--write-locks)" does not fail even when a part the dependencies are unavailable.
87+ //
88+ // https://docs.gradle.org/7.6.1/userguide/dependency_locking.html#generating_and_updating_dependency_locks
89+ task checkDependencies {
90+ notCompatibleWithConfigurationCache(" The task \" checkDependencies\" filters configurations at execution time." )
91+ doLast {
92+ configurations. findAll { it. canBeResolved }. each { it. resolve() }
13893 }
13994 }
14095
141- gemPush {
142- host = " https://rubygems.org"
143- }
144-
145- javadoc {
146- options {
147- locale = ' en_US'
148- encoding = ' UTF-8'
149- }
96+ // It should not publish a `.module` file in Maven Central.
97+ // https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html#sub:disabling-gmm-publication
98+ tasks. withType(GenerateModuleMetadata ) {
99+ enabled = false
150100 }
151101
152102 publishing {
@@ -173,6 +123,7 @@ subprojects {
173123 // http://central.sonatype.org/pages/requirements.html#license-information
174124 name = " The Apache License, Version 2.0"
175125 url = " https://www.apache.org/licenses/LICENSE-2.0.txt"
126+ distribution = " repo"
176127 }
177128 }
178129
@@ -205,6 +156,72 @@ subprojects {
205156 }
206157
207158 signing {
159+ if (project. hasProperty(" signingKey" ) && project. hasProperty(" signingPassword" )) {
160+ logger. lifecycle(" Signing with an in-memory key." )
161+ useInMemoryPgpKeys(signingKey, signingPassword)
162+ }
208163 sign publishing. publications. maven
209164 }
165+
166+ gem {
167+ authors = [ " Sadayuki Furuhashi" ]
168+ email = [ " frsyuki@gmail.com" ]
169+ summary = " JDBC input plugin for Embulk"
170+ homepage = " https://github.com/embulk/embulk-input-jdbc"
171+ licenses = [ " Apache-2.0" ]
172+
173+ into(" default_jdbc_driver" ) {
174+ from configurations. defaultJdbcDriver
175+ }
176+ }
177+
178+ gemPush {
179+ host = " https://rubygems.org"
180+ }
181+
182+ test {
183+ // JDBC input plugins depend on local time zone to parse timestamp without time stamp and datetime types.
184+ jvmArgs " -Duser.country=FI" , " -Duser.timezone=Europe/Helsinki"
185+ environment " TZ" , " Europe/Helsinki"
186+ }
187+
188+ tasks. withType(Test ) {
189+ testLogging {
190+ // set options for log level LIFECYCLE
191+ events " passed" , " skipped" , " failed" , " standardOut" , " standardError"
192+ exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat . FULL
193+ showCauses = true
194+ showExceptions = true
195+ showStackTraces = true
196+ showStandardStreams = true
197+
198+ outputs. upToDateWhen { false }
199+
200+ afterSuite { desc , result ->
201+ if (! desc. parent) { // will match the outermost suite
202+ def output = " Results: ${ result.resultType} (${ result.testCount} tests, ${ result.successfulTestCount} passed, ${ result.failedTestCount} failed, ${ result.skippedTestCount} skipped)"
203+ def startItem = ' | ' , endItem = ' |'
204+ def repeatLength = startItem. length() + output. length() + endItem. length()
205+ println (' \n ' + (' -' * repeatLength) + ' \n ' + startItem + output + endItem + ' \n ' + (' -' * repeatLength))
206+ }
207+ }
208+ }
209+ }
210+
211+ checkstyle {
212+ configFile = file(" ${ project.rootDir} /config/checkstyle/checkstyle.xml" )
213+ toolVersion = ' 6.14.1'
214+ }
215+ checkstyleMain {
216+ configFile = file(" ${ project.rootDir} /config/checkstyle/default.xml" )
217+ ignoreFailures = true
218+ }
219+ checkstyleTest {
220+ configFile = file(" ${ project.rootDir} /config/checkstyle/default.xml" )
221+ ignoreFailures = true
222+ }
223+ task checkstyle(type : Checkstyle ) {
224+ classpath = sourceSets. main. output + sourceSets. test. output
225+ source = sourceSets. main. allJava + sourceSets. test. allJava
226+ }
210227}
0 commit comments