Skip to content

Commit b4c9eb6

Browse files
authored
build: slim swagger-codegen-cli shaded jar, stop building swagger-codegen tests jar (#12784)
* build: slim swagger-codegen-cli shaded jar Reduce the CLI jar published to Maven Central from ~23.5 MB to ~18.8 MB by dropping dependencies the CLI never uses: - exclude the v2 codegen (io.swagger:swagger-codegen) pulled in by swagger-codegen core; it is only used by the online generator's GeneratorService, which the CLI does not call - remove lambdaj (and with it hamcrest-all, cglib and objenesis); its single use in Langs is replaced with Java streams * build: stop building swagger-codegen tests jar The -tests.jar (~0.25 MB per release) was published to Maven Central with every release, but nothing consumes it.
1 parent bd67636 commit b4c9eb6

4 files changed

Lines changed: 14 additions & 18 deletions

File tree

‎modules/swagger-codegen-cli/pom.xml‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@
7979
<groupId>io.swagger.codegen.v3</groupId>
8080
<artifactId>swagger-codegen</artifactId>
8181
<version>${project.version}</version>
82+
<exclusions>
83+
<!-- v2 codegen is only used by the online generator (GeneratorService), not by the CLI -->
84+
<exclusion>
85+
<groupId>io.swagger</groupId>
86+
<artifactId>swagger-codegen</artifactId>
87+
</exclusion>
88+
</exclusions>
8289
</dependency>
8390
<dependency>
8491
<groupId>io.swagger.codegen.v3</groupId>
@@ -107,11 +114,6 @@
107114
</dependency>
108115

109116

110-
<dependency>
111-
<groupId>com.googlecode.lambdaj</groupId>
112-
<artifactId>lambdaj</artifactId>
113-
<version>2.3.3</version>
114-
</dependency>
115117
<dependency>
116118
<groupId>org.testng</groupId>
117119
<artifactId>testng</artifactId>
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package io.swagger.codegen.v3.cli.cmd;
22

3-
import ch.lambdaj.collection.LambdaIterable;
43
import io.swagger.codegen.v3.CodegenConfig;
54

6-
import static ch.lambdaj.Lambda.on;
7-
import static ch.lambdaj.collection.LambdaCollections.with;
5+
import java.util.List;
6+
import java.util.stream.Collectors;
7+
import java.util.stream.StreamSupport;
8+
89
import static java.util.ServiceLoader.load;
910

1011
/**
@@ -13,8 +14,9 @@
1314
public class Langs implements Runnable {
1415
@Override
1516
public void run() {
16-
LambdaIterable<String> langs =
17-
with(load(CodegenConfig.class)).extract(on(CodegenConfig.class).getName());
17+
List<String> langs = StreamSupport.stream(load(CodegenConfig.class).spliterator(), false)
18+
.map(CodegenConfig::getName)
19+
.collect(Collectors.toList());
1820
System.out.printf("Available languages: %s%n", langs);
1921
}
2022
}

‎modules/swagger-codegen-cli/src/main/java/io/swagger/codegen/v3/cli/cmd/Meta.java‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ public void run() {
8282
*
8383
* @param targetDir - destination directory
8484
* @param data - map with additional params needed to process templates
85-
* @return converter object to pass to lambdaj
8685
*/
8786
private static void processFiles(DefaultGenerator generator, SupportingFile support, final File targetDir, final Map<String, Object> data) {
8887
try {

‎modules/swagger-codegen/pom.xml‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@
8989
</manifestEntries>
9090
</archive>
9191
</configuration>
92-
<executions>
93-
<execution>
94-
<goals>
95-
<goal>test-jar</goal>
96-
</goals>
97-
</execution>
98-
</executions>
9992
</plugin>
10093
<plugin>
10194
<groupId>org.apache.maven.plugins</groupId>

0 commit comments

Comments
 (0)