forked from higherkindness/rules_scala
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't always provide transitive dependencies' analysis files to ZincR…
…unner They aren't used if Zinc persistence is disabled. They also contain hashes of sources, which effectively makes `ijar` useless, since a target will be always be recompiled if its transitive dependencies were changed, regardless of whether their ijars changed.
- Loading branch information
Jaden Peterson
committed
Dec 23, 2024
1 parent
5b3bd62
commit d9805d7
Showing
7 changed files
with
63 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
load("@rules_scala_annex//rules:scala.bzl", "scala_library") | ||
|
||
scala_library( | ||
name = "dependency", | ||
srcs = ["Dependency.scala", "DependencyCacheInvalidation.scala"], | ||
scala_toolchain_name = "test_zinc_2_13", | ||
) | ||
|
||
scala_library( | ||
name = "dependent", | ||
srcs = ["Dependent.scala", "DependentCacheInvalidation.scala"], | ||
scala_toolchain_name = "test_zinc_2_13", | ||
deps = [":dependency"], | ||
) |
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,7 @@ | ||
package anx.ijar | ||
|
||
object Dependency { | ||
def main(args: Array[String]): Unit = { | ||
println("Hello, world!") | ||
} | ||
} |
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 @@ | ||
// 3598ab64-b0e5-49af-b12b-471f8d2dddc1 |
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 @@ | ||
package anx.ijar | ||
|
||
//aaaaaaaa | ||
object Dependent { | ||
def main(args: Array[String]): Unit = Dependency.main(args) | ||
} |
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 @@ | ||
// 630feaca-0178-4771-864d-18e932b4b10a |
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,30 @@ | ||
#!/bin/bash -e | ||
. "$(dirname "$0")"/../common.sh | ||
|
||
invalidate_dependency_cache() { | ||
echo "// $(cat /proc/sys/kernel/random/uuid)" > DependencyCacheInvalidation.scala | ||
} | ||
|
||
invalidate_dependent_cache() { | ||
echo "// $(cat /proc/sys/kernel/random/uuid)" > DependentCacheInvalidation.scala | ||
} | ||
|
||
test_actions_executed() { | ||
scalacompile_runs="$( | ||
bazel build --color no --subcommands "$1" |& \ | ||
grep '^SUBCOMMAND: # //ijar:.* \[.*, mnemonic: ScalaCompile\]$' | \ | ||
wc -l | ||
)" | ||
|
||
if [ "$scalacompile_runs" -ne "$2" ]; then | ||
echo "Expected 1 \`ScalaCompile\` action to be executed, but got $scalacompile_runs" | ||
exit 1 | ||
fi | ||
} | ||
|
||
invalidate_dependency_cache | ||
invalidate_dependent_cache | ||
test_actions_executed //ijar:dependent 2 | ||
|
||
invalidate_dependency_cache | ||
test_actions_executed //ijar:dependent 1 |