Skip to content

Commit

Permalink
Cleanup deprecated API, removed API, adapted call sites (#2031)
Browse files Browse the repository at this point in the history
Pull request: #2031
  • Loading branch information
lefou authored Dec 8, 2022
2 parents 7068794 + 232103e commit 839ee36
Show file tree
Hide file tree
Showing 43 changed files with 119 additions and 633 deletions.
76 changes: 3 additions & 73 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ object Settings {
// the exact branches containing a doc root
val docBranches = Seq()
// the exact tags containing a doc root
val docTags = Seq(
val docTags: Seq[String] = Seq(
"0.9.6",
"0.9.7",
"0.9.8",
Expand All @@ -56,19 +56,7 @@ object Settings {
"0.10.9",
"0.10.10"
)
val mimaBaseVersions =
Seq(
"0.10.0",
"0.10.1",
"0.10.2",
"0.10.3",
"0.10.4",
"0.10.5",
"0.10.6",
"0.10.7",
"0.10.8",
"0.10.9"
)
val mimaBaseVersions: Seq[String] = Seq()
}

object Deps {
Expand Down Expand Up @@ -262,65 +250,7 @@ trait MillMimaConfig extends mima.Mima {
override def mimaBinaryIssueFilters: Target[Seq[ProblemFilter]] = T {
issueFilterByModule.getOrElse(this, Seq())
}
lazy val issueFilterByModule: Map[MillMimaConfig, Seq[ProblemFilter]] = Map(
main.core -> Seq(
// refined generic parameter, should be ok
ProblemFilter.exclude[IncompatibleSignatureProblem]("mill.eval.Evaluator.plan")
),
scalalib -> Seq(
ProblemFilter.exclude[DirectMissingMethodProblem](
"mill.scalalib.JavaModule.bspCompileClassesPath"
),
ProblemFilter.exclude[DirectMissingMethodProblem](
"mill.scalalib.JavaModule.bspCompileClasspath"
),
ProblemFilter.exclude[IncompatibleMethTypeProblem](
"mill.scalalib.ScalaModule.bspCompileClassesPath"
),
ProblemFilter.exclude[DirectMissingMethodProblem](
"mill.scalalib.scalafmt.ScalafmtModule.bspCompileClassesPath"
),
ProblemFilter.exclude[DirectMissingMethodProblem](
"mill.scalalib.scalafmt.ScalafmtModule.bspCompileClasspath"
),
ProblemFilter.exclude[ReversedMissingMethodProblem](
"mill.scalalib.PublishModule.mill$scalalib$PublishModule$$super$moduleDeps"
)
),
contrib.scoverage -> Seq(
// this one is @internal but MiMa is reporting it anyway
ProblemFilter.exclude[DirectMissingMethodProblem](
"mill.contrib.scoverage.ScoverageModule#ScoverageData.bspCompileClassesPath"
),
ProblemFilter.exclude[DirectMissingMethodProblem](
"mill.contrib.scoverage.ScoverageModule#ScoverageData.bspCompileClasspath"
),
ProblemFilter.exclude[DirectMissingMethodProblem](
"mill.contrib.scoverage.ScoverageReport#workerModule.bspCompileClassesPath"
),
ProblemFilter.exclude[DirectMissingMethodProblem](
"mill.contrib.scoverage.ScoverageReport#workerModule.bspCompileClasspath"
)
),
contrib.scalapblib -> Seq(
// we changed signature of worker API
ProblemFilter.exclude[ReversedMissingMethodProblem](
"mill.contrib.scalapblib.ScalaPBWorkerApi.compileScalaPB"
)
),
// we added a new target and a submodule after 0.10.5
contrib.twirllib -> Seq(
ProblemFilter.exclude[ReversedMissingMethodProblem](
"mill.twirllib.TwirlModule.twirlScalaVersion"
),
ProblemFilter.exclude[ReversedMissingMethodProblem](
"mill.twirllib.TwirlModule.twirlCoursierResolver"
),
ProblemFilter.exclude[ReversedMissingMethodProblem](
"mill.twirllib.TwirlModule.mill$twirllib$TwirlModule$_setter_$twirlCoursierResolver_="
)
)
)
lazy val issueFilterByModule: Map[MillMimaConfig, Seq[ProblemFilter]] = Map()
}

/** A Module compiled with applied Mill-specific compiler plugins: mill-moduledefs. */
Expand Down
7 changes: 0 additions & 7 deletions contrib/bloop/src/mill/contrib/Bloop.scala

This file was deleted.

7 changes: 0 additions & 7 deletions contrib/playlib/src/mill/playlib/RouterModule.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package mill.playlib

import coursier.MavenRepository
import mill.api.PathRef
import mill.playlib.api.RouteCompilerType
import mill.scalalib.Lib.resolveDependencies
import mill.scalalib._
import mill.scalalib.api._
import mill.{Agg, T}
Expand Down Expand Up @@ -81,11 +79,6 @@ trait RouterModule extends ScalaModule with Version {
)
}

@deprecated("Use playRouterToolsClasspath instead", "mill after 0.10.0-M1")
def toolsClasspath = T {
playRouterToolsClasspath()
}

def playRouterToolsClasspath = T {
playRouteCompilerWorkerClasspath() ++ routerClasspath()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ protected[playlib] class RouteCompilerWorkerBase extends RouteCompilerWorkerApi
generatorType match {
case RouteCompilerType.InjectedGenerator =>
val result = compileWithPlay(
files.map(os.Path(_)),
additionalImports,
files.toIndexedSeq.map(os.Path(_)),
additionalImports.toIndexedSeq,
forwardsRouter,
reverseRouter,
namespaceReverseRouter,
Expand Down
6 changes: 0 additions & 6 deletions contrib/scoverage/src/ScoverageModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,6 @@ trait ScoverageModule extends ScalaModule { outer: ScalaModule =>
}
}

@deprecated("Use scoverageToolsClasspath instead.", "mill after 0.10.0-M1")
def toolsClasspath: T[Agg[PathRef]] = T {
scoverageToolsClasspath()
}

private def checkVersions = T.task {
val sv = scalaVersion()
val isSov2 = scoverageVersion().startsWith("2.")
Expand Down Expand Up @@ -233,7 +228,6 @@ trait ScoverageModule extends ScalaModule { outer: ScalaModule =>
override def sources: Sources = T.sources { outer.sources() }
override def resources: Sources = T.sources { outer.resources() }
override def scalaVersion = T { outer.scalaVersion() }
override def repositories: Seq[Repository] = outer.repositories
override def repositoriesTask: Task[Seq[Repository]] = T.task { outer.repositoriesTask() }
override def compileIvyDeps: Target[Loose.Agg[Dep]] = T { outer.compileIvyDeps() }
override def ivyDeps: Target[Loose.Agg[Dep]] =
Expand Down
2 changes: 1 addition & 1 deletion contrib/testng/test/src/mill/testng/TestNGTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object TestNGTests extends TestSuite {

object test extends super.Tests {
def testngClasspath = T {
mill.modules.Util.millProjectModule("MILL_TESTNG_LIB", "mill-contrib-testng", repositories)
mill.modules.Util.millProjectModule("MILL_TESTNG_LIB", "mill-contrib-testng", repositoriesTask())
}

override def runClasspath: Target[Seq[PathRef]] =
Expand Down
1 change: 0 additions & 1 deletion integration/thirdparty/local/src/AmmoniteTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class AmmoniteTests(fork: Boolean)
)

val compileResult = eval(
"all",
s"{shell,sshd,amm,integration}[$scalaVersion].test.compile"
)

Expand Down
17 changes: 4 additions & 13 deletions main/api/src/mill/api/AggWrapper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ sealed class AggWrapper(strictUniqueness: Boolean) {
def zip[T](other: Agg[T]): Agg[(V, T)]
def ++[T >: V](other: IterableOnce[T]): Agg[T]
def length: Int
def isEmpty: Boolean
def nonEmpty: Boolean = !isEmpty
def foreach[U](f: V => U): Unit
}

object Agg {
Expand Down Expand Up @@ -98,25 +101,12 @@ sealed class AggWrapper(strictUniqueness: Boolean) {
def ++[T >: V](other: IterableOnce[T]): Agg[T] = Agg.from(items ++ other)
def length: Int = set0.size

// Members declared in scala.collection.GenTraversableOnce
def isTraversableAgain: Boolean = items.isTraversableAgain
@deprecated("Use .iterator instead", "mill after 0.9.6")
def toIterator: Iterator[V] = iterator
@deprecated("Use .to(LazyList) instead", "mill after 0.9.6")
def toStream: Stream[V] = items.toStream: @nowarn

// Members declared in scala.collection.TraversableOnce
def copyToArray[B >: V](xs: Array[B], start: Int, len: Int): Unit =
items.copyToArray(xs, start, len)
def exists(p: V => Boolean): Boolean = items.exists(p)
def find(p: V => Boolean): Option[V] = items.find(p)
def forall(p: V => Boolean): Boolean = items.forall(p)
def foreach[U](f: V => U): Unit = items.foreach(f)
def hasDefiniteSize: Boolean = set0.hasDefiniteSize: @nowarn
def isEmpty: Boolean = items.isEmpty
def seq: scala.collection.IterableOnce[V] = items
@deprecated("Use .iterator instead", "mill after 0.9.6")
def toTraversable: Iterable[V] = Iterable.from(items)
def iterator: Iterator[V] = items

override def hashCode(): Int = items.map(_.hashCode()).sum
Expand All @@ -125,6 +115,7 @@ sealed class AggWrapper(strictUniqueness: Boolean) {
case _ => super.equals(other)
}
override def toString: String = items.mkString("Agg(", ", ", ")")

}
}
}
16 changes: 0 additions & 16 deletions main/api/src/mill/api/ClassLoader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@ object ClassLoader {

def java9OrAbove = !System.getProperty("java.specification.version").startsWith("1.")

@deprecated("Use other create method instead.", "mill after 0.9.7")
def create(
urls: Seq[URL],
parent: java.lang.ClassLoader,
sharedLoader: java.lang.ClassLoader,
sharedPrefixes: Seq[String]
)(implicit ctx: Ctx.Home): URLClassLoader = {
create(
urls = urls,
parent = parent,
sharedLoader = sharedLoader,
sharedPrefixes = sharedPrefixes,
logger = None
)
}

def create(
urls: Seq[URL],
parent: java.lang.ClassLoader,
Expand Down
3 changes: 0 additions & 3 deletions main/api/src/mill/api/CompileProblemReporter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ trait CompileProblemReporter {
def finish(): Unit
}

@deprecated("Use CompileProblemReporter instead", "mill after 0.10.0-M3")
trait BuildProblemReporter extends CompileProblemReporter

/**
* Contains general information about the build problem
*/
Expand Down
6 changes: 0 additions & 6 deletions main/core/src/mill/define/ParseArgs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ object ParseArgs {
/** Separator used in [[SelectMode.Separated]] mode to separate a target-args-tuple from the next target. */
val TargetSeparator = "+"

@deprecated("Use apply(Seq[String], SelectMode) instead", "mill after 0.10.0-M3")
def apply(
scriptArgs: Seq[String],
multiSelect: Boolean
): Either[String, TargetsWithParams] = extractAndValidate(scriptArgs, multiSelect)

def apply(
scriptArgs: Seq[String],
selectMode: SelectMode
Expand Down
41 changes: 2 additions & 39 deletions main/core/src/mill/eval/Evaluator.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import scala.util.DynamicVariable
import mill.api.{CompileProblemReporter, Ctx, DummyTestReporter, Loose, Strict, TestReporter}
import mill.api.Result.{Aborted, Failing, OuterStack, Success}
import mill.api.Strict.Agg
import mill.define.{Ctx => _, _}
import mill.define._
import mill.internal.AmmoniteUtils
import mill.util.{Ctx => _, _}
import mill.util._
import upickle.default

import scala.annotation.nowarn
Expand Down Expand Up @@ -843,18 +843,6 @@ object Evaluator {

val defaultEnv: Map[String, String] = System.getenv().asScala.toMap

@deprecated("Use EvaluatorPaths instead", "mill-0.10.0-M3")
type Paths = EvaluatorPaths
@deprecated("Use EvaluatorPaths.makeSegmentStrings instead", "mill-0.10.0-M3")
def makeSegmentStrings(segments: Segments): Seq[String] =
EvaluatorPaths.makeSegmentStrings(segments)
@deprecated("Use EvaluatorPaths.resolveDestPaths instead", "mill-0.10.0-M3")
def resolveDestPaths(
workspacePath: os.Path,
segments: Segments,
foreignSegments: Option[Segments] = None
): EvaluatorPaths = EvaluatorPaths.resolveDestPaths(workspacePath, segments, foreignSegments)

// check if the build itself has changed
def classLoaderSig: Seq[(Either[String, URL], Long)] =
Thread.currentThread().getContextClassLoader match {
Expand Down Expand Up @@ -954,31 +942,6 @@ object Evaluator {
)
}

/**
* Evaluate the given task `e`. In case, the task has no successful result(s), return the `default` value instead.
*
* Note: This method has no sensible error management! Errors are just ignored!
* The following pattern will probably suite your use case better:
*
* {{{
* evaluator.evaluate(Agg(task)) match {
* case r if r.failing.items().nonEmpty =>
* throw Exception(s"Failure during task evaluation: ${Evaluator.formatFailing(r)}")
* case r => r.values.asInstanceOf[Seq[YourResultType]]
* }
* }}}
*/
@deprecated(
"This method has no sensible error management and should be avoided. See it's scaladoc for an alternative pattern or use evalOrThrow instead.",
"mill after 0.10.0-M3"
)
def evalOrElse[T](evaluator: Evaluator, e: Task[T], default: => T): T = {
evaluator.evaluate(Agg(e)).values match {
case Seq() => default
case Seq(e: T) => e
}
}

class EvalOrThrow(evaluator: Evaluator, exceptionFactory: Results => Throwable) {
def apply[T: ClassTag](task: Task[T]): T =
evaluator.evaluate(Agg(task)) match {
Expand Down
17 changes: 0 additions & 17 deletions main/core/src/mill/eval/package.scala

This file was deleted.

Loading

0 comments on commit 839ee36

Please sign in to comment.