Skip to content

Commit

Permalink
Merge pull request playframework#585 from xuwei-k/slash-syntax
Browse files Browse the repository at this point in the history
use slash syntax instead of deprecated `in`
  • Loading branch information
mergify[bot] authored Jul 14, 2021
2 parents a0f0780 + 108bd33 commit 6cbb5c2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
62 changes: 31 additions & 31 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import sbtassembly.MergeStrategy
//---------------------------------------------------------------

resolvers ++= DefaultOptions.resolvers(snapshot = true)
resolvers in ThisBuild += Resolver.sonatypeRepo("public")
resolvers in ThisBuild += Resolver.bintrayRepo("akka", "snapshots")
ThisBuild / resolvers += Resolver.sonatypeRepo("public")
ThisBuild / resolvers += Resolver.bintrayRepo("akka", "snapshots")

// Customise sbt-dynver's behaviour to make it work with tags which aren't v-prefixed
dynverVTagPrefix in ThisBuild := false
ThisBuild / dynverVTagPrefix := false

// Sanity-check: assert that version comes from a tag (e.g. not a too-shallow clone)
// https://github.com/dwijnand/sbt-dynver/#sanity-checking-the-version
Expand Down Expand Up @@ -95,13 +95,13 @@ lazy val commonSettings = Def.settings(
scalaVersion := scala213,
crossScalaVersions := Seq(scala213, scala212),
scalacOptions ++= scalacOpts,
scalacOptions in (Compile, doc) ++= Seq(
Compile / doc / scalacOptions ++= Seq(
"-Xfatal-warnings",
// Work around 2.12 bug which prevents javadoc in nested java classes from compiling.
"-no-java-comments",
),
javacOptions in Compile ++= javacSettings,
javacOptions in Test ++= javacSettings,
Compile / javacOptions ++= javacSettings,
Test / javacOptions ++= javacSettings,
headerLicense := {
Some(
HeaderLicense.Custom(
Expand All @@ -119,20 +119,20 @@ lazy val shadedCommonSettings = Seq(
)

lazy val shadeAssemblySettings = commonSettings ++ shadedCommonSettings ++ Seq(
assemblyOption in assembly ~= (_.copy(includeScala = false)),
test in assembly := {},
assemblyOption in assembly ~= {
assembly / assemblyOption ~= (_.copy(includeScala = false)),
assembly / test := {},
assembly / assemblyOption ~= {
_.copy(includeScala = false)
},
assemblyJarName in assembly := {
assembly / assemblyJarName := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((epoch, major)) =>
s"${name.value}.jar" // we are only shading java
case _ =>
sys.error("Cannot find valid scala version!")
}
},
target in assembly := {
assembly / target := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((epoch, major)) =>
baseDirectory.value.getParentFile / "target" / s"$epoch.$major"
Expand Down Expand Up @@ -190,21 +190,21 @@ lazy val `shaded-asynchttpclient` = project
.settings(
libraryDependencies ++= asyncHttpClient,
name := "shaded-asynchttpclient",
logLevel in assembly := Level.Error,
assemblyMergeStrategy in assembly := {
assembly / logLevel := Level.Error,
assembly / assemblyMergeStrategy := {
val NettyPropertiesPath = "META-INF" + File.separator + "io.netty.versions.properties"
({
case NettyPropertiesPath =>
MergeStrategy.first
case ahcProperties if ahcProperties.endsWith("ahc-default.properties") =>
ahcMerge
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
val oldStrategy = (assembly / assemblyMergeStrategy).value
oldStrategy(x)
}: String => MergeStrategy)
},
//logLevel in assembly := Level.Debug,
assemblyShadeRules in assembly := Seq(
assembly / assemblyShadeRules := Seq(
ShadeRule.rename("org.asynchttpclient.**" -> "play.shaded.ahc.@0").inAll,
ShadeRule.rename("io.netty.**" -> "play.shaded.ahc.@0").inAll,
ShadeRule.rename("javassist.**" -> "play.shaded.ahc.@0").inAll,
Expand All @@ -220,8 +220,8 @@ lazy val `shaded-asynchttpclient` = project
//ivyXML := <dependencies></dependencies>,
//ivyLoggingLevel := UpdateLogging.Full,
//logLevel := Level.Debug,
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeBin = false, includeScala = false),
packageBin in Compile := assembly.value
assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeBin = false, includeScala = false),
Compile / packageBin := assembly.value
)

//---------------------------------------------------------------
Expand All @@ -238,24 +238,24 @@ lazy val `shaded-oauth` = project
libraryDependencies ++= oauth,
name := "shaded-oauth",
//logLevel in assembly := Level.Debug,
assemblyShadeRules in assembly := Seq(
assembly / assemblyShadeRules := Seq(
ShadeRule.rename("oauth.**" -> "play.shaded.oauth.@0").inAll,
ShadeRule.rename("org.apache.commons.**" -> "play.shaded.oauth.@0").inAll
),
// https://stackoverflow.com/questions/24807875/how-to-remove-projectdependencies-from-pom
// Remove dependencies from the POM because we have a FAT jar here.
makePomConfiguration := makePomConfiguration.value.withProcess(process = dependenciesFilter),
assemblyOption in assembly := (assemblyOption in assembly).value.copy(includeBin = false, includeScala = false),
packageBin in Compile := assembly.value
assembly / assemblyOption := (assembly / assemblyOption).value.copy(includeBin = false, includeScala = false),
Compile / packageBin := assembly.value
)

// Make the shaded version of AHC available downstream
val shadedAhcSettings = Seq(
unmanagedJars in Compile += (packageBin in (`shaded-asynchttpclient`, Compile)).value
Compile / unmanagedJars += (`shaded-asynchttpclient` / Compile / packageBin).value
)

val shadedOAuthSettings = Seq(
unmanagedJars in Compile += (packageBin in (`shaded-oauth`, Compile)).value
Compile / unmanagedJars += (`shaded-oauth` / Compile / packageBin).value
)

//---------------------------------------------------------------
Expand Down Expand Up @@ -311,8 +311,8 @@ lazy val `play-ahc-ws-standalone` = project
.enablePlugins(Publish)
.settings(
commonSettings ++ shadedAhcSettings ++ shadedOAuthSettings ++ Seq(
fork in Test := true,
testOptions in Test := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v")),
Test / fork := true,
Test / testOptions := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v")),
libraryDependencies ++= standaloneAhcWSDependencies,
// This will not work if you do a publishLocal, because that uses ivy...
pomPostProcess := { (node: xml.Node) =>
Expand Down Expand Up @@ -351,8 +351,8 @@ lazy val `play-ws-standalone-json` = project
.settings(commonSettings)
.settings(mimaSettings)
.settings(
fork in Test := true,
testOptions in Test := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v")),
Test / fork := true,
Test / testOptions := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v")),
libraryDependencies ++= standaloneAhcWSJsonDependencies
)
.settings(AutomaticModuleName.settings("play.ws.standalone.json"))
Expand All @@ -371,8 +371,8 @@ lazy val `play-ws-standalone-xml` = project
.settings(commonSettings)
.settings(mimaSettings)
.settings(
fork in Test := true,
testOptions in Test := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v")),
Test / fork := true,
Test / testOptions := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v")),
libraryDependencies ++= standaloneAhcWSXMLDependencies
)
.settings(AutomaticModuleName.settings("play.ws.standalone.xml"))
Expand All @@ -391,9 +391,9 @@ lazy val `integration-tests` = project
.settings(commonSettings)
.settings(publish / skip := true)
.settings(
fork in Test := true,
Test / fork := true,
concurrentRestrictions += Tags.limitAll(1), // only one integration test at a time
testOptions in Test := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v")),
Test / testOptions := Seq(Tests.Argument(TestFrameworks.JUnit, "-a", "-v")),
libraryDependencies ++= akkaHttp.map(_ % Test) ++ testDependencies
)
.settings(shadedAhcSettings)
Expand All @@ -419,7 +419,7 @@ lazy val bench = project
`play-ahc-ws-standalone`
)
.settings(commonSettings)
.settings(scalacOptions in (Compile, doc) -= "-Xfatal-warnings")
.settings(Compile / doc / scalacOptions -= "-Xfatal-warnings")
.settings(publish / skip := true)

//---------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion project/AutomaticModuleName.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ object AutomaticModuleName {

def settings(name: String): Seq[Def.Setting[Task[Seq[PackageOption]]]] =
Seq(
packageOptions in (Compile, packageBin) += Package.ManifestAttributes(AutomaticModuleName -> name)
Compile / packageBin / packageOptions += Package.ManifestAttributes(AutomaticModuleName -> name)
)
}

0 comments on commit 6cbb5c2

Please sign in to comment.