Skip to content

Latest commit

 

History

History
82 lines (56 loc) · 2.68 KB

clojure-base.adoc

File metadata and controls

82 lines (56 loc) · 2.68 KB

dev.clojurephant.clojure-base

Clojure Extension

Adds the dsl/clojureextension.adoc to the project allowing the user to configure builds.

Clojure Builds

For each dsl/clojurebuild.adoc it sets default values and creates the following tasks.

Check Task

Creates a tasks/clojurecheck.adoc task named checkClojure (for main build) or check<Name>Clojure (e.g. checkTestClojure), with the following defaults:

  • task.source is build.sourceRoots

  • task.classpath is build.sourceRoots plus build.classpath

  • task.reflection is build.reflection

  • task.namespaces is build.checkNamespaces

Compile Task

Creates a tasks/clojurecompile.adoc task named compileClojure (for main build) or compile<Name>Clojure (e.g. compileTestClojure), with the following defaults:

  • task.destinationDir is build.outputDir

  • task.source is build.sourceRoots

  • task.classpath is build.sourceRoots plus build.classpath

  • task.options is build.compiler

  • task.namespaces is build.aotNamespaces

Build per Source Set

For each SourceSet, the clojure-base plugin will create a dsl/clojurebuild.adoc. In addition to the defaults above, the following will be configured:

Source Roots

settings.gradle
build.gradle
src/
  <source set name>/
    clojure/ # Adds this to what java-base provides
    java/
    resources/

The build will use this src/<name>/clojure directory as its source root.

The Clojure source directories will also be registed with the source set’s allSource and allJava, making them discoverable to other Gradle plugins.

Tip

For maximum compatibility, if you want to modify your source layout, configure on the source set, rather than the build.

build.gradle
sourceSets {
  main {
    clojure.srcDirs = ['src']
    resources.srcDirs = ['resources']
  }
}

Classpath

The Clojure classpath will include:

  • the source set’s compileClasspath configuration dependencies

  • the source set’s compiled Java classes

  • the source set’s processed resources

SourceSet Output

Each source set has a concept of its output directories and the tasks needed to populate them. Depending on your use case, you may want the Clojure source to be considered the output, or you may want AOT classes to be considered the output.

The clojure-base plugin will include only the AOT classes in the source set output, if you enable any build.aotNamespaces. Otherwise, it will only include the Clojure sources.