Skip to content

Commit de956a6

Browse files
committed
Update binding contribution instructions
1 parent b3b306a commit de956a6

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

build.sbt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,16 @@ lazy val libiconv = bindingProject("iconv")
224224
}
225225
)
226226

227-
//#sbt-binding-project
227+
//#sbt-binding-project-multi-header
228228
lazy val libposix = bindingProject("posix")
229229
.configure(binding("fnmatch.h"))
230230
.configure(binding("regex.h"))
231-
//#sbt-binding-project
231+
//#sbt-binding-project-multi-header
232232

233+
//#sbt-binding-project
233234
lazy val libutf8proc = bindingProject("utf8proc")
234235
.configure(binding("utf8proc.h", Some("utf8proc")))
236+
//#sbt-binding-project
235237

236238
def project(name: String, plugged: AutoPlugin*) = {
237239
val unplugged = Seq(ScriptedPlugin).filterNot(plugged.toSet)

docs/src/paradox/bindings/index.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
The following bindings have been generated with bindgen.
44

5+
If you would like to contribute a binding see the @ref:[Contributing Bindings] page.
6+
57
@@ toc { depth=1 }
68

79
@@@ index
@@ -10,4 +12,6 @@ The following bindings have been generated with bindgen.
1012
* [iconv](iconv.md)
1113
* [utf8proc](utf8proc.md)
1214

13-
@@@
15+
@@@
16+
17+
[Contributing Bindings]: ../contrib/bindings.md

docs/src/paradox/contrib/bindings.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
## Adding a new Bindings
44

5-
To add a new binding add a new project in `build.sbt` with the name of the artifact as well as a binding configuration for each header file and optionally the library to link with. The following example shows how it is possible to generate multiple bindings per project. For most libraries a single binding should be sufficient.
5+
To add a new binding, add a new project in `build.sbt` with the name of the artifact as well as a binding configuration for each header file and optionally the library to link with.
66

77
@@snip [build.sbt](../../../../build.sbt) { #sbt-binding-project }
88

9+
It is also possible to generate multiple bindings per project. For most libraries a single binding should be sufficient.
10+
11+
@@snip [build.sbt](../../../../build.sbt) { #sbt-binding-project-multi-header }
12+
913
The new sbt project should also be added to the `bindings` project's list of aggregated projects.
1014

1115
Optionally update the top-level `Dockerfile` to install the binding library's `-dev` package.
@@ -22,16 +26,16 @@ Next, run `nativeBindgen` to generate the bindings. Note, to ensure consistency
2226
This can be done by running:
2327

2428
```sh
25-
docker-compose run --rm ubuntu-18.04-llvm-6.0 sbt bindings/$BINDING/nativeBindgen
29+
docker-compose run --rm ubuntu-18.04-llvm-6.0 sbt lib$BINDING/nativeBindgen
2630
```
2731

2832
Then write tests for the generated bindings. The test class should be in the `org.scalanative.bindgen.bindings.tests` package to make it easier to write examples for the binding documentation. Verify that the tests pass:
2933

3034
```sh
31-
docker-compose run --rm ubuntu-18.04-llvm-6.0 sbt bindings/$BINDING/test
35+
docker-compose run --rm ubuntu-18.04-llvm-6.0 sbt lib$BINDING/test
3236
```
3337

34-
Finally, add a page in the `bindings` folder and document the binding, ideally with an example or two of how to use it.
38+
Finally, add a Markdown file in the `bindings` folder and document the binding, ideally with an example or two of how to use it. Remember to add the new file to the index in `bindings/index.md`.
3539

3640
## Update all Bindings
3741

0 commit comments

Comments
 (0)