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

TODO: create a library function that can compute a root location from a module name #1826

Open
jurgenvinju opened this issue Jun 28, 2023 · 2 comments
Labels

Comments

@jurgenvinju
Copy link
Member

It's hard to refer to resources in Rascal in a consistent manner.

  • For source projects the project scheme works, but that is different from after deployment.
  • For deployed projects the lib scheme works, but it can be ambiguous due to different versions of the same library at run-time

Proposal:

  • add to util::Reflective:
    • loc getModuleRoot("my::module::Name") - produces the result of looking for /my/module/Name.rsc in the interpreter's search path and returns the root src folder. For the compiler it will return getClass("my.module.Name").getResource("/")
    • loc getModuleResource("my::module::Name", myPath) will use the child location of getModuleRoot with myPath appended to it.

The idea would be that the behavior of this function would abstract from a project source or a deployed situation. In either situation the output loc is different (one is a project source directory, the other is inside a jar file), but the same files would be found.

The user must make sure that resources end up in the target folder in the right place to make the above true.

@jurgenvinju
Copy link
Member Author

I really don't know how to make this yet, without digging deep into interpreter specific dependency.

@jurgenvinju
Copy link
Member Author

It could be that an answer to #1827 makes this a lot easier. There could be several instances of the URIResolverRegistry singleton, each for an application in which module://moduleName would indeed resolve to a unique module path. Or getModuleRoot would have a unique resolution within that layer.

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

No branches or pull requests

1 participant