Michał Klimczak
02/03/2023, 3:58 PMkotlin-jvm
and kotlinx-serialization
plugins itself as well as kotlin-dsl
. Using kotlin-dsl plugin enforces the use of kotlin 1.6.21 for all other plugins. This, in turn, means that I have to use some dependencies in their old versions. I tried using kotlin 1.7.20 for kotlin-jvm and serialization and it seemed to work, but then it has blown up with some NoSuchMethodException on some File
api when I built an app which was using my plugin - specifically on a kapt step.
This all seems really hard to follow, but from these experiences my understanding is that kotlin-dsl
plugin kind of defines everything else. Is that right?Michał Klimczak
02/07/2023, 3:34 PMNamedDomainObjectContainer<AndroidSourceSet> sourceSets = project.getExtensions().getByType(AppExtension.class).getSourceSets()
File outputDir = new File(project.getBuildDir()+ File.separator+"generated"+File.separator+"source");
...
greeterFile.writeTo(outputDir);
sourceSets.getByName("main").getJava().srcDir(outputDir);
The file is properly created and there are no warnings, but the class is not on classpath after the project is built - can't be used in android project. The source set "main" is fine, when I use something dummy, it fails. I tried getKotlin() instead of getJava(). I tried srcDir, srcDirs and other functions. I read somewhere, that you need to "register" these source sets after adding them, but this is probably some old api, since I don't see any register methods.Big Chungus
02/10/2023, 3:41 PMtwisterrob
02/13/2023, 11:21 AMrepositories.mavenCentral()
, which means you can do stuff.foo()
or stuff { foo() }
which creates a "well-known" instance in a NamedDomainObjectContainer
. Currently this is done via Kotlin delegation, but it needs internal API usage.
open class DefaultStuffContainer @Inject constructor(delegate: NamedDomainObjectContainer<Stuff>) : NamedDomainObjectContainer<Stuff> by delegate {
fun foo(): Stuff = TODO()
override fun configure(configureClosure: Closure<*>): NamedDomainObjectContainer<NexusRepository> =
// Heavy use of internal API, copied from AbstractNamedDomainObjectContainer
ConfigureUtil.configureSelf(configureClosure, this, NamedDomainObjectContainerConfigureDelegate(configureClosure, this))
}
what would be the proper way to achieve the same as RepositoryHandler
(which has named methods and is also a container) with public APIs only? because the only way I can see now is to extend DefaultNamedDomainObjectSet
directly, which is internal API.melix
02/14/2023, 10:39 AMmelix
02/15/2023, 11:54 AMMartin
02/16/2023, 12:43 PMDmitriy Voronin
02/17/2023, 2:05 PMChristoph Loy
02/18/2023, 11:25 PMDavid Gregory
02/20/2023, 6:06 PMLeon Linhart
02/20/2023, 9:42 PMorg.gradle.api.provider.Property
lazily with the option to have it default to its convention? All set
overloads seem to disallow this. I want to change the value of a property of a third-party task depending on some configuration option. For this purpose, I'd like to use a gradleProperty
provider (etc.) to derive the value for the property. However, it should also be possible for the task's property to fall back to its convention in some cases. Since there is no way to access the provider for the convention, I'm not sure how to express this.Michał Klimczak
02/21/2023, 9:52 AMpluginManagement { include("plugins/my-plugin.jar") }
pluginManagement { includeBuild("plugins/my-plugin.jar") }
pluginManagement { include("plugins") }
pluginManagement { includeFlat("plugins") }
pluginManagement {
repositories {
flatDir {
dir("plugins")
}
}
}
Or maybe there's a better way of including a closed source plugin in a project?Leon Linhart
02/21/2023, 12:39 PMJavaCompile
tasks:
String customExecutablePath = forkOptions.getExecutable();
JavaExecutableUtils.validateExecutable(
customExecutablePath, "Toolchain from `executable` property on `ForkOptions`",
toolchainExecutable, "toolchain from `javaCompiler` property");
(https://github.com/gradle/gradle/blob/7dec5105c7585151d7339beddfc549e04697a9cd/sub[…]ava/src/main/java/org/gradle/api/tasks/compile/JavaCompile.java)
This effectively seems to prevent forking with a custom compiler executable as there is no supported way to define a custom JavaCompiler
instance, no? (@Alex Semin Git blame spits out your name. Could you please have a look at this?)Daren Klamer
02/24/2023, 4:57 AMChristoph Loy
02/24/2023, 6:38 PMDavid Ankin
02/24/2023, 10:35 PMtl;dr: how should invalidate a test task on purpose, without uptodate.when false?
Roberto Fuentes
02/27/2023, 3:31 PMa
, b
, c
):
a
(gradle plugin) that depends on -> c
(core logic)
b
(other stuff) that depends on -> c
(core logic)
I want to publish gradle plugin with maven with only a
& c
modules in the plugin. But at the same time a
& b
can share the same core logic in the current working project.
How can I do that? Is there a sample? Maybe some docs that talk about it?
Edit: Not sure if this is the correct place, maybe should I post it in #maven?Ryan Schmitt
02/27/2023, 10:20 PMSettings
and Project
?Ben Madore
03/03/2023, 10:42 PMspring-boot2-conventions
and spring-boot3-conventions
.
it needs to support projects that are Spring Boot 2 (Java 11 or Java 17) AND Spring Boot 3 (Java 17 only).
the very small difference that causes such a hassle is:
boot 2:
configure<SpringBootExtension> {
buildInfo {
properties {
artifact = extension.artifactName.get()
name = extension.projectDisplayName.get()
time = null
}
}
}
boot 3:
configure<SpringBootExtension> {
buildInfo {
properties {
artifact.set(extension.artifactName.get())
name.set(extension.projectDisplayName.get())
time.set(null as String?)
}
}
}
Łukasz Wasylkowski
03/05/2023, 3:44 PMprocessIsolation
, what's the best practice regarding allowing the consumer to configure JavaForkOptions
of the spawned process? They might want to configure things like available memory, attach daemons etc., while the plugin needs to add some options it knows are needed. Should the task expose entire JavaForkOptions
? 🤔 Or maybe the task should implement it? Or I should just expose jvmArgs
and maybe other properties similar to what JavaForkOptions
has and pass them manually?Martin
03/07/2023, 2:34 PMProvider<DirectoryProperty>
that carries the task dependency using task.flatMap { it.outputDir }
. I want to wire that output to the Kotlin compiler main
source set by default: kotlin.sourceSets.getByName("main").kotlin.srcDir(outputDirProperty)
. All of that while still allowing the user to override that default wiring. Is there a canonical way to do this?melix
03/07/2023, 4:17 PMFeaturePreviews
class? In particular I need to determine if the user has enabled Groovy compilation avoidance, because then the project needs to be configured differently.Adam
03/08/2023, 9:40 AMkotlin-dsl
), and not kotlin("jvm") version "x.y.z"
?Ryan Schmitt
03/09/2023, 6:44 PMAdam
03/10/2023, 9:44 AMJavi
03/11/2023, 9:18 AMBenoît
03/13/2023, 2:32 PMsrcDir
? Does the folder passed has to be annotated with things like @get:OutputFile
for it to work?
If yes, how does one pass something like the following to those methods which don’t accept the type ConfigurableFileCollection
?
@get:OutputDirectories
abstract val outputDirectories: ConfigurableFileCollection
Adam
03/14/2023, 2:55 PMclean --no-configuration-cache --no-build-cache
, I can see in the log output:
> Configure project :
> Configure project :subproject-goodbye
> Configure project :subproject-hello
> Task :clean
> Task :subproject-goodbye:clean
> Task :subproject-hello:clean
So I can check the BuildResult.output
to verify that it contains this string exactly.
But if I re-run the the second time, the test fails because it's missing the Configure project
lines.
I've tried deleting the test project's .gradle
directory, but it didn't have any effect.
Is there a nice flag I can use to force Gradle to configure all projects?Javi
03/19/2023, 11:53 PMresources
, should it be possible to test it on Gradle Test Kit? I am getting a null pointer exception, and if I print all resource files it is not there.Dariusz Kuc
03/21/2023, 10:31 PMDariusz Kuc
03/21/2023, 10:31 PM