Unverified Commit ea81f188 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

ktfmt: 0.51 -> 0.61 (#483326)

parents 9600f3f9 b6203fa8
Loading
Loading
Loading
Loading
+1421 −0

File added.

Preview size limit exceeded, changes collapsed.

+27 −11
Original line number Diff line number Diff line
{
  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

  gradleFlags = [ "-Dfile.encoding=utf-8" ];

  nativeBuildInputs = [ makeWrapper ];
  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;
  };
}
})
+0 −60
Original line number Diff line number Diff line
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>
+18 −0
Original line number Diff line number Diff line
# 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") {