Skip to content

Commit 1b42b4c

Browse files
committed
Clean up generateVersionFile from ZincBuildUtil
1 parent 3ba57aa commit 1b42b4c

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

build.sbt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,6 @@ lazy val compilerInterface = (projectMatrix in internalPath / "compiler-interfac
456456
libraryDependencies ++= Seq(scalaLibrary.value % Test),
457457
libraryDependencies ++= Seq(scalatest % Test),
458458
exportJars := true,
459-
Compile / resourceGenerators += Def.task {
460-
val a = (Compile / compile).value
461-
generateVersionFile(version.value, resourceManaged.value, streams.value, a)
462-
}.taskValue,
463459
Compile / generateContrabands / sourceManaged :=
464460
(internalPath / "compiler-interface" / "src" / "main" / "contraband-java").getAbsoluteFile,
465461
Compile / managedSourceDirectories += (Compile / generateContrabands / sourceManaged).value,

project/ZincBuildUtil.scala

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,10 @@
11
import sbt._
22
import Keys._
3-
import xsbti.compile.CompileAnalysis
43

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

9-
def lastCompilationTime(analysis0: CompileAnalysis): Long = {
10-
val analysis = analysis0 match { case a: sbt.internal.inc.Analysis => a }
11-
val lastCompilation = analysis.compilations.allCompilations.lastOption
12-
lastCompilation.map(_.getStartTime) getOrElse 0L
13-
}
14-
def generateVersionFile(
15-
version: String,
16-
dir: File,
17-
s: TaskStreams,
18-
analysis0: CompileAnalysis
19-
): Seq[File] = {
20-
import java.util.{ Date, TimeZone }
21-
val analysis = analysis0 match { case a: sbt.internal.inc.Analysis => a }
22-
val formatter = new java.text.SimpleDateFormat("yyyyMMdd'T'HHmmss")
23-
formatter.setTimeZone(TimeZone.getTimeZone("GMT"))
24-
val timestamp = formatter.format(new Date)
25-
val content = versionLine(version) + "\ntimestamp=" + timestamp
26-
val f = dir / "incrementalcompiler.version.properties"
27-
// TODO: replace lastModified() with sbt.io.IO.getModifiedTimeOrZero(), once the build
28-
// has been upgraded to a version of sbt that includes that call.
29-
if (
30-
!f.exists || f.lastModified < lastCompilationTime(analysis) || !containsVersion(f, version)
31-
) {
32-
s.log.info("Writing version information to " + f + " :\n" + content)
33-
IO.write(f, content)
34-
}
35-
f :: Nil
36-
}
37-
def versionLine(version: String): String = "version=" + version
38-
def containsVersion(propFile: File, version: String): Boolean =
39-
IO.read(propFile).contains(versionLine(version))
40-
418
def sampleProjectSettings(ext: String) =
429
Seq(
4310
(Compile / scalaSource) := baseDirectory.value / "src",

0 commit comments

Comments
 (0)