-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathbuild.sbt
113 lines (87 loc) · 4.18 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
val nexus = "https://oss.sonatype.org/"
val nexusSnapshots = nexus + "content/repositories/snapshots";
val nexusStaging = nexus + "service/local/staging/deploy/maven2";
organization := "com.mchange"
name := "mchange-commons-java"
version := "0.3.2"
autoScalaLibrary := false // this is a pure Java library, don't depend on Scala
crossPaths := false //don't include _<scala-version> in artifact names
Compile / compile / javacOptions ++= Seq("-source","1.7","-target","1.7"/*,"-Xlint:deprecation","-Xlint:unchecked"*/)
//Compile / compile / javacOptions ++= Seq("-Xlint:all")
// some users want license files in source jar, go figure
// see https://github.com/swaldman/mchange-commons-java/issues/11
Compile / packageSrc / mappings ++= Seq(
(baseDirectory.value / "LICENSE") -> "LICENSE",
(baseDirectory.value / "LICENSE-LGPL") -> "LICENSE-LGPL",
(baseDirectory.value / "LICENSE-EPL") -> "LICENSE-EPL"
)
Compile / doc / javacOptions ++= Seq("-source","1.7")
Compile / doc / javacOptions += "-Xdoclint:none"
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.3.0" % "compile,optional",
"log4j" % "log4j" % "1.2.14+" % "compile,optional",
"org.apache.logging.log4j" % "log4j-api" % "2.17.1" % "compile,optional",
"org.apache.logging.log4j" % "log4j-core" % "2.17.1" % "compile,optional",
"org.slf4j" % "slf4j-api" % "1.7.5+" % "compile,optional",
"junit" % "junit" % "4.1+" % "test",
"ch.qos.logback" % "logback-classic" % "1.1.2" % "test",
"com.novocode" % "junit-interface" % "0.10-M3" % "test"
);
publishTo := {
if (isSnapshot.value) Some("snapshots" at nexusSnapshots ) else Some("releases" at nexusStaging )
}
resolvers += ("snapshots" at nexusSnapshots )
Compile / packageBin / packageOptions += Package.ManifestAttributes("Automatic-Module-Name" -> "com.mchange.mchangecommonsjava")
/*
* For some mysterious reasons, forking to test and setting java options on
* the forked JVM is misbehaving. Workaround is to not fork at all, but
* test with commands like
* $ export _JAVA_OPTIONS="-ea -Djava.util.logging.config.file=./src/test/resources/logging.properties"; sbt clean test; unset _JAVA_OPTIONS
*/
//scalacOptions += "-deprecation"
//fork in Test := true
//javaOptions in test += "-ea"
Test / logLevel := Level.Debug
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a -v")
pomExtra := pomExtraForProjectName( name.value )
def pomExtraForProjectName( projectName : String ) = {
<url>https://github.com/swaldman/{projectName}</url>
<licenses>
<license>
<name>GNU Lesser General Public License, Version 2.1</name>
<url>http://www.gnu.org/licenses/lgpl-2.1.html</url>
<distribution>repo</distribution>
</license>
<license>
<name>Eclipse Public License, Version 1.0</name>
<url>http://www.eclipse.org/org/documents/epl-v10.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>[email protected]:swaldman/{projectName}.git</url>
<connection>scm:git:[email protected]:swaldman/{projectName}</connection>
</scm>
<developers>
<developer>
<id>swaldman</id>
<name>Steve Waldman</name>
<email>[email protected]</email>
</developer>
</developers>
}
enablePlugins(ParadoxPlugin)
val updateSite = taskKey[Unit]("Updates the project website on tickle")
updateSite := {
import scala.sys.process._
val dummy1 = (Compile / paradox).value // force a build of the site
val localDir1 = target.value / "paradox" / "site" / "main"
val local1 = localDir1.listFiles.map( _.getPath ).mkString(" ")
val remote1 = s"tickle.mchange.com:/home/web/public/www.mchange.com/projects/${name.value}-versions/${version.value}/"
s"rsync -avz ${local1} ${remote1}"!
val dummy2 = (Compile / doc).value // force scaladocs
val localDir2 = target.value / "api"
val local2 = localDir2.listFiles.map( _.getPath ).mkString(" ")
val remote2 = s"tickle.mchange.com:/home/web/public/www.mchange.com/projects/${name.value}-versions/${version.value}/apidocs"
s"rsync -avz ${local2} ${remote2}"!
}