Giter Club home page Giter Club logo

build.edn's Introduction

build.edn

Make your Clojure library build process easy.

Note
This project is alpha version. Breaking changes may happen

GitHub Actions for test workflow GitHub Actions for lint workflow GitHub Actions for dependencies workflow

Getting started

build.edn make you buildable your libraries only preparing build.edn file for the simple usage.

  • build.edn

    • {:lib com.github.YOUR-ACCOUNT/AWESOME-LIB
       :version "0.1.{{git/commit-count}}"}
  • deps.edn

    • {:aliases
       {:build {:deps {com.github.liquidz/build.edn {:git/tag "0.2.63" :git/sha "f4e571d"}}
                :ns-default build-edn.main}}}
  • use by clojure cli

    • # Install lib to your local maven repo
      $ clojure -T:build install
      
      # Deploy to clojars.org
      # CLOJARS_USERNAME and CLOJARS_PASSWORD environmental variables are required
      $ clojure -T:build deploy

API

build-edn.main

build-edn.main namespace provides following functions:

Function Description

pom

Generate pom.xml

jar

Generate JAR file

uberjar

Generate standalone JAR file

install

Install to local Maven repository

deploy

Deploy to https://clojars.org

update-documents

Update document files for new release

Manual usage

build-edn.main namespace is just a wrapper for build-edn.core. So if you want to tune the build process a bit more, you can use build-edn.core name directly.

  • deps.edn

    • {:aliases
       {:build {:deps {com.github.liquidz/build.edn {:git/tag "0.2.63" :git/sha "f4e571d"}}
                :ns-default build}}}
  • build.clj

    • (ns build
        (:require
         [build-edn.core :as build-edn]))
      
      (def ^:private config
        {:lib 'com.github.YOUR-ACCOUNT/AWESOME-LIB
         :version "0.1.{{git/commit-count}}"})
      
      (defn deploy
        [_]
        ;; Deploy with past name for compatibility.
        (build-edn/deploy (assoc config :lib 'AWESOME-LIB/AWESOME-LIB))
        (build-edn/deploy config))

Configuration

build.edn

name type required? default description

lib

qualified-symbol?

Yes

version

string?

Yes

source-dir

string?

Your paths in deps.edn

class-dir

string?

"target/classes"

jar-file

string?

"target/{{lib}}.jar"

uber-file

string?

"target/{{lib}}-standalone.jar"

Required only for uberjar

main

symbol?

Required only for uberjar

scm

map?

You can generate pom.xml with scm section.

name type

connection

string?

developerConnection

string?

url

string?

documents

sequential?

Required only for update-documents

name type

file

string?

match

string?

action

enum :append-before, :replace, :append-after

text

string?

github-actions?

boolean?

false

See GitHub Actions section below for more information

Available variables

Name Available parameters Description

{{git/commit-count}}

version, text in documents

{{git/head-long-sha}}

version, text in documents

{{git/head-short-sha}}

version, text in documents

{{now/yyyy}}

version, text in documents

year-of-era

{{now/mm}}

version, text in documents

month-of-year

{{now/m}}

version, text in documents

month-of-year

{{now/dd}}

version, text in documents

day-of-month

{{now/d}}

version, text in documents

day-of-month

{{version}}

text in documents

{{lib}}

jar-file, uber-file

Lint your build.edn

build.edn provides build-edn.core/lint and build-edn.main/lint function.

When you use :ns-default build-edn.main setting, you can lint your build.edn file with the following command.

clojure -T:build lint

GitHub Actions

When you set true to :github-actions?, build.edn will set following outputs.

Function Output Description

pom

${{ steps.ID.outputs.pom }}

Path for the pom.xml file

jar

${{ steps.ID.outputs.jar }}

Path for the generated JAR file

uberjar

${{ steps.ID.outputs.uberjar }}

Path for the generated standalone JAR file

install

${{ steps.ID.outputs.version }}

Installed version string

deploy

${{ steps.ID.outputs.version }}

Deployed version string

update-documents

${{ steps.ID.outputs.version }}

Tagged version string

Automate your release process

If you’d like to automate your release process with GitHub Actions, it is good to refer following examples:

Projects using build.edn

Of course, build.edn itself is using build.edn for releasing.

License

Copyright © 2022 Masashi Iizuka

This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.

This Source Code may also be made available under the following Secondary Licenses when the conditions for such availability set forth in the Eclipse Public License, v. 2.0 are satisfied: GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version, with the GNU Classpath Exception which is available at https://www.gnu.org/software/classpath/license.html.

build.edn's People

Contributors

liquidz avatar

Watchers

 avatar

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.