uap-java icon indicating copy to clipboard operation
uap-java copied to clipboard

feat: move YAML parsing to compile time

Open jmini opened this issue 2 years ago • 3 comments
trafficstars

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)

jmini avatar Apr 07 '23 07:04 jmini

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

tsands2 avatar Apr 26 '23 12:04 tsands2

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

siddrameshwar avatar Apr 28 '23 04:04 siddrameshwar

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.

jmini avatar May 17 '23 06:05 jmini