ktfmt: 0.51 -> 0.61

note: ktfmt removed their maven setup in
https://github.com/facebook/ktfmt/commit/81277c3359d082cd5f3630a786a7b18c5bb11acf
This commit is contained in:
Robert Craigie
2026-02-09 13:04:51 +00:00
parent 6591704947
commit b6203fa802
4 changed files with 1466 additions and 71 deletions
+1421
View File
File diff suppressed because it is too large Load Diff
+27 -11
View File
@@ -1,34 +1,46 @@
{
lib,
stdenv,
jdk17,
fetchFromGitHub,
jre_headless,
makeWrapper,
maven,
gradle,
}:
maven.buildMavenPackage rec {
stdenv.mkDerivation (finalAttrs: {
pname = "ktfmt";
version = "0.51";
version = "0.61";
src = fetchFromGitHub {
owner = "facebook";
repo = "ktfmt";
tag = "v${version}";
hash = "sha256-TIYV/V6vtGTTSLFf9dcKo8Ezx61e7Vvz3vQvbh0Kj/Y=";
tag = "v${finalAttrs.version}";
hash = "sha256-WY3d25c8VLsgeNBV/lSlOL+C3XtM9lfRYqMz3Z0mT3s=";
};
patches = [ ./pin-default-maven-plugin-versions.patch ];
patches = ./remove-idea-plugin.patch;
mvnHash = "sha256-f/Uwc0ynROEKl2+zsgqj5ctRu1QcNblF5suU/0+fvKw=";
nativeBuildInputs = [
gradle
jdk17
makeWrapper
];
mvnParameters = "-Dproject.build.outputTimestamp=1980-01-01T00:00:02Z";
mitmCache = gradle.fetchDeps {
inherit (finalAttrs) pname;
data = ./deps.json;
};
__darwinAllowLocalNetworking = true; # this is required for using mitm-cache on Darwin
nativeBuildInputs = [ makeWrapper ];
gradleFlags = [ "-Dfile.encoding=utf-8" ];
doCheck = true;
installPhase = ''
runHook preInstall
install -Dm644 core/target/ktfmt-*-jar-with-dependencies.jar $out/share/ktfmt/ktfmt.jar
install -Dm644 core/build/libs/ktfmt-*-with-dependencies.jar $out/share/ktfmt/ktfmt.jar
makeWrapper ${jre_headless}/bin/java $out/bin/ktfmt \
--add-flags "-jar $out/share/ktfmt/ktfmt.jar"
@@ -42,6 +54,10 @@ maven.buildMavenPackage rec {
license = lib.licenses.asl20;
mainProgram = "ktfmt";
maintainers = with lib.maintainers; [ ghostbuster91 ];
sourceProvenance = with lib.sourceTypes; [
fromSource
binaryBytecode # mitm cache
];
inherit (jre_headless.meta) platforms;
};
}
})
@@ -1,60 +0,0 @@
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>
@@ -0,0 +1,18 @@
# the :idea_plugin is problematic on both darwin and linux, so just skip building it as we only care about the CLI in this package anyway.
#
# darwin: it depends on the builtin hdiutil executable on darwin, which is not packaged yet.
# linux: it errors with "Could not resolve all files for configuration ':idea_plugin:intellijPlatformClasspath'. > Could not find idea:ideaIC:2022.3."
diff --git a/settings.gradle.kts b/settings.gradle.kts
index ea48f26..52fe28e 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -26,8 +26,6 @@ project(":ktfmt").projectDir = file("core")
project(":lambda").projectDir = file("online_formatter")
-project(":idea_plugin").projectDir = file("ktfmt_idea_plugin")
-
dependencyResolutionManagement {
versionCatalogs {
create("libs") {