-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #261 from BillyAutrey/scripted-sbt2-compatibility-…
…part-2 Scripted sbt2 compatibility part 2
- Loading branch information
Showing
9 changed files
with
223 additions
and
70 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
26 changes: 26 additions & 0 deletions
26
src/sbt-test/sbt-web/multi-module/project/FileAssertions.scala
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,26 @@ | ||
import sbt.* | ||
|
||
object FileAssertions { | ||
def assertLibrary( | ||
target: File, | ||
id: String, | ||
location: LibraryLocation = Library(), | ||
altName: Option[String] = None | ||
): Unit = { | ||
val filename = altName.getOrElse(id) | ||
val fileToVerify = location match { | ||
case Root(stage) => | ||
target / "web" / "public" / stage / "js" / s"$filename.js" | ||
case Library(stage) => | ||
target / "web" / "public" / stage / "lib" / id / "js" / s"$filename.js" | ||
case External(path) => | ||
target / "web" / "public" / path / "lib" / id / s"$filename.js" | ||
} | ||
assert(fileToVerify.exists(), s"Could not find $filename.js") | ||
} | ||
} | ||
|
||
sealed trait LibraryLocation | ||
case class Root(stage: String = "main") extends LibraryLocation | ||
case class Library(stage: String = "main") extends LibraryLocation | ||
case class External(stage: String = "main") extends LibraryLocation |
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 |
---|---|---|
@@ -1,83 +1,43 @@ | ||
> a/assets | ||
|
||
$ exists target/web/public/main/js/a.js | ||
$ exists target/web/public/main/lib/b/js/b.js | ||
$ exists target/web/public/main/lib/c/js/c.js | ||
$ exists target/web/public/main/lib/d/js/d.js | ||
$ exists target/web/public/main/lib/e/js/e.js | ||
$ exists target/web/public/main/lib/jquery/jquery.js | ||
> fileCheckA | ||
|
||
> b/assets | ||
|
||
$ exists modules/b/target/web/public/main/js/b.js | ||
$ exists modules/b/target/web/public/main/lib/c/js/c.js | ||
$ exists modules/b/target/web/public/main/lib/d/js/d.js | ||
$ exists modules/b/target/web/public/main/lib/e/js/e.js | ||
$ exists modules/b/target/web/public/main/lib/jquery/jquery.js | ||
> fileCheckB | ||
|
||
> c/assets | ||
|
||
# c has set import directly | ||
$ exists modules/c/target/web/public/main/js/c.js | ||
$ exists modules/c/target/web/public/main/js/e.js | ||
$ exists modules/c/target/web/public/main/lib/jquery/jquery.js | ||
> fileCheckC | ||
|
||
> d/assets | ||
|
||
$ exists modules/d/target/web/public/main/js/d.js | ||
$ exists modules/d/target/web/public/main/lib/e/js/e.js | ||
$ exists modules/d/target/web/public/main/lib/jquery/jquery.js | ||
> fileCheckD | ||
|
||
> e/assets | ||
> fileCheckE | ||
|
||
$ exists modules/e/target/web/public/main/js/e.js | ||
$ exists modules/e/target/web/public/main/lib/jquery/jquery.js | ||
|
||
> b/web-assets-test:assets | ||
|
||
> b/TestAssets/assets | ||
# b has disabled direct modules so we expect lib/b here | ||
$ exists modules/b/target/web/public/test/lib/b/js/b.js | ||
|
||
$ exists modules/b/target/web/public/test/lib/c/js/c.js | ||
$ exists modules/b/target/web/public/test/lib/c/js/u.js | ||
$ exists modules/b/target/web/public/test/lib/d/js/d.js | ||
$ exists modules/b/target/web/public/test/lib/d/js/u.js | ||
$ exists modules/b/target/web/public/test/lib/e/js/e.js | ||
$ exists modules/b/target/web/public/test/lib/e/js/t.js | ||
$ exists modules/b/target/web/public/test/lib/jquery/jquery.js | ||
> fileCheckBTest | ||
|
||
> c/web-assets-test:assets | ||
> c/TestAssets/assets | ||
|
||
# c has set import directly | ||
$ exists modules/c/target/web/public/test/js/c.js | ||
$ exists modules/c/target/web/public/test/js/u.js | ||
$ exists modules/c/target/web/public/test/js/e.js | ||
$ exists modules/c/target/web/public/test/js/t.js | ||
$ exists modules/c/target/web/public/test/lib/jquery/jquery.js | ||
|
||
> d/web-assets-test:assets | ||
|
||
$ exists modules/d/target/web/public/test/js/d.js | ||
$ exists modules/d/target/web/public/test/js/u.js | ||
$ exists modules/d/target/web/public/test/lib/e/js/e.js | ||
$ exists modules/d/target/web/public/test/lib/e/js/t.js | ||
$ exists modules/d/target/web/public/test/lib/jquery/jquery.js | ||
> fileCheckCTest | ||
|
||
> e/web-assets-test:assets | ||
> d/TestAssets/assets | ||
> fileCheckDTest | ||
|
||
$ exists modules/e/target/web/public/test/js/e.js | ||
$ exists modules/e/target/web/public/test/js/t.js | ||
$ exists modules/e/target/web/public/test/lib/jquery/jquery.js | ||
> e/TestAssets/assets | ||
> fileCheckETest | ||
|
||
# Let's optimize the syncing | ||
|
||
> set ThisBuild / trackInternalDependencies := TrackLevel.TrackIfMissing | ||
|
||
> a/assets | ||
|
||
$ exists target/web/public/main/lib/e/js/e.js | ||
> fileCheckATracked | ||
|
||
> e/clean | ||
> a/assets | ||
|
||
$ exists target/web/public/main/lib/e/js/e.js | ||
> fileCheckETracked |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import sbt.* | ||
|
||
object FileAssertions { | ||
def assertExists(file: File): Unit = | ||
assert(file.exists(), s"Could not find ${file.getName}") | ||
} |
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 |
---|---|---|
@@ -1,14 +1,12 @@ | ||
> web-assets:package | ||
$ exists target/web-project-0.1-web-assets.jar | ||
> Assets/package | ||
> fileCheckAssets | ||
|
||
> extractAssets | ||
$ exists extracted/js/a.js | ||
$ exists extracted/lib/jquery/jquery.js | ||
> fileCheckExtracted | ||
|
||
> 'set Assets / WebKeys.packagePrefix := "public/"' | ||
> web-assets:package | ||
> Assets/package | ||
|
||
$ delete extracted | ||
> extractAssets | ||
$ exists extracted/public/js/a.js | ||
$ exists extracted/public/lib/jquery/jquery.js | ||
> fileCheckPublic |
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
6 changes: 6 additions & 0 deletions
6
src/sbt-test/sbt-web/publish-webjar/project/FileAssertions.scala
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,6 @@ | ||
import sbt.* | ||
|
||
object FileAssertions { | ||
def assertExists(file: File): Unit = | ||
assert(file.exists(), s"Could not find ${file.getName}") | ||
} |
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