Sitelet https://github.com/clojurephant/clojurephant/issues/103
Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Generic EDN config support #103

Description

@ajoberstar

Desired Behavior

Provide a generic way for a Clojure-based task to accept dynamic configuration as a map, supporting additional EDN types: Keyword and Symbol.

Something maybe like:

interface EdnAdapter {
  put(Object key, Object value)
  put(Object key, Action<EdnAdapter> config)
  putIn(List keys, Object value)
  putIn(List keys, Action<EdnAdapter> config)
}

where usage would look like (rough take at it):

compiler {
  put(kw('optimizations'), kw('advanced'))
  put(kw('modules')) {
    put(kw('common')) {
      put(kw('output-to'), 'public/js/common.js')
      put(kw('entries'), [sym('sample.common')] as Set)
    }
    put(kw('cart')) {
      put(kw('output-to'), 'public/js/cart.js')
      put(kw('entries'), [sym('sample.cart'), sym('sample.shopping')] as Set)
    }
  }
}

It would be nice to get something cleaner than this. A couple challenges:

  • Keywords and symbol support. They aren't valid Java identifiers so you can't just do something like :stuff = 'things'.
  • Can't be too Groovy specific, since we would want this to work in Kotlin DSL too.

Context

Right now, the plugin has to statically provide every single option for any Clojure tool we call out to (e.g. ClojureScript compiler, Figwheel). Most of those tools accept EDN maps as config, and have a very dynamic sense of what can be provided in them.

For example, neither ClojureScript nor Figwheel document a :devcards option, but DevCards relies on a :devcards key to be in the compiler environment to decide whether to actually create the cards.

It is very difficult to provide support for these kinds of things, as there's always another option or another tool that will require more.

The major caveat here is that to leverage Gradle, we must still identify certain values as input files/directories or output files/directories. These are needed for Gradle's incremental build support to decide whether or not to re-run tasks.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions