From 3310afa48d72ff5cba203c21d8813a71bc92b748 Mon Sep 17 00:00:00 2001
From: Elizabeth Worstell <worstell@squareup.com>
Date: Fri, 3 Nov 2023 14:29:45 -0700
Subject: [PATCH] update kotlin init templates to use detekt instead of ksp

---
 kotlin-runtime/scaffolding/pom.xml | 63 ++++++++++++++++++++----------
 1 file changed, 42 insertions(+), 21 deletions(-)

diff --git a/kotlin-runtime/scaffolding/pom.xml b/kotlin-runtime/scaffolding/pom.xml
index d937ef1ec5..690d505285 100644
--- a/kotlin-runtime/scaffolding/pom.xml
+++ b/kotlin-runtime/scaffolding/pom.xml
@@ -12,6 +12,8 @@
         <java.version>11</java.version>
         <kotlin.version>1.9.0</kotlin.version>
         <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
+        <maven.compiler.source>${java.version}</maven.compiler.source>
+        <maven.compiler.target>${java.version}</maven.compiler.target>
     </properties>
 
     <dependencies>
@@ -62,26 +64,6 @@
                         </configuration>
                     </execution>
                 </executions>
-                <configuration>
-                    <compilerPlugins>
-                        <compilerPlugin>ksp</compilerPlugin>
-                    </compilerPlugins>
-                    <pluginOptions>
-                        <option>ksp:apoption=dest=${project.build.directory}</option>
-                    </pluginOptions>
-                </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>com.dyescape</groupId>
-                        <artifactId>kotlin-maven-symbol-processing</artifactId>
-                        <version>1.6</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>xyz.block</groupId>
-                        <artifactId>ftl-runtime</artifactId>
-                        <version>${ftl.version}</version>
-                    </dependency>
-                </dependencies>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -103,6 +85,13 @@
                                     <classifier>jar-with-dependencies</classifier>
                                     <destFileName>ftl-generator.jar</destFileName>
                                 </artifactItem>
+                                <artifactItem>
+                                    <groupId>xyz.block</groupId>
+                                    <artifactId>ftl-runtime</artifactId>
+                                    <version>${ftl.version}</version>
+                                    <classifier>jar-with-dependencies</classifier>
+                                    <destFileName>ftl-runtime.jar</destFileName>
+                                </artifactItem>
                             </artifactItems>
                         </configuration>
                     </execution>
@@ -127,7 +116,8 @@
                         </goals>
                         <configuration>
                             <outputFile>${project.build.directory}/classpath.txt</outputFile>
-                            <prefix>dependency</prefix>
+                            <outputProperty>generated.classpath</outputProperty>
+                            <prefix>${project.build.directory}/dependency</prefix>
                         </configuration>
                     </execution>
                 </executions>
@@ -176,6 +166,37 @@
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>com.github.ozsie</groupId>
+                <artifactId>detekt-maven-plugin</artifactId>
+                <version>1.23.3</version>
+                <configuration>
+                    <disableDefaultRuleSets>true</disableDefaultRuleSets>
+                    <classPath>${generated.classpath}</classPath>
+                    <jvmTarget>${java.version}</jvmTarget>
+                    <config>${project.build.directory}/detekt.yml</config>
+                    <plugins>
+                        <plugin>
+                            ${project.build.directory}/dependency/ftl-runtime-${ftl.version}.jar
+                        </plugin>
+                    </plugins>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>compile</phase>
+                        <goals>
+                            <goal>check-with-type-resolution</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>xyz.block</groupId>
+                        <artifactId>ftl-runtime</artifactId>
+                        <version>${ftl.version}</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
         </plugins>
     </build>
 </project>
\ No newline at end of file