forked from SpinalHDL/SpinalHDL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
215 lines (185 loc) · 6.4 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
import sbt.Keys._
import sbt._
import sbt.Tests._
val defaultSettings = Defaults.coreDefaultSettings ++ xerial.sbt.Sonatype.sonatypeSettings ++ Seq(
organization := "com.github.spinalhdl",
version := SpinalVersion.all,
scalaVersion := SpinalVersion.compiler,
scalacOptions ++= Seq("-unchecked","-target:jvm-1.7"/*, "-feature" ,"-deprecation"*/),
javacOptions ++= Seq("-source", "1.7", "-target", "1.7"),
baseDirectory in test := file("/out/"),
fork := true,
//Enable parallel tests
Test / testForkedParallel := true,
testGrouping in Test := (testGrouping in Test).value.flatMap { group =>
// for(i <- 0 until 4) yield {
// Group("g" + i, group.tests.zipWithIndex.filter(_._2 % 4 == i).map(_._1), SubProcess(ForkOptions()))
// }
Seq(Group("g", group.tests, SubProcess(ForkOptions())))
},
// concurrentRestrictions := Seq(Tags.limit(Tags.ForkedTestGroup, 4)),
libraryDependencies += "org.scala-lang" % "scala-library" % SpinalVersion.compiler,
dependencyOverrides += "net.java.dev.jna" % "jna" % "4.2.2",
dependencyOverrides += "net.java.dev.jna" % "jna-platform" % "4.2.2",
dependencyOverrides += "org.slf4j" % "slf4j-api" % "1.7.25",
dependencyOverrides += "org.scala-lang.modules" % "scala-xml_2.11" % "1.0.5",
//set SBT_OPTS="-Xmx2G"
//sbt clean reload publishSigned
//https://oss.sonatype.org
publishMavenStyle := true,
publishArtifact in Test := false,
pomIncludeRepository := (_ => false),
pomExtra := {
<url>github.com/SpinalHDL/SpinalHDL</url>
<licenses>
<license>
<name>LGPL3</name>
<url>https://www.gnu.org/licenses/lgpl.html</url>
</license>
</licenses>
<scm>
<connection>scm:git:github.com/SpinalHDL/SpinalHDL</connection>
<developerConnection>scm:git:git@github.com:SpinalHDL/SpinalHDL</developerConnection>
<url>github.com/SpinalHDL/SpinalHDL</url>
</scm>
<developers>
<developer>
<id>Dolu1990</id>
<name>Dolu1990</name>
<url>none</url>
</developer>
</developers>
},
publishTo := {
val v = version.value
val nexus = "https://oss.sonatype.org/"
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
)
lazy val all = (project in file("."))
.enablePlugins(ScalaUnidocPlugin)
.settings(
defaultSettings,
name := "SpinalHDL-all",
version := SpinalVersion.all,
publishArtifact := false,
publishLocal := {},
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(lib, core)
)
.aggregate(sim, idslpayload, idslplugin, core, lib, debugger, tester)
import sys.process._
def gitHash = (try {
"git rev-parse HEAD".!!
} catch{
case e : java.io.IOException => "???"
}).linesIterator.next()
lazy val idslpayload = (project in file("idslpayload"))
.settings(
defaultSettings,
name := "SpinalHDL-idsl-payload",
version := SpinalVersion.sim
)
lazy val idslplugin = (project in file("idslplugin"))
.dependsOn(idslpayload)
.settings(
defaultSettings,
name := "SpinalHDL-idsl-plugin",
exportJars := true,
libraryDependencies ++= Seq(
"org.scala-lang" % "scala-compiler" % scalaVersion.value
)
)
lazy val sim = (project in file("sim"))
.settings(
defaultSettings,
name := "SpinalHDL-sim",
libraryDependencies += "commons-io" % "commons-io" % "2.4",
libraryDependencies += "net.openhft" % "affinity" % "3.1.11",
libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.7.25",
libraryDependencies += "com.github.dblock" % "oshi-core" % "3.4.0",
version := SpinalVersion.sim
)
val defaultSettingsWithPlugin = defaultSettings ++ Seq(
scalacOptions += (artifactPath in(idslplugin, Compile, packageBin)).map { file =>
s"-Xplugin:${file.getAbsolutePath}"
}.value
)
lazy val core = (project in file("core"))
.dependsOn(idslplugin)
.settings(
defaultSettingsWithPlugin,
name := "SpinalHDL-core",
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
libraryDependencies += "com.github.scopt" %% "scopt" % "3.4.0",
resolvers += Resolver.sonatypeRepo("public"),
version := SpinalVersion.core,
sourceGenerators in Compile += Def.task {
val dir = (sourceManaged in Compile).value
val file = dir / "Info.scala"
IO.write(file, """package spinal.core
|object Info {
| val version = "%s"
| val name = "%s"
| val gitHash = "%s"
|}
|""".stripMargin.format(SpinalVersion.core, name, gitHash))
Seq(file)
}.taskValue
)
.dependsOn(sim)
lazy val lib = (project in file("lib"))
.settings(
defaultSettingsWithPlugin,
name := "SpinalHDL-lib",
libraryDependencies += "commons-io" % "commons-io" % "2.4",
version := SpinalVersion.lib
)
.dependsOn (sim, core)
lazy val debugger = (project in file("debugger"))
.settings(
defaultSettingsWithPlugin,
name := "SpinalHDL Debugger",
version := SpinalVersion.debugger,
resolvers += "sparetimelabs" at "https://www.sparetimelabs.com/maven2/",
libraryDependencies += "com.github.purejavacomm" % "purejavacomm" % "1.0.2.RELEASE",
libraryDependencies += "net.liftweb" %% "lift-json" % "3.1.0-M2",
publishArtifact := false,
publishLocal := {}
)
.dependsOn(sim, core, lib/*, ip*/)
lazy val demo = (project in file("demo"))
.settings(
defaultSettingsWithPlugin,
name := "SpinalHDL-demo",
version := SpinalVersion.demo,
publishArtifact := false,
publishLocal := {}
)
.dependsOn(sim, core, lib, debugger)
lazy val tester = (project in file("tester"))
.settings(
defaultSettingsWithPlugin,
name := "SpinalHDL-tester",
version := SpinalVersion.tester,
baseDirectory in (Test) := file("./"),
libraryDependencies += "org.scalatest" % "scalatest_2.11" % "2.2.1",
publishArtifact := false,
publishLocal := {}
)
.dependsOn(sim, core, lib, debugger,demo)
// Assembly
assemblyJarName in assembly := "spinalhdl.jar"
test in assembly := {}
assemblyOutputPath in assembly := file("./release/spinalhdl.jar")
//To publish the scala doc :
//rm -rf ghpages
//sbt clean compile unidoc
//git clone https://github.com/SpinalHDL/SpinalHDL.git -b gh-pages --depth=1 ghpages
//rm -rf ghpages/*
//cp -r target/scala-2.11/unidoc/* ghpages
//cd ghpages
//git add *
//git commit -m "publish doc"
//git push
//cd ..
//rm -rf ghpages