xref: /aosp_15_r20/external/cronet/third_party/protobuf/java/kotlin/pom.xml (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1<?xml version="1.0" encoding="UTF-8"?>
2<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3  <modelVersion>4.0.0</modelVersion>
4  <parent>
5    <groupId>com.google.protobuf</groupId>
6    <artifactId>protobuf-parent</artifactId>
7    <version>3.21.12</version>
8  </parent>
9
10  <artifactId>protobuf-kotlin</artifactId>
11
12  <name>Protocol Buffers [Kotlin-Core]</name>
13  <description>
14    Kotlin core Protocol Buffers library. Protocol Buffers are a way of encoding structured data in an
15    efficient yet extensible format.
16  </description>
17
18  <properties>
19    <kotlin.version>1.6.0</kotlin.version>
20  </properties>
21
22  <dependencies>
23    <dependency>
24      <groupId>${project.groupId}</groupId>
25      <artifactId>protobuf-java</artifactId>
26    </dependency>
27    <dependency>
28      <groupId>junit</groupId>
29      <artifactId>junit</artifactId>
30      <scope>test</scope>
31    </dependency>
32    <dependency>
33      <groupId>org.mockito</groupId>
34      <artifactId>mockito-core</artifactId>
35      <scope>test</scope>
36    </dependency>
37    <dependency>
38      <groupId>com.google.guava</groupId>
39      <artifactId>guava</artifactId>
40      <scope>test</scope>
41    </dependency>
42    <dependency>
43      <groupId>com.google.guava</groupId>
44      <artifactId>guava-testlib</artifactId>
45      <scope>test</scope>
46    </dependency>
47    <dependency>
48      <groupId>com.google.truth</groupId>
49      <artifactId>truth</artifactId>
50      <scope>test</scope>
51    </dependency>
52    <dependency>
53      <groupId>org.jetbrains.kotlin</groupId>
54      <artifactId>kotlin-stdlib</artifactId>
55      <version>${kotlin.version}</version>
56    </dependency>
57    <dependency>
58      <groupId>org.jetbrains.kotlin</groupId>
59      <artifactId>kotlin-test</artifactId>
60      <version>${kotlin.version}</version>
61      <scope>test</scope>
62    </dependency>
63  </dependencies>
64
65  <build>
66    <testResources>
67      <testResource>
68        <directory>${protobuf.source.dir}</directory>
69        <includes>
70          <include>google/protobuf/testdata/golden_message_oneof_implemented</include>
71          <include>google/protobuf/testdata/golden_packed_fields_message</include>
72        </includes>
73      </testResource>
74    </testResources>
75
76    <plugins>
77      <plugin>
78        <artifactId>maven-resources-plugin</artifactId>
79        <version>3.1.0</version>
80        <executions>
81          <execution>
82            <id>copy-test-source-files</id>
83            <phase>generate-test-sources</phase>
84            <goals>
85              <goal>copy-resources</goal>
86            </goals>
87            <configuration>
88              <outputDirectory>${generated.testsources.dir}/com/google/protobuf</outputDirectory>
89              <resources>
90                <resource>
91                  <directory>${basedir}/../core/src/test/java/com/google/protobuf</directory>
92                  <includes>
93                    <include>TestUtil.java</include>
94                    <include>TestUtilLite.java</include>
95                  </includes>
96                </resource>
97              </resources>
98            </configuration>
99          </execution>
100        </executions>
101      </plugin>
102
103      <!-- Use Antrun plugin to generate sources with protoc -->
104      <plugin>
105        <artifactId>maven-antrun-plugin</artifactId>
106        <executions>
107          <!-- Generate core protos -->
108          <execution>
109            <id>generate-sources</id>
110            <phase>generate-sources</phase>
111            <configuration>
112              <target>
113                <ant antfile="generate-sources-build.xml"/>
114              </target>
115            </configuration>
116            <goals>
117              <goal>run</goal>
118            </goals>
119          </execution>
120
121          <!-- Generate the test protos -->
122          <execution>
123            <id>generate-test-sources</id>
124            <phase>generate-test-sources</phase>
125            <configuration>
126              <target>
127                <ant antfile="generate-test-sources-build.xml"/>
128              </target>
129            </configuration>
130            <goals>
131              <goal>run</goal>
132            </goals>
133          </execution>
134        </executions>
135      </plugin>
136
137      <!-- Add the generated sources to the build -->
138      <plugin>
139        <groupId>org.codehaus.mojo</groupId>
140        <artifactId>build-helper-maven-plugin</artifactId>
141        <executions>
142          <execution>
143            <id>add-generated-sources</id>
144            <phase>generate-sources</phase>
145            <goals>
146              <goal>add-source</goal>
147            </goals>
148            <configuration>
149              <sources>
150                <source>${generated.sources.dir}</source>
151              </sources>
152            </configuration>
153          </execution>
154          <execution>
155            <id>add-generated-test-sources</id>
156            <phase>generate-test-sources</phase>
157            <goals>
158              <goal>add-test-source</goal>
159            </goals>
160            <configuration>
161              <sources>
162                <source>${generated.testsources.dir}</source>
163              </sources>
164            </configuration>
165          </execution>
166        </executions>
167      </plugin>
168      <plugin>
169        <groupId>org.jetbrains.kotlin</groupId>
170        <artifactId>kotlin-maven-plugin</artifactId>
171        <version>${kotlin.version}</version>
172        <extensions>true</extensions>
173        <executions>
174          <execution>
175            <id>compile</id>
176            <goals> <goal>compile</goal> </goals>
177            <configuration>
178              <sourceDirs>
179                <sourceDir>${generated.sources.dir}</sourceDir>
180                <sourceDir>${project.basedir}/src/main/kotlin</sourceDir>
181              </sourceDirs>
182            </configuration>
183          </execution>
184          <execution>
185            <id>test-compile</id>
186            <goals> <goal>test-compile</goal> </goals>
187            <configuration>
188              <sourceDirs>
189                <sourceDir>${project.basedir}/src/test/kotlin</sourceDir>
190                <sourceDir>${generated.testsources.dir}</sourceDir>
191              </sourceDirs>
192            </configuration>
193          </execution>
194        </executions>
195      </plugin>
196    </plugins>
197  </build>
198
199</project>
200