Skip to content

Commit

Permalink
#132: rewrite tasks in gradle files to use register
Browse files Browse the repository at this point in the history
  • Loading branch information
Sabrina Wullschleger committed Jun 4, 2024
1 parent a3535e6 commit af8756a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
35 changes: 20 additions & 15 deletions gretl/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,22 @@ pluginBundle {
}
}

task setupPluginUpload() {
tasks.register('setupPluginUpload'){
description = "Converts Gradle plugin publish key and secret from environment variable to system property. (Workaround)"
doLast {
def key=System.env.gradlePublishKey
def secret = System.env.gradlePublishSecret
if( !key || !secret)
{
throw new RuntimeException("gradlePublishKey and/or gradlePublishSecret are not defined environment variables")
}
System.properties.setProperty("gradle.publish.key", key)
System.properties.setProperty("gradle.publish.secret", secret)
def key=System.env.gradlePublishKey
def secret = System.env.gradlePublishSecret

if( !key || !secret)
{
throw new RuntimeException("gradlePublishKey and/or gradlePublishSecret are not defined environment variables")
}

System.properties.setProperty("gradle.publish.key", key)
System.properties.setProperty("gradle.publish.secret", secret)
}
}

tasks.publishPlugins.dependsOn tasks.setupPluginUpload

test {
Expand All @@ -180,14 +181,17 @@ test {
}
}

task dbTest(type: Test, dependsOn: [compileJava, compileTestJava]) {
tasks.register('dbTest', Test){
dependsOn 'compileJava', 'compileTestJava'
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = 'Runs all unit tests with dependency to a db server (pg, oracle, ...).'
useJUnit {
includeCategories 'ch.so.agi.gretl.testutil.DbTest'
}
}
task sftpTest(type: Test, dependsOn: [compileJava, compileTestJava]) {

tasks.register('sftpTest', Test){
dependsOn 'compileJava', 'compileTestJava'
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = 'Runs all unit tests with dependency to a SFTP server'
useJUnit {
Expand All @@ -199,10 +203,11 @@ def s3AccessKey = System.getProperty('s3AccessKey',properties.get('s3AccessKey')
def s3SecretKey = System.getProperty('s3SecretKey',properties.get('s3SecretKey'))
def s3BucketName = System.getProperty('s3BucketName',properties.get('s3BucketName'))

task s3Test(type: Test, dependsOn: [compileJava, compileTestJava]) {
tasks.register('s3Test', Test){
dependsOn 'compileJava', 'compileTestJava'
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = 'Runs all unit tests with dependency to AWS S3.'

useJUnit {
includeCategories 'ch.so.agi.gretl.testutil.S3Test'
}
Expand Down
12 changes: 6 additions & 6 deletions gretl/integration-test.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ sourceSets {
* Task for executing the integration tests. It references the
* classes and runtime classpath of the integration test source set.
*/
task jarTest(type: Test) {
tasks.register('jarTest', Test){
description = 'Runs integration tests against the installed gretl jar.'
group = LifecycleBasePlugin.VERIFICATION_GROUP

Expand All @@ -41,7 +41,7 @@ task jarTest(type: Test) {
jvmArgs '-Xmx1g'
}

task jarS3Test(type: Test) {
tasks.register('jarS3Test', Test){
description = 'Runs the S3 integration tests against the installed gretl jar.'
group = LifecycleBasePlugin.VERIFICATION_GROUP

Expand All @@ -58,14 +58,14 @@ task jarS3Test(type: Test) {
jvmArgs '-Xmx1g'
}

task imageTest(type: Test){
tasks.register('imageTest', Test){
description = 'Runs integration tests against the installed gretl docker image.'
group = LifecycleBasePlugin.VERIFICATION_GROUP

useJUnit {
excludeCategories 'ch.so.agi.gretl.testutil.S3Test'
}

systemProperty('GRETL_TESTTYPE', 'image')

testLogging.showStandardStreams = true
Expand All @@ -74,7 +74,7 @@ task imageTest(type: Test){
classpath += sourceSets.integrationTest.runtimeClasspath
}

task imageS3Test(type: Test){
tasks.register('imageS3Test', Test){
description = 'Runs S3 integration tests against the installed gretl docker image.'
group = LifecycleBasePlugin.VERIFICATION_GROUP

Expand Down

0 comments on commit af8756a

Please sign in to comment.