Skip to content
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

[2.x] Merge 1.x #1515

Merged
merged 61 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
4367acd
Add check contraband sources consistency job
Friendseeker Oct 19, 2024
028b12b
Merge pull request #1476 from Friendseeker/contraband-generate-check
eed3si9n Oct 20, 2024
f6a433f
Bump sbt to 1.10.3
Friendseeker Oct 22, 2024
78af2d9
Bump Scala 3 to 3.3.4
Friendseeker Oct 22, 2024
48758a8
Merge pull request #1482 from Friendseeker/bump-scala-3-1
eed3si9n Oct 22, 2024
3febd22
Merge pull request #1481 from Friendseeker/bump-sbt-version
eed3si9n Oct 22, 2024
5212aa3
Update sbt-dynver to 5.1.0
scala-steward Oct 22, 2024
e66e59c
Update sbt-protobuf to 0.8.1
scala-steward Oct 22, 2024
b106f64
Add missing copyright headers
Friendseeker Oct 22, 2024
b46639b
Add copyright headers for test scope
Friendseeker Oct 22, 2024
d8b2eef
Merge pull request #1484 from scala-steward/update/sbt-protobuf-0.8.1
eed3si9n Oct 23, 2024
475b6d9
Merge pull request #1485 from Friendseeker/copyright-header
eed3si9n Oct 23, 2024
bb6a374
Merge pull request #1483 from scala-steward/update/sbt-dynver-5.1.0
eed3si9n Oct 23, 2024
e0a085c
util 1.10.4
eed3si9n Oct 28, 2024
8d88f99
Merge pull request #1486 from eed3si9n/wip/bump_util
eed3si9n Oct 28, 2024
e9f2bc2
Surface clean cache
Friendseeker Nov 4, 2024
f846042
Replace deprecated AnyRefMap
Friendseeker Nov 5, 2024
0de8e03
Merge pull request #1488 from Friendseeker/replace-anyrefmap
eed3si9n Nov 5, 2024
3c50067
Update sbt, scripted-plugin to 1.10.5
scala-steward Nov 6, 2024
cb46a0a
Update sbt-contraband to 0.7.0
scala-steward Nov 6, 2024
3aa1353
Update util-control, util-interface, ... to 1.10.5
scala-steward Nov 6, 2024
49adbf7
Better memory efficiency for Analysis
dwijnand Nov 6, 2024
5f856a5
Merge pull request #1490 from scala-steward/update/sbt-1.10.5
eed3si9n Nov 6, 2024
42e7a45
Merge pull request #1492 from scala-steward/update/util-control-1.10.5
eed3si9n Nov 6, 2024
f9baa3d
Merge branch '1.10.x' into update/sbt-contraband-0.7.0
eed3si9n Nov 6, 2024
61014f7
Merge pull request #1491 from scala-steward/update/sbt-contraband-0.7.0
eed3si9n Nov 8, 2024
29b8eb3
ci: sbt-buildinfo 0.13.1
eed3si9n Nov 9, 2024
1676f94
Merge pull request #1495 from eed3si9n/wip/bump-buildinfo
eed3si9n Nov 9, 2024
ced4262
Merge pull request #1494 from dwijnand/feature/smaller-analysis
eed3si9n Nov 13, 2024
ac27bfb
Print javac options in debug log
Friendseeker Nov 14, 2024
f8cf093
Merge pull request #1497 from Friendseeker/sbt#7883
eed3si9n Nov 15, 2024
653c45c
Add reproducible flag to ConsistentAnalysisFormat
Friendseeker Oct 21, 2024
abb7eed
Merge pull request #1479 from Friendseeker/reproducible-toggleable
eed3si9n Nov 24, 2024
eb96c19
Let Scala Steward auto-update protobuf version
Friendseeker Nov 24, 2024
8a2935f
Merge pull request #1501 from Friendseeker/protobuf-opt-in
eed3si9n Nov 25, 2024
4c2eee3
Update sbt-projectmatrix to 0.10.1
scala-steward Nov 25, 2024
aa033b8
Pin com.google.protobuf.protoc
Friendseeker Nov 25, 2024
45702ea
remove usage of blacklist
Friendseeker Nov 25, 2024
5d68baa
Merge pull request #1502 from scala-steward/update/sbt-projectmatrix-…
eed3si9n Nov 26, 2024
3721683
Merge pull request #1504 from Friendseeker/zinc-1501-follow-up
eed3si9n Nov 26, 2024
9a3af98
Merge pull request #1505 from Friendseeker/remove-blacklist-usage
eed3si9n Nov 26, 2024
e8f1e07
Merge pull request #1487 from Friendseeker/surface-cache-clean
eed3si9n Nov 29, 2024
baba381
util 1.10.6
eed3si9n Nov 30, 2024
dfd4b58
Merge pull request #1506 from eed3si9n/wip/bump-util
eed3si9n Nov 30, 2024
af2004f
Exclude anon classes from dependency registration
retronym Dec 3, 2024
f1547d0
Add some notes to the saga of absent associatedFile
retronym Dec 3, 2024
9e0c663
Precompile a regex in hot code
retronym Dec 3, 2024
3e60b78
Merge pull request #1508 from retronym/faster/regex-precompile
eed3si9n Dec 3, 2024
c752dae
Update internal/compiler-bridge/src/main/scala/xsbt/Dependency.scala
retronym Dec 3, 2024
bb01128
Bump sbt to 1.10.6
Friendseeker Dec 3, 2024
cd5aa58
Merge pull request #1510 from Friendseeker/bump-sbt-ver
eed3si9n Dec 4, 2024
f032a9a
Ensure we register a cycle if we've got scala sources but pipelining …
ephemerist Dec 4, 2024
d2cd28a
new CLA url
lrytz Dec 5, 2024
7e96c09
Merge pull request #1513 from lrytz/cla-redirect
eed3si9n Dec 5, 2024
5d17b33
Merge branch '1.10.x' into feature/cycles-registration
eed3si9n Dec 5, 2024
5ca7ed7
Merge pull request #1511 from ephemerist/feature/cycles-registration
eed3si9n Dec 6, 2024
e2f5ea1
Merge pull request #1507 from retronym/anon-dep
eed3si9n Dec 6, 2024
23219b4
Update sbt-pgp to 2.3.1
scala-steward Dec 11, 2024
8d50f01
Merge pull request #1514 from scala-steward/update/sbt-pgp-2.3.1
eed3si9n Dec 11, 2024
19fa711
Merge branch '1.10.x' into wip/merge-1.10.x
eed3si9n Dec 16, 2024
a8992c6
Adjust pending
eed3si9n Dec 16, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ jobs:
if: ${{ matrix.jobtype == 3 }}
shell: bash
run: |
sbt -v -Dfile.encoding=UTF-8 scalafmtCheckAll scalafmtSbtCheck
sbt -v -Dfile.encoding=UTF-8 scalafmtCheckAll scalafmtSbtCheck headerCheck "Test/headerCheck" generateContrabands
git diff --exit-code
- name: Benchmark (Scalac) (4)
if: ${{ matrix.jobtype == 4 }}
shell: bash
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
AUTHOR: ${{ github.event.pull_request.user.login }}
run: |
echo "Pull request submitted by $AUTHOR";
signed=$(curl -s "https://www.lightbend.com/contribute/cla/scala/check/$AUTHOR" | jq -r ".signed");
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://www.lightbend.com/contribute/cla/scala and then";
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://www.lightbend.com/contribute/cla/scala/check/$AUTHOR";
echo "Check if CLA is signed: https://contribute.akka.io/contribute/cla/scala/check/$AUTHOR";
exit 1;
fi;
10 changes: 5 additions & 5 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# either. hopefully this is a reasonable compromise value?
pullRequests.frequency = "14 days"

updates.ignore = [
# as per discussion on sbt/zinc#1236, this is
# "if it ain't broke don't fix it" territory
{ groupId = "com.google.protobuf" },
{ groupId = "org.eclipse.jgit" }
updates.pin = [
{ groupId = "com.google.protobuf", artifactId = "protobuf-java", version="3." },
{ groupId = "com.google.protobuf", artifactId = "protoc", version="3." },
# jgit 7 requires Java 17+
{ groupId = "org.eclipse.jgit", artifactId = "org.eclipse.jgit", version="6." }
]
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package scala.reflect

import scala.tools.nsc.Global
Expand Down
26 changes: 25 additions & 1 deletion internal/compiler-bridge/src/main/scala/xsbt/Dependency.scala
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,27 @@ final class Dependency(val global: CallbackGlobal) extends LocateClassFile with
* but when it does we must ensure the incremental compiler tries its best no to lose
* any dependency. Therefore, we do a last-time effort to get the origin of the symbol
* by inspecting the classpath manually.
*
* UPDATE: This can also happen without compiler bugs if the symbol is simply uninitialized.
* Example, `class Client { def foo = Server.foo }`. When compiling client, the type `Foo` returned
* by `Server.foo` does not need to be initialized as we do not select from it or check its
* conformance to another type.
*
* Initializing `targetSymbol` before calling `assosicatedFile` would work but is problematic
* see zinc/zinc#949
*
* Perhaps consider this?
* val file = targetSymbol.associatedFile match {
* case NoAbstractFile => sym.rawInfo match {
* case cfl: global.loaders.ClassfileLoader =>
* val f = cfl.associatedFile(sym) // Gets the file from the loader
* if (f.exists) f else NoAbstractFile
* case f => f
* }
* }
*
* Or the status quo might just be perfectly fine -- if compilation doesn't need to force `Foo`,
* then there isn't a real dependency.
*/
val fqn = fullName(targetSymbol, '.', targetSymbol.moduleSuffix, false)
global.findAssociatedFile(fqn) match {
Expand Down Expand Up @@ -291,9 +312,12 @@ final class Dependency(val global: CallbackGlobal) extends LocateClassFile with
assert(fromClass.isClass, Feedback.expectedClassSymbol(fromClass))
val depClass = enclOrModuleClass(dep)
val dependency = ClassDependency(fromClass, depClass)
// An anonymous class be the enclosing class of an existential type symbol inferred from refinements,
// prior to https://github.com/scala/scala/pull/10940. Allowing this here leads to a dependency on class name
// that does not exist. Guard against it here to avoid the issue with legacy compiler versions.
if (
!cache.contains(dependency) &&
!depClass.isRefinementClass
!depClass.isAnonOrRefinementClass
) {
process(dependency)
cache.add(dependency)
Expand Down
5 changes: 3 additions & 2 deletions internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import xsbti.api._
import scala.annotation.tailrec
import scala.tools.nsc.Global
import scala.PartialFunction.cond
import ExtractAPI.ConstructorWithDefaultArgument

/**
* Extracts full (including private members) API representation out of Symbols and Types.
Expand Down Expand Up @@ -836,9 +837,8 @@ class ExtractAPI[GlobalType <: Global](
constructorNameAsString(s.enclClass)
else {
val decoded = name.decode
val constructorWithDefaultArgument = "<init>\\$default\\$(\\d+)".r
decoded match {
case constructorWithDefaultArgument(index) => constructorNameAsString(s.enclClass, index)
case ConstructorWithDefaultArgument(index) => constructorNameAsString(s.enclClass, index)
case _ => decoded
}
}
Expand Down Expand Up @@ -866,4 +866,5 @@ class ExtractAPI[GlobalType <: Global](

object ExtractAPI {
private val emptyAnnotationArray = new Array[xsbti.api.Annotation](0)
private val ConstructorWithDefaultArgument = "<init>\\$default\\$(\\d+)".r
}
11 changes: 11 additions & 0 deletions internal/compiler-bridge/src/main/scala/xsbt/trace.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
*/

package xsbt

object trace extends TraceSyntax {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Lightbend, Inc. and Mark Harrah
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Lightbend, Inc. and Mark Harrah
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/**
* Implement a Scala `lazy val` in Java for the facing sbt interface.
*
* <p>
* It holds a reference to a thunk that is lazily evaluated and then
* its reference is clear to avoid memory leaks in memory-intensive code.
* It needs to be defined in [[xsbti]] or a subpackage, see [[xsbti.api.Lazy]]
Expand All @@ -34,12 +34,7 @@ public static <T> xsbti.api.Lazy<T> apply(Supplier<T> sbtThunk) {
/** Return a sbt [[xsbti.api.Lazy]] from a strict value. */
public static <T> xsbti.api.Lazy<T> strict(T value) {
// Convert strict parameter to sbt function returning it
return apply(new Supplier<T>() {
@Override
public T get() {
return value;
}
});
return new StrictImpl<T>(value);
}

private static final class Thunky<T> {
Expand Down Expand Up @@ -68,4 +63,10 @@ public T get() {
return t.result;
}
}

private static final class StrictImpl<T> extends xsbti.api.AbstractLazy<T> {
private final T value;
StrictImpl(T value) { this.value = value; }
public T get() { return value; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ static AnalysisStore sync(AnalysisStore analysisStore) {
*/
void set(AnalysisContents analysisContents);

/**
* Resets in memory cached {@link AnalysisContents}
*/
default void clearCache() {}

final class CachedAnalysisStore implements AnalysisStore {
private AnalysisStore underlying;
private Optional<AnalysisContents> lastStore = Optional.empty();
Expand All @@ -121,6 +126,10 @@ public void set(AnalysisContents analysisContents) {
underlying.set(analysisContents);
lastStore = Optional.of(analysisContents);
}

public void clearCache() {
lastStore = Optional.empty();
}
}

final class SyncedAnalysisStore implements AnalysisStore {
Expand All @@ -141,5 +150,11 @@ public void set(AnalysisContents analysisContents) {
underlying.set(analysisContents);
}
}

public void clearCache() {
if (underlying instanceof CachedAnalysisStore) {
underlying.clearCache();
}
}
}
}
46 changes: 33 additions & 13 deletions internal/zinc-apiinfo/src/main/scala/xsbt/api/APIUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ object APIUtil {
def minimizeDefinition(d: Definition): Array[Definition] =
d match {
case c: ClassLike => Array(minimizeClass(c))
case _ => Array()
case _ => emptyDefs
}
def minimizeClass(c: ClassLike): ClassLike = {
val savedAnnotations = Discovery.defAnnotations(c.structure, (_: Any) => true).toArray[String]
Expand All @@ -73,7 +73,7 @@ object APIUtil {
c.modifiers,
c.annotations,
c.definitionType,
lzy(emptyType),
emptyTypeLzy,
lzy(struct),
savedAnnotations,
c.childrenOfSealedClass,
Expand All @@ -91,8 +91,10 @@ object APIUtil {
def filterDefinitions(
ds: Array[ClassDefinition],
isModule: Boolean
): Lazy[Array[ClassDefinition]] =
lzy(if (isModule) ds filter Discovery.isMainMethod else Array())
): Lazy[Array[ClassDefinition]] = {
val mains = if (isModule) ds.filter(Discovery.isMainMethod) else emptyClassDefs
if (mains.isEmpty) emptyClassDefsLzy else lzy(mains)
}

def isNonPrivate(d: Definition): Boolean = isNonPrivate(d.access)

Expand All @@ -104,23 +106,41 @@ object APIUtil {
}
private val emptyModifiers =
new Modifiers(false, false, false, false, false, false, false, false)
private val emptyStructure = Structure.of(lzy(Array.empty), lzy(Array.empty), lzy(Array.empty))
def emptyClassLike(name: String, definitionType: DefinitionType): ClassLike =
xsbti.api.ClassLike.of(
name,
private[this] val emptyType = EmptyType.of()
private val emptyTypeLzy = lzy(emptyType: Type)
private val emptyDefs = Array.empty[Definition]
private val emptyClassDefs = Array.empty[ClassDefinition]
private val emptyClassDefsLzy = lzy(emptyClassDefs)
private val emptyStructure = Structure.of(lzy(Array.empty), emptyClassDefsLzy, emptyClassDefsLzy)
private val emptyStructureLzy = lzy(emptyStructure)
private val emptyClassLikeTemplate =
ClassLike.of(
null,
Public.of(),
emptyModifiers,
Array.empty,
definitionType,
lzy(emptyType),
lzy(emptyStructure),
null,
emptyTypeLzy,
emptyStructureLzy,
Array.empty,
Array.empty,
true,
Array.empty
)
def emptyClassLike(name: String, definitionType: DefinitionType): ClassLike =
ClassLike.of(
name,
emptyClassLikeTemplate.access,
emptyClassLikeTemplate.modifiers,
emptyClassLikeTemplate.annotations,
definitionType,
emptyTypeLzy,
emptyStructureLzy,
emptyClassLikeTemplate.savedAnnotations,
emptyClassLikeTemplate.childrenOfSealedClass,
emptyClassLikeTemplate.topLevel,
emptyClassLikeTemplate.typeParameters,
)

private[this] def lzy[T <: AnyRef](t: T): Lazy[T] = SafeLazyProxy.strict(t)

private[this] val emptyType = EmptyType.of()
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import java.util.function.Supplier

/**
* Proxy `SafeLazy` functionality from the Java implementation
* implementation in xsbt.api.SafeLazy to Scala helpers.
* in xsbt.api.SafeLazy to Scala helpers.
*
* The implementation of these helpers are not reused between each
* other because they create intermediate anonymous functions and
Expand All @@ -35,7 +35,6 @@ object SafeLazyProxy {
* Return a lazy implementation of a strict value.
*/
def strict[T](s: T): Lazy[T] = {
val sbtThunk = new Supplier[T] { override def get() = s }
SafeLazy.apply(sbtThunk)
SafeLazy.strict(s)
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Lightbend, Inc. and Mark Harrah
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Lightbend, Inc. and Mark Harrah
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Lightbend, Inc. and Mark Harrah
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Lightbend, Inc. and Mark Harrah
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
* Zinc - The incremental compiler for Scala.
* Copyright Lightbend, Inc. and Mark Harrah
* Copyright Scala Center, Lightbend, and Mark Harrah
*
* Licensed under Apache License 2.0
* (http://www.apache.org/licenses/LICENSE-2.0).
* SPDX-License-Identifier: Apache-2.0
*
* See the NOTICE file distributed with this work for
* additional information regarding copyright ownership.
Expand Down
Loading
Loading