From 893f120dee477dc3f5f1af140034a0c1edf77503 Mon Sep 17 00:00:00 2001 From: Ethan Atkins Date: Sat, 27 Jul 2019 12:47:00 -0700 Subject: [PATCH] Don't rewrite RunFromSource.classpath every time In the sbt project, we often spuriously re-doc a number of projects that haven't changed because we modify a file in the resource path. --- build.sbt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 1f61a3539..699acd08f 100644 --- a/build.sbt +++ b/build.sbt @@ -5,6 +5,7 @@ import com.typesafe.tools.mima.core._, ProblemFilters._ import local.Scripted import scala.xml.{ Node => XmlNode, NodeSeq => XmlNodeSeq, _ } import scala.xml.transform.{ RewriteRule, RuleTransformer } +import scala.util.Try ThisBuild / version := { val v = "1.3.0-SNAPSHOT" @@ -402,7 +403,9 @@ lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux")) val extDepsCp = (externalDependencyClasspath in Compile in LocalProject("sbtProj")).value val cpStrings = (mainClassDir +: testClassDir +: classDirs) ++ extDepsCp.files map (_.toString) val file = (resourceManaged in Compile).value / "RunFromSource.classpath" - IO.writeLines(file, cpStrings) + if (!file.exists || Try(IO.readLines(file)).getOrElse(Nil).toSet != cpStrings.toSet) { + IO.writeLines(file, cpStrings) + } List(file) }, mimaSettings,