uap-java
uap-java copied to clipboard
feat: move YAML parsing to compile time
This PR removes the necessity to have SnakeYAML at runtime.
A class Regexes.java is added to the project.
It represents the content of uap-core/regexes.yaml directly as Java object.
The code generation logic (adjusted from what the Parser was doing at runtime) is now in RegexesBuilder.java in the test source-set.
A test class is added RegexesBuilderTest.java.
The test testCode() makes sure that the Regexes.java is up-to-date with uap-core/regexes.yaml
The yaml regexes.yaml is no longer present in the produced jar.
Version is bumped to 2.0.0-SNAPSHOT as this is a breaking change if some people where supplying there own yaml config file.
Process to update when there is a new regexes.yaml file:
- Update the Git submodule.
- Run the test locally.
testCode()will fail and generate a newRegexes.javacontent. - Commit the new
Regexes.javafile with the submodule update and push.
Fixes #77
Fixes #81 (SnakeYAML is updated to 2.0 and is now a test dependency)
Fixes #79 (SnakeYAML Engine is not necessary)
Fixes #68 (SnakeYAML is no longer a runtime dependency)
I am really interested in this being merged. Is there a timeline for this?
I am also interested in this change. Can someone review this?
Until this is sorted out, I have released this version on maven central:
<dependency>
<groupId>com.unblu.ua-parser</groupId>
<artifactId>uap-java</artifactId>
<version>2.0.0</version>
</dependency>
From the fork https://github.com/unblu/uap-java
It contains the change suggested in this PR.