Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buildMavenPackage: add doCheck support #316765

Merged
merged 11 commits into from
Jun 4, 2024
3 changes: 2 additions & 1 deletion pkgs/applications/misc/ns-usbloader/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ maven.buildMavenPackage rec {
x86_64-linux = "sha256-vXZAlZOh9pXNF1RL78oQRal5pkXFRKDz/7SP9LibgiA=";
aarch64-linux = "sha256-xC+feb41EPi30gBrVR8usanVULI2Pt0knztzNagPQiw=";
};
mvnParameters = "-DskipTests";

nativeBuildInputs = [
copyDesktopItems
Expand All @@ -46,6 +45,8 @@ maven.buildMavenPackage rec {
gvfs
];

doCheck = false;

# Don't wrap binaries twice.
dontWrapGApps = true;

Expand Down
4 changes: 3 additions & 1 deletion pkgs/applications/science/misc/openrefine/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,13 @@ in maven'.buildMavenPackage {
postPatch = ''
cp -r ${npmPkg} main/webapp/modules/core/3rdparty
'';
mvnParameters = "-DskipTests=true -pl !packaging";
mvnParameters = "-pl !packaging";
mvnHash = "sha256-0qsKUMV9M0ZaddR5ust8VikSrsutdxVNNezKqR+F/6M=";

nativeBuildInputs = [ makeWrapper ];

doCheck = false;

installPhase = ''
mkdir -p $out/lib/server/target/lib
cp -r server/target/lib/* $out/lib/server/target/lib/
Expand Down
3 changes: 2 additions & 1 deletion pkgs/by-name/co/commafeed/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ maven.buildMavenPackage {
"-Dskip.npm"
"-Dspotless.check.skip"
"-Dmaven.gitcommitid.skip"
"-DskipTests"
];

nativeBuildInputs = [ makeWrapper ];
Expand All @@ -71,6 +70,8 @@ maven.buildMavenPackage {
runHook postConfigure
'';

doCheck = false;

installPhase = ''
runHook preInstall

Expand Down
4 changes: 3 additions & 1 deletion pkgs/by-name/ko/kotlin-interactive-shell/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ maven.buildMavenPackage rec {
};

mvnHash = "sha256-m1o0m0foqJhEzWjC9behBeld5HT08WClcZN2xc3fZrI=";
mvnParameters = "-DskipTests compile";
mvnParameters = "compile";

nativeBuildInputs = [ makeWrapper ];

doCheck = false;

installPhase = ''
runHook preInstall

Expand Down
3 changes: 1 addition & 2 deletions pkgs/by-name/ma/mariadb-connector-java/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ maven.buildMavenPackage rec {

mvnHash = "sha256-7O+G5HT6mtp12zWL3Gn12KPVUwp3GMaWGvXX6Sg1+6k=";

# Disable tests because they require networking
mvnParameters = "-DskipTests";
doCheck = false; # Requires networking

installPhase = ''
runHook preInstall
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/s3/s3proxy/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ maven.buildMavenPackage {
hash = "sha256-GhZPvo8wlXInHwg8rSmpwMMkZVw5SMpnZyKqFUYLbrE=";
};

mvnParameters = lib.optionalString stdenv.isDarwin "-DskipTests";
doCheck = !stdenv.isDarwin;

nativeBuildInputs = [ makeWrapper ];

Expand Down
4 changes: 3 additions & 1 deletion pkgs/by-name/so/sonarlint-ls/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ mavenJdk17.buildMavenPackage rec {

# disable node and npm module installation because the need network access
# for the tests.
mvnDepsParameters = "-Dskip.installnodenpm=true -Dskip.npm -DskipTests package";
mvnDepsParameters = "-Dskip.installnodenpm=true -Dskip.npm package";

# disable failing tests which either need network access or are flaky
mvnParameters = lib.escapeShellArgs [
Expand All @@ -53,6 +53,8 @@ mavenJdk17.buildMavenPackage rec {
!JavaMediumTests"
];

doCheck = false;

installPhase = ''
runHook preInstall

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{ src
, sourceRoot ? null
, buildOffline ? false
, doCheck ? true
, patches ? [ ]
, pname
, version
Expand All @@ -22,6 +23,7 @@
# created to allow using maven packages in the same style as rust

let
mvnSkipTests = lib.optionalString (!doCheck) "-DskipTests";
fetchedMavenDeps = stdenv.mkDerivation ({
name = "${pname}-${version}-maven-deps";
inherit src sourceRoot patches;
Expand Down Expand Up @@ -49,7 +51,7 @@ let
mvn dependency:sources -DincludeGroupIds="$group" -DincludeArtifactIds="$artifact" -Dmaven.repo.local=$out/.m2
done
'' + lib.optionalString (!buildOffline) ''
mvn package -Dmaven.repo.local=$out/.m2 ${mvnParameters}
mvn package -Dmaven.repo.local=$out/.m2 ${mvnSkipTests} ${mvnParameters}
'' + ''
runHook postBuild
'';
Expand Down Expand Up @@ -85,7 +87,7 @@ stdenv.mkDerivation (builtins.removeAttrs args [ "mvnFetchExtraArgs" ] // {
runHook preBuild

mvnDeps=$(cp -dpR ${fetchedMavenDeps}/.m2 ./ && chmod +w -R .m2 && pwd)
mvn package -o -nsu "-Dmaven.repo.local=$mvnDeps/.m2" ${mvnParameters}
mvn package -o -nsu "-Dmaven.repo.local=$mvnDeps/.m2" ${mvnSkipTests} ${mvnParameters}

runHook postBuild
'';
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/tools/java/java-language-server/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ maven.buildMavenPackage rec {
};

mvnFetchExtraArgs.dontConfigure = true;
mvnParameters = "-DskipTests";
mvnHash = "sha256-2uthmSjFQ43N5lgV11DsxuGce+ZptZsmRLTgjDo0M2w=";

nativeBuildInputs = [ jdk makeWrapper ];
Expand All @@ -39,6 +38,8 @@ maven.buildMavenPackage rec {
--compress 2
'';

doCheck = false;

installPhase = ''
runHook preInstall

Expand Down
4 changes: 2 additions & 2 deletions pkgs/games/forge-mtg/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ maven.buildMavenPackage {
pname = "forge-mtg";
inherit version src patches;

# Tests need a running Xorg.
mvnParameters = "-DskipTests";
mvnHash = "sha256-QK9g0tG75lIhEtf4jW03N32YbD9Fe5iI0JTuqmCTtnE=";

doCheck = false; # Needs a running Xorg

nativeBuildInputs = [ makeWrapper ];

installPhase = ''
Expand Down
4 changes: 3 additions & 1 deletion pkgs/servers/h2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ maven.buildMavenPackage rec {
hash = "sha256-pS9jSiuInA0eULPOZK5cjwr9y5KDVY51blhZ9vs4z+g=";
};

mvnParameters = "-f h2/pom.xml -DskipTests";
mvnParameters = "-f h2/pom.xml";
mvnHash = "sha256-hUzE4F+RNCAfoY836pjrivf04xqN4m9SkiLXhmVzZRA=";

nativeBuildInputs = [ makeWrapper ];

doCheck = false;

installPhase = ''
mkdir -p $out/share/java
install -Dm644 h2/target/h2-${version}.jar $out/share/java
Expand Down