Skip to content

Commit

Permalink
Merge pull request #459 from xuwei-k/slash-syntax-test
Browse files Browse the repository at this point in the history
use new slash syntax in tests
  • Loading branch information
eed3si9n authored Jan 14, 2022
2 parents 5c4f048 + 301bf12 commit 82eadf8
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 41 deletions.
6 changes: 3 additions & 3 deletions src/sbt-test/merging/mergefail/build.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
lazy val testmerge = (project in file(".")).
settings(
version := "0.1",
assemblyJarName in assembly := "foo.jar",
assemblyMergeStrategy in assembly := {
val old = (assemblyMergeStrategy in assembly).value
assembly / assemblyJarName := "foo.jar",
assembly / assemblyMergeStrategy := {
val old = (assembly / assemblyMergeStrategy).value

{
case _ => MergeStrategy.singleOrError
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/merging/mergefail2/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
lazy val testmerge = (project in file(".")).
settings(
version := "0.1",
assemblyJarName in assembly := "foo.jar"
assembly / assemblyJarName := "foo.jar"
)
10 changes: 5 additions & 5 deletions src/sbt-test/merging/merging/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version in ThisBuild := "0.1"
scalaVersion in ThisBuild := "2.12.15"
assemblyMergeStrategy in ThisBuild := {
ThisBuild / version := "0.1"
ThisBuild / scalaVersion := "2.12.15"
ThisBuild / assemblyMergeStrategy := {
case "a" => MergeStrategy.concat
case "b" => MergeStrategy.first
case "c" => MergeStrategy.last
Expand All @@ -9,13 +9,13 @@ assemblyMergeStrategy in ThisBuild := {
case "f" => MergeStrategy.discard
case PathList("x", "y") => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in ThisBuild).value
val oldStrategy = (ThisBuild / assemblyMergeStrategy).value
oldStrategy(x)
}

lazy val testmerge = (project in file("."))
.settings(
assemblyJarName in assembly := "foo.jar",
assembly / assemblyJarName := "foo.jar",
TaskKey[Unit]("check") := {
IO.withTemporaryDirectory { dir
IO.unzip(crossTarget.value / "foo.jar", dir)
Expand Down
6 changes: 3 additions & 3 deletions src/sbt-test/sbt-assembly/appendhash/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version in ThisBuild := "0.1"
scalaVersion in ThisBuild := "2.12.8"
assemblyAppendContentHash in ThisBuild := true
ThisBuild / version := "0.1"
ThisBuild / scalaVersion := "2.12.8"
ThisBuild / assemblyAppendContentHash := true

lazy val root = (project in file("."))
.settings(
Expand Down
2 changes: 1 addition & 1 deletion src/sbt-test/sbt-assembly/appendhash/test
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
> assemblyPackageDependency
> checkFile "foo-assembly-0.1-deps-[0-9abcdef]{40}.jar"

> set assemblyMaxHashLength in ThisBuild := 5
> set ThisBuild / assemblyMaxHashLength := 5
> clean
> assembly
> checkFile "foo-assembly-0.1-[0-9abcdef]{5}.jar"
4 changes: 2 additions & 2 deletions src/sbt-test/sbt-assembly/config/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version in ThisBuild := "0.1"
scalaVersion in ThisBuild := "2.12.15"
ThisBuild / version := "0.1"
ThisBuild / scalaVersion := "2.12.15"

lazy val root = (project in file("."))
.settings(inConfig(Test)(baseAssemblySettings))
Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/sbt-assembly/deps/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version in ThisBuild := "0.1"
scalaVersion in ThisBuild := "2.12.15"
ThisBuild / version := "0.1"
ThisBuild / scalaVersion := "2.12.15"

lazy val root = (project in file("."))
.settings(
Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/sbt-assembly/empty/build.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version in ThisBuild := "0.1"
scalaVersion in ThisBuild := "2.12.8"
ThisBuild / version := "0.1"
ThisBuild / scalaVersion := "2.12.8"
8 changes: 4 additions & 4 deletions src/sbt-test/sbt-assembly/piecemeal/build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version in ThisBuild := "0.1"
scalaVersion in ThisBuild := "2.12.15"
ThisBuild / version := "0.1"
ThisBuild / scalaVersion := "2.12.15"

assembleArtifact in (ThisBuild, assemblyPackageScala) := false
assembleArtifact in (ThisBuild, assemblyPackageDependency) := false
ThisBuild / assemblyPackageScala / assembleArtifact := false
ThisBuild / assemblyPackageDependency / assembleArtifact := false

lazy val root = (project in file("."))
.settings(
Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/sbt-assembly/simple/build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version in ThisBuild := "0.1"
scalaVersion in ThisBuild := "2.12.8"
ThisBuild / version := "0.1"
ThisBuild / scalaVersion := "2.12.8"

lazy val root = (project in file("."))
.settings(
Expand Down
4 changes: 2 additions & 2 deletions src/sbt-test/shading/directories/build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
scalaVersion in ThisBuild := "2.12.15"
ThisBuild / scalaVersion := "2.12.15"

assemblyShadeRules in ThisBuild := Seq(
ThisBuild / assemblyShadeRules := Seq(
ShadeRule.rename("somepackage.**" -> "shaded.@1").inAll
)

Expand Down
28 changes: 14 additions & 14 deletions src/sbt-test/shading/scalasigannot/build.sbt
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
version in ThisBuild := "1.0-SNAPSHOT"
organization in ThisBuild := "scalasigannottest"
scalaVersion in ThisBuild := scala213
ThisBuild / version := "1.0-SNAPSHOT"
ThisBuild / organization := "scalasigannottest"
ThisBuild / scalaVersion := scala213

lazy val scala212 = "2.12.15"
lazy val scala213 = "2.13.7"

crossScalaVersions in ThisBuild := List(scala212, scala213)
ThisBuild / crossScalaVersions := List(scala212, scala213)


val shadingSettings: Seq[Def.Setting[_]] = Seq(
assemblyShadeRules in assembly := Seq(
assembly / assemblyShadeRules := Seq(
ShadeRule.rename(
"to.be.shaded.**" -> "shade.@1"
).inAll
),
assemblyOption in assembly ~= { _.withIncludeScala(false) },
assemblyExcludedJars in assembly := {
val cp = (fullClasspath in assembly).value
assembly / assemblyOption ~= { _.withIncludeScala(false) },
assembly / assemblyExcludedJars := {
val cp = (assembly / fullClasspath).value
cp.filterNot {p =>
p.data.getName.startsWith("tobeshaded")
}
},

artifactClassifier in (sbt.Test, packageBin) := None,
artifact in (Compile, assembly) := (artifact in (Compile, assembly)).value.withClassifier(Some("shaded"))
sbt.Test / packageBin / artifactClassifier := None,
Compile / assembly / artifact := (Compile / assembly / artifact).value.withClassifier(Some("shaded"))

) ++ addArtifact(artifact in (Compile, assembly), assembly).settings
) ++ addArtifact(Compile / assembly / artifact, assembly).settings

// A jar to be shaded in shadedLib
lazy val toBeShaded = project.in(file("tobeshaded"))
Expand All @@ -38,8 +38,8 @@ lazy val fatLib = project.in(file("fatlib"))
.settings(
Seq(
name := "fatlib",
(unmanagedJars in Compile) := {
val tbs: File = ((packageBin in Compile) in toBeShaded).value
(Compile / unmanagedJars) := {
val tbs: File = (toBeShaded / Compile / packageBin).value
//Seq(sbt.internal.util.Attributed.blank[java.io.File](tbs))

Seq(Attributed.blank[java.io.File](tbs))
Expand All @@ -61,7 +61,7 @@ lazy val root = project.in(file("."))
//val tbs: File = ((packageBin in (Compile, assembly)) in fatLib).value
//Seq(sbt.internal.util.Attributed.blank[java.io.File](tbs))

val x = (assembly in (fatLib, Compile)).value
val x = (fatLib / Compile / assembly).value
Seq(Attributed.blank[java.io.File](x))
}
)
Expand Down

0 comments on commit 82eadf8

Please sign in to comment.