Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
73811b4
Use provided logger instead of xsbt.Log.debug
Friendseeker Dec 17, 2024
a5d3d98
Merge pull request #1516 from Friendseeker/use-right-logger
eed3si9n Dec 17, 2024
d49fdb8
Add scripted test for #1507
Friendseeker Dec 17, 2024
97dc552
Use new Scala CLA
Friendseeker Dec 17, 2024
c2e459f
Merge pull request #1518 from Friendseeker/patch-1
eed3si9n Dec 18, 2024
3ba57aa
Merge pull request #1517 from Friendseeker/zinc-1507-test
eed3si9n Dec 18, 2024
dad906b
Remove duplicated copyright
Friendseeker Dec 20, 2024
ab04fa4
Delete .java-version
Friendseeker Dec 20, 2024
866b0f0
Merge pull request #1521 from Friendseeker/java-version-remove
eed3si9n Dec 20, 2024
561bd4a
Merge pull request #1523 from Friendseeker/remove-duplicated-copyright
eed3si9n Dec 22, 2024
1ec5e04
Util 1.10.7
eed3si9n Dec 22, 2024
9b9c9a3
Merge pull request #1524 from eed3si9n/wip/bump-util
eed3si9n Dec 22, 2024
06984c6
Update sbt, scripted-plugin to 1.10.7
scala-steward Dec 25, 2024
ea947ab
Merge pull request #1526 from scala-steward/update/sbt-1.10.7
eed3si9n Dec 26, 2024
d0b5e4d
Update sbt-scalafmt to 2.5.4
scala-steward Jan 19, 2025
671a22d
Update io to 1.10.4
scala-steward Jan 19, 2025
b0f54f7
Update protobuf-java, protoc to 3.25.6
scala-steward Feb 4, 2025
0bb578b
Update sbt-protobuf to 0.8.2
scala-steward Feb 4, 2025
0a6db8f
Count all compiled classes, not only invalidated ones as compiled, mo…
rochala Jan 3, 2025
dda0ab9
Correct documentation in Relations.scala
rochala Mar 3, 2025
95a88e4
Simplify transitive invalidations
rochala Mar 3, 2025
df57a1e
Merge pull request #1528 from rochala/undercompilation-local-dependency
eed3si9n Mar 3, 2025
9bd0ec9
Update sbt, scripted-plugin, util-control, ... to 1.10.11
scala-steward Mar 17, 2025
8b91806
Merge pull request #1543 from scala-steward/update/sbt-1.10.11
eed3si9n Mar 18, 2025
ff69829
Update scala-compiler, scala-library to 2.13.16
scala-steward Jan 19, 2025
7db48d0
Update io to 1.10.5
scala-steward Mar 17, 2025
f04d22e
Merge pull request #1542 from scala-steward/update/io-1.10.5
eed3si9n Mar 20, 2025
07c09c7
Update util-control, util-interface, ... to 1.10.11
scala-steward Mar 21, 2025
e2563ca
Update sbt-projectmatrix to 0.11.0
scala-steward Apr 20, 2025
9b96da9
Merge pull request #1546 from scala-steward/update/sbt-projectmatrix-…
eed3si9n Apr 25, 2025
57a2df7
Update protobuf-java, protoc to 3.25.7
scala-steward May 6, 2025
ceec63a
Update sbt, scripted-plugin, util-control, ... to 1.11.0
scala-steward May 24, 2025
7b27eca
Update org.eclipse.jgit to 6.10.1.202505221210-r
scala-steward May 24, 2025
53209b5
Publish to Central Portal
eed3si9n Jun 1, 2025
7c43470
Merge pull request #1551 from eed3si9n/wip/publish
eed3si9n Jun 1, 2025
d39bc48
Update util-control, util-interface, ... to 1.11.0
scala-steward Jun 1, 2025
ed409b0
Update protobuf-java, protoc to 3.25.8
scala-steward Jun 17, 2025
7efad01
Update sbt, scripted-plugin, util-control, ... to 1.11.2
scala-steward Jun 17, 2025
c1841e2
Merge pull request #1554 from scala-steward/update/protobuf-java-3.25.8
eed3si9n Jun 19, 2025
75d54b6
Merge pull request #1556 from scala-steward/update/sbt-1.11.2
eed3si9n Jun 19, 2025
8b114ca
Update util-control, util-interface, ... to 1.11.2
scala-steward Jun 24, 2025
336414a
Update sbt-ide-settings to 1.1.3
scala-steward Jul 25, 2025
6a558dd
Merge pull request #1562 from scala-steward/update/sbt-ide-settings-1…
eed3si9n Jul 26, 2025
3f12c31
Merge branch '1.10.x' into wip/merge-1.10.x
eed3si9n Aug 4, 2025
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
20 changes: 3 additions & 17 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,7 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check CLA
env:
AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
echo "Pull request submitted by $AUTHOR";
signed=$(curl -s "https://contribute.akka.io/contribute/cla/scala/check/$AUTHOR" | jq -r ".signed");
if [ "$signed" = "true" ] ; then
echo "CLA check for $AUTHOR successful";
else
echo "CLA check for $AUTHOR failed";
echo "Please sign the Scala CLA to contribute to the Scala compiler.";
echo "Go to https://contribute.akka.io/contribute/cla/scala and then";
echo "comment on the pull request to ask for a new check.";
echo "";
echo "Check if CLA is signed: https://contribute.akka.io/contribute/cla/scala/check/$AUTHOR";
exit 1;
fi;
uses: scala/cla-checker@v1
with:
author: ${{ github.event.pull_request.user.login }}
1 change: 0 additions & 1 deletion .java-version

This file was deleted.

7 changes: 4 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ ThisBuild / developers := List(
)
ThisBuild / pomIncludeRepository := (_ => false) // drop repos other than Maven Central from POM
ThisBuild / publishTo := {
val nexus = "https://oss.sonatype.org/"
Some("releases" at nexus + "service/local/staging/deploy/maven2")
val centralSnapshots = "https://central.sonatype.com/repository/maven-snapshots/"
if (isSnapshot.value) Some("central-snapshots" at centralSnapshots)
else localStaging.value
}
ThisBuild / mimaPreviousArtifacts := Set.empty
// limit the number of concurrent test so testQuick works
Expand Down Expand Up @@ -306,7 +307,7 @@ lazy val zincBenchmarks = (projectMatrix in internalPath / "zinc-benchmarks")
baseSettings,
name := "Benchmarks of Zinc and the compiler bridge",
libraryDependencies ++= Seq(
"org.eclipse.jgit" % "org.eclipse.jgit" % "6.10.0.202406032230-r",
"org.eclipse.jgit" % "org.eclipse.jgit" % "6.10.1.202505221210-r",
"net.openhft" % "affinity" % "3.23.3",
),
Test / javaOptions ++= List("-Xmx600M", "-Xms600M"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ private[inc] abstract class IncrementalCommon(
invalidatedSources,
classfileManager,
pruned,
previous,
classesToRecompile,
profiler.registerCycle(
invalidatedClasses,
Expand Down Expand Up @@ -149,11 +148,11 @@ private[inc] abstract class IncrementalCommon(
invalidatedSources: Set[VirtualFile],
classFileManager: XClassFileManager,
pruned: Analysis,
override val previousAnalysis: Analysis,
classesToRecompile: Set[String],
registerCycle: (Set[String], APIChanges, Set[String], Boolean) => Unit
) extends IncrementalCallback(classFileManager) {
override val isFullCompilation: Boolean = allSources.subsetOf(invalidatedSources)
override val previousAnalysis: Analysis = previous
override val previousAnalysisPruned: Analysis = pruned

override def mergeAndInvalidate(
Expand All @@ -165,10 +164,12 @@ private[inc] abstract class IncrementalCommon(
partialAnalysis.copy(compilations = pruned.compilations ++ partialAnalysis.compilations)
else pruned ++ partialAnalysis

// Represents classes detected as changed externally and internally (by a previous cycle)
// Represents all classes that were compiled as a result of external and internal invalidation (by a previous cycle)
// Maps the changed sources by the user to class names we can count as invalidated
val getClasses = (a: Analysis) => initialChangedSources.flatMap(a.relations.classNames)
val recompiledClasses = classesToRecompile ++ getClasses(previous) ++ getClasses(analysis)
val recompiledClasses = classesToRecompile ++
getClasses(previous) ++ getClasses(analysis) ++
invalidatedSources.flatMap(previous.relations.classNames)

val newApiChanges =
detectAPIChanges(recompiledClasses, previous.apis.internalAPI, analysis.apis.internalAPI)
Expand Down Expand Up @@ -505,11 +506,11 @@ private[inc] abstract class IncrementalCommon(
Set.empty
} else {
if (invalidateTransitively) {
val firstClassTransitiveInvalidation = includeTransitiveInitialInvalidations(
initial,
IncrementalCommon.transitiveDeps(initial, log)(dependsOnClass),
dependsOnClass
)
// NOTE: As member reference relations do not include local relations, this invalidation will fully propagate
// thus we can't rely solely on `firstClassTransitiveInvalidation`. Better bet is to try to find transitive
// dependencies from result of `firstClassInvalidation`
val firstClassTransitiveInvalidation =
IncrementalCommon.transitiveDeps(firstClassInvalidation, log)(dependsOnClass)
log.debug("Invalidate by brute force:\n\t" + firstClassTransitiveInvalidation)
firstClassTransitiveInvalidation ++ secondClassInvalidation ++ thirdClassInvalidation ++ recompiledClasses
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,15 @@ trait Relations {
private[inc] def externalDependencies: ExternalDependencies

/**
* The class dependency relation between classes introduced by member reference.
* The class dependency relation between classes introduced
* by member reference excluding excluding same-source references.
*
* NOTE: All inheritance dependencies are included in this relation because in order to
* inherit from a member you have to refer to it. If you check documentation of `inheritance`
* you'll see that there's small oddity related to traits being the first parent of a
* class/trait that results in additional parents being introduced due to normalization.
* This relation properly accounts for that so the invariant that `memberRef` is a superset
* of `inheritance` is preserved.
*
* Because `inheritance` includes same-source references, `memberRef` is not a superset of `inheritance`
*/
private[inc] def memberRef: ClassDependencies

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@
// Based on zinc's FileAnalysisStore:
package sbt.internal.inc.consistent

/*
* Zinc - The incremental compiler for Scala.
* Copyright Lightbend, Inc. and Mark Harrah
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

import sbt.io.{ IO, Using }
import xsbti.compile.analysis.ReadWriteMappers
import xsbti.compile.{ AnalysisContents, AnalysisStore => XAnalysisStore }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,9 @@ class IncHandler(directory: Path, cacheDir: Path, scriptedLog: ManagedLogger, co
onArgs("checkIterations") {
case (p, x :: Nil, i) => p.checkNumberOfCompilerIterations(i, x.toInt)
},
// onArgs("checkCycles") {
// case (p, x :: Nil, i) => p.checkNumberOfCycles(i, x.toInt)
// },
onArgs("checkNumberOfLibraries") {
case (p, x :: Nil, i) => p.checkNumberOfLibraries(i, x.toInt)
},
// note that this can only tell us the *last* round a class got compiled in.
// it can't tell us *every* round something got compiled in, since only
// still-extant classfiles are available for inspection
Expand Down Expand Up @@ -533,6 +533,14 @@ case class ProjectStructure(
()
}

def checkNumberOfLibraries(i: IncState, expected: Int): Future[Unit] =
compile(i).map { analysis =>
val count = analysis.stamps.libraries.size
val msg = s"analysis.stamps.libraries.size = $count (expected $expected)"
assert(count == expected, msg)
()
}

def run(i: IncState, params: Seq[String]): Future[Unit] =
compile(i).map { analysis =>
discoverMainClasses(Some(analysis.apis)) match {
Expand Down Expand Up @@ -811,7 +819,6 @@ case class ProjectStructure(
Optional.empty[ExternalHooks.Lookup],
Optional.empty[XClassFileManager]
)
// .withInvalidationProfiler(profiler)
val base = IncOptions
.of()
.withPipelining(defaultPipelining)
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.10.6
sbt.version=1.11.2
6 changes: 3 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ scalacOptions += "-feature"

addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.1.0")
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.4")
addSbtPlugin("org.scala-sbt" % "sbt-contraband" % "0.7.0")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.1")
addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.11.0")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0")
addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.2")
addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.3")
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ final class AnalyzingJavaCompiler private[sbt] (
val javaSources: Array[VirtualFile] =
sources.sortBy(_.id).toArray
// TODO: https://github.com/sbt/sbt/issues/7883
// debug(log, prettyPrintCompilationArguments(args))
// log.debug(InterfaceUtil.toSupplier(prettyPrintCompilationArguments(args)))
val success =
javac.run(javaSources, args, output, incToolOptions, reporter, log)
if (!success) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package A

class SRC[_]
class Refined {
def select() = new {
def using(opt: Option[SRC[_]] => Some[SRC[_]]) = opt
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package B

import A.Refined

class Client {
def temp = new Refined().select().using(null)
}
15 changes: 15 additions & 0 deletions zinc/src/sbt-test/source-dependencies/anon-class-dep/build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"projects": [
{
"name": "B",
"dependsOn": [
"A"
],
"scalaVersion": "2.13.x"
},
{
"name": "A",
"scalaVersion": "2.13.x"
}
]
}
2 changes: 2 additions & 0 deletions zinc/src/sbt-test/source-dependencies/anon-class-dep/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
> B/compile
> B/checkNumberOfLibraries 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trait A {
def buildNonemptyObjects(a: Int): Int = a
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object Main extends App {
val x: C = new C { }
val z: Int = x.x
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
trait C extends B {
def x = something
}
trait B extends A {
def something = buildNonemptyObjects(5)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
trait A {
// change return type Int => String
def buildNonemptyObjects(a: Int): String = ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
trait A {
def buildNonemptyObjects(a: Int): Int = a
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
transitiveStep = 3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
transitiveStep = 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
##################### FAILURE ############################
# clean build that compiles with transitiveStep = 1
> compile

# incremental build that should fail with transitiveStep = 1
$ copy-file changes/A.scala A.scala
-> compile

##################### FAILURE ############################

# rerun the test with transitiveStep = 3
> clean
$ copy-file changes/OriginalA.scala A.scala
$ copy-file changes/incOptions.properties incOptions.properties

# clean build that compiles with transitiveStep = 3
> compile

# incremental build that should fail with transitiveStep = 3
$ copy-file changes/A.scala A.scala
-> compile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object A {
def buildNonemptyObjects(a: Int): Int = a
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object Main extends App {
val z: Int = C.x
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
object C {
def x = B.something
}

object B {
def something = A.buildNonemptyObjects(5)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object A {
// change return type Int => String
def buildNonemptyObjects(a: Int): String = ""
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
object A {
def buildNonemptyObjects(a: Int): Int = a
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
object A {
// add default param
def buildNonemptyObjects(a: Int, b: Int = 5): Int = a
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
transitiveStep = 3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
transitiveStep = 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
##################### SUCCESS ############################
# clean build that compiles with transitiveStep = 1
> compile

# incremental build that should work with transitiveStep = 1
$ copy-file changes/WorkingA.scala A.scala
> compile
# > checkIterations 2 this is not yet working, but it should be 2

##################### FAILURE ############################

# clean build that compiles with transitiveStep = 1
> clean
$ copy-file changes/OriginalA.scala A.scala
> compile

# incremental build that should fail with transitiveStep = 1
$ copy-file changes/A.scala A.scala
-> compile

##################### FAILURE ############################

# rerun the test with transitiveStep = 3
> clean
$ copy-file changes/OriginalA.scala A.scala
$ copy-file changes/incOptions.properties incOptions.properties

# clean build that compiles with transitiveStep = 3
> compile

# incremental build that should fail with transitiveStep = 3
$ copy-file changes/A.scala A.scala
-> compile
Loading