1
- import sbtcrossproject .CrossPlugin .autoImport .crossProject
1
+ lazy val root = project.in(file(" ." ))
2
+ .aggregate(parserCombinatorsJVM, parserCombinatorsJS, parserCombinatorsNative)
3
+ .settings(
4
+ publish / skip := true ,
5
+ )
2
6
3
7
lazy val parserCombinators = crossProject(JVMPlatform , JSPlatform , NativePlatform )
4
- .withoutSuffixFor(JVMPlatform ).in(file(" ." ))
5
- .settings(ScalaModulePlugin .scalaModuleSettings)
6
- .jvmSettings(ScalaModulePlugin .scalaModuleOsgiSettings)
8
+ .in(file(" ." ))
7
9
.settings(
10
+ ScalaModulePlugin .scalaModuleSettings,
8
11
name := " scala-parser-combinators" ,
9
- scalaModuleMimaPreviousVersion := None ,
12
+ scalaModuleMimaPreviousVersion := None , // until we publish 1.2.0
10
13
11
14
apiMappings ++= scalaInstance.value.libraryJars.collect {
12
15
case file if file.getName.startsWith(" scala-library" ) && file.getName.endsWith(" .jar" ) =>
13
16
file -> url(s " http://www.scala-lang.org/api/ ${scalaVersion.value}/ " )
14
17
}.toMap,
15
18
16
- scalacOptions in (Compile , doc) ++= {
19
+ // go nearly warning-free, but only on 2.13, it's too hard across all versions
20
+ Compile / scalacOptions ++= (CrossVersion .partialVersion(scalaVersion.value) match {
21
+ case Some ((2 , 13 )) => Seq (" -Werror" ,
22
+ // ideally we'd do something about this. `^?` is the responsible method
23
+ " -Wconf:site=scala.util.parsing.combinator.Parsers.*&cat=lint-multiarg-infix:i" ,
24
+ // not sure what resolving this would look like? didn't think about it too hard
25
+ " -Wconf:site=scala.util.parsing.combinator.lexical.StdLexical.*&cat=other-match-analysis:i" ,
26
+ )
27
+ case _ => Seq ()
28
+ }),
29
+ Compile / doc / scalacOptions ++= (CrossVersion .partialVersion(scalaVersion.value) match {
30
+ case Some ((2 , 13 )) => Seq (
31
+ // it isn't able to link to [[java.lang.NoSuchMethodError]]
32
+ // scala-xml doesn't have this problem, I tried copying their apiMappings stuff
33
+ // and that didn't help, I'm mystified why :-/
34
+ """ -Wconf:msg=Could not find any member to link for*:i""" ,
35
+ )
36
+ case _ => Seq ()
37
+ }),
38
+ Compile / doc / scalacOptions ++= {
17
39
if (isDotty.value)
18
40
Seq (" -language:Scala2" )
19
41
else
@@ -22,15 +44,15 @@ lazy val parserCombinators = crossProject(JVMPlatform, JSPlatform, NativePlatfor
22
44
" -doc-source-url" ,
23
45
s " https://github.com/scala/scala-parser-combinators/tree/v ${version.value}€{FILE_PATH}.scala " ,
24
46
" -sourcepath" ,
25
- (baseDirectory in LocalRootProject ).value.absolutePath,
47
+ (LocalRootProject / baseDirectory ).value.absolutePath,
26
48
" -doc-title" ,
27
49
" Scala Parser Combinators" ,
28
50
" -doc-version" ,
29
51
version.value
30
52
)
31
53
},
32
- unmanagedSourceDirectories in Compile ++= {
33
- (unmanagedSourceDirectories in Compile ).value.map { dir =>
54
+ Compile / unmanagedSourceDirectories ++= {
55
+ (Compile / unmanagedSourceDirectories ).value.map { dir =>
34
56
CrossVersion .partialVersion(scalaVersion.value) match {
35
57
case Some ((2 , 13 )) => file(dir.getPath ++ " -2.13+" )
36
58
case Some ((0 , _)) => file(dir.getPath ++ " -2.13+" )
@@ -40,22 +62,27 @@ lazy val parserCombinators = crossProject(JVMPlatform, JSPlatform, NativePlatfor
40
62
}
41
63
)
42
64
.jvmSettings(
65
+ ScalaModulePlugin .scalaModuleOsgiSettings,
43
66
OsgiKeys .exportPackage := Seq (s " scala.util.parsing.*;version= ${version.value}" ),
44
67
libraryDependencies += " junit" % " junit" % " 4.13.1" % Test ,
45
68
libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % Test
46
69
)
47
70
.jsSettings(
48
71
crossScalaVersions -= " 0.27.0-RC1" ,
49
72
// Scala.js cannot run forked tests
50
- fork in Test := false
73
+ Test / fork := false
51
74
)
52
75
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin ))
53
76
.nativeSettings(
54
- skip in compile := System .getProperty(" java.version" ).startsWith(" 1.6" ) || ! scalaVersion.value.startsWith(" 2.11" ),
77
+ compile / skip := System .getProperty(" java.version" ).startsWith(" 1.6" ) || ! scalaVersion.value.startsWith(" 2.11" ),
55
78
test := {},
56
79
libraryDependencies := {
57
80
if (! scalaVersion.value.startsWith(" 2.11" ))
58
81
libraryDependencies.value.filterNot(_.organization == " org.scala-native" )
59
82
else libraryDependencies.value
60
83
}
61
84
)
85
+
86
+ lazy val parserCombinatorsJVM = parserCombinators.jvm
87
+ lazy val parserCombinatorsJS = parserCombinators.js
88
+ lazy val parserCombinatorsNative = parserCombinators.native
0 commit comments