@@ -22,24 +22,21 @@ ThisBuild / versionScheme := Some("early-semver")
22
22
ThisBuild / versionPolicyIntention := Compatibility .BinaryAndSourceCompatible
23
23
24
24
lazy 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 =>
29
27
CrossVersion .partialVersion(scalaVersion.value) match {
30
- case Some ((2 , 13 )) => Seq (file(dir.getPath ++ " -2.13+" ))
31
28
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+" ))
33
31
}
34
32
}
35
33
},
36
-
37
- unmanagedSourceDirectories in Test ++= {
38
- (unmanagedSourceDirectories in Test ).value.flatMap { dir =>
34
+ Test / unmanagedSourceDirectories ++= {
35
+ (Test / unmanagedSourceDirectories).value.flatMap { dir =>
39
36
CrossVersion .partialVersion(scalaVersion.value) match {
40
- case Some ((2 , 13 )) => Seq (file(dir.getPath ++ " -2.13+" ))
41
37
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+" ))
43
40
}
44
41
}
45
42
},
@@ -48,7 +45,9 @@ lazy val commonSettings = Seq(
48
45
lazy val fnGen = (project in file(" fnGen" ))
49
46
.settings(commonSettings)
50
47
.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
52
51
libraryDependencies += " org.scala-lang" % " scala-reflect" % scalaVersion.value,
53
52
libraryDependencies += " org.scala-lang" % " scala-compiler" % scalaVersion.value
54
53
)
@@ -73,10 +72,11 @@ lazy val scalaJava8Compat = (project in file("."))
73
72
74
73
libraryDependencies += " com.novocode" % " junit-interface" % " 0.11" % " test" ,
75
74
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
+ },
80
80
81
81
mimaBinaryIssueFilters ++= {
82
82
import com .typesafe .tools .mima .core ._ , ProblemFilters ._
@@ -93,19 +93,19 @@ lazy val scalaJava8Compat = (project in file("."))
93
93
94
94
testOptions += Tests .Argument (TestFrameworks .JUnit , " -v" , " -a" ),
95
95
96
- (sourceGenerators in Compile ) += Def .task {
97
- val out = (sourceManaged in Compile ).value
96
+ (Compile / sourceGenerators ) += Def .task {
97
+ val out = (Compile / sourceManaged ).value
98
98
if (! out.exists) IO .createDirectory(out)
99
99
val canon = out.getCanonicalPath
100
100
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
103
103
runner.value.run(runTarget, classPath.files, args, streams.value.log)
104
104
(out ** " *.scala" ).get
105
105
}.taskValue,
106
106
107
- sourceGenerators in Compile += Def .task {
108
- val dir = (sourceManaged in Compile ).value
107
+ Compile / sourceGenerators += Def .task {
108
+ val dir = (Compile / sourceManaged ).value
109
109
val write = jwrite(dir) _
110
110
if (scalaVersion.value.startsWith(" 2.11." )) {
111
111
Seq (write(" JFunction" , CodeGen .factory)) ++
@@ -118,8 +118,8 @@ lazy val scalaJava8Compat = (project in file("."))
118
118
} else CodeGen .create212.map(write.tupled)
119
119
}.taskValue,
120
120
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))
123
123
}.taskValue,
124
124
125
125
initialize := {
@@ -131,23 +131,29 @@ lazy val scalaJava8Compat = (project in file("."))
131
131
sys.error(" Java 8 or higher is required for this project." )
132
132
},
133
133
134
- publishArtifact in packageDoc := ! disableDocs
134
+ packageDoc / publishArtifact := ! disableDocs
135
135
)
136
136
.settings(
137
137
inConfig(JavaDoc )(Defaults .configSettings) ++ {
138
138
if (disableDocs) Nil
139
139
else Seq (
140
- packageDoc in Compile := (packageDoc in JavaDoc ).value,
141
- sources in JavaDoc := {
140
+ Compile / packageDoc := (JavaDoc / packageDoc ).value,
141
+ JavaDoc / sources := {
142
142
val allJavaSources =
143
143
(target.value / " java" ** " *.java" ).get ++
144
- (sources in Compile ).value.filter(_.getName.endsWith(" .java" ))
144
+ (Compile / sources ).value.filter(_.getName.endsWith(" .java" ))
145
145
allJavaSources.filterNot(_.getName.contains(" FuturesConvertersImpl.java" )) // this file triggers bugs in genjavadoc
146
146
},
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
+ ),
151
157
)
152
158
}
153
159
)
0 commit comments