@@ -22,24 +22,21 @@ ThisBuild / versionScheme := Some("early-semver")
2222ThisBuild / versionPolicyIntention := Compatibility .BinaryAndSourceCompatible
2323
2424lazy val commonSettings = Seq (
25- scalacOptions ++= Seq (" -feature" , " -deprecation" , " -unchecked" ),
26-
27- unmanagedSourceDirectories in Compile ++= {
28- (unmanagedSourceDirectories in Compile ).value.flatMap { dir =>
25+ Compile / unmanagedSourceDirectories ++= {
26+ (Compile / unmanagedSourceDirectories).value.flatMap { dir =>
2927 CrossVersion .partialVersion(scalaVersion.value) match {
30- case Some ((2 , 13 )) => Seq (file(dir.getPath ++ " -2.13+" ))
3128 case Some ((2 , 11 )) => Seq (file(dir.getPath ++ " -2.13-" ), file(dir.getPath ++ " -2.11" ))
32- case _ => Seq (file(dir.getPath ++ " -2.13-" ))
29+ case Some ((2 , 12 )) => Seq (file(dir.getPath ++ " -2.13-" ))
30+ case _ => Seq (file(dir.getPath ++ " -2.13+" ))
3331 }
3432 }
3533 },
36-
37- unmanagedSourceDirectories in Test ++= {
38- (unmanagedSourceDirectories in Test ).value.flatMap { dir =>
34+ Test / unmanagedSourceDirectories ++= {
35+ (Test / unmanagedSourceDirectories).value.flatMap { dir =>
3936 CrossVersion .partialVersion(scalaVersion.value) match {
40- case Some ((2 , 13 )) => Seq (file(dir.getPath ++ " -2.13+" ))
4137 case Some ((2 , 11 )) => Seq (file(dir.getPath ++ " -2.13-" ), file(dir.getPath ++ " -2.11" ))
42- case _ => Seq (file(dir.getPath ++ " -2.13-" ))
38+ case Some ((2 , 12 )) => Seq (file(dir.getPath ++ " -2.13-" ))
39+ case _ => Seq (file(dir.getPath ++ " -2.13+" ))
4340 }
4441 }
4542 },
@@ -48,7 +45,9 @@ lazy val commonSettings = Seq(
4845lazy val fnGen = (project in file(" fnGen" ))
4946 .settings(commonSettings)
5047 .settings(
51- fork in run := true , // Needed if you run this project directly
48+ crossScalaVersions := Seq (" 2.12.13" ),
49+ scalaVersion := crossScalaVersions.value.head,
50+ run / fork := true , // Needed if you run this project directly
5251 libraryDependencies += " org.scala-lang" % " scala-reflect" % scalaVersion.value,
5352 libraryDependencies += " org.scala-lang" % " scala-compiler" % scalaVersion.value
5453 )
@@ -73,10 +72,11 @@ lazy val scalaJava8Compat = (project in file("."))
7372
7473 libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % " test" ,
7574
76- // we're still in 0.x land so we could choose to break bincompat,
77- // but let's at least be aware when we're doing it. also we should
78- // think about going 1.0, it's been a while
79- scalaModuleMimaPreviousVersion := Some (" 0.9.1" ),
75+ scalaModuleMimaPreviousVersion := {
76+ // pending resolution of https://github.com/scalacenter/sbt-version-policy/issues/62
77+ if (isDotty.value) None
78+ else Some (" 0.9.1" )
79+ },
8080
8181 mimaBinaryIssueFilters ++= {
8282 import com .typesafe .tools .mima .core ._ , ProblemFilters ._
@@ -93,19 +93,19 @@ lazy val scalaJava8Compat = (project in file("."))
9393
9494 testOptions += Tests .Argument (TestFrameworks .JUnit , " -v" , " -a" ),
9595
96- (sourceGenerators in Compile ) += Def .task {
97- val out = (sourceManaged in Compile ).value
96+ (Compile / sourceGenerators ) += Def .task {
97+ val out = (Compile / sourceManaged ).value
9898 if (! out.exists) IO .createDirectory(out)
9999 val canon = out.getCanonicalPath
100100 val args = (new File (canon, " FunctionConverters.scala" )).toString :: Nil
101- val runTarget = (mainClass in Compile in fnGen ).value getOrElse " No main class defined for function conversion generator"
102- val classPath = (fullClasspath in Compile in fnGen ).value
101+ val runTarget = (fnGen / Compile / mainClass ).value getOrElse " No main class defined for function conversion generator"
102+ val classPath = (fnGen / Compile / fullClasspath ).value
103103 runner.value.run(runTarget, classPath.files, args, streams.value.log)
104104 (out ** " *.scala" ).get
105105 }.taskValue,
106106
107- sourceGenerators in Compile += Def .task {
108- val dir = (sourceManaged in Compile ).value
107+ Compile / sourceGenerators += Def .task {
108+ val dir = (Compile / sourceManaged ).value
109109 val write = jwrite(dir) _
110110 if (scalaVersion.value.startsWith(" 2.11." )) {
111111 Seq (write(" JFunction" , CodeGen .factory)) ++
@@ -118,8 +118,8 @@ lazy val scalaJava8Compat = (project in file("."))
118118 } else CodeGen .create212.map(write.tupled)
119119 }.taskValue,
120120
121- sourceGenerators in Test += Def .task {
122- Seq (jwrite((sourceManaged in Test ).value)(" TestApi" , CodeGen .testApi))
121+ Test / sourceGenerators += Def .task {
122+ Seq (jwrite((Test / sourceManaged ).value)(" TestApi" , CodeGen .testApi))
123123 }.taskValue,
124124
125125 initialize := {
@@ -131,23 +131,29 @@ lazy val scalaJava8Compat = (project in file("."))
131131 sys.error(" Java 8 or higher is required for this project." )
132132 },
133133
134- publishArtifact in packageDoc := ! disableDocs
134+ packageDoc / publishArtifact := ! disableDocs
135135 )
136136 .settings(
137137 inConfig(JavaDoc )(Defaults .configSettings) ++ {
138138 if (disableDocs) Nil
139139 else Seq (
140- packageDoc in Compile := (packageDoc in JavaDoc ).value,
141- sources in JavaDoc := {
140+ Compile / packageDoc := (JavaDoc / packageDoc ).value,
141+ JavaDoc / sources := {
142142 val allJavaSources =
143143 (target.value / " java" ** " *.java" ).get ++
144- (sources in Compile ).value.filter(_.getName.endsWith(" .java" ))
144+ (Compile / sources ).value.filter(_.getName.endsWith(" .java" ))
145145 allJavaSources.filterNot(_.getName.contains(" FuturesConvertersImpl.java" )) // this file triggers bugs in genjavadoc
146146 },
147- javacOptions in JavaDoc := Seq (" -Xdoclint:none" ),
148- artifactName in packageDoc in JavaDoc := ((sv, mod, art) => " " + mod.name + " _" + sv.binary + " -" + mod.revision + " -javadoc.jar" ),
149- libraryDependencies += compilerPlugin(" com.typesafe.genjavadoc" % " genjavadoc-plugin" % " 0.16" cross CrossVersion .full),
150- scalacOptions in Compile += " -P:genjavadoc:out=" + (target.value / " java" )
147+ JavaDoc / javacOptions := Seq (" -Xdoclint:none" ),
148+ JavaDoc / packageDoc / artifactName := ((sv, mod, art) => " " + mod.name + " _" + sv.binary + " -" + mod.revision + " -javadoc.jar" ),
149+ libraryDependencies ++= (
150+ if (isDotty.value) Seq ()
151+ else Seq (compilerPlugin(" com.typesafe.genjavadoc" % " genjavadoc-plugin" % " 0.16" cross CrossVersion .full))
152+ ),
153+ Compile / scalacOptions ++= (
154+ if (isDotty.value) Seq ()
155+ else Seq (s """ -P:genjavadoc:out= ${target.value / " java" }""" )
156+ ),
151157 )
152158 }
153159 )
0 commit comments