Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.9.x] Update changed assets in subprojects (backport #12721) by @mkurz #12725

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com>

lazy val root = (project in file("."))
.enablePlugins(PlayScala)
.settings(common: _*)
.settings(
name := "asset-changes-main",
InputKey[Unit]("verifyResourceContains") := {
val args = Def.spaceDelimited("<path> <status> <words> ...").parsed
val path :: status :: assertions = args
ScriptedTools.verifyResourceContains(path, status.toInt, assertions)
},
)
.dependsOn(subproj)
.aggregate(subproj)

lazy val subproj = (project in file("subproj"))
.enablePlugins(PlayScala)
.settings(common: _*)
.settings(
name := "asset-changes-sub",
)

def common: Seq[Setting[?]] = Seq(
version := "1.0-SNAPSHOT",
PlayKeys.playInteractionMode := play.sbt.StaticPlayNonBlockingInteractionMode,
scalaVersion := ScriptedTools.scalaVersionFromJavaProperties(),
updateOptions := updateOptions.value.withLatestSnapshots(false),
update / evictionWarningOptions ~= (_.withWarnTransitiveEvictions(false).withWarnDirectEvictions(false)),
libraryDependencies += guice,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com>

-> / subproj.Routes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com>

updateOptions := updateOptions.value.withLatestSnapshots(false)
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % sys.props("project.version"))
addSbtPlugin("com.typesafe.play" % "sbt-scripted-tools" % sys.props("project.version"))
addSbtPlugin("com.github.sbt" % "sbt-less" % "2.0.1")
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
* Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com>
*/

body { margin-top: 50px; }
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
body { margin-top: 51px; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com>

GET /assets/*file controllers.Assets.versioned(path = "/public/lib/asset-changes-sub", file)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
> run
> verifyResourceContains /assets/stylesheets/main.css 200 "margin-top: 50px;"
$ copy-file subproj/app/assets/stylesheets/main.less.new subproj/app/assets/stylesheets/main.less
> verifyResourceContains /assets/stylesheets/main.css 200 "margin-top: 51px;"
> playStop
4 changes: 2 additions & 2 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ object Dependencies {
playFileWatch,
sbtDep("com.typesafe.play" % "sbt-twirl" % BuildInfo.sbtTwirlVersion),
sbtDep("com.github.sbt" % "sbt-native-packager" % BuildInfo.sbtNativePackagerVersion),
sbtDep("com.github.sbt" % "sbt-web" % "1.5.5"),
sbtDep("com.github.sbt" % "sbt-js-engine" % "1.3.6"),
sbtDep("com.github.sbt" % "sbt-web" % "1.5.6"),
sbtDep("com.github.sbt" % "sbt-js-engine" % "1.3.7"),
logback % Test
) ++ specs2Deps.map(_ % Test) ++ scalaReflect(scalaVersion)
}
Expand Down
Loading