about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTomaSajt <62384384+TomaSajt@users.noreply.github.com>2024-01-11 14:53:12 +0100
committerTomaSajt <62384384+TomaSajt@users.noreply.github.com>2024-04-21 20:56:00 +0200
commit9808effe7407068e2c8da473012594b2154f837d (patch)
tree3201600ed9464200bc954dfa1706371b3a0a0ced
parent65d8de75bd039037e896b6c9c18c7f426f74d668 (diff)
ktfmt: make deterministic
-rw-r--r--pkgs/by-name/kt/ktfmt/package.nix7
-rw-r--r--pkgs/by-name/kt/ktfmt/pin-default-maven-plugin-versions.patch60
2 files changed, 65 insertions, 2 deletions
diff --git a/pkgs/by-name/kt/ktfmt/package.nix b/pkgs/by-name/kt/ktfmt/package.nix
index 49546fd411018..99d5b03f9a53d 100644
--- a/pkgs/by-name/kt/ktfmt/package.nix
+++ b/pkgs/by-name/kt/ktfmt/package.nix
@@ -11,14 +11,17 @@ maven.buildMavenPackage rec {
     hash = "sha256-vdvKHTTD84OAQacv/VE/5BxYdW4n3bxPUHF2MdH+sQQ=";
   };
 
-  mvnHash = "sha256-Cl7P2i4VFJ/yk7700u62YPcacfKkhBztFvcDkYBfZEA=";
+  patches = [ ./pin-default-maven-plugin-versions.patch ];
+
+  mvnHash = "sha256-iw28HS0WMFC9BKQKr0v33D77rMQeIMKjXduqPcYU1XA=";
+
+  mvnParameters = "-Dproject.build.outputTimestamp=1980-01-01T00:00:02Z";
 
   nativeBuildInputs = [ makeWrapper ];
 
   installPhase = ''
     runHook preInstall
 
-    mkdir -p $out/bin
     install -Dm644 core/target/ktfmt-*-jar-with-dependencies.jar $out/share/ktfmt/ktfmt.jar
 
     makeWrapper ${jre_headless}/bin/java $out/bin/ktfmt \
diff --git a/pkgs/by-name/kt/ktfmt/pin-default-maven-plugin-versions.patch b/pkgs/by-name/kt/ktfmt/pin-default-maven-plugin-versions.patch
new file mode 100644
index 0000000000000..d3425669da0f9
--- /dev/null
+++ b/pkgs/by-name/kt/ktfmt/pin-default-maven-plugin-versions.patch
@@ -0,0 +1,60 @@
+diff --git a/core/pom.xml b/core/pom.xml
+index 267689e..6b6e04d 100644
+--- a/core/pom.xml
++++ b/core/pom.xml
+@@ -34,6 +34,55 @@
+         <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
+         <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
+         <plugins>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-enforcer-plugin</artifactId>
++                <version>3.4.1</version>
++                <executions>
++                    <execution>
++                        <id>require-all-plugin-versions-to-be-set</id>
++                        <phase>validate</phase>
++                        <goals>
++                            <goal>enforce</goal>
++                        </goals>
++                        <configuration>
++                            <rules>
++                                <requirePluginVersions />
++                            </rules>
++                        </configuration>
++                    </execution>
++                </executions>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-surefire-plugin</artifactId>
++                <version>3.2.5</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-clean-plugin</artifactId>
++                <version>3.3.2</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-install-plugin</artifactId>
++                <version>3.1.1</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-site-plugin</artifactId>
++                <version>4.0.0-M13</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-resources-plugin</artifactId>
++                <version>3.3.1</version>
++            </plugin>
++            <plugin>
++                <groupId>org.apache.maven.plugins</groupId>
++                <artifactId>maven-deploy-plugin</artifactId>
++                <version>3.1.1</version>
++            </plugin>
+             <plugin>
+                 <groupId>org.jetbrains.kotlin</groupId>
+                 <artifactId>kotlin-maven-plugin</artifactId>