Skip to content
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
11 changes: 5 additions & 6 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,11 @@ trait FirtoolResolver extends CrossScalaModule with ChipsAlliancePublishModule {
)

// Modify the classpath to remove things we want to dynamically link (Scala jars).
override def upstreamAssemblyClasspath: T[Agg[PathRef]] = T {
val all = super.upstreamAssemblyClasspath()
// Remove Scala jars.
// This removes scala-library, scala-collection-compat, and scala-xml.
val regex = """.*/scala[^\/]*\.jar""".r
all.filterNot(path => regex.matches(path.toString))
override def upstreamIvyAssemblyClasspath: T[Agg[PathRef]] = T {
val all = super.upstreamIvyAssemblyClasspath()
// Remove Scala jars (scala-library, scala-collection-compat, scala-xml, etc.)
val regex = """scala.*\.jar""".r
all.filterNot(p => regex.matches(p.path.last))
}

// Our assembly is not intended to be an executable.
Expand Down
17 changes: 17 additions & 0 deletions firtool-resolver/test/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@ $THIS_DIR/negative.sh 2>&1 | FileCheck $THIS_DIR/negative.sh

./mill firtool-resolver[$SCALA_VERSION].publishLocal

# Sanity check: the firtool-resolver jar must not bundle scala-library or other scala jars
RESOLVER_JAR="out/firtool-resolver/$SCALA_VERSION/jar.dest/out.jar"
if [[ ! -f "$RESOLVER_JAR" ]]; then
echo "ERROR: firtool-resolver jar not found at $RESOLVER_JAR"
exit 1
fi
if jar tf "$RESOLVER_JAR" | grep -q "^scala"; then
echo "ERROR: firtool-resolver jar contains scala entries that should not be bundled:"
jar tf "$RESOLVER_JAR" | grep "^scala" | head -10
exit 1
fi
# Also sanity check that we're checking the correct jar
if ! jar tf "$RESOLVER_JAR" | grep -q "^firtoolresolver/"; then
echo "ERROR: firtool-resolver jar is missing firtoolresolver/ classes"
exit 1
fi

$THIS_DIR/on_classpath.sh 2>&1 | FileCheck -DLLVM_FIRTOOL_VERSION="$LLVM_FIRTOOL_VERSION" -DFIRTOOL_VERSION="$FIRTOOL_VERSION" $THIS_DIR/on_classpath.sh

$THIS_DIR/installed.sh 2>&1 | FileCheck -DLLVM_FIRTOOL_VERSION="$LLVM_FIRTOOL_VERSION" -DFIRTOOL_VERSION="$FIRTOOL_VERSION" $THIS_DIR/installed.sh
Expand Down
Loading