Fork me on GitHub
#polylith
<
2021-07-10
>
tengstrand08:07:00

The latest commit to the issue-66 branch includes a bug fix and https://github.com/polyfy/polylith/issues/90.

🚀 3
seancorfield16:07:19

@U1G0HH87L This seems to have fixed one bug in local/root relative path resolution but introduced a different bug. Prior to this update, we had a project that depended on a non-Polylith local dep as ../../worldsingles and that used to work. Now it does, and it seems to need worldsingles instead -- which means we can't, separately, build the JAR for that project. That's the new bug. The bug that has been fixed is that, prior to this update, a base that depended on that non-Polylith local dep had to use worldsingles even though the correct path should have been ../../worldsingles.

seancorfield16:07:39

Here's what we had in the project's deps.edn file:

:deps {org.clojure/clojure {:mvn/version "1.11.0-alpha1"}

        worldsingles/worldsingles  {:local/root "../../worldsingles"}
        poly/base-batch-jobs       {:local/root "../../bases/batch-jobs"}
        ;; being very explicit about which components the base needs:
        poly/billing-machine       {:local/root "../../components/billing-machine"}
        poly/caching               {:local/root "../../components/caching"}
        poly/configuration         {:local/root "../../components/configuration"}
...
That used to work. Now that dependency has to be
worldsingles/worldsingles  {:local/root "worldsingles"}
otherwise test can't find it in the context of that project.

seancorfield16:07:45

Here's the error:

poly> test
Projects to run tests from: worldsingles

Couldn't resolve libraries for the worldsingles project: clojure.lang.ExceptionInfo: Manifest type not detected when finding deps for worldsingles/worldsingles in coordinate #:local{:root "/Developer/workspace/worldsingles"} {:lib worldsingles/worldsingles, :coord #:local{:root "/Developer/workspace/worldsingles"}}
Manifest type not detected when finding deps for worldsingles/worldsingles in coordinate #:local{:root "/Developer/workspace/worldsingles"}
You can see that ../../ is navigating up the tree relative to where poly is run rather than relative to the project folder projects/worldsingles.

tengstrand16:07:30

Ok, I will have a look.

seancorfield16:07:45

Weirdly, it seems that both worldsingles and ../../worldsingles work in the base's dependency now whereas only worldsingles worked before so I'm not sure what's up with that.

tengstrand16:07:13

Ok, interesting 😉

tengstrand16:07:35

So the worldsingles directory lives at the same level as e.g. components and projects?

seancorfield17:07:02

Yes, it's a legacy project.

tengstrand17:07:58

Okay, I will look into this.

tengstrand04:07:45

I have pushed a fix @U04V70XH6. I will add more tests around this. It will be included in the next commit.

seancorfield05:07:50

@U1G0HH87L Good morning, and thank you! I'll try that out right now.

👍 4
seancorfield05:07:18

That breaks the :test alias in the workspace-level deps.edn:

:test ; Polylith's testing context for the development project
  {:extra-deps {worldsingles/worldsingles-test {:local/root "worldsingles-test"}
                com.github.seancorfield/expectations {:mvn/version "2.0.0-alpha2"}}
   ...
Since :dev and :test are all paths relative to the workspace, I would have expected a :local/root to also be relative to the workspace? Here's the error:
Couldn't resolve libraries for the development project: clojure.lang.ExceptionInfo: Manifest type not detected when finding deps for worldsingles/worldsingles-test in coordinate #:local{:root "/Developer/workspace/wsmain/clojure/projects/development/worldsingles-test"} {:lib worldsingles/worldsingles-test, :coord #:local{:root "/Developer/workspace/wsmain/clojure/projects/development/worldsingles-test"}}
Manifest type not detected when finding deps for worldsingles/worldsingles-test in coordinate #:local{:root "/Developer/workspace/wsmain/clojure/projects/development/worldsingles-test"}
Note the path doesn't even exist: there is no development inside projects.

seancorfield05:07:07

However, with that change in place (adding ../../ to that :test local root), everything else seems to work correctly, i.e., the projects/worldsingles/deps.edn can have ../../worldsingles which was the original bug above, and its :test alias can have ../../worldsingles-test which is what I would expect. In addition, I can change bases/batch-jobs/deps.edn to use ../../worldsingles and that also now works (previously it had to be just worldsingles which made no sense.

seancorfield05:07:38

I guess maybe if it's just accepted that :local/root deps in :dev or :test in the workspace deps.edn file need to be "as-if" relative to a fictional development project (i.e., in projects), then that at least is consistent between projects...?

seancorfield05:07:59

Actually, no, that really won't work because I actually need to combine :test with legacy stuff and that relative root will not work there. So I think this is definitely a bug. The development project should treat :local/root as workspace-relative @U1G0HH87L

tengstrand05:07:14

Ahh, I know the problem. I missed to treat the development project differently from the other projects (and yes, I didn’t test that, sorry for that). I will have another look at this.

4
seancorfield05:07:41

Thanks. Really appreciate the recent changes!

tengstrand06:07:44

I found the problem. I will push a fix in a few minutes.

tengstrand06:07:26

It looked like external libraries don’t turn up in the libs command (at least not in my test), so I will look into that before I push anything.

seancorfield06:07:01

I'll be here for a short while longer (it's midnight) but I can always test the fix first thing in my morning (about 9 hours).

👍 4
tengstrand07:07:58

I pushed a fix. Please have another look again.

tengstrand07:07:47

It seems like the ws-dir:DIR doesn’t work properly now. Hopefully you will not be affected by this bug. This is one thing that I don’t have a test for, so I will add that and fix this in the weekend.

tengstrand13:07:30

The ws-dir:DIR actually works, but you have to give an existing DIR directory, otherwise it says “The command can only be executed from the workspace root, or by also passing in :: or ws-dir:DIR.“. Will change that so it will tell you that the directory doesn’t exist.

seancorfield16:07:57

Nope, that is still broken the same way as the previous update:

(! 512)-> clojure -M:poly test :dev :all
Checking out:  at 6d4a913dd5417e4b3d8e64be9c622d85b223156a
OpenJDK 64-Bit Server VM warning: Option --illegal-access is deprecated and will be removed in a future release.
Projects to run tests from: development, preview, worldsingles

Couldn't resolve libraries for the development project: clojure.lang.ExceptionInfo: Manifest type not detected when finding deps for worldsingles/worldsingles-test in coordinate #:local{:root "/Developer/workspace/wsmain/clojure/projects/development/worldsingles-test"} {:lib worldsingles/worldsingles-test, :coord #:local{:root "/Developer/workspace/wsmain/clojure/projects/development/worldsingles-test"}}
Manifest type not detected when finding deps for worldsingles/worldsingles-test in coordinate #:local{:root "/Developer/workspace/wsmain/clojure/projects/development/worldsingles-test"}

tengstrand19:07:24

Okay. It worked in my example project. Can you run this and send me the result: clojure -M:poly ws get:projects:dev:lib-deps

seancorfield19:07:58

I'll have to update my setup to test that latest SHA... just a second...

tengstrand20:07:19

I found the problem and have pushed a fix.

seancorfield20:07:01

OK, updating the SHA...

seancorfield20:07:25

Er, I don't see the update on issue-66...?

seancorfield20:07:00

"Updated 13 hours ago by tengstrand"

seancorfield20:07:32

(sorry, I know it's late for you @U1G0HH87L)

tengstrand20:07:02

Forgot to push, but have pushed now! 🙂

seancorfield20:07:11

Success on dev

(! 532)-> clojure -M:poly test :dev
Checking out:  at 99a044b02f2bcc0b6525dbee3dca3fa5f2966cea
OpenJDK 64-Bit Server VM warning: Option --illegal-access is deprecated and will be removed in a future release.
Projects to run tests from: development

Running tests from the development project, including 8 bricks: billing-machine, billing-sdk, http-client-response, messaging-sdk, seo-json-renderer, slack-notifications, batch-jobs, preview-web

Testing ws.batch-jobs.reminders-test
ServerSystem:start() {:host Sean-Corfields-iMac, :heap (3% 130M 4096M), :cpu (39% 8 3.13), :clojure 1.10.3, :java 16, :jvm 16+36, :started 2021-07-15 13:22:52, :version source}
[ws.environment.impl] {} Environment:start() reading environment...
[ws.environment.impl] {} Reading environment settings from /opt/worldsingles/environment.edn.
[ws.environment.impl] {} Using sean-dev as the hostname to determine the environment.
[ws.environment.impl] {} Selected development-sean environment.
[ws.caching.impl] {} Cache:starts() creating caches...

seancorfield20:07:11

And the ws project also tests clean as well...

seancorfield20:07:53

...and the legacy test stuff for the bases and components also works. So that's all looking good now! Thank you so much!