diff --git a/pkgs/servers/aeron/default.nix b/pkgs/servers/aeron/default.nix index 5ce49660f4af..f0ba679c9628 100644 --- a/pkgs/servers/aeron/default.nix +++ b/pkgs/servers/aeron/default.nix @@ -1,138 +1,103 @@ { lib, stdenv, - fetchFromGitHub, + fetchMavenArtifact, jdk11, - gradle, - makeWrapper, - perl, - writeText + makeWrapper }: let pname = "aeron"; version = "1.40.0"; + groupId = "io.aeron"; - src = fetchFromGitHub { - owner = "real-logic"; - repo = pname; - rev = version; - sha256 = "sha256-4C5YofA/wxwa7bfc6IqsDrw8CLQWKoVBCIe8Ec7ifAg="; + aeronAll_1_40_0 = fetchMavenArtifact { + inherit groupId; + version = "1.40.0"; + artifactId = "aeron-all"; + hash = "sha512-NyhYaQqOWcSBwzwpje6DMAp36CEgGSNXBSdaRrDyP+Fn2Z0nvh5o2czog6GKKtbjH9inYfyyF/21gehfgLF6qA=="; }; - deps = stdenv.mkDerivation { - name = "${pname}-deps"; - inherit src; - - nativeBuildInputs = [ - gradle - jdk11 - perl - ]; - - buildPhase = '' - export GRADLE_USER_HOME=$(mktemp -d); - gradle \ - --console plain \ - --no-daemon \ - --system-prop org.gradle.java.home="${jdk11.home}" \ - --exclude-task javadoc \ - build - ''; - - # Mavenize dependency paths - # e.g. org.codehaus.groovy/groovy/2.4.0/{hash}/groovy-2.4.0.jar -> org/codehaus/groovy/groovy/2.4.0/groovy-2.4.0.jar - installPhase = '' - find "$GRADLE_USER_HOME/caches/modules-2" -type f -regex '.*\.\(jar\|pom\)' \ - | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \ - | sh - ln -s "$out/com/squareup/okio/okio/2.10.0/okio-jvm-2.10.0.jar" "$out/com/squareup/okio/okio/2.10.0/okio-2.10.0.jar" - ''; - - outputHashAlgo = "sha256"; - outputHashMode = "recursive"; - outputHash = "sha256-1hvQyEiCMfIw6wv9GOEehX0wrtBnAilVuTGUWAGoH6k="; + aeronAgent_1_40_0 = fetchMavenArtifact { + inherit groupId; + version = "1.40.0"; + artifactId = "aeron-agent"; + hash = "sha512-3XZ6XxPwlNchMe4p4MuDNTWntGokFPnetN7AUMlhXzIgeXBExXvn+BdxI2crfq/xgVGrF/hjHD2shwu2NBa0Tg=="; }; - # Point to our local deps repo - gradleInit = writeText "init.gradle" '' - settingsEvaluated { settings -> - settings.pluginManagement { - repositories { - clear() - maven { url '${deps}' } - } - } - } - gradle.projectsLoaded { - rootProject.allprojects { - repositories { - clear() - maven { url '${deps}' } - } - } - } - ''; + aeronArchive_1_40_0 = fetchMavenArtifact { + inherit groupId; + version = "1.40.0"; + artifactId = "aeron-archive"; + hash = "sha512-tmH+/020d1iNkGb8nvenDG9YU+H4PLuO2hSm2dULUIjSXX5AHLDkkrQ3uVQADV9koRNMtC4UXloqtqncay18kQ=="; + }; - # replace buildSrc - buildSrc = writeText "build.gradle" '' - repositories { - clear() - maven { url '${deps}' } - } + aeronClient_1_40_0 = fetchMavenArtifact { + inherit groupId; + version = "1.40.0"; + artifactId = "aeron-client"; + hash = "sha512-y3/8Lu2EgMICRNPEWe0hrKpVhF35pDjCO6ip/Af9nPZ70ZRqGmlfEG7OzWVok11DuI8pYJ64jv6bEtUfSHTYXQ=="; + }; - dependencies { - implementation 'org.asciidoctor:asciidoctorj:2.5.5' - implementation 'org.eclipse.jgit:org.eclipse.jgit:5.13.1.202206130422-r' - } - ''; + aeronCluster_1_40_0 =fetchMavenArtifact { + inherit groupId; + version = "1.40.0"; + artifactId = "aeron-cluster"; + hash = "sha512-28m14Etjse3MVKBLvaQONujMfvdRQZG0ArezzVcjPEqVqTGd33mrqjPngALV8CG2nJTtcrJmsieRGLEosaXqTw=="; + }; -in stdenv.mkDerivation rec { + aeronDriver_1_40_0 = fetchMavenArtifact { + inherit groupId; + version = "1.40.0"; + artifactId = "aeron-driver"; + hash = "sha512-SRWHMHR6J1YEtCbSHqSLYm3vo8XgkVXGK3cFQbONT60TZvawP5UlZs7e3eFNpu3qQSA4prqEjjWO9Xc9M/sjKw=="; + }; - inherit pname src version; + aeronSamples_1_40_0 = fetchMavenArtifact { + inherit groupId; + version = "1.40.0"; + artifactId = "aeron-samples"; + hash = "sha512-vyAq4mfLDDyaVk7wcIpPvPcxSt92Ek8mxfuuZwaX+0Wu9oJCpwbnjvS9+bvzcE4qSGxzY6eJIIX6nMdw0LkACg=="; + }; + + aeronAll = aeronAll_1_40_0; + aeronArchive = aeronArchive_1_40_0; + aeronClient = aeronClient_1_40_0; + aeronCluster = aeronCluster_1_40_0; + aeronDriver= aeronDriver_1_40_0; + aeronSamples = aeronSamples_1_40_0; + +in stdenv.mkDerivation { + + inherit pname version; buildInputs = [ - jdk11 + aeronAll + aeronArchive + aeronClient + aeronCluster + aeronDriver + aeronSamples ]; nativeBuildInputs = [ - gradle makeWrapper ]; - buildPhase = '' - runHook preBuild - - export GRADLE_USER_HOME=$(mktemp -d) - cp ${buildSrc} ./buildSrc/build.gradle - - gradle \ - --console plain \ - --exclude-task checkstyleMain \ - --exclude-task checkstyleGenerated \ - --exclude-task checkstyleGeneratedTest \ - --exclude-task checkstyleMain \ - --exclude-task checkstyleTest \ - --exclude-task javadoc \ - --exclude-task test \ - --init-script "${gradleInit}" \ - --no-daemon \ - --offline \ - --project-prop VERSION=${version} \ - --system-prop org.gradle.java.home="${jdk11.home}" \ - assemble - - runHook postBuild - ''; + dontUnpack = true; + dontConfigure = true; + dontBuild = true; installPhase = '' runHook preInstall - install -D --mode=0444 --target-directory="$out/share/java" \ - "./aeron-all/build/libs/aeron-all-${version}.jar" \ - "./aeron-agent/build/libs/aeron-agent-${version}.jar" \ - "./aeron-archive/build/libs/aeron-archive-${version}.jar" \ - "./aeron-client/build/libs/aeron-client-${version}.jar" + mkdir --parents "$out/share/java" + ln --symbolic "${aeronAll.jar}" "$out/share/java/${pname}-all-${version}.jar" + ln --symbolic "${aeronArchive.jar}" "$out/share/java/${pname}-archive-${version}.jar" + ln --symbolic "${aeronClient.jar}" "$out/share/java/${pname}-client-${version}.jar" + ln --symbolic "${aeronCluster.jar}" "$out/share/java/${pname}-cluster-${version}.jar" + ln --symbolic "${aeronDriver.jar}" "$out/share/java/${pname}-driver-${version}.jar" + ln --symbolic "${aeronSamples.jar}" "$out/share/java/${pname}-samples-${version}.jar" runHook postInstall ''; @@ -141,7 +106,7 @@ in stdenv.mkDerivation rec { function wrap { makeWrapper "${jdk11}/bin/java" "$out/bin/$1" \ --add-flags "--add-opens java.base/sun.nio.ch=ALL-UNNAMED" \ - --add-flags "--class-path $out/share/java/aeron-all-${version}.jar" \ + --add-flags "--class-path ${aeronAll.jar}" \ --add-flags "$2" } @@ -153,22 +118,9 @@ in stdenv.mkDerivation rec { wrap "${pname}-cluster-tool" io.aeron.cluster.ClusterTool ''; - doCheck = true; - - checkPhase = '' - runHook preCheck - - gradle \ - --console plain \ - --init-script "${gradleInit}" \ - --no-daemon \ - --offline \ - --project-prop VERSION=${version} \ - --system-prop org.gradle.java.home="${jdk11.home}" \ - test - - runHook postCheck - ''; + passthru = { + jar = aeronAll.jar; + }; meta = with lib; { description = "Low-latency messaging library";