mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 15:03:28 +00:00
mucommander: convert to gradle setup hook
This commit is contained in:
parent
7b1a794bc2
commit
e7aa9a3aeb
@ -2,20 +2,22 @@
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, gradle_7
|
||||
, perl
|
||||
, makeWrapper
|
||||
, writeText
|
||||
, jdk
|
||||
, gsettings-desktop-schemas
|
||||
}:
|
||||
|
||||
let
|
||||
gradle = gradle_7;
|
||||
in
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "mucommander";
|
||||
version = "1.3.0-1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mucommander";
|
||||
repo = "mucommander";
|
||||
rev = version;
|
||||
rev = finalAttrs.version;
|
||||
sha256 = "sha256-rSHHv96L2EHQuKBSAdpfi1XGP2u9o2y4g1+65FHWFMw=";
|
||||
};
|
||||
|
||||
@ -23,72 +25,19 @@ let
|
||||
# there is no .git anyway
|
||||
substituteInPlace build.gradle \
|
||||
--replace "git = grgit.open(dir: project.rootDir)" "" \
|
||||
--replace "id 'org.ajoberstar.grgit' version '3.1.1'" "" \
|
||||
--replace "revision = git.head().id" "revision = '${version}'"
|
||||
--replace "revision = git.head().id" "revision = '${finalAttrs.version}'"
|
||||
'';
|
||||
|
||||
# fake build to pre-download deps into fixed-output derivation
|
||||
deps = stdenv.mkDerivation {
|
||||
pname = "mucommander-deps";
|
||||
inherit version src postPatch;
|
||||
nativeBuildInputs = [ gradle_7 perl ];
|
||||
buildPhase = ''
|
||||
export GRADLE_USER_HOME=$(mktemp -d)
|
||||
gradle --no-daemon tgz
|
||||
'';
|
||||
# perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
|
||||
# reproducible by sorting
|
||||
installPhase = ''
|
||||
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
|
||||
| LC_ALL=C sort \
|
||||
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
|
||||
| sh
|
||||
# copy maven-metadata.xml for commons-codec
|
||||
# thankfully there is only one xml
|
||||
cp $GRADLE_USER_HOME/caches/modules-2/resources-2.1/*/*/maven-metadata.xml $out/commons-codec/commons-codec/maven-metadata.xml
|
||||
'';
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
outputHash = "sha256-9tCcUg7hDNbkZiQEWtVRsUUfms73aU+vt5tQsfknM+E=";
|
||||
nativeBuildInputs = [ gradle makeWrapper ];
|
||||
|
||||
mitmCache = gradle.fetchDeps {
|
||||
inherit (finalAttrs) pname;
|
||||
data = ./deps.json;
|
||||
};
|
||||
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "mucommander";
|
||||
inherit version src postPatch;
|
||||
nativeBuildInputs = [ gradle_7 perl makeWrapper ];
|
||||
__darwinAllowLocalNetworking = true;
|
||||
|
||||
# Point to our local deps repo
|
||||
gradleInit = writeText "init.gradle" ''
|
||||
logger.lifecycle 'Replacing Maven repositories with ${deps}...'
|
||||
gradle.projectsLoaded {
|
||||
rootProject.allprojects {
|
||||
buildscript {
|
||||
repositories {
|
||||
clear()
|
||||
maven { url '${deps}' }
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
clear()
|
||||
maven { url '${deps}' }
|
||||
}
|
||||
}
|
||||
}
|
||||
settingsEvaluated { settings ->
|
||||
settings.pluginManagement {
|
||||
repositories {
|
||||
maven { url '${deps}' }
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
export GRADLE_USER_HOME=$(mktemp -d)
|
||||
|
||||
gradle --offline --init-script ${gradleInit} --no-daemon tgz
|
||||
'';
|
||||
gradleBuildTask = "tgz";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/mucommander
|
||||
@ -107,4 +56,4 @@ stdenv.mkDerivation rec {
|
||||
platforms = platforms.all;
|
||||
mainProgram = "mucommander";
|
||||
};
|
||||
}
|
||||
})
|
||||
|
1064
pkgs/applications/file-managers/mucommander/deps.json
generated
Normal file
1064
pkgs/applications/file-managers/mucommander/deps.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user