schemaspy: convert to mavenfod

This commit is contained in:
Weijia Wang 2023-06-20 12:56:20 +03:00
parent 940fcf2e5b
commit 1431c97d55

View File

@ -1,10 +1,7 @@
{ lib { lib
, stdenv , javaPackages
, callPackage
, maven , maven
, jdk
, jre , jre
, buildMaven
, makeWrapper , makeWrapper
, git , git
, fetchFromGitHub , fetchFromGitHub
@ -12,53 +9,32 @@
, ensureNewerSourcesHook , ensureNewerSourcesHook
}: }:
let javaPackages.mavenfod rec {
version = "6.1.1-SNAPSHOT";
pname = "schemaspy"; pname = "schemaspy";
version = "6.1.1-SNAPSHOT";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "schemaspy"; owner = "schemaspy";
repo = "schemaspy"; repo = "schemaspy";
rev = "110b1614f9ae4aec0e4dc4e8f0e7c647274d3af6"; rev = "110b1614f9ae4aec0e4dc4e8f0e7c647274d3af6";
sha256 = "sha256-X5B34zGhD/NxcK8TQvwdk1NljGJ1HwfBp47ocbE4HiU="; hash = "sha256-X5B34zGhD/NxcK8TQvwdk1NljGJ1HwfBp47ocbE4HiU=";
}; };
deps = stdenv.mkDerivation { mvnParameters = "-Dmaven.test.skip=true";
name = "${pname}-${version}-deps"; mvnFetchExtraArgs = {
inherit src; nativeBuildInputs = [
# the build system gets angry if it doesn't see git (even though it's not
nativeBuildInputs = [ jdk maven git ]; # actually in a git repository)
buildInputs = [ jre ]; git
maven
buildPhase = '' ];
mvn package -Dmaven.test.skip=true -Dmaven.repo.local=$out/.m2 -Dmaven.wagon.rto=5000
'';
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
installPhase = ''
find $out/.m2 -type f -regex '.+\(\.lastUpdated\|resolver-status\.properties\|_remote\.repositories\)' -delete
find $out/.m2 -type f -iname '*.pom' -exec sed -i -e 's/\r\+$//' {} \;
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-CUFA9L6qqjo3Jp5Yy1yCqbS9QAEb9PElys4ArPa9VhA=";
doCheck = false;
}; };
in mvnHash = "sha256-udjk5YlTK+Mm8weDhesK6X7qZn4w9HbKZ821SyWxsOE=";
stdenv.mkDerivation rec {
inherit version pname src;
buildInputs = [
maven
];
nativeBuildInputs = [ nativeBuildInputs = [
makeWrapper makeWrapper
# the build system gets angry if it doesn't see git (even though it's not
# actually in a git repository)
git git
maven
# springframework boot gets angry about 1970 sources # springframework boot gets angry about 1970 sources
# fix from https://github.com/nix-community/mavenix/issues/25 # fix from https://github.com/nix-community/mavenix/issues/25
@ -69,11 +45,9 @@ stdenv.mkDerivation rec {
graphviz graphviz
]; ];
buildPhase = '' preBuild = ''
VERSION=${version} VERSION=${version}
SEMVER_STR=${version} SEMVER_STR=${version}
mvn package --offline -Dmaven.test.skip=true -Dmaven.repo.local=$(cp -dpR ${deps}/.m2 ./ && chmod +w -R .m2 && pwd)/.m2
''; '';
installPhase = '' installPhase = ''