@@ -101,15 +101,12 @@ lazy val tests = project("tests")
101
101
)
102
102
.aggregate(samples)
103
103
104
- lazy val samples = project (" samples" )
104
+ lazy val samples = nativeProject (" samples" )
105
105
.in(file(" tests/samples" ))
106
- .enablePlugins(ScalaNativePlugin )
107
106
.settings(
108
107
publish / skip := true ,
109
- scalaVersion := Versions .scala211,
110
108
libraryDependencies += " com.lihaoyi" %%% " utest" % " 0.6.3" % Test ,
111
109
testFrameworks += new TestFramework (" utest.runner.Framework" ),
112
- nativeLinkStubs := true ,
113
110
compileTask(" bindgentests" , baseDirectory)
114
111
)
115
112
@@ -141,12 +138,11 @@ lazy val sbtPlugin = project("sbt-scala-native-bindgen", ScriptedPlugin)
141
138
publishLocal := publishLocal.dependsOn(tools / publishLocal).value
142
139
)
143
140
144
- lazy val docs = project (" docs" )
141
+ lazy val docs = nativeProject (" docs" )
145
142
.enablePlugins(GhpagesPlugin , ParadoxSitePlugin , ParadoxMaterialThemePlugin )
146
- .enablePlugins(ScalaNativePlugin , ScalaNativeBindgenPlugin )
143
+ .enablePlugins(ScalaNativeBindgenPlugin )
147
144
.settings(
148
145
publish / skip := true ,
149
- scalaVersion := Versions .scala211,
150
146
Test / nativeBindings += {
151
147
NativeBinding ((Test / resourceDirectory).value / " vector.h" )
152
148
.name(" vector" )
@@ -158,7 +154,6 @@ lazy val docs = project("docs")
158
154
(ThisBuild / baseDirectory).value / " bindgen/target/scala-native-bindgen" )
159
155
},
160
156
Test / nativeBindgen / target := (Test / scalaSource).value / " org/example" ,
161
- nativeLinkStubs := true ,
162
157
compileTask(" vector" , Test / resourceDirectory),
163
158
libraryDependencies += " org.scalatest" %%% " scalatest" % " 3.2.0-SNAP10" % Test ,
164
159
Paradox / paradoxProperties ++= Map (
@@ -234,6 +229,15 @@ def project(name: String, plugged: AutoPlugin*) = {
234
229
)
235
230
}
236
231
232
+ def nativeProject (name : String ) = {
233
+ project(name)
234
+ .enablePlugins(ScalaNativePlugin )
235
+ .settings(
236
+ scalaVersion := Versions .scala211,
237
+ nativeLinkStubs := true
238
+ )
239
+ }
240
+
237
241
def compileTask (libname : String , srcDirTask : SettingKey [File ]) = Def .settings(
238
242
Test / nativeLinkingOptions += {
239
243
Seq (" -L" , (Test / target).value.getAbsoluteFile / " bindgen" ).mkString
@@ -292,12 +296,10 @@ lazy val bindingsExtraArgs = Try {
292
296
}.toOption
293
297
294
298
def bindingProject (name : String ) = {
295
- project (s " lib $name" )
296
- .enablePlugins(ScalaNativePlugin , ScalaNativeBindgenPlugin )
299
+ nativeProject (s " lib $name" )
300
+ .enablePlugins(ScalaNativeBindgenPlugin )
297
301
.in(file(s " bindings/ $name" ))
298
302
.settings(
299
- scalaVersion := Versions .scala211,
300
- nativeLinkStubs := true ,
301
303
libraryDependencies += " org.scalatest" %%% " scalatest" % " 3.2.0-SNAP10" % Test ,
302
304
Compile / nativeBindgen / target :=
303
305
(Compile / scalaSource).value / " org/scalanative/bindgen/bindings" / name
0 commit comments