Skip to content

Commit

Permalink
Change field types, because they brake deserialization when launch gr…
Browse files Browse the repository at this point in the history
…adle with --configuration-cache
  • Loading branch information
belovaf committed Dec 25, 2021
1 parent 547dbcd commit 3fa721b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/main/kotlin/com/github/bjornvester/xjc/XjcPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class XjcPlugin : Plugin<Project> {
createConfiguration(project, XJC_BIND_CONFIGURATION_NAME)
createConfiguration(project, XJC_PLUGINS_CONFIGURATION_NAME)

xjcConfiguration.defaultDependencies {
xjcConfiguration.withDependencies {
addLater(extension.xjcVersion.map { project.dependencies.create("org.glassfish.jaxb:jaxb-xjc:$it") })
addLater(extension.xjcVersion.map { project.dependencies.create("org.glassfish.jaxb:jaxb-runtime:$it") })
}
Expand Down
13 changes: 6 additions & 7 deletions src/main/kotlin/com/github/bjornvester/xjc/XjcTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ package com.github.bjornvester.xjc
import com.github.bjornvester.xjc.XjcPlugin.Companion.XJC_EXTENSION_NAME
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.NamedDomainObjectProvider
import org.gradle.api.artifacts.Configuration
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.FileCollection
import org.gradle.api.file.FileSystemOperations
import org.gradle.api.file.ProjectLayout
import org.gradle.api.model.ObjectFactory
Expand Down Expand Up @@ -39,13 +38,13 @@ open class XjcTask @Inject constructor(
var xsdFiles = getXjcExtension().xsdFiles

@get:Classpath
val xjcConfiguration: Provider<Configuration> = project.configurations.named(XjcPlugin.XJC_CONFIGURATION_NAME)
val xjcConfiguration: Provider<out FileCollection> = project.configurations.named(XjcPlugin.XJC_CONFIGURATION_NAME)

@get:Classpath
val xjcPluginsConfiguration: Provider<Configuration> = project.configurations.named(XjcPlugin.XJC_PLUGINS_CONFIGURATION_NAME)
val xjcPluginsConfiguration: Provider<out FileCollection> = project.configurations.named(XjcPlugin.XJC_PLUGINS_CONFIGURATION_NAME)

@get:Classpath
val xjcBindConfiguration: Provider<Configuration> = project.configurations.named(XjcPlugin.XJC_BIND_CONFIGURATION_NAME)
val xjcBindConfiguration: Provider<out FileCollection> = project.configurations.named(XjcPlugin.XJC_BIND_CONFIGURATION_NAME)

@Optional
@Input
Expand Down Expand Up @@ -89,7 +88,7 @@ open class XjcTask @Inject constructor(
logger.info("Loading XSD files ${xsdFiles.files}")
logger.debug("XSD files are loaded from ${xsdDir.get()}")

val xjcClasspath = xjcConfiguration.get().resolve() + xjcPluginsConfiguration
val xjcClasspath = xjcConfiguration.get().files + xjcPluginsConfiguration.get().files
logger.debug("Loading JAR files for XJC: $xjcClasspath")

extractBindFilesFromJars()
Expand Down Expand Up @@ -172,7 +171,7 @@ open class XjcTask @Inject constructor(
* that causes the jar files to be locked on Windows. To avoid this, we extract the bind files ourselves.
*/
private fun extractBindFilesFromJars() {
val bindJarFiles = xjcBindConfiguration.get().resolve()
val bindJarFiles = xjcBindConfiguration.get().files
logger.debug("Loading binding JAR files: $bindJarFiles")

bindJarFiles.forEach { bindJarFile ->
Expand Down

0 comments on commit 3fa721b

Please sign in to comment.