Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use only cloc.pl on both Unix and Windows #43

Merged
merged 10 commits into from
Jan 9, 2025
Merged

Conversation

dabico
Copy link
Member

@dabico dabico commented Jan 9, 2025

This PR streamlines several aspects related to how this library works, namely:

  • Windows executable has been removed in favor of solely using the Perl script, thus reducing the overall JAR size;
  • Bundled script location is now lazily initialised only on request;
  • Said script is kept between runs, with the user home directory serving as the cache.

These changes respectively lead to the following considerations:

  • The Perl interpreter has to be installed and located on the user's PATH in order for the library to work as it did before;
  • Volatile static fields and double-locking synchronization are needed for consistent accesses in threaded scenarios;
  • MD5 checksums are now needed to validate when the cached script has been updated and requires replacement.

Closes #40

dabico added 10 commits January 9, 2025 16:57
Streamlined how we locate and load executables:
- We now only use the Perl script;
- We keep this script between runs;
- We use MD5 checks to determine when to update it;

A direct consequence is that we now rely on the `perl` interpreter
being present on the `PATH`.
Moved the initialization of the `EXECUTABLE` field to a thread-safe
lazy loading mechanism using double-checked locking. Ensures the
executable is only created once, avoiding unnecessary initialization.
@dabico dabico self-assigned this Jan 9, 2025
@dabico dabico added the enhancement New feature or request label Jan 9, 2025
@dabico dabico merged commit ecfa57c into master Jan 9, 2025
7 checks passed
@dabico dabico deleted the enhancement/executable branch January 9, 2025 18:43
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reduce dependency bundle size
1 participant