amperity / lein-monolith

Leiningen plugin for working with monorepos.
Other
214 stars 18 forks source link

Read from raw project for inherit-raw and inherit-leaky-raw #75

Closed robhanlon22 closed 4 years ago

robhanlon22 commented 4 years ago

Resolves #68.

robhanlon22 commented 4 years ago

It seems that with-all needs to be updated as well—needs to actually build and activate the inherited profiles before grabbing the paths.

EDIT: this is done

robhanlon22 commented 4 years ago

@greglook I merged master and I'm getting a test failure:

ERROR in (leiningen.monolith-test) (RT.java:849)
Uncaught exception in test fixture
expected: nil
  actual: java.lang.IllegalArgumentException: contains? not supported on type: clojure.lang.LazySeq
 at clojure.lang.RT.contains (RT.java:849)
    clojure.core$contains_QMARK_.invokeStatic (core.clj:1492)
    clojure.core$contains_QMARK_.invoke (core.clj:1484)
    leiningen.core.project$update_each_contained$fn__6893.invoke (project.clj:39)
    clojure.lang.PersistentVector.reduce (PersistentVector.java:343)
    clojure.core$reduce.invokeStatic (core.clj:6827)
    clojure.core$reduce.invoke (core.clj:6810)
    leiningen.core.project$update_each_contained.invokeStatic (project.clj:38)
    leiningen.core.project$update_each_contained.doInvoke (project.clj:37)
    clojure.lang.RestFn.invoke (RestFn.java:445)
    leiningen.core.project$normalize_values.invokeStatic (project.clj:326)
    leiningen.core.project$normalize_values.invoke (project.clj:321)
    clojure.core$map$fn__5851.invoke (core.clj:2755)
    clojure.lang.LazySeq.sval (LazySeq.java:42)
    clojure.lang.LazySeq.seq (LazySeq.java:51)
    clojure.lang.Cons.next (Cons.java:39)
    clojure.lang.RT.next (RT.java:709)
    clojure.core$next__5371.invokeStatic (core.clj:64)
    clojure.core.protocols$fn__8144.invokeStatic (protocols.clj:169)
    clojure.core.protocols/fn (protocols.clj:124)
    clojure.core.protocols$fn__8099$G__8094__8108.invoke (protocols.clj:19)
    clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
    clojure.core.protocols$fn__8131.invokeStatic (protocols.clj:75)
    clojure.core.protocols/fn (protocols.clj:75)
    clojure.core.protocols$fn__8073$G__8068__8086.invoke (protocols.clj:13)
    clojure.core$reduce.invokeStatic (core.clj:6828)
    clojure.core$reduce.invoke (core.clj:6810)
    leiningen.core.project$apply_profiles.invokeStatic (project.clj:614)
    leiningen.core.project$apply_profiles.invoke (project.clj:613)
    leiningen.core.project$init_profiles.invokeStatic (project.clj:899)
    leiningen.core.project$init_profiles.doInvoke (project.clj:881)
    clojure.lang.RestFn.invoke (RestFn.java:442)
    leiningen.core.project$set_profiles.invokeStatic (project.clj:927)
    leiningen.core.project$set_profiles.doInvoke (project.clj:922)
    clojure.lang.RestFn.invoke (RestFn.java:442)
    leiningen.core.project$merge_profiles.invokeStatic (project.clj:937)
    leiningen.core.project$merge_profiles.invoke (project.clj:931)
    leiningen.jar$warn_implicit_aot.invokeStatic (jar.clj:241)
    leiningen.jar$warn_implicit_aot.invoke (jar.clj:240)
    leiningen.jar$add_main.invokeStatic (jar.clj:252)
    leiningen.jar$add_main.invoke (jar.clj:251)
    leiningen.jar$process_project.invokeStatic (jar.clj:270)
    leiningen.jar$process_project.doInvoke (jar.clj:262)
    clojure.lang.RestFn.invoke (RestFn.java:467)
    leiningen.jar$preprocess_project.invokeStatic (jar.clj:273)
    leiningen.jar$preprocess_project.doInvoke (jar.clj:272)
    clojure.lang.RestFn.invoke (RestFn.java:423)
    leiningen.jar$jar.invokeStatic (jar.clj:345)
    leiningen.jar$jar.invoke (jar.clj:328)
    leiningen.jar$jar.invokeStatic (jar.clj:348)
    leiningen.jar$jar.invoke (jar.clj:328)
    leiningen.install$install.invokeStatic (install.clj:21)
    leiningen.install$install.invoke (install.clj:12)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__6592.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    lein_monolith.task.each$apply_subproject_task.invokeStatic (each.clj:201)
    lein_monolith.task.each$apply_subproject_task.invoke (each.clj:195)
    lein_monolith.task.each$run_task_BANG_.invokeStatic (each.clj:283)
    lein_monolith.task.each$run_task_BANG_.invoke (each.clj:261)
    clojure.core$partial$fn__5824.invoke (core.clj:2624)
    clojure.core$comp$fn__5792.invoke (core.clj:2569)
    clojure.core$mapv$fn__8430.invoke (core.clj:6912)
    clojure.core.protocols$fn__8144.invokeStatic (protocols.clj:168)
    clojure.core.protocols/fn (protocols.clj:124)
    clojure.core.protocols$fn__8099$G__8094__8108.invoke (protocols.clj:19)
    clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
    clojure.core.protocols$fn__8131.invokeStatic (protocols.clj:75)
    clojure.core.protocols/fn (protocols.clj:75)
    clojure.core.protocols$fn__8073$G__8068__8086.invoke (protocols.clj:13)
    clojure.core$reduce.invokeStatic (core.clj:6828)
    clojure.core$mapv.invokeStatic (core.clj:6903)
    clojure.core$mapv.invoke (core.clj:6903)
    lein_monolith.task.each$run_linear_BANG_.invokeStatic (each.clj:322)
    lein_monolith.task.each$run_linear_BANG_.invoke (each.clj:318)
    lein_monolith.task.each$run_tasks.invokeStatic (each.clj:394)
    lein_monolith.task.each$run_tasks.invoke (each.clj:364)
    lein_monolith.test_utils$prepare_example_project.invokeStatic (test_utils.clj:35)
    lein_monolith.test_utils$prepare_example_project.invoke (test_utils.clj:21)
    lein_monolith.test_utils$use_example_project$fn__3936$fn__3937.invoke (test_utils.clj:46)
    lein_monolith.test_utils$use_example_project$fn__3936.invoke (test_utils.clj:46)
    clojure.test$compose_fixtures$fn__9701$fn__9702.invoke (test.clj:694)
    clojure.test$default_fixture.invokeStatic (test.clj:687)
    clojure.test$default_fixture.invoke (test.clj:683)
    clojure.test$compose_fixtures$fn__9701.invoke (test.clj:694)
    clojure.test$test_vars.invokeStatic (test.clj:731)
    clojure.test$test_all_vars.invokeStatic (test.clj:737)
    clojure.test$test_ns.invokeStatic (test.clj:758)
    clojure.test$test_ns.invoke (test.clj:743)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.core$apply.invoke (core.clj:660)
    test2junit.core$apply_junit_output_hook$fn__850$fn__869$fn__880$fn__881.invoke (core.clj:54)
    test2junit.core$apply_junit_output_hook$fn__850$fn__869$fn__880.invoke (core.clj:53)
    test2junit.core$apply_junit_output_hook$fn__850$fn__869.invoke (core.clj:52)
    test2junit.core$apply_junit_output_hook$fn__850.doInvoke (core.clj:52)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    robert.hooke$compose_hooks$fn__10419.doInvoke (hooke.clj:40)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.core$apply.invoke (core.clj:660)
    robert.hooke$run_hooks.invokeStatic (hooke.clj:46)
    robert.hooke$run_hooks.invoke (hooke.clj:45)
    robert.hooke$prepare_for_hooks$fn__10424$fn__10425.doInvoke (hooke.clj:54)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    user$eval1002$fn__1063.invoke (NO_SOURCE_FILE:0)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.injected$compose_hooks$fn__932.doInvoke (NO_SOURCE_FILE:0)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.injected$run_hooks.invokeStatic (NO_SOURCE_FILE:0)
    leiningen.core.injected$run_hooks.invoke (NO_SOURCE_FILE:0)
    leiningen.core.injected$prepare_for_hooks$fn__937$fn__938.doInvoke (NO_SOURCE_FILE:0)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    clojure.core$map$fn__5851.invoke (core.clj:2755)
    clojure.lang.LazySeq.sval (LazySeq.java:42)
    clojure.lang.LazySeq.seq (LazySeq.java:51)
    clojure.lang.Cons.next (Cons.java:39)
    clojure.lang.RT.next (RT.java:709)
    clojure.core$next__5371.invokeStatic (core.clj:64)
    clojure.core$reduce1.invokeStatic (core.clj:944)
    clojure.core$reduce1.invokeStatic (core.clj:934)
    clojure.core$merge_with.invokeStatic (core.clj:3059)
    clojure.core$merge_with.doInvoke (core.clj:3051)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.test$run_tests.invokeStatic (test.clj:768)
    clojure.test$run_tests.doInvoke (test.clj:768)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.core$apply.invoke (core.clj:660)
    user$eval1002$fn__1075$fn__1108.invoke (NO_SOURCE_FILE:0)
    user$eval1002$fn__1075$fn__1076.invoke (NO_SOURCE_FILE:0)
    user$eval1002$fn__1075.invoke (NO_SOURCE_FILE:0)
    user$eval1002.invokeStatic (NO_SOURCE_FILE:0)
    user$eval1002.invoke (NO_SOURCE_FILE:-1)
    clojure.lang.Compiler.eval (Compiler.java:7176)
    clojure.lang.Compiler.eval (Compiler.java:7166)
    clojure.lang.Compiler.eval (Compiler.java:7131)
    clojure.core$eval.invokeStatic (core.clj:3214)
    clojure.core$eval.invoke (core.clj:3210)
    leiningen.core.eval$fn__6411.invokeStatic (eval.clj:343)
    leiningen.core.eval/fn (eval.clj:333)
    clojure.lang.MultiFn.invoke (MultiFn.java:234)
    leiningen.core.eval$eval_in_project.invokeStatic (eval.clj:367)
    leiningen.core.eval$eval_in_project.invoke (eval.clj:357)
    leiningen.test$test.invokeStatic (test.clj:229)
    leiningen.test$test.doInvoke (test.clj:195)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.test2junit$test2junit$fn__908.invoke (test2junit.clj:56)
    leiningen.test2junit$test2junit.invokeStatic (test2junit.clj:54)
    leiningen.test2junit$test2junit.doInvoke (test2junit.clj:31)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__6592.doInvoke (main.clj:284)
    clojure.lang.RestFn.invoke (RestFn.java:410)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.with_profile$with_profiles_STAR_.invokeStatic (with_profile.clj:14)
    leiningen.with_profile$with_profiles_STAR_.invoke (with_profile.clj:8)
    leiningen.with_profile$apply_task_with_profiles.invokeStatic (with_profile.clj:53)
    leiningen.with_profile$apply_task_with_profiles.invoke (with_profile.clj:45)
    leiningen.with_profile$with_profile$fn__10482.invoke (with_profile.clj:85)
    clojure.core$mapv$fn__8430.invoke (core.clj:6912)
    clojure.core.protocols$fn__8144.invokeStatic (protocols.clj:168)
    clojure.core.protocols/fn (protocols.clj:124)
    clojure.core.protocols$fn__8099$G__8094__8108.invoke (protocols.clj:19)
    clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
    clojure.core.protocols$fn__8131.invokeStatic (protocols.clj:75)
    clojure.core.protocols/fn (protocols.clj:75)
    clojure.core.protocols$fn__8073$G__8068__8086.invoke (protocols.clj:13)
    clojure.core$reduce.invokeStatic (core.clj:6828)
    clojure.core$mapv.invokeStatic (core.clj:6903)
    clojure.core$mapv.invoke (core.clj:6903)
    leiningen.with_profile$with_profile.invokeStatic (with_profile.clj:85)
    leiningen.with_profile$with_profile.doInvoke (with_profile.clj:63)
    clojure.lang.RestFn.invoke (RestFn.java:445)
    clojure.lang.AFn.applyToHelper (AFn.java:160)
    clojure.lang.RestFn.applyTo (RestFn.java:132)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$partial_task$fn__6592.doInvoke (main.clj:284)
    clojure.lang.RestFn.applyTo (RestFn.java:139)
    clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:667)
    clojure.core$apply.invoke (core.clj:660)
    leiningen.core.main$apply_task.invokeStatic (main.clj:334)
    leiningen.core.main$apply_task.invoke (main.clj:320)
    leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
    leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
    leiningen.core.main$_main$fn__6681.invoke (main.clj:452)
    leiningen.core.main$_main.invokeStatic (main.clj:442)
    leiningen.core.main$_main.doInvoke (main.clj:439)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.main$main_opt.invokeStatic (main.clj:491)
    clojure.main$main_opt.invoke (main.clj:487)
    clojure.main$main.invokeStatic (main.clj:598)
    clojure.main$main.doInvoke (main.clj:561)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.lang.Var.applyTo (Var.java:705)
    clojure.main.main (main.java:37)

anything jumping out to you here? i couldn't track it down with any sort of expediency. looks like it can be reproed in the example project by doing

lein monolith each :refresh foo :start lein-monolith/example.app-a install

seems like it has to do with composite profiles.

greglook commented 4 years ago

That's the composite profile issue I fixed in #77 - the example app project has composite profiles now to exercise that problem. Maybe you lost some of the changes in the merge?

robhanlon22 commented 4 years ago

okay, i'll go over it with a fine-toothed comb

robhanlon22 commented 4 years ago

Determined that it had to do with the project/init-project inside of find-monolith. For some reason, this was causing an issue—I fixed it by not loading the monolith project at that point. I presume that somewhere along the line, the project was getting loaded again, which was doing some odd things to the project map.

robhanlon22 commented 4 years ago

@greglook this is ready to go!

robhanlon22 commented 4 years ago

Thank you for the thoughtful review! I'll address these comments ASAP.

robhanlon22 commented 4 years ago

@greglook ready for 👀 again! One thing that might be addressed on a follow-up is that I couldn't get values from composite profiles to correctly merge into the all profile. This is, however, the current behavior, so it should be addressed. Example: the app-a/bench directory isn't in the all profile, even though it should be.

robhanlon22 commented 4 years ago

Also, would you like me to squash this?

greglook commented 4 years ago

Thanks for the updates! I'll take another look.

Also, would you like me to squash this?

I'll squash when I merge.

robhanlon22 commented 4 years ago

@greglook ready for 👀 again! One thing that might be addressed on a follow-up is that I couldn't get values from composite profiles to correctly merge into the all profile. This is, however, the current behavior, so it should be addressed. Example: the app-a/bench directory isn't in the all profile, even though it should be.

I reverted some added behavior that attempted to activate all of the active profiles when building the child (re)source and test paths. It's back to its existing behavior, which is that paths under the profiles activated in the parent are not merged, e.g. if there are paths in the :dev profile in a child profile and :dev is active in the parent when running with-all, those paths are not merged.

robhanlon22 commented 4 years ago

@greglook here's the follow-up work, as discussed: https://github.com/robhanlon22/lein-monolith/pull/1 I opened it as a PR against this branch in my fork; I'll re-apply the changes against master and open a PR against upstream once this PR lands.