Merge pull request #161956 from Ma27/bump-signald

signald: 0.15.0 -> 0.17.0
This commit is contained in:
Maximilian Bosch 2022-02-28 16:58:44 +01:00 committed by GitHub
commit aa688ca64e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 107 additions and 46 deletions

View File

@ -0,0 +1,35 @@
From 232c692240b9c52b95bd38ba7aecb11e7077cf31 Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Sat, 26 Feb 2022 12:33:13 +0100
Subject: [PATCH] Fetch buildconfig during gradle build inside Nix FOD
---
build.gradle | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/build.gradle b/build.gradle
index cbb587f..3b06e80 100644
--- a/build.gradle
+++ b/build.gradle
@@ -82,6 +82,9 @@ static String getVersion() {
repositories {
maven {url "https://gitlab.com/api/v4/groups/6853927/-/packages/maven"} // https://gitlab.com/groups/signald/-/packages
+ maven {
+ url "https://plugins.gradle.org/m2/"
+ }
mavenCentral()
}
@@ -102,6 +105,8 @@ dependencies {
implementation 'io.prometheus:simpleclient_httpserver:0.14.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
implementation 'io.sentry:sentry:5.6.1'
+ implementation 'com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:3.0.3'
+ implementation 'org.jetbrains.kotlin:kotlin-scripting-jvm:1.4.31'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
}
--
2.33.1

View File

@ -0,0 +1,60 @@
From 80277ce9e24d9efa8dfd6eb775187c823e0e528e Mon Sep 17 00:00:00 2001
From: Maximilian Bosch <maximilian@mbosch.me>
Date: Sat, 26 Feb 2022 12:36:15 +0100
Subject: [PATCH 2/2] buildconfig/local deps fixes
---
build.gradle | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/build.gradle b/build.gradle
index cbb587f..ad836cf 100644
--- a/build.gradle
+++ b/build.gradle
@@ -9,10 +9,21 @@ import org.gradle.nativeplatform.platform.internal.ArchitectureInternal
import org.gradle.nativeplatform.platform.internal.OperatingSystemInternal
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
+buildscript {
+ repositories {
+ maven {
+ url(uri("@deps@"))
+ }
+ }
+ dependencies {
+ classpath "com.github.gmazzo:gradle-buildconfig-plugin:3.0.3"
+ }
+}
+
plugins {
- id 'com.github.gmazzo.buildconfig' version '3.0.3'
id 'application'
}
+apply plugin: "com.github.gmazzo.buildconfig"
compileJava.options.encoding = 'UTF-8'
@@ -82,7 +93,10 @@ static String getVersion() {
repositories {
maven {url "https://gitlab.com/api/v4/groups/6853927/-/packages/maven"} // https://gitlab.com/groups/signald/-/packages
- mavenCentral()
+ mavenLocal()
+ maven {
+ url uri("@deps@")
+ }
}
dependencies {
@@ -102,6 +116,8 @@ dependencies {
implementation 'io.prometheus:simpleclient_httpserver:0.14.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
implementation 'io.sentry:sentry:5.6.1'
+ implementation 'com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:3.0.3'
+ implementation 'org.jetbrains.kotlin:kotlin-scripting-jvm:1.4.31'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
}
--
2.33.1

View File

@ -1,34 +1,24 @@
{ lib, stdenv, fetchurl, fetchFromGitLab, jdk17_headless, coreutils, gradle_6, git, perl
, makeWrapper, fetchpatch
, makeWrapper, fetchpatch, substituteAll
}:
let
pname = "signald";
version = "0.15.0";
version = "0.17.0";
src = fetchFromGitLab {
owner = pname;
repo = pname;
rev = version;
sha256 = "ftK+oeqzJ+TxrlvqivFkAi5RCcyJ5Y0oQAJuo0YheBg=";
};
log4j-update-cve-2021-44228 = fetchpatch {
url = "https://gitlab.com/signald/signald/-/commit/7f668062ab9ffa09a49d171e995f57cf0a0803a7.patch";
sha256 = "sha256-504je6hKciUGelVCGZjxGjHi1qZQaovagXD5PBQP+mM=";
};
buildConfigJar = fetchurl {
url = "https://dl.bintray.com/mfuerstenau/maven/gradle/plugin/de/fuerstenau/BuildConfigPlugin/1.1.8/BuildConfigPlugin-1.1.8.jar";
sha256 = "0y1f42y7ilm3ykgnm6s3ks54d71n8lsy5649xgd9ahv28lj05x9f";
sha256 = "sha256-eN6lEs6PuRczbzQZmGlNf6Ahp4FbWpA3EArlATEiZHU=";
};
# fake build to pre-download deps into fixed-output derivation
deps = stdenv.mkDerivation {
pname = "${pname}-deps";
inherit src version;
patches = [ log4j-update-cve-2021-44228 ];
nativeBuildInputs = [ gradle_6 perl ];
patches = [ ./0001-Fetch-buildconfig-during-gradle-build-inside-Nix-FOD.patch ];
buildPhase = ''
export GRADLE_USER_HOME=$(mktemp -d)
gradle --no-daemon build
@ -36,7 +26,7 @@ let
# 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)
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 =~ s/-jvm//r)}" #e' \
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/''${\($5 =~ s/okio-jvm/okio/r)}" #e' \
| sh
'';
# Don't move info to share/
@ -45,8 +35,8 @@ let
outputHashMode = "recursive";
# Downloaded jars differ by platform
outputHash = {
x86_64-linux = "sha256-e2Tehtznc+VsvQzD3lQ50Lg7ipQc7P3ekOnb8XLORO8=";
aarch64-linux = "sha256-P48s3vG5vUNxCCga5FhzpODhlvvc+F2ZZGX/G0FVGWc=";
x86_64-linux = "sha256-kZ25p+lIkOqNoFFBgJRYFcvKJenKICVa1PasaaEHmRA=";
aarch64-linux = "sha256-CbFNigp3R7ETX0uXv6PNuhDpmPc4sowbWmwZ+5txXQs=";
}.${stdenv.system} or (throw "Unsupported platform");
};
@ -54,22 +44,17 @@ in stdenv.mkDerivation rec {
inherit pname src version;
patches = [
./gradle-plugin.patch
log4j-update-cve-2021-44228
(substituteAll {
src = ./0002-buildconfig-local-deps-fixes.patch;
inherit deps;
})
];
postPatch = ''
sed -i 's|BuildConfig.jar|${buildConfigJar}|' build.gradle
'';
buildPhase = ''
runHook preBuild
export GRADLE_USER_HOME=$(mktemp -d)
# Use the local packages from -deps
sed -i -e 's|mavenCentral()|mavenLocal(); maven { url uri("${deps}") }|' build.gradle
gradle --offline --no-daemon distTar
runHook postBuild
@ -100,7 +85,7 @@ in stdenv.mkDerivation rec {
'';
homepage = "https://signald.org";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ expipiplus1 ];
maintainers = with maintainers; [ expipiplus1 ma27 ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
};
}

View File

@ -1,19 +0,0 @@
diff --git a/build.gradle b/build.gradle
index 11d7a99..66805bb 100644
--- a/build.gradle
+++ b/build.gradle
@@ -18,9 +18,12 @@ import org.gradle.nativeplatform.platform.internal.OperatingSystemInternal
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
import org.xml.sax.SAXParseException
-plugins {
- id 'de.fuerstenau.buildconfig' version '1.1.8'
+buildscript {
+ dependencies {
+ classpath files ("BuildConfig.jar")
+ }
}
+apply plugin: 'de.fuerstenau.buildconfig'
apply plugin: 'java'
apply plugin: 'application'