xref: /aosp_15_r20/external/ktfmt/core/pom.xml (revision 5be3f65c8cf0e6db0a7e312df5006e8e93cdf9ec)
1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="http://maven.apache.org/POM/4.0.0"
3         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4    <modelVersion>4.0.0</modelVersion>
5
6    <artifactId>ktfmt</artifactId>
7
8    <name>Ktfmt</name>
9    <description>A program that reformats Kotlin source code to comply with the common community standard for Kotlin code conventions.</description>
10
11    <parent>
12        <groupId>com.facebook</groupId>
13        <artifactId>ktfmt-parent</artifactId>
14        <version>0.52</version>
15    </parent>
16
17    <properties>
18        <dokka.version>0.10.1</dokka.version>
19        <kotlin.version>1.8.22</kotlin.version>
20        <spotless.version>6.25.0</spotless.version>
21        <kotlin.compiler.incremental>true</kotlin.compiler.incremental>
22        <kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
23        <main.class>com.facebook.ktfmt.cli.Main</main.class>
24    </properties>
25
26    <pluginRepositories>
27        <pluginRepository>
28            <id>jcenter</id>
29            <name>JCenter</name>
30            <url>https://jcenter.bintray.com/</url>
31        </pluginRepository>
32    </pluginRepositories>
33
34    <build>
35        <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
36        <testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
37        <plugins>
38            <!-- Spotless for formatting -->
39            <plugin>
40                <groupId>com.diffplug.spotless</groupId>
41                <artifactId>spotless-maven-plugin</artifactId>
42                <version>${spotless.version}</version>
43                <configuration>
44                    <kotlin>
45                        <includes>
46                            <include>src/main/java/**/*.kt</include>
47                            <include>src/test/java/**/*.kt</include>
48                        </includes>
49                        <ktfmt/>
50                    </kotlin>
51                </configuration>
52            </plugin>
53
54            <plugin>
55                <groupId>org.jetbrains.kotlin</groupId>
56                <artifactId>kotlin-maven-plugin</artifactId>
57                <version>${kotlin.version}</version>
58
59                <executions>
60                    <execution>
61                        <id>compile</id>
62                        <goals>
63                            <goal>compile</goal>
64                        </goals>
65                        <configuration>
66                            <sourceDirs>
67                                <sourceDir>${project.basedir}/src/main/java</sourceDir>
68                            </sourceDirs>
69                        </configuration>
70                    </execution>
71
72                    <execution>
73                        <id>test-compile</id>
74                        <goals>
75                            <goal>test-compile</goal>
76                        </goals>
77                        <configuration>
78                            <sourceDirs>
79                                <sourceDir>${project.basedir}/src/test/java</sourceDir>
80                            </sourceDirs>
81                        </configuration>
82                    </execution>
83                </executions>
84            </plugin>
85            <plugin>
86                <groupId>org.apache.maven.plugins</groupId>
87                <artifactId>maven-compiler-plugin</artifactId>
88                <version>3.5.1</version>
89                <configuration>
90                    <source>1.8</source>
91                    <target>1.8</target>
92                </configuration>
93                <executions>
94                    <!-- Replacing default-compile as it is treated specially by maven -->
95                    <execution>
96                        <id>default-compile</id>
97                        <phase>none</phase>
98                    </execution>
99                    <!-- Replacing default-testCompile as it is treated specially by maven -->
100                    <execution>
101                        <id>default-testCompile</id>
102                        <phase>none</phase>
103                    </execution>
104                    <execution>
105                        <id>java-compile</id>
106                        <phase>compile</phase>
107                        <goals>
108                            <goal>compile</goal>
109                        </goals>
110                    </execution>
111                    <execution>
112                        <id>java-test-compile</id>
113                        <phase>test-compile</phase>
114                        <goals>
115                            <goal>testCompile</goal>
116                        </goals>
117                    </execution>
118                </executions>
119            </plugin>
120            <plugin>
121                <groupId>org.apache.maven.plugins</groupId>
122                <artifactId>maven-jar-plugin</artifactId>
123                <version>3.3.0</version>
124                <configuration>
125                    <archive>
126                        <manifest>
127                            <addClasspath>true</addClasspath>
128                            <mainClass>${main.class}</mainClass>
129                        </manifest>
130                    </archive>
131                </configuration>
132            </plugin>
133            <plugin>
134                <groupId>org.apache.maven.plugins</groupId>
135                <artifactId>maven-assembly-plugin</artifactId>
136                <version>3.3.0</version>
137                <executions>
138                    <execution>
139                        <id>make-assembly</id>
140                        <phase>package</phase>
141                        <goals>
142                            <goal>single</goal>
143                        </goals>
144                        <configuration>
145                            <archive>
146                                <manifest>
147                                    <mainClass>${main.class}</mainClass>
148                                </manifest>
149                            </archive>
150                            <descriptorRefs>
151                                <descriptorRef>jar-with-dependencies</descriptorRef>
152                            </descriptorRefs>
153                        </configuration>
154                    </execution>
155                </executions>
156            </plugin>
157            <plugin>
158                <groupId>org.apache.maven.plugins</groupId>
159                <artifactId>maven-surefire-plugin</artifactId>
160                <version>3.2.5</version>
161                <configuration>
162                    <!-- Tests that everything works when using an unusual default Charset. -->
163                    <argLine>-Dfile.encoding=UTF-16</argLine>
164                </configuration>
165            </plugin>
166        </plugins>
167    </build>
168
169    <dependencies>
170        <dependency>
171            <groupId>com.google.guava</groupId>
172            <artifactId>guava</artifactId>
173            <version>32.0.0-jre</version>
174        </dependency>
175        <dependency>
176            <groupId>org.jetbrains.kotlin</groupId>
177            <artifactId>kotlin-stdlib-jdk7</artifactId>
178            <version>${kotlin.version}</version>
179        </dependency>
180        <dependency>
181            <groupId>org.jetbrains.kotlin</groupId>
182            <artifactId>kotlin-test</artifactId>
183            <version>${kotlin.version}</version>
184        </dependency>
185        <dependency>
186            <groupId>org.jetbrains.kotlin</groupId>
187            <artifactId>kotlin-compiler-embeddable</artifactId>
188            <version>${kotlin.version}</version>
189        </dependency>
190        <!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna -->
191        <dependency>
192            <groupId>net.java.dev.jna</groupId>
193            <artifactId>jna</artifactId>
194            <version>4.2.2</version>
195        </dependency>
196        <dependency>
197            <groupId>com.google.googlejavaformat</groupId>
198            <artifactId>google-java-format</artifactId>
199            <version>1.22.0</version>
200        </dependency>
201        <dependency>
202            <groupId>junit</groupId>
203            <artifactId>junit</artifactId>
204            <version>4.13.1</version>
205            <scope>test</scope>
206        </dependency>
207        <dependency>
208            <groupId>com.google.truth</groupId>
209            <artifactId>truth</artifactId>
210            <version>1.0</version>
211            <scope>test</scope>
212        </dependency>
213    </dependencies>
214
215    <profiles>
216        <profile>
217            <id>release</id>
218            <build>
219                <plugins>
220                    <plugin>
221                        <groupId>org.sonatype.plugins</groupId>
222                        <artifactId>nexus-staging-maven-plugin</artifactId>
223                        <version>1.6.13</version>
224                        <extensions>true</extensions>
225                        <configuration>
226                            <serverId>ossrh</serverId>
227                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
228                            <autoReleaseAfterClose>true</autoReleaseAfterClose>
229                        </configuration>
230                    </plugin>
231
232                    <!-- Source JAR -->
233                    <plugin>
234                        <groupId>org.apache.maven.plugins</groupId>
235                        <artifactId>maven-source-plugin</artifactId>
236                        <version>2.2.1</version>
237                        <executions>
238                            <execution>
239                                <id>attach-sources</id>
240                                <goals>
241                                    <goal>jar-no-fork</goal>
242                                </goals>
243                            </execution>
244                        </executions>
245                    </plugin>
246
247                    <!-- Javadoc JAR -->
248                    <!-- Dokka, Kotlin's javadoc, doesn't work on JDK 10+, so we're creating an empty javadoc jar instead. -->
249                    <!-- (https://github.com/Kotlin/dokka/issues/294) -->
250                    <plugin>
251                        <groupId>org.apache.maven.plugins</groupId>
252                        <artifactId>maven-jar-plugin</artifactId>
253                        <executions>
254                            <execution>
255                                <phase>package</phase>
256                                <goals>
257                                    <goal>jar</goal>
258                                </goals>
259                                <configuration>
260                                    <classifier>javadoc</classifier>
261                                    <classesDirectory>${project.basedir}/non/existing/dir</classesDirectory>
262                                </configuration>
263                            </execution>
264                        </executions>
265                    </plugin>
266
267                    <!-- Sign artifacts -->
268                    <plugin>
269                        <groupId>org.apache.maven.plugins</groupId>
270                        <artifactId>maven-gpg-plugin</artifactId>
271                        <version>1.6</version>
272                        <executions>
273                            <execution>
274                                <id>sign-artifacts</id>
275                                <phase>verify</phase>
276                                <goals>
277                                    <goal>sign</goal>
278                                </goals>
279                                <configuration>
280                                    <!-- Honor -Dgpg.passphrase=... on the command line. -->
281                                    <gpgArguments>
282                                        <arg>--pinentry-mode</arg>
283                                        <arg>loopback</arg>
284                                    </gpgArguments>
285                                </configuration>
286                            </execution>
287                        </executions>
288                    </plugin>
289                </plugins>
290            </build>
291        </profile>
292    </profiles>
293
294    <distributionManagement>
295        <snapshotRepository>
296            <id>ossrh</id>
297            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
298        </snapshotRepository>
299    </distributionManagement>
300
301</project>
302