GithubHelp home page GithubHelp logo

Comments (7)

practicalli-johnny avatar practicalli-johnny commented on May 12, 2024

Thank you for the work on build-clj project, it's high on my to-do list

The plan is to move to tools.build as soon as I have had time to look at this approach in detail (should be working on this over the next few weeks)

If I understand correctly, a build.edn file is required. If so, I would need to understand at least the basics of this before switching and include a suitable config

I also plan to prioritize deps-new over clj-new (and create several templates) which simplifies the build process by providing a build.edn configuration.

Thank you.

from clojure-cli-config.

seancorfield avatar seancorfield commented on May 12, 2024

What is build.edn? Never heard of that. Do you mean build.clj? To invoke just the uber function from the build-clj wrapper for tools.build, you can just use -T and an alias. Maybe I'll add some examples to build-clj's README...

from clojure-cli-config.

seancorfield avatar seancorfield commented on May 12, 2024

@practicalli-john I've added some examples to the build-clj README of how you can use it via just an alias from the CLI without a build.clj file.

from clojure-cli-config.

practicalli-johnny avatar practicalli-johnny commented on May 12, 2024

Using the stand-alone commands seems to require specific aliases defined, eg. to run tests then :test alias that defines the path and cognitect-labs/test-runner deps should be defined (assume this can be either project deps.edn or user level deps.edn file.

If the :test alias is renamed then the test runner namespace is not found. This is the same when using the clojure -T:build test

As build-clj looks for cognitect/test_runner.clj by default. If changing :test to use the Koacha test runner then the alias must contain a :main-opts with a value defining the main namespace. If an :exec-fn is included, then the test task will try to use cognitect/test_runner and fail as its not on the classpath. Curious as to why :exec-fn cannot be used, if that is a choice of build-clj or limitation of tools.build.

Some investigation required into tools.build and build-clj is still required.

from clojure-cli-config.

seancorfield avatar seancorfield commented on May 12, 2024

I wasn't sure whether your last comment was "musing out loud" or some questions intended for me, which is why I didn't respond at the time. However, this feels like a question I should answer:

Curious as to why :exec-fn cannot be used, if that is a choice of build-clj or limitation of tools.build.

This comes about because the tests are run in a separate process, so that none of the tools.build/tools.deps.alpha stuff is on the classpath when running your code under test.

tools.build has tasks that support building a java command and executing it, so you're going to be running a -main function -- either in your own code or clojure.main. The -X stuff is all built into a small exec.jar that is bundled into the Clojure CLI but is not available as a library anywhere. See https://clojure.atlassian.net/browse/TBUILD-6 for some discussion around this (and code close to what we do at work to allow for "exec" task execution in our build.clj file -- it's pretty nasty and relies on internals of the Clojure CLI to work, since it has to generate a -X-style command-line from a data structure so that it can start the process off via the java command!).

If you execute tests in-process -- as happens if you just use an alias to run Cognitect's test-runner directly -- you can just require, resolve, and directly call the "exec" function from your build.clj script. But when you run test-runner or Koacha etc, you are only adding the test runner's dependencies into the mix, not all of the tools.* stuff (which drags in a lot of libraries!).

from clojure-cli-config.

practicalli-johnny avatar practicalli-johnny commented on May 12, 2024

After much though and slack discussions I'll deprecate / delete all aliases that can be done with tools.build instead.

Add a section to Practicalli Clojure to cover tools.build and any useful projects that support it.

from clojure-cli-config.

practicalli-johnny avatar practicalli-johnny commented on May 12, 2024

Resolved by #61

from clojure-cli-config.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.