Created
February 9, 2021 23:54
-
-
Save felix19350/5c2a9959123a47f32017af84cf638e14 to your computer and use it in GitHub Desktop.
Gradle (groovy) task definitions to be able to run AWS CDK in a project with a main class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* AWS CDK integration. Changes the mainClassName variable and calls run | |
* */ | |
def cdkMainClassName = "com.rideal.infrastructure.aws.RidealApp" | |
def originalMainClassName = mainClassName | |
tasks.register("run-cdk") { | |
description "Specific run-script for AWS CDK integration" | |
group "CDK" | |
doLast { | |
mainClassName = cdkMainClassName | |
println("Running up CDK integration") | |
} | |
} | |
tasks.register("reset-main-class"){ | |
description "Resets the main class name after running CDK" | |
group "CDK" | |
mainClassName = originalMainClassName | |
doLast { | |
println("Cleaning up CDK integration") | |
} | |
} | |
tasks.getByName("run-cdk").configure { finalizedBy tasks.getByName("run") } | |
tasks.getByName("run").configure { | |
finalizedBy tasks.getByName("reset-main-class") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment