You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kw...@apache.org on 2024/07/20 12:57:00 UTC
(maven-apache-resources) branch master updated: [MASFRES-69] Also exclude deeply nested target directories
This is an automated email from the ASF dual-hosted git repository.
kwin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-apache-resources.git
The following commit(s) were added to refs/heads/master by this push:
new b64ef89 [MASFRES-69] Also exclude deeply nested target directories
b64ef89 is described below
commit b64ef8928a93531de5baec97fcede97bb9622945
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Fri Jul 19 17:15:15 2024 +0200
[MASFRES-69] Also exclude deeply nested target directories
Add single module test
Add test already having a target directory (simulating build without
clean)
---
.../main/resources/assemblies/source-shared.xml | 2 +-
...ZipAndTarCreation.java => IT_SingleModule.java} | 25 ++-----
.../java/org/apache/its/IT_ZipAndTarCreation.java | 1 -
.../build-output-dir-child1/.gitignore | 3 +
.../build-output-dir-child1/target/dummy.txt | 16 +++++
.../src/test/resources/single-module/pom.xml | 84 ++++++++++++++++++++++
.../src/main/java/org/apache/assembly/it/App.java | 32 +++++++++
.../main/resources/META-INF/plexus/components.xml | 24 +++++++
.../test/java/org/apache/assembly/it/AppTest.java | 57 +++++++++++++++
9 files changed, 223 insertions(+), 21 deletions(-)
diff --git a/source-release/src/main/resources/assemblies/source-shared.xml b/source-release/src/main/resources/assemblies/source-shared.xml
index 7fb04d6..7363b74 100644
--- a/source-release/src/main/resources/assemblies/source-shared.xml
+++ b/source-release/src/main/resources/assemblies/source-shared.xml
@@ -27,7 +27,7 @@
<useDefaultExcludes>true</useDefaultExcludes>
<excludes>
<!-- build output -->
- <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)${project.build.directory}(/.*)?]</exclude>
+ <exclude>%regex[(?!((?!${project.build.directory}/)[^/]+/)*src/)(.*/)?${project.build.directory}(/.*)?]</exclude>
<!-- NOTE: Most of the following excludes should not be required
if the standard release process is followed. This is because the
diff --git a/source-release/src/test/java/org/apache/its/IT_ZipAndTarCreation.java b/source-release/src/test/java/org/apache/its/IT_SingleModule.java
similarity index 63%
copy from source-release/src/test/java/org/apache/its/IT_ZipAndTarCreation.java
copy to source-release/src/test/java/org/apache/its/IT_SingleModule.java
index d415b75..aa75a3b 100644
--- a/source-release/src/test/java/org/apache/its/IT_ZipAndTarCreation.java
+++ b/source-release/src/test/java/org/apache/its/IT_SingleModule.java
@@ -21,7 +21,6 @@ package org.apache.its;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
-import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -30,16 +29,14 @@ import org.apache.maven.it.VerificationException;
import org.apache.maven.it.Verifier;
import org.junit.Test;
-import static org.apache.its.util.TestUtils.archivePathFromChild;
import static org.apache.its.util.TestUtils.archivePathFromProject;
-import static org.apache.its.util.TestUtils.assertTarContents;
import static org.apache.its.util.TestUtils.assertZipContents;
import static org.apache.its.util.TestUtils.createVerifier;
import static org.apache.its.util.TestUtils.getTestDir;
-public class IT_ZipAndTarCreation {
+public class IT_SingleModule {
- private static final String BASENAME = "zip-and-tar";
+ private static final String BASENAME = "single-module";
private static final String VERSION = "1";
@Test
@@ -53,30 +50,20 @@ public class IT_ZipAndTarCreation {
verifier.verifyErrorFreeLog();
verifier.resetStreams();
- // make sure the tar did NOT get created by default
- File tarAssemblyFile = new File(testDir, "target/" + BASENAME + "-" + VERSION + "-source-release.tar.gz");
- Assert.assertTrue("tar assembly should have been created", tarAssemblyFile.exists());
-
File zipAssemblyFile = new File(testDir, "target/" + BASENAME + "-" + VERSION + "-source-release.zip");
Assert.assertTrue("zip assembly should have been created", zipAssemblyFile.exists());
Set<String> required = new HashSet<>();
required.add(archivePathFromProject(BASENAME, VERSION, "/pom.xml"));
- required.add(archivePathFromChild(BASENAME, VERSION, "child1", "pom.xml"));
- required.add(archivePathFromChild(BASENAME, VERSION, "child2", "/pom.xml"));
- required.add(
- archivePathFromChild(BASENAME, VERSION, "child1", "/src/main/java/org/apache/assembly/it/App.java"));
- required.add(archivePathFromChild(
- BASENAME, VERSION, "child1", "/src/main/resources/META-INF/plexus/components.xml"));
+ required.add(archivePathFromProject(BASENAME, VERSION, "/src/main/java/org/apache/assembly/it/App.java"));
+ required.add(archivePathFromProject(BASENAME, VERSION, "/src/main/resources/META-INF/plexus/components.xml"));
- required.add(
- archivePathFromChild(BASENAME, VERSION, "child2", "/src/main/java/org/apache/assembly/it/App.java"));
+ Set<String> banned = new HashSet<>();
- Set<String> banned = Collections.emptySet();
+ banned.add(archivePathFromProject(BASENAME, VERSION, "/target"));
assertZipContents(required, banned, zipAssemblyFile);
- assertTarContents(required, banned, tarAssemblyFile);
}
}
diff --git a/source-release/src/test/java/org/apache/its/IT_ZipAndTarCreation.java b/source-release/src/test/java/org/apache/its/IT_ZipAndTarCreation.java
index d415b75..258cecc 100644
--- a/source-release/src/test/java/org/apache/its/IT_ZipAndTarCreation.java
+++ b/source-release/src/test/java/org/apache/its/IT_ZipAndTarCreation.java
@@ -53,7 +53,6 @@ public class IT_ZipAndTarCreation {
verifier.verifyErrorFreeLog();
verifier.resetStreams();
- // make sure the tar did NOT get created by default
File tarAssemblyFile = new File(testDir, "target/" + BASENAME + "-" + VERSION + "-source-release.tar.gz");
Assert.assertTrue("tar assembly should have been created", tarAssemblyFile.exists());
diff --git a/source-release/src/test/resources/build-output-dir/build-output-dir-child1/.gitignore b/source-release/src/test/resources/build-output-dir/build-output-dir-child1/.gitignore
new file mode 100644
index 0000000..b97970d
--- /dev/null
+++ b/source-release/src/test/resources/build-output-dir/build-output-dir-child1/.gitignore
@@ -0,0 +1,3 @@
+!*
+target/*
+!target/dummy.txt
\ No newline at end of file
diff --git a/source-release/src/test/resources/build-output-dir/build-output-dir-child1/target/dummy.txt b/source-release/src/test/resources/build-output-dir/build-output-dir-child1/target/dummy.txt
new file mode 100644
index 0000000..287f9b1
--- /dev/null
+++ b/source-release/src/test/resources/build-output-dir/build-output-dir-child1/target/dummy.txt
@@ -0,0 +1,16 @@
+# 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.
\ No newline at end of file
diff --git a/source-release/src/test/resources/single-module/pom.xml b/source-release/src/test/resources/single-module/pom.xml
new file mode 100644
index 0000000..0015403
--- /dev/null
+++ b/source-release/src/test/resources/single-module/pom.xml
@@ -0,0 +1,84 @@
+<?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.assembly.it</groupId>
+ <artifactId>single-module</artifactId>
+ <version>1</version>
+ <packaging>jar</packaging>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>@assemblyPluginVersion@</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.apache.resources</groupId>
+ <artifactId>apache-source-release-assembly-descriptor</artifactId>
+ <version>@project.version@</version>
+ </dependency>
+ </dependencies>
+
+ <executions>
+ <execution>
+ <id>source-release-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <runOnlyAtExecutionRoot>true</runOnlyAtExecutionRoot>
+ <descriptorRefs>
+ <descriptorRef>source-release</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.11.0</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/source-release/src/test/resources/single-module/src/main/java/org/apache/assembly/it/App.java b/source-release/src/test/resources/single-module/src/main/java/org/apache/assembly/it/App.java
new file mode 100644
index 0000000..02b2fdf
--- /dev/null
+++ b/source-release/src/test/resources/single-module/src/main/java/org/apache/assembly/it/App.java
@@ -0,0 +1,32 @@
+package org.apache.assembly.it;
+
+/*
+ * 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.
+ */
+
+/**
+ * Hello world!
+ *
+ */
+public class App
+{
+ public static void main( String[] args )
+ {
+ System.out.println( "Hello World!" );
+ }
+}
diff --git a/source-release/src/test/resources/single-module/src/main/resources/META-INF/plexus/components.xml b/source-release/src/test/resources/single-module/src/main/resources/META-INF/plexus/components.xml
new file mode 100644
index 0000000..047058a
--- /dev/null
+++ b/source-release/src/test/resources/single-module/src/main/resources/META-INF/plexus/components.xml
@@ -0,0 +1,24 @@
+<?xml version='1.0'?>
+<!--
+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.
+-->
+
+<component-set>
+ <components>
+ </components>
+</component-set>
\ No newline at end of file
diff --git a/source-release/src/test/resources/single-module/src/test/java/org/apache/assembly/it/AppTest.java b/source-release/src/test/resources/single-module/src/test/java/org/apache/assembly/it/AppTest.java
new file mode 100644
index 0000000..c6b11d0
--- /dev/null
+++ b/source-release/src/test/resources/single-module/src/test/java/org/apache/assembly/it/AppTest.java
@@ -0,0 +1,57 @@
+package org.apache.assembly.it;
+
+/*
+ * 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 junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest
+ extends TestCase
+{
+ /**
+ * Create the test case
+ *
+ * @param testName name of the test case
+ */
+ public AppTest( String testName )
+ {
+ super( testName );
+ }
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite()
+ {
+ return new TestSuite( AppTest.class );
+ }
+
+ /**
+ * Rigourous Test :-)
+ */
+ public void testApp()
+ {
+ assertTrue( true );
+ }
+}