Skip to content

Commit b653b7f

Browse files
committed
Update bindgen sbt plugin to 0.3.0-RC1
1 parent fc815fe commit b653b7f

File tree

4 files changed

+19
-26
lines changed

4 files changed

+19
-26
lines changed

build.sbt

-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ lazy val docs = project("docs")
133133
.settings(
134134
publish / skip := true,
135135
scalaVersion := Versions.scala211,
136-
// FIXME: Remove when a version has been released with Test scope settings.
137-
ScalaNativeBindgenPlugin.nativeBindgenScopedSettings(Test),
138136
Test / nativeBindings += {
139137
NativeBinding((Test / resourceDirectory).value / "vector.h")
140138
.name("vector")

docs/src/test/scala/org/example/vector.scala

+16-21
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,22 @@ object vector {
99
type struct_point = native.CStruct2[native.CFloat, native.CFloat]
1010
type struct_vector = native.CStruct2[struct_point, struct_point]
1111
def add(v1: native.Ptr[struct_vector], v2: native.Ptr[struct_vector]): native.Ptr[struct_vector] = native.extern
12-
}
13-
14-
import vector._
1512

16-
object vectorHelpers {
17-
18-
implicit class struct_point_ops(val p: native.Ptr[struct_point]) extends AnyVal {
19-
def x: native.CFloat = !p._1
20-
def x_=(value: native.CFloat): Unit = !p._1 = value
21-
def y: native.CFloat = !p._2
22-
def y_=(value: native.CFloat): Unit = !p._2 = value
13+
object implicits {
14+
implicit class struct_point_ops(val p: native.Ptr[struct_point]) extends AnyVal {
15+
def x: native.CFloat = !p._1
16+
def x_=(value: native.CFloat): Unit = !p._1 = value
17+
def y: native.CFloat = !p._2
18+
def y_=(value: native.CFloat): Unit = !p._2 = value
19+
}
20+
def struct_point()(implicit z: native.Zone): native.Ptr[struct_point] = native.alloc[struct_point]
21+
22+
implicit class struct_vector_ops(val p: native.Ptr[struct_vector]) extends AnyVal {
23+
def a: native.Ptr[struct_point] = p._1
24+
def a_=(value: native.Ptr[struct_point]): Unit = !p._1 = !value
25+
def b: native.Ptr[struct_point] = p._2
26+
def b_=(value: native.Ptr[struct_point]): Unit = !p._2 = !value
27+
}
28+
def struct_vector()(implicit z: native.Zone): native.Ptr[struct_vector] = native.alloc[struct_vector]
2329
}
24-
25-
def struct_point()(implicit z: native.Zone): native.Ptr[struct_point] = native.alloc[struct_point]
26-
27-
implicit class struct_vector_ops(val p: native.Ptr[struct_vector]) extends AnyVal {
28-
def a: native.Ptr[struct_point] = p._1
29-
def a_=(value: native.Ptr[struct_point]): Unit = !p._1 = !value
30-
def b: native.Ptr[struct_point] = p._2
31-
def b_=(value: native.Ptr[struct_point]): Unit = !p._2 = !value
32-
}
33-
34-
def struct_vector()(implicit z: native.Zone): native.Ptr[struct_vector] = native.alloc[struct_vector]
3530
}

docs/src/test/scala/org/scalanative/bindgen/docs/VectorSpec.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class VectorSpec extends FunSpec {
88
//#step-1
99
import scala.scalanative.native.Zone
1010
import org.example.vector
11-
import org.example.vectorHelpers._
11+
import org.example.vector.implicits._
1212

1313
Zone { implicit zone =>
1414
val vec1p1 = struct_point()

project/plugins.sbt

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
99

1010
libraryDependencies += "org.scala-sbt" %% "scripted-plugin" % sbtVersion.value
1111

12-
val VERSION = "0.3.0-RC0"
12+
val VERSION = "0.3.0-RC1"
1313

1414
//#sbt-plugin-example
1515
addSbtPlugin("org.scala-native.bindgen" % "sbt-scala-native-bindgen" % VERSION)
1616

1717
resolvers += Resolver.bintrayIvyRepo("scala-native-bindgen", "sbt-plugins")
1818
resolvers += Resolver.bintrayRepo("scala-native-bindgen", "maven")
19-
//#sbt-plugin-example
19+
//#sbt-plugin-example

0 commit comments

Comments
 (0)