forked from scala/scala-parser-combinators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
138 lines (107 loc) · 4.44 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
organization := "org.scala-lang.modules"
name := "scala-parser-combinators"
version := "1.0.0-SNAPSHOT"
scalaVersion := "2.11.0-M5"
// NOTE: not necessarily equal to scalaVersion
// (e.g., during PR validation, we override scalaVersion to validate,
// but don't rebuild scalacheck, so we don't want to rewire that dependency)
scalaBinaryVersion := "2.11.0-M5"
// don't use for doc scope, scaladoc warnings are not to be reckoned with
scalacOptions in compile ++= Seq("-optimize", "-Xfatal-warnings", "-feature", "-deprecation", "-unchecked", "-Xlint")
// Generate $name.properties to store our version as well as the scala version used to build
resourceGenerators in Compile <+= Def.task {
val props = new java.util.Properties
props.put("version.number", version.value)
props.put("scala.version.number", scalaVersion.value)
props.put("scala.binary.version.number", scalaBinaryVersion.value)
val file = (resourceManaged in Compile).value / s"${name.value}.properties"
IO.write(props, null, file)
Seq(file)
}
mappings in (Compile, packageBin) += {
(baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties"
}
// maven publishing
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (version.value.trim.endsWith("SNAPSHOT"))
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := { _ => false }
pomExtra := (
<url>http://www.scala-lang.org/</url>
<inceptionYear>2002</inceptionYear>
<licenses>
<license>
<distribution>repo</distribution>
<name>BSD 3-Clause</name>
<url>https://github.com/scala/{name.value}/blob/master/LICENSE.md</url>
</license>
</licenses>
<scm>
<connection>scm:git:git://github.com/scala/{name.value}.git</connection>
<url>https://github.com/scala/{name.value}</url>
</scm>
<issueManagement>
<system>JIRA</system>
<url>https://issues.scala-lang.org/</url>
</issueManagement>
<developers>
<developer>
<id>epfl</id>
<name>EPFL</name>
</developer>
<developer>
<id>Typesafe</id>
<name>Typesafe, Inc.</name>
</developer>
</developers>
)
// default value must be set here
TestKeys.includeTestDependencies := true
// default
TestKeys.partestVersion := "1.0.0-RC6"
// the actual partest the interface calls into -- must be binary version close enough to ours
// so that it can link to the compiler/lib we're using (testing)
// NOTE: not sure why, but the order matters (maybe due to the binary version conflicts for xml/parser combinators pulled in for scaladoc?)
libraryDependencies ++= (
if (TestKeys.includeTestDependencies.value)
Seq("org.scala-lang.modules" %% "scala-partest-interface" % "0.2" % "test",
"org.scala-lang.modules" %% "scala-partest" % TestKeys.partestVersion.value % "test")
else Seq.empty
)
// necessary for partest -- see comments in its build.sbt
conflictWarning ~= { _.copy(failOnConflict = false) }
fork in Test := true
javaOptions in Test += "-Xmx1G"
testFrameworks += new TestFramework("scala.tools.partest.Framework")
definedTests in Test += (
new sbt.TestDefinition(
"partest",
// marker fingerprint since there are no test classes
// to be discovered by sbt:
new sbt.testing.AnnotatedFingerprint {
def isModule = true
def annotationName = "partest"
}, true, Array())
)
osgiSettings
val osgiVersion = version(_.replace('-', '.'))
OsgiKeys.bundleSymbolicName := s"${organization.value}.${name.value}"
OsgiKeys.bundleVersion := osgiVersion.value
OsgiKeys.exportPackage := Seq(s"scala.util.parsing.*;version=${version.value}")
// Sources should also have a nice MANIFEST file
packageOptions in packageSrc := Seq(Package.ManifestAttributes(
("Bundle-SymbolicName", s"${organization.value}.${name.value}.source"),
("Bundle-Name", s"${name.value} sources"),
("Bundle-Version", osgiVersion.value),
("Eclipse-SourceBundle", s"""${organization.value}.${name.value};version="${osgiVersion.value}";roots:="."""")
))
// TODO: mima
// import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings
// import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
// previousArtifact := Some(organization.value %% name.value % binaryReferenceVersion.value)