You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/02/10 15:54:35 UTC
[maven-surefire] branch master updated: [SUREFIRE-2006] Don't use Services Transformer in shadefire
This is an automated email from the ASF dual-hosted git repository.
sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/master by this push:
new d69d7ad [SUREFIRE-2006] Don't use Services Transformer in shadefire
d69d7ad is described below
commit d69d7ad40bbf5abfa9316740b79746859fa87b2d
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Wed Feb 9 19:37:21 2022 +0100
[SUREFIRE-2006] Don't use Services Transformer in shadefire
---
.../jiras/Surefire2006ShadefireTransformersIT.java | 42 +++++++++++++++++
.../surefire-2006-shadefire-transformers/pom.xml | 54 ++++++++++++++++++++++
.../src/test/java/PojoTest.java | 26 +++++++++++
surefire-shadefire/pom.xml | 27 +++++++++--
...refire.spi.MasterProcessChannelProcessorFactory | 20 ++++++++
...he.maven.surefire.api.provider.SurefireProvider | 19 ++++++++
6 files changed, 185 insertions(+), 3 deletions(-)
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire2006ShadefireTransformersIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire2006ShadefireTransformersIT.java
new file mode 100644
index 0000000..ca6997e
--- /dev/null
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire2006ShadefireTransformersIT.java
@@ -0,0 +1,42 @@
+package org.apache.maven.surefire.its.jiras;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
+import org.junit.Test;
+
+/**
+ * Test for shadefire usage
+ *
+ * @author Slawomir Jaranowski
+ */
+public class Surefire2006ShadefireTransformersIT
+ extends SurefireJUnit4IntegrationTestCase
+{
+ @Test
+ public void shadefireShouldBeUsed()
+ {
+ unpack( "surefire-2006-shadefire-transformers" )
+ .executeTest()
+ .assertTestSuiteResults( 1, 0, 0, 0 )
+ .verifyTextInLog(
+ "[INFO] Using configured provider org.apache.maven.shadefire.surefire.junit.JUnit3Provider" );
+ }
+}
diff --git a/surefire-its/src/test/resources/surefire-2006-shadefire-transformers/pom.xml b/surefire-its/src/test/resources/surefire-2006-shadefire-transformers/pom.xml
new file mode 100644
index 0000000..68ea260
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-2006-shadefire-transformers/pom.xml
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
+ -->
+
+<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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.plugins.surefire</groupId>
+ <artifactId>surefire-2006</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <name>shadefire usage test</name>
+
+ <properties>
+ <maven.compiler.source>${java.specification.version}</maven.compiler.source>
+ <maven.compiler.target>${java.specification.version}</maven.compiler.target>
+ </properties>
+
+ <!-- NOTE: This has no dependencies on JUnit or TestNG, just nothing -->
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.surefire</groupId>
+ <artifactId>surefire-shadefire</artifactId>
+ <version>${surefire.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/surefire-its/src/test/resources/surefire-2006-shadefire-transformers/src/test/java/PojoTest.java b/surefire-its/src/test/resources/surefire-2006-shadefire-transformers/src/test/java/PojoTest.java
new file mode 100644
index 0000000..1638c64
--- /dev/null
+++ b/surefire-its/src/test/resources/surefire-2006-shadefire-transformers/src/test/java/PojoTest.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+public class PojoTest
+{
+ public void testSuccess()
+ {
+ assert true;
+ }
+}
diff --git a/surefire-shadefire/pom.xml b/surefire-shadefire/pom.xml
index 164e35c..1c8c412 100644
--- a/surefire-shadefire/pom.xml
+++ b/surefire-shadefire/pom.xml
@@ -88,9 +88,30 @@
<shadedPattern>org.apache.maven.shadefire</shadedPattern>
</relocation>
</relocations>
- <transformers>
- <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
- </transformers>
+ <filters>
+ <filter>
+ <!-- exclude all services to be sure that everything is manually taken -->
+ <artifact>org.apache.maven.surefire:*</artifact>
+ <excludes>
+ <exclude>META-INF/services/**</exclude>
+ </excludes>
+ </filter>
+ </filters>
+ <transformers>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
+ <resource>META-INF/services/org.apache.maven.shadefire.surefire.spi.MasterProcessChannelProcessorFactory</resource>
+ <file>src/main/resources/META-INF/services/org.apache.maven.shadefire.surefire.spi.MasterProcessChannelProcessorFactory</file>
+ </transformer>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
+ <resource>META-INF/services/org.apache.maven.surefire.api.provider.SurefireProvider</resource>
+ <file>src/main/resources/META-INF/services/org.apache.maven.surefire.api.provider.SurefireProvider</file>
+ </transformer>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
+ <transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
+ <resource>META-INF/DEPENDENCIES</resource>
+ </transformer>
+ </transformers>
</configuration>
</execution>
</executions>
diff --git a/surefire-shadefire/src/main/resources/META-INF/services/org.apache.maven.shadefire.surefire.spi.MasterProcessChannelProcessorFactory b/surefire-shadefire/src/main/resources/META-INF/services/org.apache.maven.shadefire.surefire.spi.MasterProcessChannelProcessorFactory
new file mode 100644
index 0000000..5fe2d23
--- /dev/null
+++ b/surefire-shadefire/src/main/resources/META-INF/services/org.apache.maven.shadefire.surefire.spi.MasterProcessChannelProcessorFactory
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.maven.shadefire.surefire.booter.spi.LegacyMasterProcessChannelProcessorFactory
+org.apache.maven.shadefire.surefire.booter.spi.SurefireMasterProcessChannelProcessorFactory
diff --git a/surefire-shadefire/src/main/resources/META-INF/services/org.apache.maven.surefire.api.provider.SurefireProvider b/surefire-shadefire/src/main/resources/META-INF/services/org.apache.maven.surefire.api.provider.SurefireProvider
new file mode 100644
index 0000000..1445853
--- /dev/null
+++ b/surefire-shadefire/src/main/resources/META-INF/services/org.apache.maven.surefire.api.provider.SurefireProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+org.apache.maven.shadefire.surefire.junit.JUnit3Provider