-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
90 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
sbt-plugin/src/sbt-test/dependency-manifest/ignore-scaladoc/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import ch.epfl.scala.githubapi.DependencyRelationship | ||
import ch.epfl.scala.githubapi.DependencyScope | ||
import ch.epfl.scala.githubapi.Manifest | ||
import ch.epfl.scala.SubmitInput | ||
import sjsonnew.shaded.scalajson.ast.unsafe.JString | ||
|
||
val checkScaladoc = taskKey[Unit]("Check scaladoc_3 is in the manifest ") | ||
val ignoreScaladoc = taskKey[StateTransform]("Ignore the scala-doc-tool in the submit input") | ||
val checkIgnoreScaladoc = taskKey[Unit]("Check scaladoc_3 is absent in the manifest") | ||
|
||
inThisBuild( | ||
Seq( | ||
organization := "ch.epfl.scala", | ||
version := "1.2.0-SNAPSHOT", | ||
scalaVersion := "3.2.1" | ||
) | ||
) | ||
|
||
Global / ignoreScaladoc := { | ||
val input = SubmitInput(None, Vector.empty, ignoredConfigs = Vector("scala-doc-tool")) | ||
StateTransform(state => state.put(githubSubmitInputKey, input)) | ||
} | ||
|
||
lazy val p1 = project | ||
.in(file("p1")) | ||
.settings( | ||
checkScaladoc := { | ||
val manifest = githubDependencyManifest.value.get | ||
checkDependency(manifest, "org.scala-lang:scaladoc_3:3.2.1")( | ||
expectedRelationship = DependencyRelationship.direct, | ||
expectedScope = DependencyScope.development, | ||
expectedConfig = "scala-doc-tool" | ||
) | ||
}, | ||
checkIgnoreScaladoc := { | ||
val manifest = githubDependencyManifest.value.get | ||
val suspicious = manifest.resolved.keys.filter(dep => dep.contains("scaladoc_3")) | ||
assert(suspicious.isEmpty, s"The manifest should not contain scaladoc_3, found ${suspicious.mkString(", ")}") | ||
} | ||
) | ||
|
||
def checkDependency(manifest: Manifest, name: String)( | ||
expectedRelationship: DependencyRelationship = DependencyRelationship.direct, | ||
expectedScope: DependencyScope = DependencyScope.runtime, | ||
expectedConfig: String = "compile", | ||
expectedDeps: Seq[String] = Seq.empty | ||
): Unit = { | ||
val node = manifest.resolved(name) | ||
assert(node.package_url.startsWith("pkg:maven/"), s"Wrong package_url for node $name: ${node.package_url}") | ||
assert(node.relationship.contains(expectedRelationship), s"Wrong relationship for node $name: ${node.relationship}") | ||
assert(node.scope.contains(expectedScope), s"Wrong scope for node $name: ${node.scope}") | ||
val configurations = node.metadata.get("config").collect { case JString(c) => c } | ||
assert(configurations.contains(expectedConfig), s"Wrong config in metadata for node $name: $configurations") | ||
expectedDeps.foreach(d => assert(node.dependencies.contains(d), s"missing dependency $d in node $name")) | ||
} |
3 changes: 3 additions & 0 deletions
3
sbt-plugin/src/sbt-test/dependency-manifest/ignore-scaladoc/project/plugins.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
val pluginVersion = sys.props("plugin.version") | ||
|
||
addSbtPlugin("ch.epfl.scala" % "sbt-github-dependency-submission" % pluginVersion) |
3 changes: 3 additions & 0 deletions
3
sbt-plugin/src/sbt-test/dependency-manifest/ignore-scaladoc/test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
> p1 / checkScaladoc | ||
> Global / ignoreScaladoc | ||
> p1 / checkIgnoreScaladoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters