README.md 3.64 KB
Newer Older
Drew's avatar
Drew committed
1 2 3 4
# atbuild

The Anarchy Tools Build Tool.

Drew's avatar
Drew committed
5 6
# Building

Drew's avatar
Drew committed
7
To build atbuild "from scratch", simply `./bootstrap/build.sh`.
Drew's avatar
Drew committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23

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"]
```

# Configuration

Drew's avatar
Drew committed
24
```bash
Drew's avatar
Drew committed
25
$ atbuild
Drew's avatar
Drew committed
26 27 28
$ atbuild build
$ atbuild build-tests
$ atbuild run-tests
Drew's avatar
Drew committed
29 30
```

Drew's avatar
Drew committed
31
The configuration file defines *tasks*, which are entrypoints on the CLI.  If no task is specified, we run a task called `default`.
Drew's avatar
Drew committed
32

33
Configurations look like this:
Drew's avatar
Drew committed
34 35

```bash
Drew's avatar
Drew committed
36
$ atbuild run-tests --platform linux
Drew's avatar
Drew committed
37 38
```

39 40 41 42 43 44 45 46 47 48 49 50
A complete build.atpkg example is below.

```clojure
;; This is a comment

(package
  :name "atbuild"

  ;;These "tasks" are just entrypoints on the CLI.
  ;;For example, `atbuild run-tests` runs the `run-tests` task.
  :tasks {

Drew's avatar
Drew committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
            :atbuild {
                :tool "atllbuild" ;;The tool for this task.  atllbuild compiles a swift project.  
                                  ;; For more information, see docs/attlbuild.md
                :source ["atbuild/src/**.swift"]
                :name "atbuild"
                :outputType "executable"
                :linkWithProduct ["attools.a" "atpkg.a"]
                :dependencies ["attools" "atpkg"]
            }

            :atpkg {
                :tool "atllbuild"
                :source ["atpkg/src/**.swift"]
                :name "atpkg"
                :outputType "static-library"
            }
67
                  
Drew's avatar
Drew committed
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
            :attools {
                :tool "atllbuild"
                :source ["attools/src/**.swift"]
                :name "attools"
                :outputType "static-library"
            }

            :atpkg-tests {
                :tool "atllbuild"
                :dependencies ["atpkg"]
                :source ["atpkg/tests/**.swift"]
                :name "atpkgtests"
                :outputType "executable"
                :linkWithProduct ["atpkg.a"]
            }

            :run-atpkg-tests {
                :tool "shell"
                :dependencies ["atpkg-tests"]
                :script "./.atllbuild/products/atpkgtests"
            }

            :run-tests {
                :dependencies ["run-atpkg-tests"]
                :tool "nop"
            }
    }
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120

  ;;These configurations "override" task configurations when activated.
  ;;You activate a configuration via `atbuild --name [value]`
  :configurations {
        ;;Create a configuration called "bootstrap"
        :bootstrap {
             ;;If bootstrap is yes
             :yes {
                :atpkg { ;;specify additional options for atpkg
                  :bootstrapOnly true
                  :llbuildyaml "bootstrap/bootstrap-macosx-atpkg.swift-build"
                }
                :attools { ;;specify additional options for attools
                  :bootstrapOnly true
                  :llbuildyaml "bootstrap/bootstrap-macosx-attools.swift-build"
                }
                :atbuild { ;;specify additional options for atbuild
                  :bootstrapOnly true
                  :llbuildyaml "bootstrap/bootstrap-macosx-attools.swift-build"
                }
             }
        }
  }

)

Drew's avatar
Drew committed
121 122 123 124
```

The package file is a set of metadata to describe how the build process should work, and push all the actual work out to separate tools. There are a set of tools that are built-in that provide some of the standard behavior we want to support. At the same time, there are extension points to defining new tools as well. These tools can be defined within the package file or within source code for more advanced tools.