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

Base config.edn dev profile include conflicts with other libraries artifact name #112

Open
lucassousaf opened this issue Dec 1, 2022 · 0 comments · May be fixed by #114
Open

Base config.edn dev profile include conflicts with other libraries artifact name #112

lucassousaf opened this issue Dec 1, 2022 · 0 comments · May be fixed by #114

Comments

@lucassousaf
Copy link

The base config.edn declares two profile includes for dev and local .

 :duct.profile/dev   #duct/include "dev"
 :duct.profile/local #duct/include "local"

This is a problem for artifact names that start with either dev or local.

For example, if you include the following library to your project:
[dev.gethop/sql-utils "0.4.13"]

When duct starts reading the configuration it will throw the following exception:

Execution error at integrant.core/read-string (core.cljc:155).
EOF while reading

We think the root of the problem is this line in the core library. Because if you run the following:

dev> (io/resource "dev")
#object[java.net.URL 0x482a879d "jar:file:/home/hop/.m2/repository/dev/gethop/sql-utils/0.4.13/sql-utils-0.4.13.jar!/dev"]

you can see that the return value is not the expected one from the duct point of view.

We think that the #duct/include for profiles in the base config of the duct template, should point to existing files explicitly. For example dev.edn and local.edn. That means changing the following lines in the base config of the duct template:

 :duct.profile/dev   #duct/include "dev.edn"
 :duct.profile/local #duct/include "local.edn"

What do you think? Is there are reason for having just dev and local instead of specific file names and extensions?

iarenaza added a commit to biotz/duct that referenced this issue Jan 8, 2025
The default profile includes in the base `config.edn` file conflict
with other libraries artifact names, if those artifact names have
`dev` or `local` as their fist "path component".

The base `config.edn` declares two profile includes:

   :duct.profile/dev   #duct/include "dev"
   :duct.profile/local #duct/include "local"

This is a problem for artifact names that start with either `dev` or
`local`.

For example, if you add the following depenency library to
your (Leiningen) project:

   [dev.gethop/sql-utils "0.4.13"]

When Duct starts reading the configuration it will throw the following
exception:

   Execution error at integrant.core/read-string (core.cljc:155).
   EOF while reading

The root of the problem is the line at
https://github.com/duct-framework/core/blob/28de7df11af9c95ceb157d0c5163c061a75554b3/src/duct/core.clj#L89
in the `core` library. Because if you run the following code snippet
in a REPL from the a project containing the above dependency:

    user=> (dev)
    :loaded
    dev=> (io/resource "dev")
    #object[java.net.URL 0x482a879d "jar:file:/home/hop/.m2/repository/dev/gethop/sql-utils/0.4.13/sql-utils-0.4.13.jar!/dev"]
    dev=>

you can see that the return value is not the expected one from the
Duct point of view (the `dev.edn` file in the project directory), but
the `dev` directory from the dependency jar file.

The profile includes in the base config of the Duct template should
point to the project files explicitly.

[Fixes: duct-framework#112]
@iarenaza iarenaza linked a pull request Jan 8, 2025 that will close this issue
iarenaza added a commit to biotz/duct that referenced this issue Jan 8, 2025
Include file extension for dev.edn and local.edn configurations in order
to prevent conflicts with dev and local resource directories.
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 a pull request may close this issue.

1 participant