|
1 | 1 | # grml - A simple build automation tool written in Go |
2 | 2 |
|
3 | | -**TODO**: Update the README. The syntax has changed with the latest release. |
4 | | - |
5 | | -grml is a simple Makefile alternative. Build targets are defined in a `grml.yaml` |
6 | | -file located in the project's root directory. |
| 3 | +grml is a simple Makefile alternative. Build targets are defined in a `grml.yaml` file located in the project's root directory. |
7 | 4 | This file uses the [YAML](http://yaml.org/) syntax. |
8 | 5 |
|
9 | | -A minimal `grml.yaml` file can be expressed as follows: |
10 | | - |
11 | | -```yaml |
12 | | -targets: |
13 | | - app: |
14 | | - help: build the app |
15 | | - default: true |
16 | | - run: | |
17 | | - gb build all |
18 | | -``` |
19 | | -
|
20 | | -The build is triggered with: |
21 | | -
|
22 | | -``` |
23 | | -$ grml app |
24 | | -``` |
25 | | - |
26 | | -or just with the default target: |
27 | | - |
28 | | -``` |
29 | | -$ grml |
30 | | -``` |
31 | | - |
32 | | - |
33 | | -The run section is called in a shell (sh) process. All sh expressions (`if`, `elif`, ...) are valid. |
34 | | - |
35 | | -## Outputs |
36 | | - |
37 | | -For each target multiple outputs can be defined. Targets are skipped if the output files exist. |
38 | | - |
39 | | -```yaml |
40 | | -targets: |
41 | | - resources: |
42 | | - help: build the resources |
43 | | - output: |
44 | | - - build/resources |
45 | | - run: | |
46 | | - mkdir -p build |
47 | | - touch build/resources |
48 | | -``` |
49 | | -
|
50 | | -## Dependencies |
51 | | -
|
52 | | -Dependencies can be specified within the **deps** section. |
53 | | -
|
54 | | -```yaml |
55 | | -targets: |
56 | | - app: |
57 | | - help: build the app |
58 | | - deps: |
59 | | - - resources |
60 | | - run: | |
61 | | - gb build all |
62 | | - resources: |
63 | | - help: build the resources |
64 | | - output: |
65 | | - - build/resources |
66 | | - run: | |
67 | | - mkdir -p build |
68 | | - touch build/resources |
69 | | -``` |
| 6 | +A minimal sample can be found within the [sample](sample/grml.yaml) directory. Enter the directory with a terminal and execute `grml`. |
70 | 7 |
|
71 | | -## Variables |
| 8 | +## Installation |
| 9 | +### From Source |
| 10 | + go install github.com/desertbit/grml@latest |
72 | 11 |
|
73 | | -Environment variables can be defined in the **env** section. These variables are passed to all run target processes. |
| 12 | +## Specification |
| 13 | +- Environment variables can be defined in the **env** section. These variables are passed to all run target processes. |
| 14 | +- Variables are also accessible with the `${}` selector within **help** messages and **import** statements. |
| 15 | +- Dependencies can be specified within the command's **deps** section. |
74 | 16 |
|
75 | | -```yaml |
76 | | -env: |
77 | | - version: 1.0.0 |
78 | | - |
79 | | -targets: |
80 | | - app: |
81 | | - help: build the app |
82 | | - default: true |
83 | | - run: | |
84 | | - echo "$version" |
85 | | -``` |
86 | | -
|
87 | | -Variables are accessible with the `${}` selector in the **env**, **deps** and **output** section. |
88 | | - |
89 | | -```yaml |
90 | | -env: |
91 | | - version: 1.0.0 |
92 | | - buildDir: build/ |
93 | | - destBin: app-${version} |
94 | | -
|
95 | | -targets: |
96 | | - app: |
97 | | - help: build the app |
98 | | - deps: |
99 | | - - resources |
100 | | - run: | |
101 | | - echo "building app ${destBin}" |
102 | | - gb build all |
103 | | -
|
104 | | - resources: |
105 | | - help: build the resources |
106 | | - output: |
107 | | - - ${buildDir}/resources |
108 | | - run: | |
109 | | - mkdir -p ${buildDir} |
110 | | - touch ${buildDir}/resources |
111 | | -``` |
112 | | - |
113 | | -### Additonal Variables |
| 17 | +### Additonal Environment Variables |
114 | 18 |
|
115 | 19 | The process environment is inherited and following additonal variables are set: |
116 | 20 |
|
117 | | -| KEY | VALUE | |
118 | | -|:-----|:---------------------------------------------------------------| |
119 | | -| ROOT | Path to the root build directory containing the grml.yaml file | |
120 | | - |
121 | | - |
122 | | -## Final Example |
123 | | - |
124 | | -```yaml |
125 | | -env: |
126 | | - version: 1.0.0 |
127 | | - buildDir: build/ |
128 | | - destBin: app-${version} |
129 | | -
|
130 | | -targets: |
131 | | - app: |
132 | | - help: build the app |
133 | | - default: true |
134 | | - deps: |
135 | | - - resources |
136 | | - - db |
137 | | - run: | |
138 | | - echo "building app ${destBin}" |
139 | | - gb build all |
140 | | -
|
141 | | - resources: |
142 | | - help: build the resources |
143 | | - help-group: Resources |
144 | | - deps: |
145 | | - - images |
146 | | - output: |
147 | | - - ${buildDir}/resources |
148 | | - run: | |
149 | | - mkdir -p ${buildDir} |
150 | | - touch ${buildDir}/resources |
151 | | -
|
152 | | - images: |
153 | | - help: build the image resources |
154 | | - help-group: Resources |
155 | | - output: |
156 | | - - ${buildDir}/images |
157 | | - run: | |
158 | | - mkdir -p ${buildDir} |
159 | | - touch ${buildDir}/images |
160 | | -
|
161 | | - db: |
162 | | - help: build the database files |
163 | | - output: |
164 | | - - ${buildDir}/db |
165 | | - run: | |
166 | | - mkdir -p ${buildDir} |
167 | | - touch ${buildDir}/db |
168 | | -``` |
| 21 | +| KEY | VALUE | |
| 22 | +|:--------|:---------------------------------------------------------------| |
| 23 | +| ROOT | Path to the root build directory containing the grml.yaml file | |
| 24 | +| PROJECT | Project name as specified within the grml file | |
| 25 | +| NUMCPU | Number of CPU cores | |
0 commit comments