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

feat: move YAML parsing to compile time #83

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jmini
Copy link

@jmini jmini commented Apr 7, 2023

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 new Regexes.java content.
  • Commit the new Regexes.java file 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)

@tsands2
Copy link

tsands2 commented Apr 26, 2023

I am really interested in this being merged. Is there a timeline for this?

@siddrameshwar
Copy link

I am also interested in this change. Can someone review this?

@jmini
Copy link
Author

jmini commented May 17, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants