Fork me on GitHub
#tools-deps
<
2018-04-13
>
seancorfield00:04:09

What does a runtime scope mean for Maven?

Alex Miller (Clojure team)00:04:50

Itโ€™s for running things :)

Alex Miller (Clojure team)00:04:08

But not needed to compile

hagmonk03:04:14

Hum, well, that's an interesting distinction

hagmonk03:04:51

Is the classpath assembled for a deps.edn based project intended to get it only as far as compilation? I hit this problem through a transient dependency, and I actually had to use lein deps :tree to discover the problem, because tools.deps.alpha completely filtered out the existence of the transient dependency

Alex Miller (Clojure team)03:04:51

yeah, thereโ€™s a ticket for this already

Alex Miller (Clojure team)03:04:39

feel free to add your vote

hagmonk03:04:33

will do sir, thanks

seancorfield06:04:11

@richiardiandrea made me do it!

clj -Sdeps '{:deps {seancorfield/clj-new {:git/url "" :sha "653441d86834160124a94065c4d92a4a9ad12554"}}}' -m clj-new.create app myapp/clj-test
The beginnings of a clj-based new project template generator...

๐Ÿ‘ 4
๐Ÿš€ 4
๐Ÿพ 4
๐Ÿ’ฅ 4
john13:04:53

So, I can just do clj -m clj-new.create figwheel myapp and it'll bring in the leiningen template and build it?

john13:04:35

When I do clj -Sdeps '{:deps {seancorfield/clj-new {:git/url "" :sha "653441d86834160124a94065c4d92a4a9ad12554"}}}' -m clj-new.create figwheel figfig

john13:04:22

I get

Failed with: Failed to read artifact descriptor for figwheel:lein-template:jar:RELEASE
Exception in thread "main" clojure.lang.ExceptionInfo: Could not load artifact for template: figwheel
	Tried coordinates:
		[figwheel/boot-template "RELEASE"]
		[figwheel/lein-template "RELEASE"] {}
	at clojure.core$ex_info.invokeStatic(core.clj:4754)
	at clojure.core$ex_info.invoke(core.clj:4754)
...

seancorfield15:04:03

As noted, work in progress. Needs more work before it can do more than the built-in templates. But, yes, the plan is that will work.

john15:04:31

niiiiiice!

seancorfield15:04:16

I think that fails because I haven't set up the full clj environment for t.d.a. yet (in particular the repos).

seancorfield20:04:47

@john OK,

clj -Sdeps '{:deps {seancorfield/clj-new {:git/url "" :sha "a87bdc0347fe1523e8d85283d94b06f5dd68b2cb"}}}' -m clj-new.create figwheel figfig
This should work now!

parrot 4
john20:04:33

this is newsworthy

john20:04:55

we'll have to whip up some clj/cljs.main templates ๐Ÿ™‚

seancorfield20:04:45

I plan to add clj-template support soon, so we can have clj templates that produce deps.edn-based projects.

richiardiandrea20:04:06

let me try macchiato

richiardiandrea20:04:29

works! awesome ๐Ÿ˜„

seancorfield06:04:17

(it currently generates boot templates by default -- but it should be able to generate any Leiningen template too)

dominicm06:04:12

Lol, that's great.

seancorfield06:04:30

He made me itch. I had to scratch it.

๐Ÿ‘ 4
dominicm06:04:21

I spent far too long last night writing an ANSI parser, I feel the sentiment quite hard right now :)

simple_smile 4
Alex Miller (Clojure team)14:04:18

someone dropped a docker command to spin a linux box for testing clj installs here a couple weeks ago - anyone have that handy?

dominicm14:04:19

I wouldn't use that for testing

dominicm14:04:17

Docker runs as root within the container, you miss a key aspect of testing that way

Alex Miller (Clojure team)14:04:39

I wasnโ€™t only going to only use it

mkvlr15:04:46

> docker run -ti openjdk:8 /bin/bash

hagmonk15:04:51

@dominicm that's true by default but it's trivially disabled

mkvlr15:04:59

apt-get update
apt-get install -y rlwrap curl
export CLOJURE_VERSION=1.9.0.341 && curl -O  && /bin/bash linux-install-${CLOJURE_VERSION}.sh

hagmonk15:04:04

although for the purposes of installing clojure, it looks like the getting started guide recommends root anyway

mkvlr15:04:22

@alexmiller these two things should do or do you want a built image?

dominicm15:04:31

@hagmonk running it is the difficulty

hagmonk15:04:04

running it?

dominicm17:04:51

Running the script as non-root is the important part, to ensure that OS permissions are correctly set

hagmonk15:04:48

docker run -ti openjdk:8 bash -c "$(curl ) && clojure"

๐Ÿ‘ 4
hagmonk16:04:55

Now with @bhauman power up mode: docker run -ti openjdk:8 bash -c "$(curl ) && clojure -Sdeps \"{:deps {com.bhauman/rebel-readline {:mvn/version \\\"0.1.2\\\"}}}\" -m rebel-readline.main"

hagmonk16:04:54

I have a docker container internally that already has a .cpcache for fast rebel readline startup in a container :) Useful for when I need a totally clean slate

Alex Miller (Clojure team)16:04:08

do you think the prefix dir should be created if it doesnโ€™t exist?

Alex Miller (Clojure team)16:04:28

with the TDEPS-65 patch for the linux install, it will be created if it doesnโ€™t exist

Alex Miller (Clojure team)16:04:47

I think Iโ€™m ok with that behavior

dominicm17:04:12

See no reason not to add a guard if we want to ensure that the prefix exists already. I suppose it's keeping with other tools to not create leading directories by default. I ignored that comment because I was fairly certain that the current behavior didn't follow that.

hagmonk17:04:30

I'd actually argue, just from memory and experience, that directories should be created if it they don't already exist. I can't recall the last time I supplied any directory or prefix argument to a tool and then thought "shoot, I have to manually make that directory"

hagmonk17:04:50

But that's just my own experience

Alex Miller (Clojure team)17:04:29

this is mostly an issue for when you are supplying the prefix dir

hagmonk17:04:52

right, I'd expect that if I supply the prefix dir, it will be created if it doesn't exist

hagmonk17:04:17

I'm trying to think of a case where I've done something similar recently

hagmonk17:04:09

I guess maybe the classic case is ./configure --prefix=/usr/local/whatever

hagmonk17:04:18

when using autotools

hagmonk17:04:27

I checked the nearest autotools generated configure script โ€ฆ

hagmonk17:04:32

they definitely mkdir -p, although they do it in the most gloriously overwrought tradition of GNU autotools:

# as_fn_mkdir_p
# -------------
# Create "$as_dir" as a directory, including parents if necessary.
as_fn_mkdir_p ()
{

  case $as_dir in #(
  -*) as_dir=./$as_dir;;
  esac
  test -d "$as_dir" || eval $as_mkdir_p || {
    as_dirs=
    while :; do
      case $as_dir in #(
      *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
      *) as_qdir=$as_dir;;
      esac
      as_dirs="'$as_qdir' $as_dirs"
      as_dir=`$as_dirname -- "$as_dir" ||
$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
         X"$as_dir" : 'X\(//\)[^/]' \| \
         X"$as_dir" : 'X\(//\)$' \| \
         X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
$as_echo X"$as_dir" |
    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
            s//\1/
            q
          }
          /^X\(\/\/\)[^/].*/{
            s//\1/
            q
          }
          /^X\(\/\/\)$/{
            s//\1/
            q
          }
          /^X\(\/\).*/{
            s//\1/
            q
          }
          s/.*/./; q'`
      test -d "$as_dir" && break
    done
    test -z "$as_dirs" || eval "mkdir $as_dirs"
  } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"


} # as_fn_mkdir_p

hagmonk17:04:48

eww sorry, I thought that would collapse

seancorfield18:04:49

Question about classloaders -- when I run code with clj -m ... should I be able to get at a modifiable classloader?

seancorfield18:04:46

It seems that when you're in the REPL, you have a DynamicClassLoader from Clojure, but when running via -m you only have sun.misc.Launcher$AppClassLoader and sun.misc.Launcher$ExtClassLoader neither of which are modifiable...

dominicm18:04:38

The goal should be to act like a normal Linux program. Regardless of whether we expect those behaviours ourselves.

seancorfield19:04:23

Well, to dynamically load Leiningen templates at runtime, I need a modifiable classloader... for now I've made one (`clojure.lang.RT/makeClassLoader`) and stuffed it back into the current thread.

seancorfield19:04:31

Anyone happen to know what package org.sonatype.aether.collection.DependencyGraphTransformer is part of? When I try to load leiningen-core via t.d.a. this doesn't seem to get loaded...

seancorfield19:04:47

NM, figured it out.

john20:04:08

our diabolical plans are almost in place

seancorfield20:04:26

Qualified project names do not work (they don't work in boot-new either).

john20:04:40

this is super sweet though, thanks Sean!

seancorfield20:04:14

I'll work on it more over the weekend and make an official announcement on Monday I expect.

richiardiandrea20:04:29

Don't have to say how cool this is, no more lein or boot for template generation is a boon for lumo projects

Alex Miller (Clojure team)21:04:19

new tools.deps.alpha 0.5.425 is out. new installers working their way through the meat grinder

Alex Miller (Clojure team)21:04:28

mostly just bug fix releases for both, Iโ€™ll do a ggroups announcement when brew is done

seancorfield21:04:53

I'll add it to the tools page after it's had some polish this weekend. There are a few issues (opened on GH!) that need addressing before it's ready for real world users! ๐Ÿ™‚

john21:04:08

s/lein new/clj -A:new/

seancorfield22:04:12

clj -A:new right? ๐Ÿ™‚

seancorfield22:04:33

(or does it support omitting the leading : now?)

richiardiandrea22:04:24

I have put it directly in my :deps in ~/.clojure/deps.edn

john22:04:16

so what's it look like? the -m ... line goes in extra-args right?

john22:04:57

ah, main-opts

john22:04:23

Yeah, this works for me:

...
 :aliases
 {:new {:main-opts ["-m" "clj-new.create"]
        :extra-deps 
          {seancorfield/clj-new {:git/url "" 
                                 :sha "a87bdc0347fe1523e8d85283d94b06f5dd68b2cb"}}}
  ...

timgilbert17:04:03

Adding this magic entry to ~/.clojure/deps.edn, or a project deps.edn, seems like something that could be written as a useful tool, similar to npm install or yarn add or whatnot - typing all of this info is slightly too annoying right now for use in shell scripts / one-liners IMHO

dominicm17:04:17

I have this in pack.alpha

dominicm17:04:25

Pack can inject itself for you.

dominicm17:04:46

I'm thinking it might become a general injector eventually which you can then do clj -A:user/inject new to inject into deps.edn

๐Ÿ‘ 4
john22:04:09

then just do clj -A:new figwheel figthing

Alex Miller (Clojure team)23:04:22

I intentionally wrote the code to be a little lax on that leading colon so itโ€™s optional

4
seancorfield23:04:16

clj-new SHA "87d175c5e49618fffe8ed16b1bf86aa6f0fbc624" -- https://github.com/seancorfield/clj-new/blob/master/README.md -- a whole bunch of clean up, refactoring, and rewriting the default project templates.

seancorfield23:04:06

The built in templates now generate projects with deps.edn files

$ clj -A:new app myapp
$ cd myapp
$ clj -m myapp.core
Hello World!
$ clj -A:test:runner
...FIXME test failure...

timgilbert17:04:03

Adding this magic entry to ~/.clojure/deps.edn, or a project deps.edn, seems like something that could be written as a useful tool, similar to npm install or yarn add or whatnot - typing all of this info is slightly too annoying right now for use in shell scripts / one-liners IMHO