aboutsummaryrefslogtreecommitdiff
path: root/gson/pom.xml
blob: 4e7b88a69b7547a8aff12aadd4d258e2328f9691 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<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">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.google.code.gson</groupId>
    <artifactId>gson-parent</artifactId>
    <version>2.11-SNAPSHOT</version>
  </parent>

  <artifactId>gson</artifactId>
  <name>Gson</name>

  <licenses>
    <license>
      <name>Apache-2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <properties>
    <excludeTestCompilation>**/Java17*</excludeTestCompilation>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!--
        Plugins for source generation and compilation
      -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>templating-maven-plugin</artifactId>
        <version>1.0.0</version>
        <executions>
          <execution>
            <id>filtering-java-templates</id>
            <goals>
              <goal>filter-sources</goal>
            </goals>
            <configuration>
              <sourceDirectory>${basedir}/src/main/java-templates</sourceDirectory>
              <outputDirectory>${project.build.directory}/generated-sources/java-templates</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>default-compile</id>
            <configuration>
              <excludes>
                <!-- module-info.java is compiled using ModiTect -->
                <exclude>module-info.java</exclude>
              </excludes>
            </configuration>
          </execution>
          <execution>
            <id>default-testCompile</id>
            <phase>test-compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <testExcludes>
                <exclude>${excludeTestCompilation}</exclude>
              </testExcludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-maven-plugin</artifactId>
        <version>6.3.1</version>
        <executions>
          <execution>
            <goals>
              <goal>bnd-process</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!--
        Plugins for test execution
      -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M7</version>
        <configuration>
          <!-- Deny illegal access, this is required for ReflectionAccessTest -->
          <!-- Requires Java >= 9; Important: In case future Java versions 
            don't support this flag anymore, don't remove it unless CI also runs with 
            that Java version. Ideally would use toolchain to specify that this should 
            run with e.g. Java 11, but Maven toolchain requirements (unlike Gradle ones) 
            don't seem to be portable (every developer would have to set up toolchain 
            configuration locally). -->
          <argLine>--illegal-access=deny</argLine>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.coderplus.maven.plugins</groupId>
        <artifactId>copy-rename-maven-plugin</artifactId>
        <version>1.0.1</version>
        <executions>
          <execution>
            <id>pre-obfuscate-class</id>
            <phase>process-test-classes</phase>
            <goals>
              <goal>rename</goal>
            </goals>
            <configuration>
              <fileSets>
                <fileSet>
                  <sourceFile>${project.build.directory}/test-classes/com/google/gson/functional/EnumWithObfuscatedTest.class</sourceFile>
                  <destinationFile>${project.build.directory}/test-classes-obfuscated-injar/com/google/gson/functional/EnumWithObfuscatedTest.class</destinationFile>
                </fileSet>
                <fileSet>
                  <sourceFile>${project.build.directory}/test-classes/com/google/gson/functional/EnumWithObfuscatedTest$Gender.class</sourceFile>
                  <destinationFile>${project.build.directory}/test-classes-obfuscated-injar/com/google/gson/functional/EnumWithObfuscatedTest$Gender.class</destinationFile>
                </fileSet>
              </fileSets>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.wvengen</groupId>
        <artifactId>proguard-maven-plugin</artifactId>
        <version>2.6.0</version>
        <executions>
          <execution>
            <id>obfuscate-test-class</id>
            <phase>process-test-classes</phase>
            <goals>
              <goal>proguard</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <obfuscate>true</obfuscate>
          <injar>test-classes-obfuscated-injar</injar>
          <outjar>test-classes-obfuscated-outjar</outjar>
          <inFilter>**/*.class</inFilter>
          <proguardInclude>${basedir}/src/test/resources/testcases-proguard.conf</proguardInclude>
          <libs>
            <lib>${project.build.directory}/classes</lib>
            <lib>${java.home}/jmods/java.base.jmod</lib>
          </libs>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
          <execution>
            <id>post-obfuscate-class</id>
            <phase>process-test-classes</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/test-classes/com/google/gson/functional</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.build.directory}/test-classes-obfuscated-outjar/com/google/gson/functional</directory>
                  <includes>
                    <include>EnumWithObfuscatedTest.class</include>
                    <include>EnumWithObfuscatedTest$Gender.class</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!--
        Plugins for building / modifying artifacts
      -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <!-- Use existing manifest generated by BND plugin -->
            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
          </archive>
        </configuration>
      </plugin>
      <!-- Add module-info to JAR, see https://github.com/moditect/moditect#adding-module-descriptors-to-existing-jar-files -->
      <!-- Uses ModiTect instead of separate maven-compiler-plugin executions 
        for better Eclipse IDE support, see https://github.com/eclipse-m2e/m2e-core/issues/393 -->
      <!-- Note: For some reason this has to be executed before javadoc plugin; otherwise `javadoc:jar` goal fails
        to find source files -->
      <plugin>
        <groupId>org.moditect</groupId>
        <artifactId>moditect-maven-plugin</artifactId>
        <version>1.0.0.RC2</version>
        <executions>
          <execution>
            <id>add-module-info</id>
            <phase>package</phase>
            <goals>
              <goal>add-module-info</goal>
            </goals>
            <configuration>
              <jvmVersion>9</jvmVersion>
              <module>
                <moduleInfoFile>${project.build.sourceDirectory}/module-info.java</moduleInfoFile>
              </module>
              <!-- Overwrite the previously generated JAR file, if any -->
              <overwriteExistingFiles>true</overwriteExistingFiles>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Note: Javadoc plugin has to be run in combination with >= `package` phase,
        e.g. `mvn package javadoc:javadoc`, otherwise it fails with
        "Aggregator report contains named and unnamed modules" -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <excludePackageNames>com.google.gson.internal:com.google.gson.internal.bind</excludePackageNames>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>JDK17</id>
      <activation>
        <jdk>[17,)</jdk>
      </activation>
      <properties>
        <maven.compiler.testRelease>17</maven.compiler.testRelease>
        <excludeTestCompilation />
      </properties>
    </profile>
  </profiles>
</project>