|
| 1 | +# Hacking Guide |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This guide contains instructions for building artifacts contained in this repository. |
| 6 | + |
| 7 | +### Go |
| 8 | + |
| 9 | +This spec includes several Go packages, and a command line tool considered to be a reference implementation of the OCI image specification. |
| 10 | + |
| 11 | +Prerequsites: |
| 12 | +* Go >=1.5 |
| 13 | +* make |
| 14 | + |
| 15 | +The following make targets are relevant for any work involving the Go packages. |
| 16 | + |
| 17 | +### Linting |
| 18 | + |
| 19 | +The included Go source code is being examined for any linting violations not included in the standard Go compiler. Linting is done using [gometalinter](https://github.com/alecthomas/gometalinter). |
| 20 | + |
| 21 | +Invocation: |
| 22 | +``` |
| 23 | +$ make lint |
| 24 | +``` |
| 25 | + |
| 26 | +### Tests |
| 27 | + |
| 28 | +This target executes all Go based tests. |
| 29 | + |
| 30 | +Invocation: |
| 31 | +``` |
| 32 | +$ make test |
| 33 | +$ make validate-examples |
| 34 | +``` |
| 35 | + |
| 36 | +### OCI image tool |
| 37 | + |
| 38 | +This target builds the `oci-image-tool` binary. |
| 39 | + |
| 40 | +Invocation: |
| 41 | +``` |
| 42 | +$ make oci-image-tool |
| 43 | +``` |
| 44 | + |
| 45 | +### Virtual schema http/FileSystem |
| 46 | + |
| 47 | +The `oci-image-tool` uses a virtual [http/FileSystem](https://golang.org/pkg/net/http/#FileSystem) to load the JSON schema files for validating OCI images and/or manifests. The virtual file system is generated using the `esc` tool and compiled into the `oci-image-tool` binary so the JSON schema files don't have to be distributed along with the binary. |
| 48 | + |
| 49 | +Whenever changes are being done in any of the `schema/*.json` files, one must refresh the generated virtual file system. Otherwise schema changes will not be visible inside the `oci-image-tool`. |
| 50 | + |
| 51 | +Prerequisites: |
| 52 | +* [esc](https://github.com/mjibson/esc) |
| 53 | + |
| 54 | +Invocation: |
| 55 | +``` |
| 56 | +$ make schema-fs |
| 57 | +``` |
| 58 | + |
| 59 | +### JSON schema formatting |
| 60 | + |
| 61 | +This target auto-formats all JSON files in the `schema` directory using the `jq` tool. |
| 62 | + |
| 63 | +Prerequisites: |
| 64 | +* [jq](https://stedolan.github.io/jq/) |
| 65 | + |
| 66 | +Invocation: |
| 67 | +``` |
| 68 | +$ make fmt |
| 69 | +``` |
| 70 | + |
| 71 | +### OCI image specification PDF/HTML documentation files |
| 72 | + |
| 73 | +This target generates a PDF/HTML version of the OCI image specification. |
| 74 | + |
| 75 | +Prerequisites: |
| 76 | +* [Docker](https://www.docker.com/) |
| 77 | + |
| 78 | +Invocation: |
| 79 | +``` |
| 80 | +$ make docs |
| 81 | +``` |
| 82 | + |
| 83 | +### License header check |
| 84 | + |
| 85 | +This target checks if the source code includes necessary headers. |
| 86 | + |
| 87 | +Invocation: |
| 88 | +``` |
| 89 | +$ make check-license |
| 90 | +``` |
| 91 | + |
| 92 | +### Update vendored dependencies |
| 93 | + |
| 94 | +This target updates all vendored depencies to their newest available versions. The `glide` tools is being used for the actual management and `glide-vc` tool is being used for stripping down the vendor directory size. |
| 95 | + |
| 96 | +Prerequisites: |
| 97 | +* [glide](https://github.com/Masterminds/glide) |
| 98 | +* [glide-vc](https://github.com/sgotti/glide-vc) |
| 99 | + |
| 100 | +Invocation: |
| 101 | +``` |
| 102 | +$ make update-deps |
| 103 | +``` |
| 104 | + |
| 105 | +### Clean build artifacts |
| 106 | + |
| 107 | +This target cleans all generated/compiled artifacts. |
| 108 | + |
| 109 | +Invocation: |
| 110 | +``` |
| 111 | +$ make clean |
| 112 | +``` |
| 113 | + |
| 114 | +### Create PNG images from dot files |
| 115 | + |
| 116 | +This target generates PNG image files from DOT source files in the `img` directory. |
| 117 | + |
| 118 | +Prerequisites: |
| 119 | +* [graphviz](http://www.graphviz.org/) |
| 120 | + |
| 121 | +Invocation: |
| 122 | +``` |
| 123 | +$ make img/media-types.png |
| 124 | +``` |
0 commit comments