Slackbot
01/25/2024, 4:49 PMVampire
01/25/2024, 4:57 PMJon Bayle
01/25/2024, 4:58 PMJon Bayle
01/25/2024, 5:39 PMVampire
01/25/2024, 7:09 PMVampire
01/25/2024, 7:12 PMbuildscript { dependencies { classpath("...") } }.
But really, a shared build service is the way to go for various reasons.
When for example would you stop the testcontainer?
In doLast of test? What if the tests failed and thus the doLast is not executed?
In a finalizedBy task of test? What if liquibase task already failed and thus test is not even started?
...?Jon Bayle
01/26/2024, 3:06 PMJon Bayle
01/26/2024, 3:33 PMJon Bayle
01/26/2024, 3:33 PMJon Bayle
01/26/2024, 3:34 PMVampire
01/26/2024, 3:38 PMVampire
01/26/2024, 3:39 PMCommandLineArgumentProvider as `jvmArgumentProviders`to lazily get the port from the service only if the task is actually going to be executed then.Vampire
01/26/2024, 3:45 PMabstract class Foo : BuildService<BuildServiceParameters.None> {
val port: Int
init {
port = Random.nextInt()
}
}
val foo = gradle.sharedServices.registerIfAbsent("foo", Foo::class) {}
tasks.test {
usesService(foo)
jvmArgumentProviders.add(object : CommandLineArgumentProvider {
override fun asArguments(): Iterable<String> =
listOf("-DserverPort=${foo.get().port}")
})
}Jon Bayle
01/26/2024, 3:45 PMCommandLineArgumentProvider to see if I can use it with liquibase update and jooqcodegenVampire
01/26/2024, 3:53 PMLiquibaseTask extends JavaExec, so you can use the same there if setting as jvm arg is what you need there tooJon Bayle
01/26/2024, 4:51 PMVampire
01/26/2024, 4:54 PMJon Bayle
01/26/2024, 4:54 PMVampire
01/26/2024, 4:54 PMJon Bayle
01/26/2024, 4:55 PMproject.jooq.executions[*].configuration.jdbc.urlJon Bayle
01/26/2024, 4:56 PMjooq {
executions {
create("main") {
configuration {
jdbc {
username = DB_USERNAME
password = DB_PASSWORD
url = "<postgresql://localhost>:RANDOMPORT/db_name"
}Vampire
01/26/2024, 4:56 PMJon Bayle
01/26/2024, 4:57 PMVampire
01/26/2024, 4:58 PMJon Bayle
01/26/2024, 4:58 PMJon Bayle
01/26/2024, 5:12 PMurl = containerProvider.get().db.getJdbcUrl()Vampire
01/26/2024, 5:25 PMJon Bayle
01/26/2024, 5:26 PMVampire
01/26/2024, 5:27 PMjooq {
configuration {
jdbc {
println("setting url")
}
}
}
and then calling gw help -mVampire
01/26/2024, 5:27 PMsetting url printed and then a sax parse exceptionJon Bayle
01/26/2024, 5:27 PMVampire
01/26/2024, 5:27 PMVampire
01/26/2024, 5:28 PMJon Bayle
01/26/2024, 5:28 PMJon Bayle
01/26/2024, 5:29 PMVampire
01/26/2024, 5:32 PMJon Bayle
01/26/2024, 6:10 PM