Skip to content

Commit 72fd2bb

Browse files
committed
evict correct nonbootstrapped version
1 parent fc899a6 commit 72fd2bb

File tree

4 files changed

+36
-26
lines changed

4 files changed

+36
-26
lines changed

project/Build.scala

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,7 @@ object DottyJSPlugin extends AutoPlugin {
8686

8787
object Build {
8888
import ScaladocConfigs._
89-
90-
val referenceVersion = "3.4.2-RC1"
91-
92-
val baseVersion = "3.5.0-RC1"
89+
import versionhelpers.DottyVersion._
9390

9491
// LTS or Next
9592
val versionLine = "Next"
@@ -158,24 +155,6 @@ object Build {
158155
val dottyGithubUrl = "https://github.com/scala/scala3"
159156
val dottyGithubRawUserContentUrl = "https://raw.githubusercontent.com/scala/scala3"
160157

161-
162-
val isRelease = sys.env.get("RELEASEBUILD") == Some("yes")
163-
164-
val dottyVersion = {
165-
def isNightly = sys.env.get("NIGHTLYBUILD") == Some("yes")
166-
if (isRelease)
167-
baseVersion
168-
else if (isNightly)
169-
baseVersion + "-bin-" + VersionUtil.commitDate + "-" + VersionUtil.gitHash + "-NIGHTLY"
170-
else
171-
baseVersion + "-bin-SNAPSHOT"
172-
}
173-
val dottyNonBootstrappedVersion = {
174-
// Make sure sbt always computes the scalaBinaryVersion correctly
175-
val bin = if (!dottyVersion.contains("-bin")) "-bin" else ""
176-
dottyVersion + bin + "-nonbootstrapped"
177-
}
178-
179158
val sbtCommunityBuildVersion = "0.1.0-SNAPSHOT"
180159

181160
val agentOptions = List(
@@ -625,7 +604,7 @@ object Build {
625604
val contents = //2.11.11.v20170413-090219-8a413ba7cc
626605
s"""version.number=${version.value}
627606
|maven.version.number=${version.value}
628-
|git.hash=${VersionUtil.gitHash}
607+
|git.hash=${versionhelpers.VersionUtil.gitHash}
629608
|copyright.string=Copyright 2002-$currentYear, LAMP/EPFL
630609
""".stripMargin
631610

@@ -665,7 +644,7 @@ object Build {
665644
// Spawn new JVM in run and test
666645

667646
// Add git-hash used to package the distribution to the manifest to know it in runtime and report it in REPL
668-
packageOptions += ManifestAttributes(("Git-Hash", VersionUtil.gitHash)),
647+
packageOptions += ManifestAttributes(("Git-Hash", versionhelpers.VersionUtil.gitHash)),
669648

670649
javaOptions ++= {
671650
val log = streams.value.log
@@ -2284,6 +2263,7 @@ object Build {
22842263

22852264
object ScaladocConfigs {
22862265
import Build._
2266+
import versionhelpers.DottyVersion._
22872267
private lazy val currentYear: String = java.util.Calendar.getInstance().get(java.util.Calendar.YEAR).toString
22882268

22892269
def dottyExternalMapping = ".*scala/.*::scaladoc3::https://dotty.epfl.ch/api/"
@@ -2363,7 +2343,7 @@ object ScaladocConfigs {
23632343
.add(UseJavacp(true))
23642344
.add(ProjectName("scaladoc"))
23652345
.add(OutputDir("scaladoc/output/self"))
2366-
.add(Revision(VersionUtil.gitHash))
2346+
.add(Revision(versionhelpers.VersionUtil.gitHash))
23672347
.add(ExternalMappings(List(dottyExternalMapping, javaExternalMapping)))
23682348
.withTargets((Compile / classDirectory).value.getAbsolutePath :: Nil)
23692349
}

project/DottyVersion.scala

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package versionhelpers
2+
3+
object DottyVersion {
4+
val isRelease = sys.env.get("RELEASEBUILD") == Some("yes")
5+
6+
val baseVersion = "3.5.0-RC1"
7+
8+
val referenceVersion = "3.4.2-RC1"
9+
10+
val dottyVersion = {
11+
def isNightly = sys.env.get("NIGHTLYBUILD") == Some("yes")
12+
if (isRelease)
13+
baseVersion
14+
else if (isNightly)
15+
baseVersion + "-bin-" + VersionUtil.commitDate + "-" + VersionUtil.gitHash + "-NIGHTLY"
16+
else
17+
baseVersion + "-bin-SNAPSHOT"
18+
}
19+
val dottyNonBootstrappedVersion = {
20+
// Make sure sbt always computes the scalaBinaryVersion correctly
21+
val bin = if (!dottyVersion.contains("-bin")) "-bin" else ""
22+
dottyVersion + bin + "-nonbootstrapped"
23+
}
24+
}

project/RepublishPlugin.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ import sbt.util.CacheImplicits._
1111

1212
import scala.collection.mutable
1313
import java.nio.file.Files
14+
import versionhelpers.DottyVersion._
1415

1516
/** This local plugin provides ways of publishing a project classpath and library dependencies to
1617
* .a local repository */
1718
object RepublishPlugin extends AutoPlugin {
19+
1820
override def trigger = allRequirements
1921
override def requires = super.requires && PublishBinPlugin && PackPlugin
2022

@@ -87,7 +89,9 @@ object RepublishPlugin extends AutoPlugin {
8789

8890
localResolved.foreach({ resolved =>
8991
val simpleId = resolved.id
90-
evicted += simpleId.copy(revision = simpleId.revision + "-nonbootstrapped")
92+
if (simpleId.revision == dottyVersion) {
93+
evicted += simpleId.copy(revision = dottyNonBootstrappedVersion)
94+
}
9195
found(simpleId) = resolved
9296
})
9397

project/VersionUtil.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
package versionhelpers
2+
13
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
24
import org.eclipse.jgit.lib.{Constants, ObjectId, Ref, Repository}
35
import org.eclipse.jgit.revwalk.{RevCommit, RevWalk}

0 commit comments

Comments
 (0)