Skip to content

Commit

Permalink
Better runEngineDistribution --run test/Base_Tests "filter" (#8940)
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach authored Feb 4, 2024
1 parent 1d109ec commit 2028d6b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 36 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2019,7 +2019,7 @@ lazy val `runtime-fat-jar` =
case PathList("META-INF", "services", xs @ _*) =>
MergeStrategy.concat
case PathList(xs @ _*) if xs.last.contains("module-info") =>
JPMSUtils.removeAllModuleInfoExcept("runtime")
MergeStrategy.preferProject
case _ => MergeStrategy.first
}
)
Expand Down
31 changes: 0 additions & 31 deletions project/JPMSUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,37 +127,6 @@ object JPMSUtils {
truffleRelatedArtifacts
}

/** There may be multiple module-info.class files comming from different
* dependencies. We care only about the one from the `runtime` project.
* The following merge strategy ensures that all other module-info.class
* files are discarded from the resulting uber Jar.
*
* @param projName Project name for which the module-info.class is retained.
*/
def removeAllModuleInfoExcept(
projName: String
): MergeStrategy = {
CustomMergeStrategy(
strategyName =
s"Discard all module-info except for module-info from project $projName",
notifyIfGTE = 1
) { conflictingDeps: Vector[Dependency] =>
val runtimeModuleInfoOpt = conflictingDeps.collectFirst {
case project @ Project(name, _, _, stream) if name == projName =>
project
}
runtimeModuleInfoOpt match {
case Some(runtimeModuleInfo) =>
Right(
Vector(
JarEntry(runtimeModuleInfo.target, runtimeModuleInfo.stream)
)
)
case None => Right(Vector())
}
}
}

/** Compiles a single `module-info.java` source file with the default java compiler (
* the one that is defined for the project). Before the module-info is compiled, all the
* class files from `scopeFilter` are copied into the `target` directory of the current project.
Expand Down
6 changes: 4 additions & 2 deletions test/Base_Tests/src/Main.enso
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import project.System.Temporary_File_Spec

import project.Random_Spec

main =
main filter=Nothing =
suite = Test.build suite_builder->
Any_Spec.add_specs suite_builder
Array_Spec.add_specs suite_builder
Expand Down Expand Up @@ -126,6 +126,7 @@ main =
Instrumentor_Spec.add_specs suite_builder
Meta_Location_Spec.add_specs suite_builder
Names_Spec.add_specs suite_builder
Numbers_Spec.add_specs suite_builder
Equals_Spec.add_specs suite_builder
Ordering_Spec.add_specs suite_builder
Comparator_Spec.add_specs suite_builder
Expand Down Expand Up @@ -165,4 +166,5 @@ main =
System_Spec.add_specs suite_builder
Random_Spec.add_specs suite_builder
XML_Spec.add_specs suite_builder
suite.run_with_filter

suite.run_with_filter filter
5 changes: 3 additions & 2 deletions test/Table_Tests/src/Main.enso
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ import project.Helpers
import project.In_Memory
import project.IO

main =
main filter=Nothing =
suite = Test.build suite_builder->
In_Memory.Main.add_specs suite_builder
IO.Main.add_specs suite_builder
Formatting.Main.add_specs suite_builder
Database.Main.add_specs suite_builder
Helpers.Main.add_specs suite_builder
suite.run_with_filter

suite.run_with_filter filter

0 comments on commit 2028d6b

Please sign in to comment.