README.md 2.67 KB
Newer Older
Drew's avatar
Drew committed
1 2
# atbuild

Drew's avatar
Drew committed
3 4
[![Anarchy Tools compatible](https://img.shields.io/badge/Anarchy%20Tools-compatible-4BC51D.svg?style=flat)](http://anarchytools.org)

Drew's avatar
Drew committed
5 6
The Anarchy Tools Build Tool.

David Owens II's avatar
David Owens II committed
7
`atbuild` is a cross-platform build system, primarily for Swift-language projects, following the [Anarchy Tools philosophy](http://anarchytools.org/) of simple, unopinionated, hackable tools.
Drew's avatar
Drew committed
8

Drew's avatar
Drew committed
9
# Tasks
Drew's avatar
Drew committed
10

Drew's avatar
Drew committed
11
With `atbuild` you define a set of *tasks*, representing high-level operations like building, running, and cleaning.  Then you can use these tasks from the command line.
Drew's avatar
Drew committed
12

Drew's avatar
Drew committed
13
```bash
Drew's avatar
Drew committed
14 15 16
$ atbuild build
$ atbuild build-tests
$ atbuild run-tests
Drew's avatar
Drew committed
17
$ atbuild #runs a task named "default"
Drew's avatar
Drew committed
18 19 20
```


Drew's avatar
Drew committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
Tasks are defined in a clojure-like format.  Here's a simple example:

```clojure
;; This is a comment

(package
  :name "foo"

  ;;These "tasks" are just entrypoints on the CLI.
  ;;For example, `atbuild build` runs the `build` task.
  :tasks {
    :run {
      :tool "shell"               ;;Tools are functions built into atbuild.
      :script "echo Hello world!" ;;The shell tool requires a script
    }
  }
)
```

Name that `build.atpkg`.  Now we can call 
Drew's avatar
Drew committed
41 42

```bash
Drew's avatar
Drew committed
43 44 45 46 47 48
$ atbuild run
Building package foo...
Running task run...
Hello world!
Completed task run.
Built package foo.
Drew's avatar
Drew committed
49 50
```

Drew's avatar
Drew committed
51
# Building Swift code
52

Drew's avatar
Drew committed
53
How do we build a Swift project?  There's a built-in tool called `atllbuild`, which is our *low-level build system*.
54

Drew's avatar
Drew committed
55
```clojure
56
(package
Drew's avatar
Drew committed
57
  :name "foo"
58 59

  ;;These "tasks" are just entrypoints on the CLI.
Drew's avatar
Drew committed
60
  ;;For example, `atbuild build` runs the `build` task.
61
  :tasks {
Drew's avatar
Drew committed
62 63
    :build {
      :tool "atllbuild"
64 65
      :sources ["src/**.swift"] ;;walk the src directory, looking for Swift files
      :output-type "executable"
Drew's avatar
Drew committed
66
      :name "example"
Drew's avatar
Drew committed
67
    }
68 69
  }
)
Drew's avatar
Drew committed
70 71
```

Drew's avatar
Drew committed
72 73 74 75 76 77 78 79 80
That's all you need to get started!  `atbuild` supports many more usecases than can fit in a README.  For more information, browse our [documentation](/docs).

# Building

We publish [binary releases](https://github.com/AnarchyTools/atbuild/releases), which are the easiest way to get started.

`atbuild` is self-hosting, so building it with an existing copy is usually your best bet.

That said, if you're doing something fancy, or are bootstrapping onto a new platform, use `./bootstrap/build.sh`.
Drew's avatar
Drew committed
81

Drew's avatar
Drew committed
82 83 84 85 86 87 88 89 90 91 92 93
Then you can check the program was built successfully:

```bash
$ ./atbuild --help
atbuild - Anarchy Tools Build Tool 0.1.0-dev
https://github.com/AnarchyTools
© 2016 Anarchy Tools Contributors.

Usage:
atbuild [task]
    task: ["default", "helloworld", "bootstrap"]
```
Drew's avatar
Drew committed
94 95 96 97 98 99 100 101

# Badges

To declare your project to be compatible with Anarchy Tools, simply

```markdown
[![Anarchy Tools compatible](https://img.shields.io/badge/Anarchy%20Tools-compatible-4BC51D.svg?style=flat)](http://anarchytools.org)
```