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

Unify writing and reading compile specs #142

Merged
merged 7 commits into from
May 12, 2024

Conversation

tudortimi
Copy link
Owner

No description provided.

The default implementation will grow to also handle reading from and writing to XML.
The Java Architecture for XML Binding (JAXB) simplifies the code a lot. It will also make it easier to perform the reverse operation.

The tests fail at the moment, because the XMLs that are produced contain absolute paths for the files.
We have to pass the directory where the source files are located to the file adapter. We're only interested in calling `unmarshall()` in this context, so the fact that the project is not set is not an issue.
JAXB is only available in the JDK until version 8. In JDK9 it is still technically available, but has to be activated using a compile/runtime switch, which is not compatible with JDK8. Starting with JDK11, the package was removed altogether and has to be procured as a 3rd party library.

The tests work without the dependency, because they run in JDK8. Trying to run a "real" Gradle build might use a newer JDK, which would cause errors due to missing classes.
Code in the `WriteXrunArgsFile` artifact transform fails with a classloader error in JDK11:

```
         > javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
            - with linked exception:
           [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory]
```

The `WriteCompileSpecFile` task also uses `JAXBException`, but it has no problem in finding the implementation classes. The class mentioned in the error message is present in the JAR. Why it fails is a mystery.

Version 3 of JAXB works in both JDK8 and JDK11. The namespace has changed from `javax` to `jakarta`, though. Version 4 requires JDK11, so we can't use it because we have to keep supporting JDK8.
@tudortimi tudortimi merged commit ba448b8 into master May 12, 2024
1 check passed
@tudortimi tudortimi deleted the unify-writing-and-reading-compile-specs branch May 12, 2024 09:18
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.

None yet

1 participant