Skip to content

Commit bf7f0b0

Browse files
authored
Add a tool to manipulate plugin descriptors (#139)
The tool is based on picocli and supports the following commands: * `toJson`: converts a `Log4j2Plugins.dat` to a JSON representation. * `fromJson`: converts the JSON representation of a plugin descriptor to its `Log4j2Plugins.dat` form. * `filterReflectConfig`: filters a GraalVM `reflect-config.json` file by removing the classes that are not contained in a `Log4j2Plugins.json` file.
1 parent bdd205e commit bf7f0b0

File tree

17 files changed

+1410
-81
lines changed

17 files changed

+1410
-81
lines changed

.gitattributes

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# Checked by Spotless (LF line endings)
17-
*.java text eol=lf
18-
*.xml text eol=lf
19-
*.yaml text eol=lf
20-
*.yml text eol=lf
16+
# All text files with LF line endings
17+
* text=auto eol=lf
18+
# Maven Wrapper cmd script
19+
/mvnw.cmd eol=crlf
20+
# Maven Wrapper need LF line endings
21+
/.mvn/wrapper/maven-wrapper.properties eol=lf
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
This file activates the `picocli` profile

log4j-codegen/pom.xml

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@
6161
<scope>provided</scope>
6262
</dependency>
6363

64-
<!-- Compile dependencies: the artifact is shaded, so limit these to the maximum -->
64+
<!-- Compile dependencies: the artifact is shaded, so limit these. -->
6565
<dependency>
6666
<groupId>info.picocli</groupId>
6767
<artifactId>picocli</artifactId>
68-
<version>${picocli.version}</version>
6968
</dependency>
7069

7170
<!-- Test dependencies -->
@@ -89,69 +88,4 @@
8988

9089
</dependencies>
9190

92-
<build>
93-
94-
<plugins>
95-
<plugin>
96-
<groupId>org.apache.maven.plugins</groupId>
97-
<artifactId>maven-compiler-plugin</artifactId>
98-
<configuration>
99-
<annotationProcessorPaths combine.children="append">
100-
<path>
101-
<groupId>info.picocli</groupId>
102-
<artifactId>picocli-codegen</artifactId>
103-
<version>${picocli.version}</version>
104-
</path>
105-
</annotationProcessorPaths>
106-
</configuration>
107-
</plugin>
108-
109-
<plugin>
110-
<groupId>org.apache.maven.plugins</groupId>
111-
<artifactId>maven-shade-plugin</artifactId>
112-
<version>${maven-shade-plugin.version}</version>
113-
<dependencies>
114-
<dependency>
115-
<groupId>org.apache.logging.log4j</groupId>
116-
<artifactId>log4j-transform-maven-shade-plugin-extensions</artifactId>
117-
<version>${project.version}</version>
118-
</dependency>
119-
</dependencies>
120-
<executions>
121-
<execution>
122-
<id>shade-jar-with-dependencies</id>
123-
<goals>
124-
<goal>shade</goal>
125-
</goals>
126-
<configuration>
127-
<filters>
128-
<filter>
129-
<artifact>*:*</artifact>
130-
<excludes>
131-
<exclude>module-info.class</exclude>
132-
<exclude>META-INF/versions/*/module-info.class</exclude>
133-
<exclude>META-INF/MANIFEST.MF</exclude>
134-
</excludes>
135-
</filter>
136-
</filters>
137-
<shadedArtifactAttached>true</shadedArtifactAttached>
138-
<shadedClassifierName>shaded</shadedClassifierName>
139-
<transformers>
140-
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
141-
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer" />
142-
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
143-
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
144-
<manifestEntries>
145-
<Multi-Release>true</Multi-Release>
146-
</manifestEntries>
147-
</transformer>
148-
</transformers>
149-
</configuration>
150-
</execution>
151-
</executions>
152-
</plugin>
153-
</plugins>
154-
155-
</build>
156-
15791
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to you under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
This file activates the `picocli` profile
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to you under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
<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/xsd/maven-4.0.0.xsd">
19+
<modelVersion>4.0.0</modelVersion>
20+
<parent>
21+
<groupId>org.apache.logging.log4j</groupId>
22+
<artifactId>log4j-transform-parent</artifactId>
23+
<version>${revision}</version>
24+
<relativePath>../log4j-transform-parent</relativePath>
25+
</parent>
26+
27+
<artifactId>log4j-converter-plugin-descriptor</artifactId>
28+
<name>Apache Log4j plugin descriptor tools</name>
29+
<description>Tools to manipulate `Log4j2Plugins.dat` plugin descriptors and synchronize them with GraalVM reachability metadata.</description>
30+
31+
<properties>
32+
<!-- Disabling `bnd-baseline-maven-plugin`, since we don't have a release yet to compare against. -->
33+
<bnd.baseline.fail.on.missing>false</bnd.baseline.fail.on.missing>
34+
35+
<Main-Class>org.apache.logging.log4j.converter.plugins.PluginCacheConverter</Main-Class>
36+
37+
<!-- Dependency versions -->
38+
<jackson.version>2.18.0</jackson.version>
39+
</properties>
40+
41+
<dependencies>
42+
43+
<dependency>
44+
<groupId>org.jspecify</groupId>
45+
<artifactId>jspecify</artifactId>
46+
<scope>provided</scope>
47+
</dependency>
48+
49+
<!-- Compile dependencies: the artifact is shaded, so limit these. -->
50+
<dependency>
51+
<groupId>org.apache.logging.log4j</groupId>
52+
<artifactId>log4j-api</artifactId>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>info.picocli</groupId>
57+
<artifactId>picocli</artifactId>
58+
</dependency>
59+
60+
<dependency>
61+
<groupId>com.fasterxml.jackson.core</groupId>
62+
<artifactId>jackson-core</artifactId>
63+
<version>${jackson.version}</version>
64+
</dependency>
65+
66+
<dependency>
67+
<groupId>com.fasterxml.jackson.core</groupId>
68+
<artifactId>jackson-databind</artifactId>
69+
<version>${jackson.version}</version>
70+
</dependency>
71+
72+
</dependencies>
73+
74+
<build>
75+
<plugins>
76+
77+
<plugin>
78+
<groupId>org.apache.maven.plugins</groupId>
79+
<artifactId>maven-assembly-plugin</artifactId>
80+
<executions>
81+
<execution>
82+
<id>create-shaded-resources</id>
83+
<goals>
84+
<goal>single</goal>
85+
</goals>
86+
<phase>prepare-package</phase>
87+
<configuration>
88+
<inlineDescriptors>
89+
<assembly>
90+
<id>shaded-resources</id>
91+
<formats>
92+
<format>jar</format>
93+
</formats>
94+
<baseDirectory>/</baseDirectory>
95+
<fileSets>
96+
<fileSet>
97+
<directory>src/main/shaded-resources</directory>
98+
<outputDirectory>/</outputDirectory>
99+
</fileSet>
100+
</fileSets>
101+
</assembly>
102+
</inlineDescriptors>
103+
</configuration>
104+
</execution>
105+
</executions>
106+
</plugin>
107+
108+
<plugin>
109+
<groupId>org.apache.maven.plugins</groupId>
110+
<artifactId>maven-shade-plugin</artifactId>
111+
<executions>
112+
<execution>
113+
<id>shade-jar-with-dependencies</id>
114+
<configuration>
115+
<extraJars>
116+
<jar>${project.build.directory}/${project.build.finalName}-shaded-resources.jar</jar>
117+
</extraJars>
118+
</configuration>
119+
</execution>
120+
</executions>
121+
</plugin>
122+
123+
</plugins>
124+
</build>
125+
</project>

0 commit comments

Comments
 (0)