Maximilian Bosch 2023-02-13 10:40:21 +01:00
parent e8b67bd87c
commit 60838304dd
No known key found for this signature in database
GPG key ID: 9A6EEA275CA5BE0A
3 changed files with 59 additions and 32 deletions

View file

@ -1,4 +1,4 @@
From 2c126682aaabd7f486dfb2ff75fe29b5d8697060 Mon Sep 17 00:00:00 2001
From 33d8de9ccce7eecb12542e0fc11131b5101e1aa8 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
@ -8,10 +8,10 @@ Subject: [PATCH] Fetch buildconfig during gradle build inside Nix FOD
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/build.gradle b/build.gradle
index 799e782..caceaac 100644
index ea3fea1..01e444d 100644
--- a/build.gradle
+++ b/build.gradle
@@ -83,6 +83,9 @@ static String getVersion() {
@@ -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
@ -21,16 +21,16 @@ index 799e782..caceaac 100644
mavenCentral()
}
@@ -104,6 +107,8 @@ dependencies {
@@ -101,6 +104,8 @@ dependencies {
implementation 'io.prometheus:simpleclient:0.16.0'
implementation 'io.prometheus:simpleclient_hotspot:0.16.0'
implementation 'io.prometheus:simpleclient_httpserver:0.16.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
implementation 'io.sentry:sentry:6.4.0'
+ implementation 'com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:3.1.0'
+ implementation 'com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:3.0.3'
+ implementation 'org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
}
@@ -171,4 +176,4 @@ allprojects {
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
implementation 'io.sentry:sentry:6.11.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
@@ -170,4 +175,4 @@ allprojects {
runtime {
options = ['--strip-java-debug-attributes', '--compress', '2', '--no-header-files', '--no-man-pages']
modules = ['java.base', 'java.management', 'java.naming', 'java.sql', 'java.xml', 'jdk.crypto.ec', 'jdk.httpserver', 'java.desktop', 'jdk.unsupported']
@ -38,5 +38,5 @@ index 799e782..caceaac 100644
\ No newline at end of file
+}
--
2.36.2
2.38.3

View file

@ -1,4 +1,4 @@
From b068af1f3e49dedfb489e3ed957934ff651e98ee Mon Sep 17 00:00:00 2001
From 4bf0aef4003f7494103a93ae1c2957b2cd32bb59 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
@ -8,7 +8,7 @@ Subject: [PATCH 2/2] buildconfig/local deps fixes
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/build.gradle b/build.gradle
index 799e782..6ecef3e 100644
index ea3fea1..24415d8 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,11 +10,21 @@ import org.gradle.nativeplatform.platform.internal.ArchitectureInternal
@ -35,7 +35,7 @@ index 799e782..6ecef3e 100644
compileJava.options.encoding = 'UTF-8'
@@ -83,7 +93,10 @@ static String getVersion() {
@@ -82,7 +92,10 @@ static String getVersion() {
repositories {
maven {url "https://gitlab.com/api/v4/groups/6853927/-/packages/maven"} // https://gitlab.com/groups/signald/-/packages
@ -47,16 +47,16 @@ index 799e782..6ecef3e 100644
}
dependencies {
@@ -104,6 +117,8 @@ dependencies {
@@ -101,6 +114,8 @@ dependencies {
implementation 'io.prometheus:simpleclient:0.16.0'
implementation 'io.prometheus:simpleclient_hotspot:0.16.0'
implementation 'io.prometheus:simpleclient_httpserver:0.16.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3'
implementation 'io.sentry:sentry:6.4.0'
+ implementation 'com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:3.1.0'
+ implementation 'com.github.gmazzo.buildconfig:com.github.gmazzo.buildconfig.gradle.plugin:3.0.3'
+ implementation 'org.jetbrains.kotlin:kotlin-scripting-jvm:1.7.10'
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
}
@@ -167,8 +182,3 @@ allprojects {
implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0'
implementation 'io.sentry:sentry:6.11.0'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.0'
@@ -166,8 +181,3 @@ allprojects {
}
}
}
@ -67,5 +67,5 @@ index 799e782..6ecef3e 100644
-}
\ No newline at end of file
--
2.36.2
2.38.3

View file

@ -2,15 +2,18 @@
, makeWrapper, fetchpatch, substituteAll, jre_minimal
}:
# NOTE: when updating the package, please check if some of the hacks in `deps.installPhase`
# can be removed again!
let
pname = "signald";
version = "0.23.0";
version = "0.23.2";
src = fetchFromGitLab {
owner = pname;
repo = pname;
rev = version;
sha256 = "sha256-RN0OYjOmVtHKeFkviep952uf3qWuBj8lhcaP1Lk/gDo=";
sha256 = "sha256-EofgwZSDp2ZFhlKL2tHfzMr3EsidzuY4pkRZrV2+1bA=";
};
jre' = jre_minimal.override {
@ -42,11 +45,30 @@ let
export GRADLE_USER_HOME=$(mktemp -d)
gradle --no-daemon build
'';
# 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/okio-jvm/okio/r)}" #e' \
| sh
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
| sh -x
# WARNING: don't try this at home and wear safety-goggles while working with this!
# We patch around in the dependency tree to resolve some spurious dependency resolution errors.
# Whenever this package gets updated, please check if some of these hacks are obsolete!
# Mimic existence of okio-3.2.0.jar. Originally known as okio-jvm-3.2.0 (and renamed),
# but gradle doesn't detect such renames, only fetches the latter and then fails
# in `signald.buildPhase` because it cannot find `okio-3.2.0.jar`.
pushd $out/com/squareup/okio/okio/3.2.0 &>/dev/null
cp -v ../../okio-jvm/3.2.0/okio-jvm-3.2.0.jar okio-3.2.0.jar
popd &>/dev/null
# For some reason gradle fetches 2.14.1 instead of 2.14.0 here even though 2.14.0 is required
# according to `./gradlew -q dependencies`, so we pretend to have 2.14.0 available here.
# According to the diff in https://github.com/FasterXML/jackson-dataformats-text/compare/jackson-dataformats-text-2.14.0...jackson-dataformats-text-2.14.1
# the only relevant change is in the code itself (and in the tests/docs), so this seems
# binary-compatible.
cp -v \
$out/com/fasterxml/jackson/dataformat/jackson-dataformat-toml/2.14.1/jackson-dataformat-toml-2.14.1.jar \
$out/com/fasterxml/jackson/dataformat/jackson-dataformat-toml/2.14.0/jackson-dataformat-toml-2.14.0.jar
'';
# Don't move info to share/
forceShare = [ "dummy" ];
@ -54,12 +76,12 @@ let
outputHashMode = "recursive";
# Downloaded jars differ by platform
outputHash = {
x86_64-linux = "sha256-ANiNDdTuCuDEH5zUPsrVF6Uegdq3zVsMv+uMtYRX0jE=";
aarch64-linux = "sha256-V9zn4v/ZeLELAwFJ5y7OVAeJwZp4DmHm4KWxE6KpwGs=";
x86_64-linux = "sha256-9DHykkvazVBN2kfw1Pbejizk/R18v5w8lRBHZ4aXL5Q=";
aarch64-linux = "sha256-RgAiRbUojBc+9RN/HpAzzpTjkjZ6q+jebDsqvah5XBw=";
}.${stdenv.system} or (throw "Unsupported platform");
};
in stdenv.mkDerivation rec {
in stdenv.mkDerivation {
inherit pname src version;
patches = [
@ -69,6 +91,11 @@ in stdenv.mkDerivation rec {
})
];
passthru = {
# Mostly for debugging purposes.
inherit deps;
};
buildPhase = ''
runHook preBuild