Skip to content

[POC] sbt 1.5.0 validation #11568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Closed
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
5 changes: 1 addition & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,9 @@ jobs:
- name: Add SBT proxy repositories
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true

- name: Test sbt 1.4.x
- name: Test sbt
run: ./project/scripts/sbt "sbt-dotty/scripted; sbt-community-build/scripted"

- name: Test sbt 1.5.x
run: ./project/scripts/sbt "set \`sbt-dotty\`/scriptedSbt := \"1.5.0-RC1\"; sbt-dotty/scripted sbt-dotty/*"

test_java8:
runs-on: [self-hosted, Linux]
container:
Expand Down
2 changes: 1 addition & 1 deletion community-build/community-projects/AsyncFile
2 changes: 1 addition & 1 deletion community-build/community-projects/Equal
2 changes: 1 addition & 1 deletion community-build/community-projects/Log
2 changes: 1 addition & 1 deletion community-build/community-projects/Lucre
2 changes: 1 addition & 1 deletion community-build/community-projects/Model
2 changes: 1 addition & 1 deletion community-build/community-projects/Numbers
2 changes: 1 addition & 1 deletion community-build/community-projects/ScalaPB
2 changes: 1 addition & 1 deletion community-build/community-projects/Serial
2 changes: 1 addition & 1 deletion community-build/community-projects/Span
2 changes: 1 addition & 1 deletion community-build/community-projects/algebra
2 changes: 1 addition & 1 deletion community-build/community-projects/cats
2 changes: 1 addition & 1 deletion community-build/community-projects/cats-effect-2
2 changes: 1 addition & 1 deletion community-build/community-projects/cats-effect-3
2 changes: 1 addition & 1 deletion community-build/community-projects/cats-mtl
Submodule cats-mtl updated 1 files
+1 −0 project/plugins.sbt
2 changes: 1 addition & 1 deletion community-build/community-projects/coop
Submodule coop updated 1 files
+1 −0 project/plugins.sbt
2 changes: 1 addition & 1 deletion community-build/community-projects/effpi
2 changes: 1 addition & 1 deletion community-build/community-projects/endpoints4s
2 changes: 1 addition & 1 deletion community-build/community-projects/fastparse
2 changes: 1 addition & 1 deletion community-build/community-projects/intent
2 changes: 1 addition & 1 deletion community-build/community-projects/minitest
2 changes: 1 addition & 1 deletion community-build/community-projects/munit
2 changes: 1 addition & 1 deletion community-build/community-projects/scalap
2 changes: 1 addition & 1 deletion community-build/community-projects/scodec
Submodule scodec updated 1 files
+1 −0 project/plugins.sbt
2 changes: 1 addition & 1 deletion community-build/community-projects/scodec-bits
2 changes: 1 addition & 1 deletion community-build/community-projects/sconfig
2 changes: 1 addition & 1 deletion community-build/community-projects/stdLib213
2 changes: 1 addition & 1 deletion community-build/community-projects/verify
14 changes: 7 additions & 7 deletions community-build/src/scala/dotty/communitybuild/projects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ final case class SbtCommunityProject(
override val docCommand =
if sbtDocCommand eq null then null else
val cmd = if sbtDocCommand.startsWith(";") then sbtDocCommand else s";$sbtDocCommand"
s"$baseCommand set every useScaladoc := true; set every doc/logLevel := Level.Warn $cmd "
s"$baseCommand set every doc/logLevel := Level.Warn $cmd "

override val runCommandsArgs: List[String] =
// Run the sbt command with the compiler version and sbt plugin set in the build
val sbtProps = Option(System.getProperty("sbt.ivy.home")) match
case Some(ivyHome) => List(s"-Dsbt.ivy.home=$ivyHome")
case _ => Nil
extraSbtArgs ++ sbtProps ++ List(
"-sbt-version", "1.4.9",
"-sbt-version", "1.5.0-RC2",
"-Dsbt.supershell=false",
s"-Ddotty.communitybuild.dir=$communitybuildDir",
s"--addPluginSbtFile=$sbtPluginFilePath"
Expand All @@ -140,7 +140,7 @@ object projects:

private def forceDoc(projects: String*) =
projects.map(project =>
s""";set $project/Compile/doc/sources ++= ($project/Compile/doc/tastyFiles).value ;$project/doc"""
s""";set $project/Compile/doc/sources := ($project/Compile/sources).value ;$project/doc"""
).mkString(" ")

private def aggregateDoc(in: String)(projects: String*) =
Expand Down Expand Up @@ -397,15 +397,15 @@ object projects:
project = "scodec-bits",
sbtTestCommand = "coreJVM/test;coreJS/test",
sbtPublishCommand = "coreJVM/publishLocal;coreJS/publishLocal",
sbtDocCommand = "coreJVM/doc",
// sbtDocCommand = "coreJVM/doc",
dependencies = List(munit)
)

lazy val scodec = SbtCommunityProject(
project = "scodec",
sbtTestCommand = "unitTests/test",
// Adds <empty> package
sbtDocCommand = "coreJVM/doc",
// sbtDocCommand = "coreJVM/doc",
dependencies = List(munit, scodecBits)
)

Expand Down Expand Up @@ -451,14 +451,14 @@ object projects:
lazy val catsEffect2 = SbtCommunityProject(
project = "cats-effect-2",
sbtTestCommand = "test",
sbtDocCommand = ";coreJVM/doc ;lawsJVM/doc",
// sbtDocCommand = ";coreJVM/doc ;lawsJVM/doc",
dependencies = List(cats, disciplineMunit)
)

lazy val catsEffect3 = SbtCommunityProject(
project = "cats-effect-3",
sbtTestCommand = "test",
sbtDocCommand = ";coreJVM/doc ;lawsJVM/doc ;kernelJVM/doc",
// sbtDocCommand = ";coreJVM/doc ;lawsJVM/doc ;kernelJVM/doc",
dependencies = List(cats, coop, disciplineSpecs2, scalacheck)
)

Expand Down
39 changes: 39 additions & 0 deletions project/Bootstrap.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package sbt

import sbt.internal.classpath.ClassLoaderCache
import sbt.internal.inc.ScalaInstance

object Bootstrap {
// copied from https://github.com/sbt/sbt/blob/33e2bfe2810246c8e4e1b37ec110d15e588a4fce/main/src/main/scala/sbt/Defaults.scala#L1120-L1165
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this method be made public upstream?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think that's worth it. It's only useful for works on the Scala compilers and we probably don't want to maintain compatibility just in case other people use it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your call, but It seems better than having to deal with the complicated classloader caching logic API directly. And does this need to be in package sbt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does because the ScalaInstance constructor is package private. But we could as well create our own ScalaInstance implementation.

This code is a quick and dirty copy-paste, it can be made simpler.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does because the ScalaInstance constructor is package private.

It looks public to me (https://github.com/sbt/zinc/blob/13ddb10938237263f706174439d8ed055e8e4ac2/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ScalaInstance.scala#L34-L43), and weren't we already using it before this PR?

def makeScalaInstance(
version: String,
libraryJars: Array[File],
allCompilerJars: Seq[File],
allDocJars: Seq[File],
state: State,
topLoader: ClassLoader
): ScalaInstance = {
val classLoaderCache = state.extendedClassLoaderCache
val compilerJars = allCompilerJars.filterNot(libraryJars.contains).distinct.toArray
val docJars = allDocJars
.filterNot(jar => libraryJars.contains(jar) || compilerJars.contains(jar))
.distinct.toArray
val allJars = libraryJars ++ compilerJars ++ docJars

val libraryLoader = classLoaderCache(libraryJars.toList, topLoader)
val compilerLoader = classLoaderCache(compilerJars.toList, libraryLoader)
val fullLoader =
if (docJars.isEmpty) compilerLoader
else classLoaderCache(docJars.distinct.toList, compilerLoader)
new ScalaInstance(
version = version,
loader = fullLoader,
loaderCompilerOnly = compilerLoader,
loaderLibraryOnly = libraryLoader,
libraryJars = libraryJars,
compilerJars = compilerJars,
allJars = allJars,
explicitActual = Some(version)
)
}
}
Loading