diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5bb26241c..cc56a380e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml index f9ead39fdc..91f51361e9 100644 --- a/.github/workflows/cla.yml +++ b/.github/workflows/cla.yml @@ -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; diff --git a/.scala-steward.conf b/.scala-steward.conf index 00e3eba3a2..bca00ae028 100644 --- a/.scala-steward.conf +++ b/.scala-steward.conf @@ -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." } ] diff --git a/internal/compiler-bridge/src/main/scala/scala/reflect/ReflectAccess.scala b/internal/compiler-bridge/src/main/scala/scala/reflect/ReflectAccess.scala index bdf8f342e3..30de6319eb 100644 --- a/internal/compiler-bridge/src/main/scala/scala/reflect/ReflectAccess.scala +++ b/internal/compiler-bridge/src/main/scala/scala/reflect/ReflectAccess.scala @@ -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 diff --git a/internal/compiler-bridge/src/main/scala/xsbt/Dependency.scala b/internal/compiler-bridge/src/main/scala/xsbt/Dependency.scala index e7425ca1b4..6b1c2ec155 100644 --- a/internal/compiler-bridge/src/main/scala/xsbt/Dependency.scala +++ b/internal/compiler-bridge/src/main/scala/xsbt/Dependency.scala @@ -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 { @@ -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) diff --git a/internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala b/internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala index fb77ed6c4d..28de452dcc 100644 --- a/internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala +++ b/internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala @@ -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. @@ -836,9 +837,8 @@ class ExtractAPI[GlobalType <: Global]( constructorNameAsString(s.enclClass) else { val decoded = name.decode - val constructorWithDefaultArgument = "\\$default\\$(\\d+)".r decoded match { - case constructorWithDefaultArgument(index) => constructorNameAsString(s.enclClass, index) + case ConstructorWithDefaultArgument(index) => constructorNameAsString(s.enclClass, index) case _ => decoded } } @@ -866,4 +866,5 @@ class ExtractAPI[GlobalType <: Global]( object ExtractAPI { private val emptyAnnotationArray = new Array[xsbti.api.Annotation](0) + private val ConstructorWithDefaultArgument = "\\$default\\$(\\d+)".r } diff --git a/internal/compiler-bridge/src/main/scala/xsbt/trace.scala b/internal/compiler-bridge/src/main/scala/xsbt/trace.scala index c219b1a444..d71fe4b2f1 100644 --- a/internal/compiler-bridge/src/main/scala/xsbt/trace.scala +++ b/internal/compiler-bridge/src/main/scala/xsbt/trace.scala @@ -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 { diff --git a/internal/compiler-interface/src/main/java/xsbti/BasicHashedVirtualFileRef.java b/internal/compiler-interface/src/main/java/xsbti/BasicHashedVirtualFileRef.java index f497e79c11..a4ab7cb4be 100644 --- a/internal/compiler-interface/src/main/java/xsbti/BasicHashedVirtualFileRef.java +++ b/internal/compiler-interface/src/main/java/xsbti/BasicHashedVirtualFileRef.java @@ -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. diff --git a/internal/compiler-interface/src/main/java/xsbti/HashedVirtualFileRef.java b/internal/compiler-interface/src/main/java/xsbti/HashedVirtualFileRef.java index 2413e04aab..253c687b10 100644 --- a/internal/compiler-interface/src/main/java/xsbti/HashedVirtualFileRef.java +++ b/internal/compiler-interface/src/main/java/xsbti/HashedVirtualFileRef.java @@ -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. diff --git a/internal/compiler-interface/src/main/java/xsbti/api/SafeLazy.java b/internal/compiler-interface/src/main/java/xsbti/api/SafeLazy.java index 65ae4a55cb..318f75d061 100644 --- a/internal/compiler-interface/src/main/java/xsbti/api/SafeLazy.java +++ b/internal/compiler-interface/src/main/java/xsbti/api/SafeLazy.java @@ -15,7 +15,7 @@ /** * Implement a Scala `lazy val` in Java for the facing sbt interface. - * + *

* 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]] @@ -34,12 +34,7 @@ public static xsbti.api.Lazy apply(Supplier sbtThunk) { /** Return a sbt [[xsbti.api.Lazy]] from a strict value. */ public static xsbti.api.Lazy strict(T value) { // Convert strict parameter to sbt function returning it - return apply(new Supplier() { - @Override - public T get() { - return value; - } - }); + return new StrictImpl(value); } private static final class Thunky { @@ -68,4 +63,10 @@ public T get() { return t.result; } } + + private static final class StrictImpl extends xsbti.api.AbstractLazy { + private final T value; + StrictImpl(T value) { this.value = value; } + public T get() { return value; } + } } diff --git a/internal/compiler-interface/src/main/java/xsbti/compile/AnalysisStore.java b/internal/compiler-interface/src/main/java/xsbti/compile/AnalysisStore.java index db0185fa50..d04adc3daa 100644 --- a/internal/compiler-interface/src/main/java/xsbti/compile/AnalysisStore.java +++ b/internal/compiler-interface/src/main/java/xsbti/compile/AnalysisStore.java @@ -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 lastStore = Optional.empty(); @@ -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 { @@ -141,5 +150,11 @@ public void set(AnalysisContents analysisContents) { underlying.set(analysisContents); } } + + public void clearCache() { + if (underlying instanceof CachedAnalysisStore) { + underlying.clearCache(); + } + } } } diff --git a/internal/zinc-apiinfo/src/main/scala/xsbt/api/APIUtil.scala b/internal/zinc-apiinfo/src/main/scala/xsbt/api/APIUtil.scala index 567e0f44fb..578bd6aab0 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/APIUtil.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/APIUtil.scala @@ -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] @@ -73,7 +73,7 @@ object APIUtil { c.modifiers, c.annotations, c.definitionType, - lzy(emptyType), + emptyTypeLzy, lzy(struct), savedAnnotations, c.childrenOfSealedClass, @@ -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) @@ -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() } diff --git a/internal/zinc-apiinfo/src/main/scala/xsbt/api/SafeLazyProxy.scala b/internal/zinc-apiinfo/src/main/scala/xsbt/api/SafeLazyProxy.scala index 996255e10a..efc22150aa 100644 --- a/internal/zinc-apiinfo/src/main/scala/xsbt/api/SafeLazyProxy.scala +++ b/internal/zinc-apiinfo/src/main/scala/xsbt/api/SafeLazyProxy.scala @@ -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 @@ -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) } } diff --git a/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassCanonicalNameSpec.scala b/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassCanonicalNameSpec.scala index 8bc2db7d30..173fb9cffe 100644 --- a/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassCanonicalNameSpec.scala +++ b/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassCanonicalNameSpec.scala @@ -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. diff --git a/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassToAPISpecification.scala b/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassToAPISpecification.scala index 462c8be254..8bf9f4cc9a 100644 --- a/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassToAPISpecification.scala +++ b/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassToAPISpecification.scala @@ -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. diff --git a/internal/zinc-apiinfo/src/test/scala/xsbt/api/ClassLikeHelpers.scala b/internal/zinc-apiinfo/src/test/scala/xsbt/api/ClassLikeHelpers.scala index 8f66e28d59..21a86df644 100644 --- a/internal/zinc-apiinfo/src/test/scala/xsbt/api/ClassLikeHelpers.scala +++ b/internal/zinc-apiinfo/src/test/scala/xsbt/api/ClassLikeHelpers.scala @@ -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. diff --git a/internal/zinc-apiinfo/src/test/scala/xsbt/api/HashAPISpecification.scala b/internal/zinc-apiinfo/src/test/scala/xsbt/api/HashAPISpecification.scala index 507d7e7a6a..ed2cf24c59 100644 --- a/internal/zinc-apiinfo/src/test/scala/xsbt/api/HashAPISpecification.scala +++ b/internal/zinc-apiinfo/src/test/scala/xsbt/api/HashAPISpecification.scala @@ -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. diff --git a/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala b/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala index 9c010e2f0b..7542839088 100644 --- a/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala +++ b/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala @@ -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. diff --git a/internal/zinc-benchmarks/src/test/scala/xsbt/AnalysisFormatBenchmark.scala b/internal/zinc-benchmarks/src/test/scala/xsbt/AnalysisFormatBenchmark.scala index 5b413af13c..3991175343 100644 --- a/internal/zinc-benchmarks/src/test/scala/xsbt/AnalysisFormatBenchmark.scala +++ b/internal/zinc-benchmarks/src/test/scala/xsbt/AnalysisFormatBenchmark.scala @@ -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 import java.io.File @@ -45,7 +56,7 @@ class AnalysisFormatBenchmark { ) writeAll( "-ref-cbin-nosort", - ConsistentFileAnalysisStore.binary(_, ReadWriteMappers.getEmptyMappers, sort = false), + ConsistentFileAnalysisStore.binary(_, ReadWriteMappers.getEmptyMappers, reproducible = false), cached ) println("Sizes:") @@ -83,7 +94,11 @@ class AnalysisFormatBenchmark { bh.consume( writeAll( "-test-cbin-nosort", - ConsistentFileAnalysisStore.binary(_, ReadWriteMappers.getEmptyMappers, sort = false), + ConsistentFileAnalysisStore.binary( + _, + ReadWriteMappers.getEmptyMappers, + reproducible = false + ), cached ) ) @@ -93,7 +108,7 @@ class AnalysisFormatBenchmark { cached.foreach { case (s, a) => val ser = new NullSerializer - val af = new ConsistentAnalysisFormat(ReadWriteMappers.getEmptyMappers, sort = true) + val af = new ConsistentAnalysisFormat(ReadWriteMappers.getEmptyMappers, reproducible = true) af.write(ser, a.getAnalysis, a.getMiniSetup) bh.consume(ser.count) } @@ -104,7 +119,8 @@ class AnalysisFormatBenchmark { cached.foreach { case (s, a) => val ser = new NullSerializer - val af = new ConsistentAnalysisFormat(ReadWriteMappers.getEmptyMappers, sort = false) + val af = + new ConsistentAnalysisFormat(ReadWriteMappers.getEmptyMappers, reproducible = false) af.write(ser, a.getAnalysis, a.getMiniSetup) bh.consume(ser.count) } diff --git a/internal/zinc-benchmarks/src/test/scala/xsbt/BenchmarkBase.scala b/internal/zinc-benchmarks/src/test/scala/xsbt/BenchmarkBase.scala index 7acf62ea75..fda6b06f3a 100644 --- a/internal/zinc-benchmarks/src/test/scala/xsbt/BenchmarkBase.scala +++ b/internal/zinc-benchmarks/src/test/scala/xsbt/BenchmarkBase.scala @@ -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. diff --git a/internal/zinc-benchmarks/src/test/scala/xsbt/BenchmarkProjects.scala b/internal/zinc-benchmarks/src/test/scala/xsbt/BenchmarkProjects.scala index 3ad7e0fa4c..dd39f883b5 100644 --- a/internal/zinc-benchmarks/src/test/scala/xsbt/BenchmarkProjects.scala +++ b/internal/zinc-benchmarks/src/test/scala/xsbt/BenchmarkProjects.scala @@ -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. diff --git a/internal/zinc-benchmarks/src/test/scala/xsbt/GlobalBenchmarkSetup.scala b/internal/zinc-benchmarks/src/test/scala/xsbt/GlobalBenchmarkSetup.scala index 01f6757d39..44c5fc24de 100644 --- a/internal/zinc-benchmarks/src/test/scala/xsbt/GlobalBenchmarkSetup.scala +++ b/internal/zinc-benchmarks/src/test/scala/xsbt/GlobalBenchmarkSetup.scala @@ -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. diff --git a/internal/zinc-benchmarks/src/test/scala/xsbt/ScalacBenchmark.scala b/internal/zinc-benchmarks/src/test/scala/xsbt/ScalacBenchmark.scala index 0b85d31bb3..4ffd685d97 100644 --- a/internal/zinc-benchmarks/src/test/scala/xsbt/ScalacBenchmark.scala +++ b/internal/zinc-benchmarks/src/test/scala/xsbt/ScalacBenchmark.scala @@ -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. diff --git a/internal/zinc-benchmarks/src/test/scala/xsbt/ShapelessBenchmark.scala b/internal/zinc-benchmarks/src/test/scala/xsbt/ShapelessBenchmark.scala index cd1028281f..45e90fb06e 100644 --- a/internal/zinc-benchmarks/src/test/scala/xsbt/ShapelessBenchmark.scala +++ b/internal/zinc-benchmarks/src/test/scala/xsbt/ShapelessBenchmark.scala @@ -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. diff --git a/internal/zinc-benchmarks/src/test/scala/xsbt/ZincBenchmark.scala b/internal/zinc-benchmarks/src/test/scala/xsbt/ZincBenchmark.scala index 72e6dfeb30..3d63d60470 100644 --- a/internal/zinc-benchmarks/src/test/scala/xsbt/ZincBenchmark.scala +++ b/internal/zinc-benchmarks/src/test/scala/xsbt/ZincBenchmark.scala @@ -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. diff --git a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/AnalyzeSpecification.scala b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/AnalyzeSpecification.scala index dd116930b8..9386d8f783 100644 --- a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/AnalyzeSpecification.scala +++ b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/AnalyzeSpecification.scala @@ -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. diff --git a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/IndexBasedZipFsOpsSpec.scala b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/IndexBasedZipFsOpsSpec.scala index bdce9975d0..db86527aed 100644 --- a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/IndexBasedZipFsOpsSpec.scala +++ b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/IndexBasedZipFsOpsSpec.scala @@ -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 sbt.internal.inc package classfile diff --git a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala index 779613d4ab..f43f828840 100644 --- a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala +++ b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala @@ -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. diff --git a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/ParserSpecification.scala b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/ParserSpecification.scala index 4305846706..9ac6dff080 100644 --- a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/ParserSpecification.scala +++ b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/ParserSpecification.scala @@ -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. diff --git a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ScalaInstance.scala b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ScalaInstance.scala index b282301521..5ff49a0307 100644 --- a/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ScalaInstance.scala +++ b/internal/zinc-classpath/src/main/scala/sbt/internal/inc/ScalaInstance.scala @@ -266,12 +266,12 @@ object ScalaInstance { /** Return all the required Scala jars from a path `scalaHome`. */ def allJars(scalaHome: File): Seq[File] = - IO.listFiles(scalaLib(scalaHome)).toIndexedSeq.filter(f => !blacklist(f.getName)) + IO.listFiles(scalaLib(scalaHome)).toIndexedSeq.filter(f => !excludeList(f.getName)) private[this] def scalaLib(scalaHome: File): File = new File(scalaHome, "lib") - private[this] val blacklist: Set[String] = Set( + private[this] val excludeList: Set[String] = Set( "scala-actors.jar", "scalacheck.jar", "scala-partest.jar", diff --git a/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/bad.java b/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/bad.java index 401fe111d5..72b0ed06d7 100644 --- a/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/bad.java +++ b/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/bad.java @@ -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. diff --git a/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/good.java b/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/good.java index 8a1ca52360..e3b2107f5b 100644 --- a/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/good.java +++ b/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/good.java @@ -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. diff --git a/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/hasstaticfinal.java b/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/hasstaticfinal.java index 8b00b1eedf..a8f480fdc5 100644 --- a/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/hasstaticfinal.java +++ b/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/hasstaticfinal.java @@ -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. diff --git a/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/test1.java b/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/test1.java index 9c31e8d21a..ba68925f70 100644 --- a/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/test1.java +++ b/internal/zinc-compile-core/src/test/resources/sbt/internal/inc/javac/test1.java @@ -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. diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/ClassFileManagerDefaultsSpec.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/ClassFileManagerDefaultsSpec.scala index 610a9184f5..afc40cdda6 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/ClassFileManagerDefaultsSpec.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/ClassFileManagerDefaultsSpec.scala @@ -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. diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/TestClassFileManager.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/TestClassFileManager.scala index 17eb20adc3..fb4ecbc81f 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/TestClassFileManager.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/TestClassFileManager.scala @@ -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. diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/VirtualDirectoryTest.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/VirtualDirectoryTest.scala index 867bed4319..fe3effa917 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/VirtualDirectoryTest.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/VirtualDirectoryTest.scala @@ -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. diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingLogger.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingLogger.scala index 837e771e2e..952c52eb8b 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingLogger.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingLogger.scala @@ -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. diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala index b71efa7bc4..8d29b3c17b 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala @@ -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. diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaCompilerSpec.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaCompilerSpec.scala index ceb2a56ae6..601e88e5be 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaCompilerSpec.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaCompilerSpec.scala @@ -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. diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaErrorParserSpec.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaErrorParserSpec.scala index b092adfff8..15c8bd23d5 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaErrorParserSpec.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaErrorParserSpec.scala @@ -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. diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaErrorPositionTranslator.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaErrorPositionTranslator.scala index f56d6aa8ec..e7adbddfd4 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaErrorPositionTranslator.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaErrorPositionTranslator.scala @@ -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. diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala index e0ab4ab8f9..6e8841663f 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala @@ -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. diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/Incremental.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/Incremental.scala index d15c8f3be2..1fe34c19b2 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/Incremental.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/Incremental.scala @@ -70,14 +70,18 @@ object Incremental { * Merge latest analysis as of pickling into pruned previous analysis, compute invalidations * and decide whether we need another cycle. */ - def mergeAndInvalidate(partialAnalysis: Analysis, completingCycle: Boolean): CompileCycleResult + def mergeAndInvalidate( + partialAnalysis: Analysis, + shouldRegisterCycle: Boolean + ): CompileCycleResult /** * Merge latest analysis as of analyzer into pruned previous analysis and inform file manager. */ def completeCycle( prev: Option[CompileCycleResult], - partialAnalysis: Analysis + partialAnalysis: Analysis, + shouldRegisterCycle: Boolean ): CompileCycleResult def previousAnalysisPruned: Analysis @@ -938,7 +942,13 @@ private final class AnalysisCallback( if (!writtenEarlyArtifacts) // writing implies the updates merge has happened mergeUpdates() // must merge updates each cycle or else scalac will clobber it } - incHandler.completeCycle(invalidationResults, getAnalysis) + + val partialAnalysis = getAnalysis + val hasScala = Analysis.sources(partialAnalysis).scala.nonEmpty + // If we had early output and scala sources, then the cycle has already been registered + val shouldRegisterCycle = earlyOutput.isEmpty || !hasScala + + incHandler.completeCycle(invalidationResults, partialAnalysis, shouldRegisterCycle) } else { throw new IllegalStateException( "can't call AnalysisCallback#getCycleResultOnce more than once" @@ -1112,12 +1122,12 @@ private final class AnalysisCallback( override def apiPhaseCompleted(): Unit = { // If we know we're done with cycles (presumably because all sources were invalidated) we can store early analysis - // and picke data now. Otherwise, we need to wait for dependency information to decide if there are more cycles. + // and pickle data now. Otherwise, we need to wait for dependency information to decide if there are more cycles. incHandlerOpt foreach { incHandler => if (earlyOutput.isDefined && incHandler.isFullCompilation) { val a = getAnalysis val CompileCycleResult(continue, invalidations, merged) = - incHandler.mergeAndInvalidate(a, false) + incHandler.mergeAndInvalidate(a, shouldRegisterCycle = true) if (lookup.shouldDoEarlyOutput(merged)) { assert( !continue && invalidations.isEmpty, @@ -1135,7 +1145,7 @@ private final class AnalysisCallback( if (earlyOutput.isDefined && invalidationResults.isEmpty) { val a = getAnalysis val CompileCycleResult(continue, invalidations, merged) = - incHandler.mergeAndInvalidate(a, false) + incHandler.mergeAndInvalidate(a, shouldRegisterCycle = true) // Store invalidations and continuation decision; the analysis will be computed again after Analyze phase. invalidationResults = Some(CompileCycleResult(continue, invalidations, Analysis.empty)) // If there will be no more compilation cycles, store the early analysis file and update the pickle jar diff --git a/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala b/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala index f78e7cf283..94752d26be 100644 --- a/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala +++ b/internal/zinc-core/src/main/scala/sbt/internal/inc/IncrementalCommon.scala @@ -158,7 +158,7 @@ private[inc] abstract class IncrementalCommon( override def mergeAndInvalidate( partialAnalysis: Analysis, - completingCycle: Boolean + shouldRegisterCycle: Boolean, ): CompileCycleResult = { val analysis = if (isFullCompilation) @@ -190,10 +190,7 @@ private[inc] abstract class IncrementalCommon( val continue = nextInvalidations.nonEmpty && lookup.shouldDoIncrementalCompilation(nextInvalidations, analysis) - val hasScala = Analysis.sources(partialAnalysis).scala.nonEmpty - - // If we're completing the cycle and we had scala sources, then mergeAndInvalidate has already been called - if (!completingCycle || !hasScala) { + if (shouldRegisterCycle) { registerCycle(recompiledClasses, newApiChanges, nextInvalidations, continue) } CompileCycleResult(continue, nextInvalidations, analysis) @@ -201,12 +198,13 @@ private[inc] abstract class IncrementalCommon( override def completeCycle( prev: Option[CompileCycleResult], - partialAnalysis: Analysis + partialAnalysis: Analysis, + shouldRegisterCycle: Boolean ): CompileCycleResult = { classFileManager.generated(partialAnalysis.relations.allProducts.map(toVf).toArray) prev match { case Some(prev) => prev.copy(analysis = pruned ++ partialAnalysis) - case _ => mergeAndInvalidate(partialAnalysis, true) + case _ => mergeAndInvalidate(partialAnalysis, shouldRegisterCycle) } } } diff --git a/internal/zinc-core/src/test/scala/sbt/internal/inc/HashSpec.scala b/internal/zinc-core/src/test/scala/sbt/internal/inc/HashSpec.scala index 5b5920195b..b5c371c01b 100644 --- a/internal/zinc-core/src/test/scala/sbt/internal/inc/HashSpec.scala +++ b/internal/zinc-core/src/test/scala/sbt/internal/inc/HashSpec.scala @@ -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. diff --git a/internal/zinc-core/src/test/scala/sbt/internal/inc/MiniSetupUtilSpec.scala b/internal/zinc-core/src/test/scala/sbt/internal/inc/MiniSetupUtilSpec.scala index 7ae876500b..f4368d7794 100644 --- a/internal/zinc-core/src/test/scala/sbt/internal/inc/MiniSetupUtilSpec.scala +++ b/internal/zinc-core/src/test/scala/sbt/internal/inc/MiniSetupUtilSpec.scala @@ -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. diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ConsistentAnalysisFormat.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ConsistentAnalysisFormat.scala index a5ca285439..b217c47997 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ConsistentAnalysisFormat.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ConsistentAnalysisFormat.scala @@ -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 sbt.internal.inc.consistent import java.nio.file.Paths @@ -25,7 +36,7 @@ import sbt.internal.inc.binary.converters.InternalApiProxy * - Faster serialization and deserialization than the existing binary format. * - Smaller implementation than either of the existing formats. */ -class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) { +class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, reproducible: Boolean) { import ConsistentAnalysisFormat._ private[this] final val VERSION = 1100029 @@ -41,6 +52,7 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) { writeAPIs(out, analysis0.apis, setup.storeApis()) writeSourceInfos(out, analysis0.infos) // we do not read or write the Compilations + // as zinc does not use Compilations from deserialized analysis out.int(VERSION) out.end() } @@ -53,6 +65,7 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) { val apis = readAPIs(in, setup.storeApis()) val infos = readSourceInfos(in) // we do not read or write the Compilations + // as zinc does not use Compilations from deserialized analysis val compilations = Compilations.of(Nil) readVersion(in) in.end() @@ -65,9 +78,12 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) { name: String, map: scala.collection.Iterable[(String, V)], perEntry: Int = 1 - )(f: V => Unit): Unit = - if (sort) out.writeSortedStringMap(name, map, perEntry)(f) + )(f: V => Unit): Unit = { + // For reproducible output, need to write strings in sorted order + // otherwise strings may be written in different order resulting in different output + if (reproducible) out.writeSortedStringMap(name, map, perEntry)(f) else out.writeColl(name, map, perEntry + 1) { kv => out.string(kv._1); f(kv._2) } + } private[this] def readVersion(in: Deserializer): Unit = { val ver = in.int() @@ -149,7 +165,7 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) { out.long(ac.bytecodeHash()) out.long(ac.transitiveBytecodeHash()) val nh0 = ac.nameHashes() - val nh = if (nh0.length > 1 && sort) { + val nh = if (nh0.length > 1 && reproducible) { val nh = nh0.clone() Arrays.sort(nh, nameHashComparator) nh @@ -192,14 +208,17 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) { } private[this] def writeAPIs(out: Serializer, apis: APIs, storeApis: Boolean): Unit = { - def write(n: String, m: Map[String, AnalyzedClass]): Unit = + def write(n: String, m: Map[String, AnalyzedClass]): Unit = { writeMaybeSortedStringMap( out, n, - m.view.mapValues(_.withCompilationTimestamp(DefaultCompilationTimestamp)) + if (reproducible) m.mapValues(_.withCompilationTimestamp(DefaultCompilationTimestamp)) + else m ) { ac => writeAnalyzedClass(out, ac, storeApis) } + } + write("internal", apis.internal) write("external", apis.external) } @@ -346,7 +365,7 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) { rel.forwardMap.view.map { case (k, vs) => kf(k) -> vs } ) { vs => val a = vs.iterator.map(vf).toArray - if (sort) Arrays.sort(a, implicitly[Ordering[String]]) + if (reproducible) Arrays.sort(a, implicitly[Ordering[String]]) out.writeColl("item", a)(out.string) } def wrS(name: String, rel: Relation[String, String]): Unit = @@ -421,11 +440,11 @@ class ConsistentAnalysisFormat(val mappers: ReadWriteMappers, sort: Boolean) { if (sc.contains(UseScope.PatMatTarget)) i += 4 (un.name, i.toByte) }.toArray.groupBy(_._2) - val groups = if (sort) groups0.toVector.sortBy(_._1) else groups0 + val groups = if (reproducible) groups0.toVector.sortBy(_._1) else groups0 out.writeColl("groups", groups, 2) { case (g, gNames) => out.byte(g) val names = gNames.map(_._1) - if (sort) Arrays.sort(names, implicitly[Ordering[String]]) + if (reproducible) Arrays.sort(names, implicitly[Ordering[String]]) out.writeStringColl("names", names) } } diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ConsistentFileAnalysisStore.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ConsistentFileAnalysisStore.scala index 418eae932b..469c3a72c5 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ConsistentFileAnalysisStore.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ConsistentFileAnalysisStore.scala @@ -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. + */ + // Based on zinc's FileAnalysisStore: package sbt.internal.inc.consistent @@ -24,12 +35,12 @@ object ConsistentFileAnalysisStore { def text( file: File, mappers: ReadWriteMappers, - sort: Boolean = true, + reproducible: Boolean = true, parallelism: Int = Runtime.getRuntime.availableProcessors() ): XAnalysisStore = new AStore( file, - new ConsistentAnalysisFormat(mappers, sort), + new ConsistentAnalysisFormat(mappers, reproducible), SerializerFactory.text, parallelism ) @@ -38,7 +49,7 @@ object ConsistentFileAnalysisStore { binary( file, mappers = ReadWriteMappers.getEmptyMappers(), - sort = true, + reproducible = true, ) def binary( @@ -48,18 +59,18 @@ object ConsistentFileAnalysisStore { binary( file, mappers, - sort = true, + reproducible = true, ) def binary( file: File, mappers: ReadWriteMappers, - sort: Boolean, + reproducible: Boolean, parallelism: Int = Runtime.getRuntime.availableProcessors() ): XAnalysisStore = new AStore( file, - new ConsistentAnalysisFormat(mappers, sort), + new ConsistentAnalysisFormat(mappers, reproducible), SerializerFactory.binary, parallelism ) diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ParallelGzipOutputStream.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ParallelGzipOutputStream.scala index 0419abf820..39be1419c2 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ParallelGzipOutputStream.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/ParallelGzipOutputStream.scala @@ -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. + */ + // Original code by Stefan Zeiger (see https://github.com/szeiger/zinc/blob/1d296b2fbeaae1cf14e4c00db0bbc2203f9783a4/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/NewParallelGzipOutputStream.scala) // Modified by Rex Kerr to use Java threads directly rather than Future package sbt.internal.inc.consistent diff --git a/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/Serializer.scala b/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/Serializer.scala index 4eec2f28bd..70f5496ff7 100644 --- a/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/Serializer.scala +++ b/internal/zinc-persist/src/main/scala/sbt/internal/inc/consistent/Serializer.scala @@ -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 sbt.internal.inc.consistent import java.io.{ diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisFormatHelpers.scala b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisFormatHelpers.scala index e4d1e23f9d..fd9a37bcb8 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisFormatHelpers.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisFormatHelpers.scala @@ -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. diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala index 8ec26c311d..2273d2bbad 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala @@ -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. diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala index 66aa679236..5b88ee2ce1 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala @@ -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. diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryMappersSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryMappersSpecification.scala index 1e63afb3fb..b586e7651a 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryMappersSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryMappersSpecification.scala @@ -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. diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/binary/converter/InternalApiProxySpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/binary/converter/InternalApiProxySpecification.scala index b7e776b49b..161a734d39 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/binary/converter/InternalApiProxySpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/binary/converter/InternalApiProxySpecification.scala @@ -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. diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ConsistentAnalysisFormatIntegrationSuite.scala b/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ConsistentAnalysisFormatIntegrationSuite.scala index 4b953fa29c..05a224d433 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ConsistentAnalysisFormatIntegrationSuite.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ConsistentAnalysisFormatIntegrationSuite.scala @@ -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 sbt.inc.consistent import java.io.{ File, FileInputStream } diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ConsistentAnalysisFormatSuite.scala b/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ConsistentAnalysisFormatSuite.scala index 02f9457723..2b1c78ecaa 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ConsistentAnalysisFormatSuite.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ConsistentAnalysisFormatSuite.scala @@ -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 sbt.inc.consistent import org.scalatest.funsuite.AnyFunSuite diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ParallelGzipOutputStreamSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ParallelGzipOutputStreamSpecification.scala index 061064eeab..f990e7caea 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ParallelGzipOutputStreamSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/consistent/ParallelGzipOutputStreamSpecification.scala @@ -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 sbt.inc.consistent import org.scalatest.flatspec.AnyFlatSpec diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/text/Base64Specification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/text/Base64Specification.scala index 9073b31591..2753b3e9a1 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/text/Base64Specification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/text/Base64Specification.scala @@ -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. diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatHelpers.scala b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatHelpers.scala index aedd0ab6fd..220672a49f 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatHelpers.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatHelpers.scala @@ -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. diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala index 16d3d237e5..4e3cea4c10 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala @@ -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. diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextMappersSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextMappersSpecification.scala index d286b73f5e..fea4f2b95b 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextMappersSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextMappersSpecification.scala @@ -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. diff --git a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala index dc66e27216..57ae6d5cfb 100644 --- a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala +++ b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala @@ -26,11 +26,14 @@ import xsbti.{ FileConverter, Problem, Severity, VirtualFileRef, VirtualFile } import xsbti.compile.{ AnalysisContents, AnalysisStore, + ClassFileManager => XClassFileManager, ClasspathOptionsUtil, CompileAnalysis, CompileOrder, CompileProgress, + DefaultExternalHooks, DefinesClass, + ExternalHooks, IncOptions, IncOptionsUtil, PerClasspathEntryLookup, @@ -229,6 +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) + }, // 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 @@ -336,6 +342,7 @@ case class ProjectStructure( val earlyCacheFile = baseDirectory / "target" / "early" / "inc_compile.zip" val earlyAnalysisStore = FileAnalysisStore.binary(earlyCacheFile.toFile) // val earlyCachedStore = AnalysisStore.cached(fileStore) + val profiler = new ZincInvalidationProfiler // We specify the class file manager explicitly even though it's noew possible // to specify it in the incremental option property file (this is the default for sbt) @@ -432,6 +439,15 @@ case class ProjectStructure( () } + def checkNumberOfCycles(i: IncState, expected: Int): Future[Unit] = + compile(i).map { _ => + import scala.collection.JavaConverters._ + val count = profiler.toProfile.getRunsList.asScala.map(_.getCyclesList.size).sum + val msg = s"Expected $expected cycles, got $count" + assert(count == expected, msg) + () + } + def checkClasses(i: IncState, src: String, expected: List[String]): Future[Unit] = compile(i).map { analysis => def classes(src: String): Set[String] = @@ -791,10 +807,13 @@ case class ProjectStructure( import scala.jdk.CollectionConverters._ val map = new java.util.HashMap[String, String] properties.asScala foreach { case (k: String, v: String) => map.put(k, v) } + val externalHooks = new DefaultExternalHooks(Optional.empty[ExternalHooks.Lookup], Optional.empty[XClassFileManager]) + .withInvalidationProfiler(profiler) val base = IncOptions .of() .withPipelining(defaultPipelining) .withApiDebug(true) + .withExternalHooks(externalHooks) // .withRelationsDebug(true) val incOptions = { val opts = IncOptionsUtil.fromStringMap(base, map, scriptedLog) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 863886ca73..45fd811598 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -17,7 +17,7 @@ object Dependencies { val scala212_213 = Seq(defaultScalaVersion, scala213) val scala3_only = Seq(scala3) - private val ioVersion = nightlyVersion.getOrElse("1.10.1") + private val ioVersion = nightlyVersion.getOrElse("1.10.2") private val utilVersion = nightlyVersion.getOrElse("2.0.0-M1") private val sbtIO = "org.scala-sbt" %% "io" % ioVersion diff --git a/project/build.properties b/project/build.properties index 0b699c3052..e88a0d817d 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.10.2 +sbt.version=1.10.6 diff --git a/project/plugins.sbt b/project/plugins.sbt index 140bd7b155..91243639d4 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,13 +1,13 @@ scalacOptions += "-feature" -addSbtPlugin("com.github.sbt" % "sbt-dynver" % "5.0.1") -addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.0") +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.scala-sbt" % "sbt-contraband" % "0.6.0") +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.12.0") -addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.0") +addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.13.1") +addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.10.1") addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.2.0") addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.2") diff --git a/zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala b/zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala index 2a4ea46fda..dba096ec06 100644 --- a/zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala +++ b/zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala @@ -507,7 +507,7 @@ object MixedAnalyzingCompiler { useTextAnalysis = useTextAnalysis, useConsistent = false, mappers = ReadWriteMappers.getEmptyMappers(), - sort = true, + reproducible = true, parallelism = Runtime.getRuntime.availableProcessors(), ) @@ -516,7 +516,7 @@ object MixedAnalyzingCompiler { useTextAnalysis: Boolean, useConsistent: Boolean, mappers: ReadWriteMappers, - sort: Boolean, + reproducible: Boolean, parallelism: Int, ): AnalysisStore = { val fileStore = (useTextAnalysis, useConsistent) match { @@ -526,7 +526,7 @@ object MixedAnalyzingCompiler { ConsistentFileAnalysisStore.binary( file = analysisFile.toFile, mappers = mappers, - sort = sort, + reproducible = reproducible, parallelism = parallelism, ) case (true, false) => @@ -535,7 +535,7 @@ object MixedAnalyzingCompiler { ConsistentFileAnalysisStore.text( file = analysisFile.toFile, mappers = mappers, - sort = sort, + reproducible = reproducible, parallelism = parallelism, ) } diff --git a/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala b/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala index ed71d80530..e443a5a06e 100644 --- a/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala +++ b/zinc/src/main/scala/sbt/internal/inc/javac/AnalyzingJavaCompiler.scala @@ -165,18 +165,20 @@ final class AnalyzingJavaCompiler private[sbt] ( options, scalaInstance, classpathOptions - ) + ).toArray val javaSources: Array[VirtualFile] = sources.sortBy(_.id).toArray + // TODO: https://github.com/sbt/sbt/issues/7883 + // debug(log, prettyPrintCompilationArguments(args)) val success = - javac.run(javaSources, args.toArray, output, incToolOptions, reporter, log) + javac.run(javaSources, args, output, incToolOptions, reporter, log) if (!success) { /* Assume that no Scalac problems are reported for a Javac-related * reporter. This relies on the incremental compiler will not run * Javac compilation if Scala compilation fails, which means that * the same reporter won't be used for `AnalyzingJavaCompiler`. */ val msg = "javac returned non-zero exit code" - throw new CompileFailed(args.toArray, msg, reporter.problems()) + throw new CompileFailed(args, msg, reporter.problems()) } } @@ -264,4 +266,7 @@ final class AnalyzingJavaCompiler private[sbt] ( log.debug(label + " took " + (elapsed / 1e9) + " s") result } + + private def prettyPrintCompilationArguments(args: Array[String]) = + args.mkString("[zinc] The Java compiler is invoked with:\n\t", "\n\t", "") } diff --git a/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/A.scala b/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/A.scala new file mode 100644 index 0000000000..fb24dcd514 --- /dev/null +++ b/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/A.scala @@ -0,0 +1,13 @@ +/* + * 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. + */ + +class A() + diff --git a/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/changes/A.scala b/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/changes/A.scala new file mode 100644 index 0000000000..017538128b --- /dev/null +++ b/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/changes/A.scala @@ -0,0 +1,16 @@ +/* + * 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. + */ + +class A() + + + +// random placeholder change \ No newline at end of file diff --git a/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/incOptions.properties b/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/incOptions.properties new file mode 100644 index 0000000000..e7b9a57ecb --- /dev/null +++ b/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/incOptions.properties @@ -0,0 +1 @@ +pipelining = false \ No newline at end of file diff --git a/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/test b/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/test new file mode 100644 index 0000000000..3c91240b70 --- /dev/null +++ b/zinc/src/sbt-test/profiler/check-cycles-no-pipelining/test @@ -0,0 +1,5 @@ +> compile + +$ copy-file changes/A.scala A.scala + +> checkCycles 2 \ No newline at end of file diff --git a/zinc/src/sbt-test/profiler/check-cycles/A.scala b/zinc/src/sbt-test/profiler/check-cycles/A.scala new file mode 100644 index 0000000000..fb24dcd514 --- /dev/null +++ b/zinc/src/sbt-test/profiler/check-cycles/A.scala @@ -0,0 +1,13 @@ +/* + * 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. + */ + +class A() + diff --git a/zinc/src/sbt-test/profiler/check-cycles/changes/A.scala b/zinc/src/sbt-test/profiler/check-cycles/changes/A.scala new file mode 100644 index 0000000000..017538128b --- /dev/null +++ b/zinc/src/sbt-test/profiler/check-cycles/changes/A.scala @@ -0,0 +1,16 @@ +/* + * 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. + */ + +class A() + + + +// random placeholder change \ No newline at end of file diff --git a/zinc/src/sbt-test/profiler/check-cycles/test b/zinc/src/sbt-test/profiler/check-cycles/test new file mode 100644 index 0000000000..3c91240b70 --- /dev/null +++ b/zinc/src/sbt-test/profiler/check-cycles/test @@ -0,0 +1,5 @@ +> compile + +$ copy-file changes/A.scala A.scala + +> checkCycles 2 \ No newline at end of file diff --git a/zinc/src/test/resources/sbt/inc/Depender.scala b/zinc/src/test/resources/sbt/inc/Depender.scala index 814c2dcd2a..6f0229005c 100644 --- a/zinc/src/test/resources/sbt/inc/Depender.scala +++ b/zinc/src/test/resources/sbt/inc/Depender.scala @@ -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. diff --git a/zinc/src/test/resources/sbt/inc/Ext1.scala b/zinc/src/test/resources/sbt/inc/Ext1.scala index 7835ce4938..cd61d82026 100644 --- a/zinc/src/test/resources/sbt/inc/Ext1.scala +++ b/zinc/src/test/resources/sbt/inc/Ext1.scala @@ -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. diff --git a/zinc/src/test/resources/sbt/inc/Ext2.scala b/zinc/src/test/resources/sbt/inc/Ext2.scala index 921443e808..f423ece5a9 100644 --- a/zinc/src/test/resources/sbt/inc/Ext2.scala +++ b/zinc/src/test/resources/sbt/inc/Ext2.scala @@ -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. diff --git a/zinc/src/test/resources/sources/Foo.scala b/zinc/src/test/resources/sources/Foo.scala index 5b547c9af0..7162c0dca2 100644 --- a/zinc/src/test/resources/sources/Foo.scala +++ b/zinc/src/test/resources/sources/Foo.scala @@ -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. diff --git a/zinc/src/test/resources/sources/Good.scala b/zinc/src/test/resources/sources/Good.scala index 76cdc9667a..d59346a265 100644 --- a/zinc/src/test/resources/sources/Good.scala +++ b/zinc/src/test/resources/sources/Good.scala @@ -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. diff --git a/zinc/src/test/resources/sources/NestedJavaClasses.java b/zinc/src/test/resources/sources/NestedJavaClasses.java index 13f58336c0..f155f24da8 100644 --- a/zinc/src/test/resources/sources/NestedJavaClasses.java +++ b/zinc/src/test/resources/sources/NestedJavaClasses.java @@ -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. diff --git a/zinc/src/test/resources/sources/NoopMacroUsed.scala b/zinc/src/test/resources/sources/NoopMacroUsed.scala index 09f1fe3d09..900ae01378 100644 --- a/zinc/src/test/resources/sources/NoopMacroUsed.scala +++ b/zinc/src/test/resources/sources/NoopMacroUsed.scala @@ -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. diff --git a/zinc/src/test/resources/sources/a/A.scala b/zinc/src/test/resources/sources/a/A.scala index 5a8d6e9ce3..23733eed14 100644 --- a/zinc/src/test/resources/sources/a/A.scala +++ b/zinc/src/test/resources/sources/a/A.scala @@ -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. diff --git a/zinc/src/test/resources/sources/a/AA.scala b/zinc/src/test/resources/sources/a/AA.scala index 4c04258cb9..e2ad13f6f4 100644 --- a/zinc/src/test/resources/sources/a/AA.scala +++ b/zinc/src/test/resources/sources/a/AA.scala @@ -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. diff --git a/zinc/src/test/resources/sources/b/B.scala b/zinc/src/test/resources/sources/b/B.scala index 20cfe2148b..767a53dafb 100644 --- a/zinc/src/test/resources/sources/b/B.scala +++ b/zinc/src/test/resources/sources/b/B.scala @@ -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. diff --git a/zinc/src/test/resources/sources/b/c/C.scala b/zinc/src/test/resources/sources/b/c/C.scala index 1832934d5c..81e8837a4e 100644 --- a/zinc/src/test/resources/sources/b/c/C.scala +++ b/zinc/src/test/resources/sources/b/c/C.scala @@ -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. diff --git a/zinc/src/test/resources/sources/foo/NoopMacro.scala b/zinc/src/test/resources/sources/foo/NoopMacro.scala index 3fd9e8f467..106bee2b46 100644 --- a/zinc/src/test/resources/sources/foo/NoopMacro.scala +++ b/zinc/src/test/resources/sources/foo/NoopMacro.scala @@ -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. diff --git a/zinc/src/test/resources/sources/naha/ClientWithImplicitNotUsed.scala b/zinc/src/test/resources/sources/naha/ClientWithImplicitNotUsed.scala index 75303301ad..f3c66062aa 100644 --- a/zinc/src/test/resources/sources/naha/ClientWithImplicitNotUsed.scala +++ b/zinc/src/test/resources/sources/naha/ClientWithImplicitNotUsed.scala @@ -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. diff --git a/zinc/src/test/resources/sources/naha/ClientWithImplicitUsed.scala b/zinc/src/test/resources/sources/naha/ClientWithImplicitUsed.scala index 2a6f4eabad..7030c523f9 100644 --- a/zinc/src/test/resources/sources/naha/ClientWithImplicitUsed.scala +++ b/zinc/src/test/resources/sources/naha/ClientWithImplicitUsed.scala @@ -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. diff --git a/zinc/src/test/resources/sources/naha/ClientWithoutAnythingUsed.scala b/zinc/src/test/resources/sources/naha/ClientWithoutAnythingUsed.scala index 317d5c70b9..d44f837e5a 100644 --- a/zinc/src/test/resources/sources/naha/ClientWithoutAnythingUsed.scala +++ b/zinc/src/test/resources/sources/naha/ClientWithoutAnythingUsed.scala @@ -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. diff --git a/zinc/src/test/resources/sources/naha/ClientWithoutImplicit.scala b/zinc/src/test/resources/sources/naha/ClientWithoutImplicit.scala index 813a5be282..326dde8b4b 100644 --- a/zinc/src/test/resources/sources/naha/ClientWithoutImplicit.scala +++ b/zinc/src/test/resources/sources/naha/ClientWithoutImplicit.scala @@ -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. diff --git a/zinc/src/test/resources/sources/naha/NormalDependecy.scala b/zinc/src/test/resources/sources/naha/NormalDependecy.scala index ec596886d6..f37f65a2fc 100644 --- a/zinc/src/test/resources/sources/naha/NormalDependecy.scala +++ b/zinc/src/test/resources/sources/naha/NormalDependecy.scala @@ -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. diff --git a/zinc/src/test/resources/sources/naha/Other.scala b/zinc/src/test/resources/sources/naha/Other.scala index de0e5cc495..bfc79b2ce0 100644 --- a/zinc/src/test/resources/sources/naha/Other.scala +++ b/zinc/src/test/resources/sources/naha/Other.scala @@ -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. diff --git a/zinc/src/test/resources/sources/naha/Other2.scala b/zinc/src/test/resources/sources/naha/Other2.scala index d09f2f6567..7e8f820881 100644 --- a/zinc/src/test/resources/sources/naha/Other2.scala +++ b/zinc/src/test/resources/sources/naha/Other2.scala @@ -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. diff --git a/zinc/src/test/resources/sources/naha/Other3.scala b/zinc/src/test/resources/sources/naha/Other3.scala index 3818ef95e8..b4aabffa40 100644 --- a/zinc/src/test/resources/sources/naha/Other3.scala +++ b/zinc/src/test/resources/sources/naha/Other3.scala @@ -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. diff --git a/zinc/src/test/resources/sources/naha/WithImplicits.scala b/zinc/src/test/resources/sources/naha/WithImplicits.scala index 0b50c077cb..df8ca90850 100644 --- a/zinc/src/test/resources/sources/naha/WithImplicits.scala +++ b/zinc/src/test/resources/sources/naha/WithImplicits.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/AuxiliaryClassFilesSpec.scala b/zinc/src/test/scala/sbt/inc/AuxiliaryClassFilesSpec.scala index 96079a9795..96ce9d6460 100644 --- a/zinc/src/test/scala/sbt/inc/AuxiliaryClassFilesSpec.scala +++ b/zinc/src/test/scala/sbt/inc/AuxiliaryClassFilesSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala b/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala index 21103a2eff..2d950e5af0 100644 --- a/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala +++ b/zinc/src/test/scala/sbt/inc/BaseCompilerSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/BinaryDepSpec.scala b/zinc/src/test/scala/sbt/inc/BinaryDepSpec.scala index 4038d495b7..1a79e1db5d 100644 --- a/zinc/src/test/scala/sbt/inc/BinaryDepSpec.scala +++ b/zinc/src/test/scala/sbt/inc/BinaryDepSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/ClassFileManagerHookSpec.scala b/zinc/src/test/scala/sbt/inc/ClassFileManagerHookSpec.scala index 9947ea66c0..e2c0a9d1e4 100644 --- a/zinc/src/test/scala/sbt/inc/ClassFileManagerHookSpec.scala +++ b/zinc/src/test/scala/sbt/inc/ClassFileManagerHookSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/ClasspathHashingHookSpec.scala b/zinc/src/test/scala/sbt/inc/ClasspathHashingHookSpec.scala index bc749adfaa..5063c11a9d 100644 --- a/zinc/src/test/scala/sbt/inc/ClasspathHashingHookSpec.scala +++ b/zinc/src/test/scala/sbt/inc/ClasspathHashingHookSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/ConstantBridgeProvider.scala b/zinc/src/test/scala/sbt/inc/ConstantBridgeProvider.scala index e9bb086214..8bcc528fc3 100644 --- a/zinc/src/test/scala/sbt/inc/ConstantBridgeProvider.scala +++ b/zinc/src/test/scala/sbt/inc/ConstantBridgeProvider.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala b/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala index 6aced00df1..b99ac36cc4 100644 --- a/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala +++ b/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala b/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala index 5a50abce75..a481e8421c 100644 --- a/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala +++ b/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/NameHashingCompilerSpec.scala b/zinc/src/test/scala/sbt/inc/NameHashingCompilerSpec.scala index fafada071e..19e37b8fff 100644 --- a/zinc/src/test/scala/sbt/inc/NameHashingCompilerSpec.scala +++ b/zinc/src/test/scala/sbt/inc/NameHashingCompilerSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/NestedJavaClassSpec.scala b/zinc/src/test/scala/sbt/inc/NestedJavaClassSpec.scala index 8b4f9c2f92..d859f62ccf 100644 --- a/zinc/src/test/scala/sbt/inc/NestedJavaClassSpec.scala +++ b/zinc/src/test/scala/sbt/inc/NestedJavaClassSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/OutputSpec.scala b/zinc/src/test/scala/sbt/inc/OutputSpec.scala index cddfb568e5..3f299595dc 100644 --- a/zinc/src/test/scala/sbt/inc/OutputSpec.scala +++ b/zinc/src/test/scala/sbt/inc/OutputSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/SourceFiles.scala b/zinc/src/test/scala/sbt/inc/SourceFiles.scala index 183fdec71d..28200d4e7f 100644 --- a/zinc/src/test/scala/sbt/inc/SourceFiles.scala +++ b/zinc/src/test/scala/sbt/inc/SourceFiles.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/TestProjectSetup.scala b/zinc/src/test/scala/sbt/inc/TestProjectSetup.scala index ebe2f46052..dfab070f5a 100644 --- a/zinc/src/test/scala/sbt/inc/TestProjectSetup.scala +++ b/zinc/src/test/scala/sbt/inc/TestProjectSetup.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/TestResource.scala b/zinc/src/test/scala/sbt/inc/TestResource.scala index 71060e3037..feaa162ba7 100644 --- a/zinc/src/test/scala/sbt/inc/TestResource.scala +++ b/zinc/src/test/scala/sbt/inc/TestResource.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/inc/cached/CachedHashingSpec.scala b/zinc/src/test/scala/sbt/inc/cached/CachedHashingSpec.scala index 2e60c849b8..642f435371 100644 --- a/zinc/src/test/scala/sbt/inc/cached/CachedHashingSpec.scala +++ b/zinc/src/test/scala/sbt/inc/cached/CachedHashingSpec.scala @@ -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. diff --git a/zinc/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala b/zinc/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala index c47834896b..b0762b48e4 100644 --- a/zinc/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala +++ b/zinc/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala @@ -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.