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

Use jakarta #25

Merged
merged 7 commits into from
Dec 5, 2024
Merged

Use jakarta #25

merged 7 commits into from
Dec 5, 2024

Conversation

brinxmat
Copy link
Contributor

@brinxmat 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"
Copy link
Contributor Author

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.

plugins {
id 'java'
id "org.unbroken-dome.xjc" version "2.0.0"
id("io.github.alexpercont.xjc-plugin") version "1.1"
Copy link
Contributor Author

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.

Copy link

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?

Copy link
Contributor Author

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

Comment on lines +34 to 40
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'
}
Copy link
Contributor Author

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()) {
Copy link
Contributor Author

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)
Copy link
Contributor Author

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') {
Copy link
Contributor Author

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')
Copy link
Contributor Author

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

Comment on lines +3 to +5
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hurra

@brinxmat brinxmat requested a review from monaullah December 4, 2024 17:32
@ketilaa
Copy link

ketilaa commented Dec 5, 2024

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-o

plugins {
id 'java'
id "org.unbroken-dome.xjc" version "2.0.0"
id("io.github.alexpercont.xjc-plugin") version "1.1"
Copy link

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?

Copy link

github-actions bot commented Dec 5, 2024

Test Results

5 tests   5 ✅  0s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit 099227e.

♻️ This comment has been updated with latest results.

Co-authored-by: brinxmat <789709+brinxmat@users.noreply.github.com>
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for c8c45af1 0.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (c8c45af) Report Missing Report Missing Report Missing
Head commit (099227e) 997 427 42.83%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#25) 1 0 0.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@brinxmat
Copy link
Contributor Author

brinxmat commented Dec 5, 2024

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

@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.

@brinxmat brinxmat merged commit e2d7046 into develop Dec 5, 2024
6 checks passed
@brinxmat brinxmat deleted the use-jakarta branch December 5, 2024 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants