benedekfazekas / mranderson

Dependency inlining and shadowing
Eclipse Public License 1.0
151 stars 14 forks source link

load statements aren't handled #61

Open expez opened 3 years ago

expez commented 3 years ago

I recently tried to inline tools.deps.alpha to get hotload-dependencies working again for cljr, but mranderson failed to consider these load statements in the middle of the file.

expez commented 3 years ago

From what I can tell this happens because tools.namespace only considers the ns form and doesn't register the dependency caused by the load statement.

Guess we could run our own pass over the file to look for load, require, use and import...

benedekfazekas commented 3 years ago

:wave: @expez give above (branch handle-load-stmt) a try and let me know if it works

benedekfazekas commented 3 years ago

also require/use/import etc is taken care of. what was missing is checking file path like references what load is using

benedekfazekas commented 3 years ago

gentle bump @expez

expez commented 3 years ago

Got an error:

unzipping [ plexus-component-annotations  [ v2v1v0 ]]
  munge source files of plexus-component-annotations artifact on branch [] exposed false.
  munge source files of commons-compress artifact on branch [] exposed false.
  munge source files of commons-lang artifact on branch [] exposed false.
  munge source files of xz artifact on branch [] exposed false.
  munge source files of compliment artifact on branch [] exposed false.
Error encountered performing task 'inline-deps' with profile(s): 'base,system,provided,dev,1.10'
java.util.concurrent.ExecutionException: clojure.lang.ExceptionInfo: Invalid symbol: Error:. {:type :reader-exception, :ex-kind :reader-error}
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at clojure.core$deref_future.invokeStatic(core.clj:2300)
    at clojure.core$future_call$reify__8439.deref(core.clj:6974)
    at clojure.core$deref.invokeStatic(core.clj:2320)
    at clojure.core$pmap$step__8452$fn__8456.invoke(core.clj:7025)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.next(RT.java:709)
    at clojure.core$next__5371.invokeStatic(core.clj:64)
    at clojure.core$dorun.invokeStatic(core.clj:3142)
    at clojure.core$doall.invokeStatic(core.clj:3148)
    at clojure.core$doall.invoke(core.clj:3148)
    at mranderson.move$replace_ns_symbol_in_source_files.invokeStatic(move.clj:303)
    at mranderson.move$replace_ns_symbol_in_source_files.invoke(move.clj:294)
    at mranderson.move$move_ns.invokeStatic(move.clj:318)
    at mranderson.move$move_ns.invoke(move.clj:305)
    at mranderson.core$update_artifact_BANG_.invokeStatic(core.clj:227)
    at mranderson.core$update_artifact_BANG_.invoke(core.clj:196)
    at mranderson.dependency.tree$walk_ordered_deps$fn__2194$fn__2199.invoke(tree.clj:83)
    at clojure.core$map$fn__5851.invoke(core.clj:2755)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.next(RT.java:709)
    at clojure.core$next__5371.invokeStatic(core.clj:64)
    at clojure.core$dorun.invokeStatic(core.clj:3142)
    at clojure.core$dorun.invoke(core.clj:3133)
    at mranderson.dependency.tree$walk_ordered_deps$fn__2194.invoke(tree.clj:83)
    at mranderson.dependency.tree$walk_ordered_deps.invokeStatic(tree.clj:82)
    at mranderson.dependency.tree$walk_ordered_deps.invoke(tree.clj:73)
    at mranderson.core$mranderson_resolved_deps_BANG_.invokeStatic(core.clj:326)
    at mranderson.core$mranderson_resolved_deps_BANG_.invoke(core.clj:307)
    at mranderson.core$mranderson.invokeStatic(core.clj:357)
    at mranderson.core$mranderson.invoke(core.clj:333)
    at leiningen.inline_deps$inline_deps.invokeStatic(inline_deps.clj:65)
    at leiningen.inline_deps$inline_deps.doInvoke(inline_deps.clj:52)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.lang.Var.applyTo(Var.java:705)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$apply.invoke(core.clj:660)
    at leiningen.core.main$partial_task$fn__6592.doInvoke(main.clj:284)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at clojure.lang.AFn.applyToHelper(AFn.java:154)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.lang.AFunction$1.doInvoke(AFunction.java:31)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$apply.invoke(core.clj:660)
    at leiningen.core.main$apply_task.invokeStatic(main.clj:334)
    at leiningen.core.main$apply_task.invoke(main.clj:320)
    at leiningen.with_profile$with_profiles_STAR_.invokeStatic(with_profile.clj:14)
    at leiningen.with_profile$with_profiles_STAR_.invoke(with_profile.clj:8)
    at leiningen.with_profile$apply_task_with_profiles.invokeStatic(with_profile.clj:53)
    at leiningen.with_profile$apply_task_with_profiles.invoke(with_profile.clj:45)
    at leiningen.with_profile$with_profile$fn__10482.invoke(with_profile.clj:85)
    at clojure.core$mapv$fn__8430.invoke(core.clj:6912)
    at clojure.core.protocols$fn__8144.invokeStatic(protocols.clj:168)
    at clojure.core.protocols$fn__8144.invoke(protocols.clj:124)
    at clojure.core.protocols$fn__8099$G__8094__8108.invoke(protocols.clj:19)
    at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31)
    at clojure.core.protocols$fn__8131.invokeStatic(protocols.clj:75)
    at clojure.core.protocols$fn__8131.invoke(protocols.clj:75)
    at clojure.core.protocols$fn__8073$G__8068__8086.invoke(protocols.clj:13)
    at clojure.core$reduce.invokeStatic(core.clj:6828)
    at clojure.core$mapv.invokeStatic(core.clj:6903)
    at clojure.core$mapv.invoke(core.clj:6903)
    at leiningen.with_profile$with_profile.invokeStatic(with_profile.clj:85)
    at leiningen.with_profile$with_profile.doInvoke(with_profile.clj:63)
    at clojure.lang.RestFn.invoke(RestFn.java:445)
    at clojure.lang.AFn.applyToHelper(AFn.java:160)
    at clojure.lang.RestFn.applyTo(RestFn.java:132)
    at clojure.lang.Var.applyTo(Var.java:705)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$apply.invoke(core.clj:660)
    at leiningen.core.main$partial_task$fn__6592.doInvoke(main.clj:284)
    at clojure.lang.RestFn.applyTo(RestFn.java:139)
    at clojure.lang.AFunction$1.doInvoke(AFunction.java:31)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$apply.invoke(core.clj:660)
    at leiningen.core.main$apply_task.invokeStatic(main.clj:334)
    at leiningen.core.main$apply_task.invoke(main.clj:320)
    at leiningen.core.main$resolve_and_apply.invokeStatic(main.clj:343)
    at leiningen.core.main$resolve_and_apply.invoke(main.clj:336)
    at leiningen.core.main$_main$fn__6681.invoke(main.clj:452)
    at leiningen.core.main$_main.invokeStatic(main.clj:442)
    at leiningen.core.main$_main.doInvoke(main.clj:439)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.lang.Var.applyTo(Var.java:705)
    at clojure.core$apply.invokeStatic(core.clj:665)
    at clojure.main$main_opt.invokeStatic(main.clj:491)
    at clojure.main$main_opt.invoke(main.clj:487)
    at clojure.main$main.invokeStatic(main.clj:598)
    at clojure.main$main.doInvoke(main.clj:561)
    at clojure.lang.RestFn.applyTo(RestFn.java:137)
    at clojure.lang.Var.applyTo(Var.java:705)
    at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: Invalid symbol: Error:. {:type :reader-exception, :ex-kind :reader-error}
    at clojure.tools.reader.impl.errors$throw_ex.invokeStatic(errors.clj:34)
    at clojure.tools.reader.impl.errors$throw_ex.doInvoke(errors.clj:24)
    at clojure.lang.RestFn.invoke(RestFn.java:442)
    at clojure.tools.reader.impl.errors$reader_error.invokeStatic(errors.clj:40)
    at clojure.tools.reader.impl.errors$reader_error.doInvoke(errors.clj:36)
    at clojure.lang.RestFn.invoke(RestFn.java:516)
    at clojure.tools.reader.impl.errors$throw_invalid.invokeStatic(errors.clj:97)
    at clojure.tools.reader.impl.errors$throw_invalid.invoke(errors.clj:96)
    at clojure.tools.reader.edn$read_symbol.invokeStatic(edn.clj:262)
    at clojure.tools.reader.edn$read_symbol.invoke(edn.clj:249)
    at clojure.tools.reader.edn$read.invokeStatic(edn.clj:407)
    at clojure.tools.reader.edn$read.invoke(edn.clj:371)
    at clojure.tools.reader.edn$read.invokeStatic(edn.clj:392)
    at clojure.tools.reader.edn$read.invoke(edn.clj:371)
    at clojure.tools.reader.edn$read_string.invokeStatic(edn.clj:440)
    at clojure.tools.reader.edn$read_string.invoke(edn.clj:429)
    at clojure.tools.reader.edn$read_string.invokeStatic(edn.clj:437)
    at clojure.tools.reader.edn$read_string.invoke(edn.clj:429)
    at rewrite_clj.reader$string__GT_edn.invokeStatic(reader.cljc:109)
    at rewrite_clj.reader$string__GT_edn.invoke(reader.cljc:106)
    at rewrite_clj.parser.token$symbol_node.invokeStatic(token.cljc:34)
    at rewrite_clj.parser.token$symbol_node.invoke(token.cljc:23)
    at rewrite_clj.parser.token$parse_token.invokeStatic(token.cljc:47)
    at rewrite_clj.parser.token$parse_token.invoke(token.cljc:37)
    at rewrite_clj.parser.core$eval4078$fn__4079.invoke(core.cljc:74)
    at clojure.lang.MultiFn.invoke(MultiFn.java:229)
    at rewrite_clj.reader$read_with_meta.invokeStatic(reader.cljc:147)
    at rewrite_clj.reader$read_with_meta.invoke(reader.cljc:143)
    at rewrite_clj.parser.core$parse_next.invokeStatic(core.cljc:46)
    at rewrite_clj.parser.core$parse_next.invoke(core.cljc:44)
    at rewrite_clj.parser.core$parse_delim$fn__4070.invoke(core.cljc:54)
    at rewrite_clj.reader$read_repeatedly$fn__3108.invoke(reader.cljc:156)
    at clojure.core$repeatedly$fn__6448.invoke(core.clj:5149)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:531)
    at clojure.core$seq__5387.invokeStatic(core.clj:137)
    at clojure.core$take_while$fn__5902.invoke(core.clj:2904)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.next(RT.java:709)
    at clojure.core$next__5371.invokeStatic(core.clj:64)
    at clojure.core$dorun.invokeStatic(core.clj:3142)
    at clojure.core$doall.invokeStatic(core.clj:3148)
    at clojure.core$doall.invoke(core.clj:3148)
    at rewrite_clj.reader$read_repeatedly.invokeStatic(reader.cljc:158)
    at rewrite_clj.reader$read_repeatedly.invoke(reader.cljc:152)
    at rewrite_clj.parser.core$parse_delim.invokeStatic(core.cljc:55)
    at rewrite_clj.parser.core$parse_delim.invoke(core.cljc:50)
    at rewrite_clj.parser.core$eval4148$fn__4149.invoke(core.cljc:201)
    at clojure.lang.MultiFn.invoke(MultiFn.java:229)
    at rewrite_clj.reader$read_with_meta.invokeStatic(reader.cljc:147)
    at rewrite_clj.reader$read_with_meta.invoke(reader.cljc:143)
    at rewrite_clj.parser.core$parse_next.invokeStatic(core.cljc:46)
    at rewrite_clj.parser.core$parse_next.invoke(core.cljc:44)
    at rewrite_clj.reader$read_n.invokeStatic(reader.cljc:168)
    at rewrite_clj.reader$read_n.invoke(reader.cljc:160)
    at rewrite_clj.parser.core$parse_printables.invokeStatic(core.cljc:61)
    at rewrite_clj.parser.core$parse_printables.doInvoke(core.cljc:57)
    at clojure.lang.RestFn.invoke(RestFn.java:445)
    at rewrite_clj.parser.core$eval4110$fn__4111.invoke(core.cljc:118)
    at clojure.lang.MultiFn.invoke(MultiFn.java:229)
    at rewrite_clj.reader$read_with_meta.invokeStatic(reader.cljc:147)
    at rewrite_clj.reader$read_with_meta.invoke(reader.cljc:143)
    at rewrite_clj.parser.core$parse_next.invokeStatic(core.cljc:46)
    at rewrite_clj.parser.core$parse_next.invoke(core.cljc:44)
    at rewrite_clj.parser.core$parse_delim$fn__4070.invoke(core.cljc:54)
    at rewrite_clj.reader$read_repeatedly$fn__3108.invoke(reader.cljc:156)
    at clojure.core$repeatedly$fn__6448.invoke(core.clj:5149)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.RT.seq(RT.java:531)
    at clojure.core$seq__5387.invokeStatic(core.clj:137)
    at clojure.core$take_while$fn__5902.invoke(core.clj:2904)
    at clojure.lang.LazySeq.sval(LazySeq.java:42)
    at clojure.lang.LazySeq.seq(LazySeq.java:51)
    at clojure.lang.Cons.next(Cons.java:39)
    at clojure.lang.RT.next(RT.java:709)
    at clojure.core$next__5371.invokeStatic(core.clj:64)
    at clojure.core$dorun.invokeStatic(core.clj:3142)
    at clojure.core$doall.invokeStatic(core.clj:3148)
    at clojure.core$doall.invoke(core.clj:3148)
    at rewrite_clj.reader$read_repeatedly.invokeStatic(reader.cljc:158)
    at rewrite_clj.reader$read_repeatedly.invoke(reader.cljc:152)
    at rewrite_clj.parser.core$parse_delim.invokeStatic(core.cljc:55)
    at rewrite_clj.parser.core$parse_delim.invoke(core.cljc:50)
    at rewrite_clj.parser.core$eval4140$fn__4141.invoke(core.cljc:193)
    at clojure.lang.MultiFn.invoke(MultiFn.java:229)
    at rewrite_clj.reader$read_with_meta.invokeStatic(reader.cljc:147)
    at rewrite_clj.reader$read_with_meta.invoke(reader.cljc:143)
    at rewrite_clj.parser.core$parse_next.invokeStatic(core.cljc:46)
    at rewrite_clj.parser.core$parse_next.invoke(core.cljc:44)
    at rewrite_clj.parser$parse.invokeStatic(parser.cljc:20)
    at rewrite_clj.parser$parse.invoke(parser.cljc:17)
    at mranderson.move$split_ns_form_ns_body.invokeStatic(move.clj:139)
    at mranderson.move$split_ns_form_ns_body.invoke(move.clj:130)
    at mranderson.move$replace_ns_symbol.invokeStatic(move.clj:256)
    at mranderson.move$replace_ns_symbol.invoke(move.clj:247)
    at clojure.lang.AFn.applyToHelper(AFn.java:178)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invokeStatic(core.clj:667)
    at clojure.core$apply.invoke(core.clj:660)
    at mranderson.move$update_file.invokeStatic(move.clj:38)
    at mranderson.move$update_file.doInvoke(move.clj:32)
    at clojure.lang.RestFn.invoke(RestFn.java:566)
    at mranderson.move$replace_ns_symbol_in_source_files$fn__4897.invoke(move.clj:302)
    at clojure.core$pmap$fn__8447$fn__8448.invoke(core.clj:7022)
    at clojure.core$binding_conveyor_fn$fn__5739.invoke(core.clj:2030)
    at clojure.lang.AFn.call(AFn.java:18)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
    at java.base/java.lang.Thread.run(Thread.java:831)
make: *** [Makefile:10: .inline-deps] Error 1
expez commented 3 years ago

I added some debug info and here's the ns form of the file it choked on:

(ns ^{:author "Alex Taggart", :doc "Support for testing whether logging calls are made.

  Usage example:
    (require '[clojure.tools.logging :as log]
             '[clojure.tools.logging.test :refer [logged? with-log])

    (with-log
      (log/info "Hello World!")
      (log/error (Exception. "Did a thing") "Error: oops")
      (logged? 'user :info #"Hello")                           ; true
      (logged? 'user :error [Throwable #"thing"] #"Error:")    ; true
      (logged? 'user :debug "Hi"))                             ; false", :mranderson/inlined true} clojure.tools.logging.test
  (:import [clojure.lang Fn Keyword Namespace Symbol]
           java.util.Set
           java.util.regex.Pattern)
  (:require [clojure.tools.logging :refer [*logger-factory*]]
            [clojure.tools.logging.impl :as impl]))

This ns form is unreadable because the strings in the code example have lost their escape characters.

Here's the original as a reference:

(ns ^{:author "Alex Taggart"
      :doc
  "Support for testing whether logging calls are made.

  Usage example:
    (require '[clojure.tools.logging :as log]
             '[clojure.tools.logging.test :refer [logged? with-log])

    (with-log
      (log/info \"Hello World!\")
      (log/error (Exception. \"Did a thing\") \"Error: oops\")
      (logged? 'user :info #\"Hello\")                           ; true
      (logged? 'user :error [Throwable #\"thing\"] #\"Error:\")    ; true
      (logged? 'user :debug \"Hi\"))                             ; false"}
    clojure.tools.logging.test
  (:import [clojure.lang Fn Keyword Namespace Symbol]
           java.util.Set
           java.util.regex.Pattern)
  (:require [clojure.tools.logging :refer [*logger-factory*]]
            [clojure.tools.logging.impl :as impl]))
benedekfazekas commented 3 years ago

hm.. I though rewrite-clj handled such strings but maybe not.. will check check this. that said this seems to be a different issue from the original,right? does this mean the load statements are now fine?

expez commented 3 years ago

It doesn't get to the load statements because it fails pretty quickly.

benedekfazekas commented 3 years ago

bit confused here. how did you get to the original failure with the load statements then? you don't get this problem with the version of mranderson you used before reporting the original?

expez commented 3 years ago
unzipping [ orchard  [ v0v7v3 ]]
unzipping [ toolsdepsalpha  [ v0v12v1048 ]]
unzipping [ api  [ v0v8v524 ]]
unzipping [ dataxml  [ v0v2v0-alpha6 ]]
unzipping [ datacodec  [ v0v1v0 ]]
unzipping [ maven-core  [ v3v8v2 ]]
unzipping [ maven-plugin-api  [ v3v8v2 ]]
unzipping [ maven-resolver-provider  [ v3v8v2 ]]
unzipping [ maven-model-builder  [ v3v8v2 ]]
unzipping [ maven-artifact  [ v3v8v2 ]]
unzipping [ http-client  [ v0v1v106 ]]
unzipping [ coreasync  [ v1v3v622 ]]
unzipping [ toolsanalyzerjvm  [ v1v1v0 ]]
unzipping [ corememoize  [ v1v0v236 ]]
unzipping [ corecache  [ v1v0v207 ]]
unzipping [ guice  [ v4v2v2 ]]
unzipping [ guava  [ v25v1-android ]]
unzipping [ maven-settings-builder  [ v3v8v2 ]]
unzipping [ maven-builder-support  [ v3v8v2 ]]
unzipping [ maven-shared-utils  [ v3v3v4 ]]
unzipping [ commons-io  [ v2v6 ]]
unzipping [ datapriority-map  [ v1v0v0 ]]
unzipping [ maven-repository-metadata  [ v3v8v2 ]]
unzipping [ maven-resolver-impl  [ v1v6v3 ]]
unzipping [ maven-resolver-connector-basic  [ v1v6v3 ]]
unzipping [ maven-resolver-transport-http  [ v1v6v3 ]]
unzipping [ maven-resolver-util  [ v1v6v3 ]]
unzipping [ orgeclipsesisuplexus  [ v0v3v4 ]]
unzipping [ orgeclipsesisuinject  [ v0v3v4 ]]
unzipping [ maven-model  [ v3v8v2 ]]
unzipping [ maven-resolver-transport-file  [ v1v6v3 ]]
unzipping [ jcl-over-slfj  [ v1v7v30 ]]
unzipping [ slfj-api  [ v1v7v30 ]]
unzipping [ toolsgitlibs  [ v2v3v167 ]]
unzipping [ dynapath  [ v1v1v0 ]]
unzipping [ rewrite-clj  [ v1v0v699-alpha ]]
unzipping [ cljfmt  [ v0v8v0 ]]
unzipping [ toolsreader  [ v1v3v6 ]]
unzipping [ jetty-client  [ v9v4v36vv20210114 ]]
unzipping [ jetty-http  [ v9v4v36vv20210114 ]]
unzipping [ jetty-io  [ v9v4v36vv20210114 ]]
unzipping [ cdi-api  [ v1v0 ]]
unzipping [ httpclient  [ v4v5v12 ]]
unzipping [ plexus-interpolation  [ v1v25 ]]
unzipping [ plexus-sec-dispatcher  [ v1v4 ]]
unzipping [ plexus-classworlds  [ v2v6v0 ]]
unzipping [ jobjc-annotations  [ v1v1 ]]
unzipping [ maven-resolver-spi  [ v1v6v3 ]]
unzipping [ commons-codec  [ v1v11 ]]
unzipping [ toolsnamespace  [ v1v1v0 ]]
unzipping [ javaclasspath  [ v1v0v0 ]]
unzipping [ checker-compat-qual  [ v2v0v0 ]]
unzipping [ diffutils  [ v1v3v0 ]]
unzipping [ jsr-api  [ v1v0 ]]
unzipping [ aopalliance  [ v1v0 ]]
unzipping [ maven-resolver-api  [ v1v6v3 ]]
unzipping [ fs  [ v1v6v307 ]]
unzipping [ httpcore  [ v4v4v13 ]]
unzipping [ maven-settings  [ v3v8v2 ]]
unzipping [ asm  [ v5v2 ]]
unzipping [ http-kit  [ v2v5v3 ]]
unzipping [ plexus-utils  [ v3v2v1 ]]
unzipping [ version-clj  [ v1v0v0 ]]
unzipping [ jetty-util  [ v9v4v36vv20210114 ]]
unzipping [ animal-sniffer-annotations  [ v1v14 ]]
unzipping [ toolscli  [ v1v0v206 ]]
unzipping [ toolslogging  [ v1v1v0 ]]
unzipping [ toolsanalyzer  [ v1v0v0 ]]
unzipping [ datajson  [ v2v3v1 ]]
unzipping [ compliment  [ v0v3v12 ]]
unzipping [ xz  [ v1v8 ]]
unzipping [ commons-lang  [ v3v8v1 ]]
unzipping [ commons-compress  [ v1v20 ]]
unzipping [ plexus-component-annotations  [ v2v1v0 ]]
  munge source files of plexus-component-annotations artifact on branch [] exposed false.
  munge source files of commons-compress artifact on branch [] exposed false.
  munge source files of commons-lang artifact on branch [] exposed false.
  munge source files of xz artifact on branch [] exposed false.
  munge source files of compliment artifact on branch [] exposed false.
Failed to update file #object[java.io.File 0x442615b4 /home/lars/git/refactor-nrepl/target/srcdeps/clojure/tools/logging/test.clj] function #object[mranderson.move$replace_ns_symbol 0x1249354 mranderson.move$replace_ns_symbol@1249354] (compliment.core refactor-nrepl.inlined-deps.compliment.v0v3v12.compliment.core :mranderson/inlined ".clj" ".clj")
Error encountered performing task 'inline-deps' with profile(s): 'base,system,provided,dev,1.10'
java.util.concurrent.ExecutionException: clojure.lang.ExceptionInfo: Invalid symbol: Error:. {:type :reader-exception, :ex-kind :reader-error}
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at clojure.core$deref_future.invokeStatic(core.clj:2300)

Here's a bit more of the printout. As you can see it crashes before it reaches clojure.tools.deps which contained the problematic load statements.

benedekfazekas commented 3 years ago

how did you get to clojure.tools.deps originally then? TOL maybe would worth to create a repro project with just clojure.tools.deps...

expez commented 3 years ago

how did you get to clojure.tools.deps originally then?

make install in the refactor-nrepl repo on the hotload-deps branch gave me the load error with version 0.5.3. This branch (that I installed as 0.5.4-SNAPSHOT with lein install) gave me the error above when I ran make install again.

expez commented 3 years ago

To repro the only dep you need is this one, from refactor-nrepl:

                 ^:inline-dep [org.clojure/tools.deps.alpha "0.12.1048"
                               :exclusions
                               [
                                com.cognitect.aws/s3
                                com.cognitect.aws/endpoints
                                javax.inject]]

It will cause this branch to fail.

tools.dep really puts mranderson through it's paces as it pulls in A LOT of deps :/

benedekfazekas commented 3 years ago

thx for the repro snippet. haha that is good in a way ;)

expez commented 3 years ago

Here's an even better repro by modifying the new test you created for this branch:

(def tool-deps-alpha-example
  "(ns
  ^{:author \"Alex Taggart\"
    :doc
    \"Support for testing whether logging calls are made.

  Usage example:
    (require '[clojure.tools.logging :as log]
             '[clojure.tools.logging.test :refer [logged? with-log])

    (with-log
      (log/info \"Hello World!\")
      (log/error (Exception. \"Did a thing\") \"Error: oops\")
      (logged? 'user :info #\"Hello\")                           ; true
      (logged? 'user :error [Throwable #\"thing\"] #\"Error:\")    ; true
      (logged? 'user :debug \"Hi\"))                             ; false\"}

clojure.tools.deps.alpha)
   (load \"/clojure/tools/deps/alpha/extensions/maven\")")
benedekfazekas commented 2 years ago

can't really reproduce this with above as dblquotes inside the doc string should be double escaped. not even sure that is possible so just put the above example in a file and that is processed without a problem -- see latest commit on https://github.com/benedekfazekas/mranderson/tree/handle-load-stmt branch.

the maybe offending file is in tools logging btw: https://github.com/clojure/tools.logging/blob/master/src/main/clojure/clojure/tools/logging/test.clj will have an other go and see if mranderson can inline tools logging

benedekfazekas commented 2 years ago

mranderson does not seem to have a problem with tools logging. added it to mranderson.core-test/dependencies the test run fine:

lein test mranderson.core-test
retrieve dependencies and munge clojure source files
in RESOLVED-TREE mode, working on a resolved dependency tree
 [cljfmt "0.7.0"]
   [com.googlecode.java-diff-utils/diffutils "1.3.0"]
   [org.clojure/tools.cli "1.0.194"]
   [org.clojure/tools.reader "1.3.3"]
   [rewrite-clj "0.6.1"]
   [rewrite-cljs "0.4.5"]
 [org.clojure/data.xml "0.2.0-alpha6"]
   [org.clojure/data.codec "0.1.0"]
 [org.clojure/tools.logging "1.1.0"]
 [riddley "0.1.12"]
unzipping [ cljfmt  [ v0v7v0 ]]
unzipping [ rewrite-cljs  [ v0v4v5 ]]
unzipping [ dataxml  [ v0v2v0-alpha6 ]]
unzipping [ datacodec  [ v0v1v0 ]]
unzipping [ rewrite-clj  [ v0v6v1 ]]
unzipping [ toolsreader  [ v1v3v3 ]]
unzipping [ diffutils  [ v1v3v0 ]]
unzipping [ riddley  [ v0v1v12 ]]
  removing duplicated file with namespace mismatch: compiler.clj
  removing duplicated file with namespace mismatch: walk.clj
unzipping [ toolscli  [ v1v0v194 ]]
unzipping [ toolslogging  [ v1v1v0 ]]
  munge source files of toolslogging artifact on branch [] exposed false.
  munge source files of toolscli artifact on branch [] exposed false.
  munge source files of riddley artifact on branch [] exposed false.
  munge source files of diffutils artifact on branch [] exposed false.
  munge source files of toolsreader artifact on branch [] exposed false.
  munge source files of rewrite-clj artifact on branch [] exposed false.
  munge source files of datacodec artifact on branch [] exposed false.
  munge source files of dataxml artifact on branch [] exposed false.
  munge source files of rewrite-cljs artifact on branch [] exposed false.
  munge source files of cljfmt artifact on branch [] exposed false.

and after digging out the inlined file the ns macro looks like this:

;; Copyright (c) Alex Taggart. All rights reserved.  The use
;; and distribution terms for this software are covered by the Eclipse
;; Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
;; which can be found in the file epl-v10.html at the root of this
;; distribution.  By using this software in any fashion, you are
;; agreeing to be bound by the terms of this license.  You must not
;; remove this notice, or any other, from this software.

(ns ^{:mranderson/inlined true} mranderson-test58044.toolslogging.v1v1v0.clojure.tools.logging.test
  (:import [clojure.lang Fn Keyword Namespace Symbol]
           java.util.Set
           java.util.regex.Pattern)
  (:require [mranderson-test58044.toolslogging.v1v1v0.clojure.tools.logging :refer [*logger-factory*]]
            [mranderson-test58044.toolslogging.v1v1v0.clojure.tools.logging.impl :as impl]))

so can't really repro the problem unfortunately. the load stmt thing is fixed too. let me know if i can be any help tho