Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for JakartaEE JAXB/XJC 4.0 + major dependency upgrades #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Invokes the `xjc` binding compiler from a Gradle build.

== Requirements

- Gradle 5.6 or higher
- JDK 1.8 or higher (when running Gradle)
- Gradle 6.8 or higher
- JDK 11 or higher (when running Gradle)


== Quick Start
Expand All @@ -34,7 +34,7 @@ dependency on the JAXB API:
.build.gradle(.kts)
----
plugins {
id("org.unbroken-dome.xjc") version "2.0.0"
id("org.unbroken-dome.xjc") version "3.0.0"
}

dependencies {
Expand Down
115 changes: 63 additions & 52 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ plugins {
kotlin("jvm")
`java-gradle-plugin`
`maven-publish`
id("org.unbroken-dome.test-sets") version "3.0.1"
id("com.gradle.plugin-publish") version "0.12.0"
id("org.asciidoctor.convert") version "1.5.9.2"
id("org.jetbrains.dokka") version "0.10.1"
id("org.unbroken-dome.test-sets") version "4.0.0"
id("com.gradle.plugin-publish") version "1.1.0"
id("org.asciidoctor.jvm.convert") version "3.3.2"
id("org.jetbrains.dokka") version "1.8.10"
}


val kotlinVersion: String by extra


repositories {
jcenter()
mavenCentral()
}


Expand All @@ -34,20 +34,30 @@ val xjcCommon: SourceSet by sourceSets.creating
val xjc22: SourceSet by sourceSets.creating
val xjc23: SourceSet by sourceSets.creating
val xjc30: SourceSet by sourceSets.creating
val xjcSourceSets = listOf(xjcCommon, xjc22, xjc23, xjc30)
val xjc40: SourceSet by sourceSets.creating
val xjcSourceSets = listOf(xjcCommon, xjc22, xjc23, xjc30, xjc40)

val asciidoctorExtensions by configurations.creating

configurations {
xjcSourceSets.forEach { xjcSourceSet ->
(xjcSourceSet.compileOnlyConfigurationName) {
extendsFrom(configurations["compileOnly"], configurations["implementation"])
}
}
}

dependencies {
asciidoctorExtensions("com.bmuschko:asciidoctorj-tabbed-code-extension:0.3")

compileOnly(kotlin("stdlib-jdk8"))
compileOnly(gradleApi())

implementation("javax.activation:javax.activation-api:1.2.0")
implementation("xml-resolver:xml-resolver:1.2")

for (xjcSourceSet in xjcSourceSets) {
xjcSourceSets.forEach { xjcSourceSet ->
(xjcSourceSet.compileOnlyConfigurationName)(sourceSets["main"].output)
(xjcSourceSet.compileOnlyConfigurationName)(configurations["compileOnly"])
(xjcSourceSet.implementationConfigurationName)(configurations["implementation"])
}

"xjcCommonCompileOnly"("com.sun.xml.bind:jaxb-xjc:2.3.3")
Expand All @@ -62,21 +72,25 @@ dependencies {
"xjc23CompileOnly"("com.sun.xml.bind:jaxb-xjc:2.3.3")

"xjc30CompileOnly"(xjcCommon.output)
"xjc30CompileOnly"("com.sun.xml.bind:jaxb-xjc:3.0.0-M4")
"xjc30CompileOnly"("com.sun.xml.bind:jaxb-xjc:3.0.0")
"xjc30CompileOnly"("com.sun.xml.bind:jaxb-xjc:2.3.3")
"xjc30CompileOnly"("jakarta.xml.bind:jakarta.xml.bind-api:3.0.0-RC3")
"xjc30CompileOnly"("jakarta.xml.bind:jakarta.xml.bind-api:3.0.0")

"xjc40CompileOnly"(xjcCommon.output)
"xjc40CompileOnly"("com.sun.xml.bind:jaxb-xjc:4.0.2")
"xjc40CompileOnly"("jakarta.xml.bind:jakarta.xml.bind-api:4.0.0")

"testLibApi"(kotlin("stdlib-jdk8"))
"testLibApi"("com.willowtreeapps.assertk:assertk-jvm:0.22")
"testLibApi"("com.willowtreeapps.assertk:assertk-jvm:0.25")

"testImplementation"("org.spekframework.spek2:spek-dsl-jvm:2.0.9")
"testRuntimeOnly"("org.spekframework.spek2:spek-runner-junit5:2.0.9")
"testImplementation"("org.spekframework.spek2:spek-dsl-jvm:2.0.19")
"testRuntimeOnly"("org.spekframework.spek2:spek-runner-junit5:2.0.19")

"integrationTestImplementation"(gradleTestKit())
"integrationTestImplementation"("org.junit.jupiter:junit-jupiter-api:5.7.0")
"integrationTestImplementation"("org.junit.platform:junit-platform-commons:1.7.0")
"integrationTestImplementation"("org.ow2.asm:asm:9.0")
"integrationTestRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.7.0")
"integrationTestImplementation"("org.junit.jupiter:junit-jupiter-api:5.9.2")
"integrationTestImplementation"("org.junit.platform:junit-platform-commons:1.9.1")
"integrationTestImplementation"("org.ow2.asm:asm:9.4")
"integrationTestRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.9.2")
}


Expand All @@ -88,9 +102,15 @@ configurations.all {
}
}

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}


tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.jvmTarget = "11"
kotlinOptions.freeCompilerArgs = listOf("-Xjvm-default=enable")
}

Expand Down Expand Up @@ -174,52 +194,43 @@ gradlePlugin {
}


pluginBundle {
website = "https://github.com/unbroken-dome/gradle-xjc-plugin"
vcsUrl = "https://github.com/unbroken-dome/gradle-xjc-plugin"
description = "A plugin that integrates the XJC binding compiler into a Gradle build."
tags = listOf("xjc", "jaxb", "code generation", "xml")
gradlePlugin {
website.set("https://github.com/unbroken-dome/gradle-xjc-plugin")
vcsUrl.set("https://github.com/unbroken-dome/gradle-xjc-plugin")

(plugins) {
"xjcPlugin" {
displayName = "XJC Plugin"
description = "A plugin that integrates the XJC binding compiler into a Gradle build."
tags.set(listOf("xjc", "jaxb", "code generation", "xml"))
}
}
}


tasks.named("dokka", org.jetbrains.dokka.gradle.DokkaTask::class) {
outputFormat = "html"
configuration {
externalDocumentationLink {
url = uri("https://docs.gradle.org/current/javadoc/").toURL()
}
reportUndocumented = false
sourceLink {
path = "src/main/kotlin"
url = "https://github.com/unbroken-dome/gradle-xjc-plugin/blob/v${project.version}/src/main/kotlin"
lineSuffix = "#L"
}
perPackageOption {
prefix = "org.unbrokendome.gradle.plugins.xjc.internal"
suppress = true
tasks.withType(org.jetbrains.dokka.gradle.DokkaTask::class).configureEach {
dokkaSourceSets {
configureEach {
externalDocumentationLink {
url.set(uri("https://docs.gradle.org/current/javadoc/").toURL())
}
reportUndocumented.set(false)
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(uri("https://github.com/unbroken-dome/gradle-xjc-plugin/blob/v${project.version}/src/main/kotlin").toURL())
remoteLineSuffix.set("#L")
}
perPackageOption {
matchingRegex.set("""org\.unbrokendome\.gradle\.plugins\.xjc\.internal""")
suppress.set(true)
}
}
}
}


asciidoctorj {
version = "2.4.1"
}

dependencies {
"asciidoctor"("com.bmuschko:asciidoctorj-tabbed-code-extension:0.3")
}


tasks.named("asciidoctor", org.asciidoctor.gradle.AsciidoctorTask::class) {
sourceDir("docs")
sources(delegateClosureOf<PatternSet> { include("index.adoc") })
tasks.named("asciidoctor", org.asciidoctor.gradle.jvm.AsciidoctorTask::class) {
setSourceDir(file("docs"))
baseDirFollowsSourceFile()

options(mapOf(
"doctype" to "book"
Expand Down
4 changes: 2 additions & 2 deletions docs/prerequisites.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

You need at least the following:

* Gradle 5.6 or higher
* Gradle 6.9 or higher

* JDK 8 or higher (for running Gradle)
* JDK 11 or higher (for running Gradle)
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
kotlinVersion=1.3.72
kotlinVersion=1.8.10

group=org.unbroken-dome.gradle-plugins
version=2.0.0
version=3.0.0
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions samples/groovy-dsl/basic/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id('java')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


repositories {
jcenter()
mavenCentral()
}


Expand Down
2 changes: 1 addition & 1 deletion samples/groovy-dsl/catalogs/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
2 changes: 1 addition & 1 deletion samples/groovy-dsl/catalogs/consumer/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id('java')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


Expand Down
2 changes: 1 addition & 1 deletion samples/groovy-dsl/complete/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
2 changes: 1 addition & 1 deletion samples/groovy-dsl/complete/consumer/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id('java')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


Expand Down
2 changes: 1 addition & 1 deletion samples/groovy-dsl/complete/library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id('java-library')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


Expand Down
2 changes: 1 addition & 1 deletion samples/groovy-dsl/episodes/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
2 changes: 1 addition & 1 deletion samples/groovy-dsl/episodes/episode-consumer/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id('java')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


Expand Down
2 changes: 1 addition & 1 deletion samples/groovy-dsl/episodes/episode-producer/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id('java-library')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


Expand Down
4 changes: 2 additions & 2 deletions samples/groovy-dsl/remote-schema/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id('java')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


repositories {
jcenter()
mavenCentral()
}


Expand Down
4 changes: 2 additions & 2 deletions samples/groovy-dsl/xjc-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id('java')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


repositories {
jcenter()
mavenCentral()
}


Expand Down
4 changes: 2 additions & 2 deletions samples/groovy-dsl/xjc-version-2_2/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id('java')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


repositories {
jcenter()
mavenCentral()
}


Expand Down
4 changes: 2 additions & 2 deletions samples/groovy-dsl/xjc-version-3_0/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
plugins {
id('java')
id('org.unbroken-dome.xjc') version '2.0.0'
id('org.unbroken-dome.xjc') version '3.0.0'
}


repositories {
jcenter()
mavenCentral()
}


Expand Down
19 changes: 19 additions & 0 deletions samples/groovy-dsl/xjc-version-4_0/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
plugins {
id('java')
id('org.unbroken-dome.xjc') version '3.0.0'
}


repositories {
mavenCentral()
}


xjc {
xjcVersion = '4.0'
}

dependencies {
// XJC 3.0 requires a different JAXB API artifact
implementation 'jakarta.xml.bind:jakarta.xml.bind-api:4.0.0'
}
8 changes: 8 additions & 0 deletions samples/groovy-dsl/xjc-version-4_0/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenLocal()
}
}

rootProject.name = 'xjc-version-4_0'
Loading