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+ )
26
37lazy val parserCombinators = crossProject(JVMPlatform , JSPlatform , NativePlatform )
4- .withoutSuffixFor(JVMPlatform ).in(file(" ." ))
5- .settings(ScalaModulePlugin .scalaModuleSettings)
6- .jvmSettings(ScalaModulePlugin .scalaModuleOsgiSettings)
8+ .in(file(" ." ))
79 .settings(
10+ ScalaModulePlugin .scalaModuleSettings,
811 name := " scala-parser-combinators" ,
9- scalaModuleMimaPreviousVersion := None ,
12+ scalaModuleMimaPreviousVersion := None , // until we publish 1.2.0
1013
1114 apiMappings ++= scalaInstance.value.libraryJars.collect {
1215 case file if file.getName.startsWith(" scala-library" ) && file.getName.endsWith(" .jar" ) =>
1316 file -> url(s " http://www.scala-lang.org/api/ ${scalaVersion.value}/ " )
1417 }.toMap,
1518
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 ++= {
1739 if (isDotty.value)
1840 Seq (" -language:Scala2" )
1941 else
@@ -22,15 +44,15 @@ lazy val parserCombinators = crossProject(JVMPlatform, JSPlatform, NativePlatfor
2244 " -doc-source-url" ,
2345 s " https://github.com/scala/scala-parser-combinators/tree/v ${version.value}€{FILE_PATH}.scala " ,
2446 " -sourcepath" ,
25- (baseDirectory in LocalRootProject ).value.absolutePath,
47+ (LocalRootProject / baseDirectory ).value.absolutePath,
2648 " -doc-title" ,
2749 " Scala Parser Combinators" ,
2850 " -doc-version" ,
2951 version.value
3052 )
3153 },
32- unmanagedSourceDirectories in Compile ++= {
33- (unmanagedSourceDirectories in Compile ).value.map { dir =>
54+ Compile / unmanagedSourceDirectories ++= {
55+ (Compile / unmanagedSourceDirectories ).value.map { dir =>
3456 CrossVersion .partialVersion(scalaVersion.value) match {
3557 case Some ((2 , 13 )) => file(dir.getPath ++ " -2.13+" )
3658 case Some ((0 , _)) => file(dir.getPath ++ " -2.13+" )
@@ -40,22 +62,27 @@ lazy val parserCombinators = crossProject(JVMPlatform, JSPlatform, NativePlatfor
4062 }
4163 )
4264 .jvmSettings(
65+ ScalaModulePlugin .scalaModuleOsgiSettings,
4366 OsgiKeys .exportPackage := Seq (s " scala.util.parsing.*;version= ${version.value}" ),
4467 libraryDependencies += " junit" % " junit" % " 4.13.1" % Test ,
4568 libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % Test
4669 )
4770 .jsSettings(
4871 crossScalaVersions -= " 0.27.0-RC1" ,
4972 // Scala.js cannot run forked tests
50- fork in Test := false
73+ Test / fork := false
5174 )
5275 .jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin ))
5376 .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" ),
5578 test := {},
5679 libraryDependencies := {
5780 if (! scalaVersion.value.startsWith(" 2.11" ))
5881 libraryDependencies.value.filterNot(_.organization == " org.scala-native" )
5982 else libraryDependencies.value
6083 }
6184 )
85+
86+ lazy val parserCombinatorsJVM = parserCombinators.jvm
87+ lazy val parserCombinatorsJS = parserCombinators.js
88+ lazy val parserCombinatorsNative = parserCombinators.native
0 commit comments