Skip to content

Commit

Permalink
Merge pull request #705 from eed3si9n/bport/701
Browse files Browse the repository at this point in the history
[1.3.x] Ignore stub symbols when API hashing annotations
  • Loading branch information
eed3si9n authored Oct 12, 2019
2 parents 95f97ef + c2c5a14 commit 824278b
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 6 deletions.
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
dist: xenial
group: stable

language: scala

scala: 2.12.8

matrix:
include:
- env: ADOPTOPENJDK=11
- env: ADOPTOPENJDK=8

before_install:
# adding $HOME/.sdkman to cache would create an empty directory, which interferes with the initial installation
- "[[ -d /home/travis/.sdkman/ ]] && [[ -d /home/travis/.sdkman/bin/ ]] || rm -rf /home/travis/.sdkman/"
- curl -sL https://get.sdkman.io | bash
- echo sdkman_auto_answer=true > /home/travis/.sdkman/etc/config
- source "/home/travis/.sdkman/bin/sdkman-init.sh"

install:
- sdk install java $(sdk list java | grep -o "$ADOPTOPENJDK\.[0-9\.]*hs-adpt" | head -1)
- unset _JAVA_OPTIONS
- java -Xmx32m -version
# detect sbt version from project/build.properties
- export TRAVIS_SBT=$(grep sbt.version= project/build.properties | sed -e 's/sbt.version=//g' ) && echo "sbt $TRAVIS_SBT"
- sdk install sbt $TRAVIS_SBT
- unset SBT_OPTS
- unset JAVA_OPTS

script: bin/run-ci.sh

before_cache:
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete
- find $HOME/.sbt -name "*.lock" -delete

cache:
directories:
- $HOME/.cache/coursier
- $HOME/.ivy2/cache
- $HOME/.sbt/boot
- $HOME/.sdkman
2 changes: 1 addition & 1 deletion bin/run-ci-scripted-to-jar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ set -o nounset
PROJECT_ROOT="zincRoot"
sbt -Dfile.encoding=UTF-8 \
-J-XX:ReservedCodeCacheSize=512M \
-J-Xms1024M -J-Xmx4096M -J-server \
-J-Xms1024M -J-Xmx2048M -J-server \
"zincScripted/test:run --to-jar"
2 changes: 1 addition & 1 deletion bin/run-ci-scripted.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ PROJECT_ROOT="zincRoot"

sbt -Dfile.encoding=UTF-8 \
-J-XX:ReservedCodeCacheSize=512M \
-J-Xms1024M -J-Xmx4096M -J-server \
-J-Xms1024M -J-Xmx2048M -J-server \
"zincScripted/test:run"
2 changes: 1 addition & 1 deletion bin/run-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -o nounset
PROJECT_ROOT="zincRoot"
sbt -Dfile.encoding=UTF-8 \
-J-XX:ReservedCodeCacheSize=512M \
-J-Xms1024M -J-Xmx4096M -J-server \
-J-Xms1024M -J-Xmx2048M -J-server \
"$PROJECT_ROOT/mimaReportBinaryIssues" \
scalafmtCheckAll \
scalafmtSbtCheck \
Expand Down
12 changes: 10 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def mimaSettings: Seq[Setting[_]] = Seq(
"1.2.0",
"1.2.1",
"1.2.2",
"1.3.0",
) map (
version =>
organization.value %% moduleName.value % version
Expand Down Expand Up @@ -52,6 +53,7 @@ ThisBuild / developers +=
ThisBuild / pomIncludeRepository := { _ =>
false
}
ThisBuild / mimaPreviousArtifacts := Set.empty

def commonSettings: Seq[Setting[_]] = Seq(
scalaVersion := scala212,
Expand Down Expand Up @@ -307,11 +309,16 @@ lazy val zincPersist = (project in internalPath / "zinc-persist")
exclude[DirectMissingMethodProblem]("sbt.internal.inc.schema.Position.apply"),
exclude[DirectMissingMethodProblem]("sbt.internal.inc.schema.Position.copy"),
exclude[DirectMissingMethodProblem]("sbt.internal.inc.schema.Position.this"),

// Added Problem#reported
exclude[DirectMissingMethodProblem]("sbt.internal.inc.schema.Problem.apply"),
exclude[DirectMissingMethodProblem]("sbt.internal.inc.schema.Problem.copy"),
exclude[DirectMissingMethodProblem]("sbt.internal.inc.schema.Problem.this"),
exclude[IncompatibleSignatureProblem]("sbt.internal.inc.schema.Problem.unapply"),
exclude[IncompatibleSignatureProblem]("sbt.internal.inc.schema.Position.unapply"),
exclude[IncompatibleSignatureProblem]("sbt.internal.inc.schema.AnalyzedClass.unapply"),
exclude[IncompatibleSignatureProblem]("sbt.internal.inc.schema.AnalyzedClass.unapply"),
exclude[IncompatibleSignatureProblem]("sbt.internal.inc.schema.Version.values"),
exclude[IncompatibleSignatureProblem]("sbt.internal.inc.schema.Position.unapply"),
)
}
)
Expand Down Expand Up @@ -410,7 +417,8 @@ lazy val zincCore = (project in internalPath / "zinc-core")
exclude[IncompatibleMethTypeProblem]("sbt.internal.inc.Incremental.prune"),
exclude[DirectMissingMethodProblem]("sbt.internal.inc.IncrementalCompile.apply"),
exclude[DirectMissingMethodProblem]("sbt.internal.inc.AnalysisCallback#Builder.this"),
exclude[DirectMissingMethodProblem]("sbt.internal.inc.AnalysisCallback.this")
exclude[DirectMissingMethodProblem]("sbt.internal.inc.AnalysisCallback.this"),
exclude[IncompatibleSignatureProblem]("sbt.internal.inc.MiniSetupUtil.equivCompileSetup"),
)
}
)
Expand Down
10 changes: 9 additions & 1 deletion internal/compiler-bridge/src/main/scala/xsbt/ExtractAPI.scala
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,16 @@ class ExtractAPI[GlobalType <: Global](
ann.atp.typeSymbol isNonBottomSubClass definitions.StaticAnnotationClass
}
implicit def compat(ann: AnnotationInfo): IsStatic = new IsStatic(ann)
annotations.filter(_.isStatic)

// scala/bug#11679 annotations of inherited members may be absent from the compile time classpath
// so avoid calling `isNonBottomSubClass` on these stub symbols which would trigger a fatal error.
annotations.filter(ann => !isStub(ann.atp.typeSymbol) && ann.isStatic)
}

private def isStub(sym: Symbol): Boolean = sym match {
case _: StubSymbol => true
case _ => false
}
}

object ExtractAPI {
Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ libraryDependencies += // Remember to remove the explicit dependency on java-pro
"com.trueaccord.scalapb" %% "compilerplugin" % "0.6.0"
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.13")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1")

0 comments on commit 824278b

Please sign in to comment.