Skip to content

Commit

Permalink
minor refactor: use later gradle syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
paulk-asert committed Jan 6, 2025
1 parent 3c6596c commit c4932f6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.ConfigurableFileTree
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.Classpath
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
Expand All @@ -42,6 +44,8 @@ class DgmConverter extends DefaultTask {

private final ExecOperations execOperations

@Input Provider<String> groovyTargetBytecodeVersion = project.rootProject.extensions.getByType(SharedConfiguration).groovyTargetBytecodeVersion

@OutputDirectory
final DirectoryProperty outputDirectory

Expand Down Expand Up @@ -71,7 +75,7 @@ class DgmConverter extends DefaultTask {
execOperations.javaexec {
it.mainClass.set('org.codehaus.groovy.tools.DgmConverter')
it.classpath = this.classpath
it.jvmArgs("-Dgroovy.target.bytecode=${project.rootProject.extensions.getByType(SharedConfiguration).groovyTargetBytecodeVersion.get()}" as String)
it.jvmArgs("-Dgroovy.target.bytecode=${groovyTargetBytecodeVersion.get()}" as String)
it.args('--info', outputDirectory.asFile.get().absolutePath)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class WriteExtensionDescriptorTask extends DefaultTask {
@Input String extensionClasses = ''
@Input String staticExtensionClasses = ''
@OutputFile File descriptor = computeDescriptorFile()
@Input String moduleName = project.name
@Input String moduleVersion = project.version

private File computeDescriptorFile() {
def metaInfDir = project.layout.buildDirectory.dir('resources/main/META-INF/groovy').get().asFile
Expand All @@ -43,8 +45,8 @@ class WriteExtensionDescriptorTask extends DefaultTask {
def writeDescriptor() {
descriptor.parentFile.mkdirs()
descriptor.withWriter {
it << """moduleName=${project.name}
moduleVersion=${project.version}
it << """moduleName=$moduleName
moduleVersion=$moduleVersion
extensionClasses=${extensionClasses}
staticExtensionClasses=${staticExtensionClasses}"""
}
Expand Down

0 comments on commit c4932f6

Please sign in to comment.