Skip to content

Commit 00bd9bf

Browse files
committed
Add default dependency filter to ignore metadata jars
1 parent ce81537 commit 00bd9bf

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

buildGradleApplication/default.nix

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,19 @@
1414
gradle ? pkgs.gradle,
1515
buildInputs ? [],
1616
nativeBuildInputs ? [],
17-
dependencyFilter ? depSpec: true,
17+
dependencyFilter ? depSpec: let
18+
# Lots of libraries have references to metadata jars that are not present on maven central, for example:
19+
# - kasechange-metadata-1.4.1.jar (net.pearx.kasechange:kasechange)
20+
# - kotlin-result-metadata-2.0.0.jar (com.michael-bull.kotlin-result:kotlin-result)
21+
# - kotlinx-serialization-core-metadata-1.7.0.jar (org.jetbrains.kotlinx:kotlinx-serialization-core)
22+
# These will make the nix build fail because we cannot fetch them. They are usually not needed for the build, so it's relatively safe to ignore them by default.
23+
# However, it MIGHT be the case that some -metadata.jars ARE actually required but I have not yet found one. If you do, please open an issue!
24+
isUnpublishedMetadataJar =
25+
depSpec.name == "${depSpec.component.name}-metadata-${depSpec.component.version}.jar";
26+
in
27+
if isUnpublishedMetadataJar
28+
then builtins.trace "Ignoring potentially unpublished metadata jar: ${depSpec.name}" false
29+
else true,
1830
repositories ? ["https://plugins.gradle.org/m2/" "https://repo1.maven.org/maven2/"],
1931
verificationFile ? "gradle/verification-metadata.xml",
2032
buildTask ? ":installDist",

0 commit comments

Comments
 (0)