-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use jakarta #25
Use jakarta #25
Conversation
brinxmat
commented
Dec 4, 2024
- Uses an xjc gradle plugin that has been updated recently (previous is basically dead)
- Does as much as possible in groovy, rather than via the plugin, which hopefully means we can drop-in replacement since no special functionality is required
- jakarta is now used
plugins { | ||
id 'java' | ||
id "org.unbroken-dome.xjc" version "2.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was last updated four years ago, a PR was created by a third party for jakarta update in recent time, but nothing has been commented or merged in four years.
datacite-transform/build.gradle
Outdated
plugins { | ||
id 'java' | ||
id "org.unbroken-dome.xjc" version "2.0.0" | ||
id("io.github.alexpercont.xjc-plugin") version "1.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessarily the best choice, but it is the most recent and supports jakarta.
The download plugin is a common choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @ketilaa have a point regarding the xsd and if we also don't need to rely on a plugin with short track record and only one contributor, that would be nice. If download is not a requirement, would it be easier to find an alternative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We changed the plugin to another one-person (with two personalities) project, but with more users
def xml = new groovy.xml.XmlSlurper().parseText(source.getText()) | ||
|
||
if (!file(schemaDir + urlFile).exists()) { | ||
Files.createFile(Paths.get(schemaDir + urlFile)) | ||
.text = "https://schema.datacite.org/meta/kernel-${schemaVersion}/metadata.xsd" | ||
return xml.'**'.findAll { | ||
it.name() == 'include' || it.name() == 'import' | ||
}.collect { | ||
it.@'schemaLocation' | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we're extracting the URIs of the XML files that we need to gather in order to be able to build.
def uri = "https://schema.datacite.org/meta/kernel-${SCHEMA_VERSION}/${path}" | ||
def file = file(SCHEMA_DIR.toURI().toString() + '/' + path) | ||
|
||
if (!file.exists()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to download if we already have.
} | ||
DID_DOWNLOAD.put(path, true) | ||
} else { | ||
DID_DOWNLOAD.put(path, false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't, we give the message that you might want to clean the source to override.
from "${layout.buildDirectory}/classes/java/main" | ||
} | ||
|
||
tasks.named('sourcesJar') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary to provide explicit dependency here.
} | ||
|
||
System.setProperty('javax.xml.accessExternalSchema', 'all') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what we cannot do
import jakarta.xml.bind.JAXBContext; | ||
import jakarta.xml.bind.JAXBException; | ||
import jakarta.xml.bind.Marshaller; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hurra
Have we considered just downloading the schema files? It is somewhat risky to rely on external content during a build, and a given build might be hard to reproduce: https://reproducible-builds.org |
|
||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-o
datacite-transform/build.gradle
Outdated
plugins { | ||
id 'java' | ||
id "org.unbroken-dome.xjc" version "2.0.0" | ||
id("io.github.alexpercont.xjc-plugin") version "1.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @ketilaa have a point regarding the xsd and if we also don't need to rely on a plugin with short track record and only one contributor, that would be nice. If download is not a requirement, would it be easier to find an alternative?
Test Results5 tests 5 ✅ 0s ⏱️ Results for commit 099227e. ♻️ This comment has been updated with latest results. |
Co-authored-by: brinxmat <789709+brinxmat@users.noreply.github.com>
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more Footnotes
|
@ketilaa @torbjokv @LarsV123 I will create a new PR that makes the "download" functionality a "helper" and put the XSD under version control IF AND WHEN I know the licensing status of the XSD. |