Skip to content

new reusable functions for using PathConfig #2270

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

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

jurgenvinju
Copy link
Member

@jurgenvinju jurgenvinju commented May 22, 2025

  • this branch is a pure extension of another cleaner PR branch: clean-factor-path-config
  • this branch adds basic functionality to compute file names from module names and module names from file names
  • a reusable function for computing the latest relevant source file or binary file or library file based on the PathConfig and the timestamps of the relevant files
  • the parameters for the above functions are computed from a LanguageFileConfig constructor, that explain which extensions, prefixes and filename escapes to use.

@jurgenvinju jurgenvinju self-assigned this May 22, 2025
@jurgenvinju jurgenvinju requested a review from PaulKlint May 22, 2025 12:04
@rodinaarssen
Copy link
Member

We should probably revisit #2265 after finishing this PR.

@jurgenvinju jurgenvinju requested a review from rodinaarssen May 22, 2025 12:09
@PaulKlint

This comment was marked as outdated.

Copy link

codecov bot commented May 22, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47%. Comparing base (1d20d27) to head (7678934).

Additional details and impacted files
@@           Coverage Diff            @@
##              main   #2270    +/-   ##
========================================
  Coverage       47%     47%            
+ Complexity    6335    6334     -1     
========================================
  Files          762     761     -1     
  Lines        62974   62868   -106     
  Branches      9397    9382    -15     
========================================
+ Hits         29909   29930    +21     
+ Misses       30849   30722   -127     
  Partials      2216    2216            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jurgenvinju jurgenvinju marked this pull request as draft May 26, 2025 09:18
return replaceAll(relative.path[1..], "/", fcfg.packageSep);
}

// below we have some core tests of the above features
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to see these tests, but this violates our current test organization.
I would expects then in tests/libraries/PathConfigs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been slowly moving library tests to the library since a few years, because the tests are documentation for the users. The current tutor displays the bodies of tests in the API documentation (while normal function declarations are only shown by their signatures.)

= libsFile(qualifiedModuleName, pcfg.libs, fcfg);

loc libsFile(str qualifiedModuleName, list[loc] libs, LanguageFileConfig fcfg) throws PathNotFound {
loc relativeFile = |relative:///| + fcfg.targetRoot + replaceAll(qualifiedModuleName, fcfg.packageSep, "/");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "relative" a new scheme?

Copy link
Member Author

@jurgenvinju jurgenvinju May 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no that has been there for a while. It is a scheme without semantics (no readers or writers), except that it is always the output scheme of relativize and the input scheme of resolve (the inverse of relativize).

relative:/// locations can be highly useful to use the operations like loc[extension="bla], or loc + str or loc.parent without having to resort to string manipulation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually you use either resolve(absoluteLoc, relativeLoc) or absoluteLoc + relativeLoc.path to get a normal loc again that can read and write stuff.

Copy link
Member

@PaulKlint PaulKlint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you move the Manifest-related code from util::Reflective to?

Copy link
Member

@PaulKlint PaulKlint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did you move the Manifest-related code from util::Reflective to?

@jurgenvinju jurgenvinju changed the title maintain pathconfig new reusable functions for using PathConfig May 26, 2025
@jurgenvinju
Copy link
Member Author

Where did you move the Manifest-related code from util::Reflective to?

I thought I kept it where it was? Just added @deprecated to those functions.

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.

3 participants