Slackbot
11/14/2023, 7:32 PMVampire
11/15/2023, 9:16 AMsourceSets {
java {
srcDir(generateSourceTask)
}
resources {
srcDir(generateResourcesTask)
}
}Paul Kramer
11/15/2023, 1:49 PMPaul Kramer
11/15/2023, 1:50 PMThomas Broyer
11/15/2023, 1:59 PMsrc/main/java and src/main/resources!) and the source set directory will now include that directory too, and know that it's generated by that task. The compilation and resource-processing tasks now have implicit dependencies on the code generation tasks through the source set; and the generation tasks' output directory is (re)configurable by the user and everything should just get the files from the correct location.Paul Kramer
11/15/2023, 2:00 PMThomas Broyer
11/15/2023, 2:11 PM@OutputDirectory-annotated property to configure it, that the plugin will call with a good default value, and the user could reconfigure at its preferences. And if (because) you arrange tasks by wiring their inputs and outputs (possibly through a source set as suggested here), reconfiguring the task is taken into account by any task that (implicitly then) depends on it.Paul Kramer
11/15/2023, 2:15 PMVampire
11/15/2023, 2:21 PMVampire
11/15/2023, 2:21 PMVampire
11/15/2023, 2:22 PMPaul Kramer
11/15/2023, 2:22 PMVampire
11/15/2023, 2:23 PMPaul Kramer
11/15/2023, 2:25 PMVampire
11/15/2023, 2:26 PMVampire
11/15/2023, 2:26 PMPaul Kramer
11/15/2023, 2:26 PMPaul Kramer
11/15/2023, 6:10 PMsourceSets {
java {
srcDir(createVersionClass)
}
}Paul Kramer
11/15/2023, 6:11 PMbuild.gradle.kts:25:9: Unresolved reference: srcDirThomas Broyer
11/15/2023, 6:38 PMsourceSets { // SourceSetContainer
main { // SourceSet
java { // SourceDirectorySet
srcDir(createVersionClass)
}
}
}Paul Kramer
11/15/2023, 6:39 PMPaul Kramer
11/15/2023, 6:52 PMUnresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val TaskContainer.createVersionClass: TaskProvider<CreateVersionClassFile> defined in org.gradle.kotlin.dsl
I am registering the task in my plugin-Class as such:
GradleVersionerExtension extension = project.getExtensions().create("gradleVersioner", GradleVersionerExtension.class);
project.getTasks().register("createVersionClass", CreateVersionClassFile.class, task->{
task.getVersionOutputName().set(extension.getVersionClassName());
task.getOutputDir().set(extension.getClassOutputDir().convention(project.getLayout().getBuildDirectory().get().dir("gradle-versioner-src")));
});
And in the CreateVersionClassFile.java, I have:
@OutputDirectory
abstract public DirectoryProperty getOutputDir();
Am I missing anything else?Paul Kramer
11/15/2023, 6:54 PMPaul Kramer
11/15/2023, 7:34 PMsourceSets{
main{
java{
srcDir(tasks.getByName("createVersionClass"))
}
}
}Vampire
11/15/2023, 10:43 PMPaul Kramer
11/15/2023, 11:18 PMplugins {
`java-library`
id("org.openapi.generator") version "6.2.0"
}
repositories {
mavenCentral()
}
sourceSets{
main{
java{
srcDir(openApiGenerate)
}
}
}Paul Kramer
11/15/2023, 11:18 PMPaul Kramer
11/15/2023, 11:19 PMplugins {
`java-library`
id("org.openapi.generator") version "6.2.0"
}
repositories {
mavenCentral()
}
sourceSets{
main{
java{
srcDir(tasks.getByName("openApiGenerate"))
}
}
}Vampire
11/15/2023, 11:20 PMPaul Kramer
11/15/2023, 11:26 PMPaul Kramer
11/15/2023, 11:26 PMVampire
11/15/2023, 11:27 PMPaul Kramer
11/15/2023, 11:28 PMVampire
11/15/2023, 11:29 PMPaul Kramer
11/15/2023, 11:30 PMVampire
11/15/2023, 11:30 PMVampire
11/15/2023, 11:30 PMPaul Kramer
11/15/2023, 11:34 PMPaul Kramer
11/15/2023, 11:36 PMCannot convert the provided notation to a File or URI: extension 'openApiGenerate'.
The following types/formats are supported:
- A String or CharSequence path, for example 'src/main/java' or '/usr/include'.
- A String or CharSequence URI, for example 'file:/usr/include'.
- A File instance.
- A Path instance.
- A Directory instance.
- A RegularFile instance.
- A URI or URL instance.
- A TextResource instance.
(the message is different here than in my earlier project, because openApiGenerate seems to be also the name of the extension)Vampire
11/15/2023, 11:40 PMtasks. prefix or within tasks { ... }Vampire
11/15/2023, 11:40 PMPaul Kramer
11/15/2023, 11:40 PMVampire
11/15/2023, 11:41 PMVampire
11/15/2023, 11:41 PMVampire
11/15/2023, 11:41 PMsrcDir(tasks.openApiGenerate)Paul Kramer
11/15/2023, 11:41 PMPaul Kramer
11/15/2023, 11:42 PMPaul Kramer
11/15/2023, 11:43 PMVampire
11/15/2023, 11:43 PMAny and just does a runtime checkVampire
11/16/2023, 12:36 AMUnresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public val TaskContainer.createVersionClass: TaskProvider<CreateVersionClassFile> defined in org.gradle.kotlin.dsl
means "you are trying to get the property createVersionClass from an object that does not have such a property, there is such a property on TaskContainer but where you try to get it from is not of that type".