Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,6 @@ lazy val compilerInterface = (projectMatrix in internalPath / "compiler-interfac
libraryDependencies ++= Seq(scalaLibrary.value % Test),
libraryDependencies ++= Seq(scalatest % Test),
exportJars := true,
Compile / resourceGenerators += Def.task {
val a = (Compile / compile).value
generateVersionFile(version.value, resourceManaged.value, streams.value, a)
}.taskValue,
Compile / generateContrabands / sourceManaged :=
(internalPath / "compiler-interface" / "src" / "main" / "contraband-java").getAbsoluteFile,
Compile / managedSourceDirectories += (Compile / generateContrabands / sourceManaged).value,
Expand Down
33 changes: 0 additions & 33 deletions project/ZincBuildUtil.scala
Original file line number Diff line number Diff line change
@@ -1,43 +1,10 @@
import sbt._
import Keys._
import xsbti.compile.CompileAnalysis

object ZincBuildUtil {
lazy val apiDefinitions = TaskKey[Seq[File]]("api-definitions")
lazy val genTestResTask = TaskKey[Seq[File]]("gen-test-resources")

def lastCompilationTime(analysis0: CompileAnalysis): Long = {
val analysis = analysis0 match { case a: sbt.internal.inc.Analysis => a }
val lastCompilation = analysis.compilations.allCompilations.lastOption
lastCompilation.map(_.getStartTime) getOrElse 0L
}
def generateVersionFile(
version: String,
dir: File,
s: TaskStreams,
analysis0: CompileAnalysis
): Seq[File] = {
import java.util.{ Date, TimeZone }
val analysis = analysis0 match { case a: sbt.internal.inc.Analysis => a }
val formatter = new java.text.SimpleDateFormat("yyyyMMdd'T'HHmmss")
formatter.setTimeZone(TimeZone.getTimeZone("GMT"))
val timestamp = formatter.format(new Date)
val content = versionLine(version) + "\ntimestamp=" + timestamp
val f = dir / "incrementalcompiler.version.properties"
// TODO: replace lastModified() with sbt.io.IO.getModifiedTimeOrZero(), once the build
// has been upgraded to a version of sbt that includes that call.
if (
!f.exists || f.lastModified < lastCompilationTime(analysis) || !containsVersion(f, version)
) {
s.log.info("Writing version information to " + f + " :\n" + content)
IO.write(f, content)
}
f :: Nil
}
def versionLine(version: String): String = "version=" + version
def containsVersion(propFile: File, version: String): Boolean =
IO.read(propFile).contains(versionLine(version))

def sampleProjectSettings(ext: String) =
Seq(
(Compile / scalaSource) := baseDirectory.value / "src",
Expand Down
Loading