Skip to content

Commit

Permalink
fix: Kotlin scaffolding output to root/target instead of module/target
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Nov 10, 2023
1 parent 0cb45f2 commit afa65e9
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 164 deletions.
33 changes: 33 additions & 0 deletions kotlin-runtime/scaffolding/ftl-module-{{ .Name | lower }}/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,37 @@
<groupId>ftl</groupId>
<artifactId>ftl-module-{{ .Name | camel | lower }}</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>{{ .GroupID }}</groupId>
<artifactId>{{ .ArtifactID }}</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>

<build>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
</plugin>
<!-- Run ftl-generator to generate stubs -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
</plugin>
<!-- Add generated sources to the classpath -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
</plugin>
<!-- Extract schema -->
<plugin>
<groupId>com.github.ozsie</groupId>
<artifactId>detekt-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
322 changes: 159 additions & 163 deletions kotlin-runtime/scaffolding/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,168 +37,164 @@
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<!-- Install FTL code generator into target directory. -->
<execution>
<phase>initialize</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>xyz.block</groupId>
<artifactId>ftl-generator</artifactId>
<version>${ftl.version}</version>
<classifier>jar-with-dependencies</classifier>
<destFileName>ftl-generator.jar</destFileName>
</artifactItem>
<artifactItem>
<groupId>xyz.block</groupId>
<artifactId>ftl-runtime</artifactId>
<version>${ftl.version}</version>
<destFileName>ftl-runtime.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<!-- Copy all dependencies into the target directory -->
<execution>
<id>copy-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
<!-- Collect classpath -->
<execution>
<id>build-classpath</id>
<phase>compile</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<outputFile>${project.build.directory}/classpath.txt</outputFile>
<outputProperty>generated.classpath</outputProperty>
<prefix>${project.build.directory}/dependency</prefix>
</configuration>
</execution>
</executions>
</plugin>
<!-- Run the FTL code generator -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-jar</argument>
<argument>target/dependency/ftl-generator.jar</argument>
<argument>--endpoint=http://127.0.0.1:8892</argument>
<argument>--dest=${project.build.directory}</argument>
<argument>--module={{ .Name | camel | lower }}</argument>
<argument>--module-client-suffix=ModuleClient</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<!-- Add sources generated by the FTL tooling -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/ftl</source>
</sources>
</configuration>
</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>
<input>${project.basedir}</input>
</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>
<pluginManagement>
<plugins>
<plugin>
<artifactId>kotlin-maven-plugin</artifactId>
<groupId>org.jetbrains.kotlin</groupId>
<version>${kotlin.version}</version>
<executions>
<execution>
<id>compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
<execution>
<id>test-compile</id>
<goals>
<goal>test-compile</goal>
</goals>
<configuration>
<sourceDirs>
<sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
</sourceDirs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.2.0</version>
<executions>
<!-- Install FTL code generator into target directory. -->
<execution>
<phase>initialize</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>xyz.block</groupId>
<artifactId>ftl-generator</artifactId>
<version>${ftl.version}</version>
<classifier>jar-with-dependencies</classifier>
<destFileName>ftl-generator.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
<!-- Copy all dependencies into the target directory -->
<execution>
<id>copy-dependencies</id>
<phase>compile</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependency</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
<!-- Collect classpath -->
<execution>
<id>build-classpath</id>
<phase>compile</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<outputFile>${project.build.directory}/classpath.txt</outputFile>
<outputProperty>generated.classpath</outputProperty>
<prefix>${project.build.directory}/dependency</prefix>
</configuration>
</execution>
</executions>
</plugin>
<!-- Run the FTL code generator -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>java</executable>
<arguments>
<argument>-jar</argument>
<argument>target/dependency/ftl-generator.jar</argument>
<argument>--endpoint=http://127.0.0.1:8892</argument>
<argument>--dest=${project.build.directory}</argument>
<argument>--module={{ .Name | camel | lower }}</argument>
<argument>--module-client-suffix=ModuleClient</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<!-- Add sources generated by the FTL tooling -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/ftl</source>
</sources>
</configuration>
</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>
<input>${project.basedir}</input>
</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>
</pluginManagement>
</build>
</project>
2 changes: 1 addition & 1 deletion scripts/integration-tests
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ deploy_fresh_kotlin() (
info "Deploying newly initialised Kotlin module"
rm -rf build/echo2
ftl init kotlin -n echo2 build/echo2
cd build/echo2
cd build/echo2/ftl-module-echo2
mvn compile
ftl deploy target
)
Expand Down

0 comments on commit afa65e9

Please sign in to comment.