File tree Expand file tree Collapse file tree 3 files changed +15
-23
lines changed
tests/src/test/scala/org/scalanative/bindgen
tools/src/main/scala/org/scalanative/bindgen Expand file tree Collapse file tree 3 files changed +15
-23
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ inThisBuild(
1818
1919val tests = project
2020 .in(file(" tests" ))
21+ .dependsOn(tools)
2122 .aggregate(samples)
2223 .settings(
2324 fork in Test := true ,
Original file line number Diff line number Diff line change 11package org .scalanative .bindgen
22
3- import java .io .{File , PrintWriter }
3+ import java .io .{File }
44import org .scalatest .FunSpec
55import scala .io .Source
6- import scala .sys .process ._
76
87class BindgenSpec extends FunSpec {
98 describe(" Bindgen" ) {
@@ -19,24 +18,15 @@ class BindgenSpec extends FunSpec {
1918 }
2019
2120 def bindgen (inputFile : File , name : String , outputFile : File ): Unit = {
22- val cmd = Seq (
23- bindgenPath,
24- inputFile.getAbsolutePath,
25- " --name" ,
26- name,
27- " --link" ,
28- " bindgentests" ,
29- " --package" ,
30- " org.scalanative.bindgen.samples" ,
31- " --exclude-prefix=__" ,
32- " --"
33- )
34- val output = Process (cmd).lineStream.mkString(" \n " )
35-
36- new PrintWriter (outputFile) {
37- write(output)
38- close()
39- }
21+ Bindgen ()
22+ .bindgenExecutable(new File (bindgenPath))
23+ .header(inputFile)
24+ .scalaObjectName(name)
25+ .link(" bindgentests" )
26+ .packageName(" org.scalanative.bindgen.samples" )
27+ .excludePrefix(" __" )
28+ .generate()
29+ .writeToFile(outputFile)
4030 }
4131
4232 def contentOf (file : File ) =
Original file line number Diff line number Diff line change @@ -148,12 +148,13 @@ object Bindgen {
148148 }
149149
150150 if (excludePrefix != null ) {
151- cmd :+= excludePrefix
151+ cmd ++= Seq ( " --exclude-prefix " , excludePrefix)
152152 }
153153
154- cmd :+= " --"
154+ for (arg <- extraArg) cmd ++= Seq (" --extra-arg" , arg)
155+ for (arg <- extraArgBefore) cmd ++= Seq (" --extra-arg-before" , arg)
155156
156- // TODO: extra args
157+ cmd :+= " -- "
157158
158159 val output = Process (cmd).lineStream.mkString(" \n " )
159160
You can’t perform that action at this time.
0 commit comments