You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2022/09/25 17:19:40 UTC

[isis] 03/03: ISIS-2965 - refactors wicket-graceful to use ant task within mvn

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch release-2.0.0-M8-RC2
in repository https://gitbox.apache.org/repos/asf/isis.git

commit 8dc54964719f1538a111fa468f3d2282ebde3260
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Sep 25 16:15:20 2022 +0100

    ISIS-2965 - refactors wicket-graceful to use ant task within mvn
    
    ... the usage of a test job fails on windows, with a locking issue.
    
    We bind the ant task to 'process-sources' phase because 'dependency:resolve' binds to phase before, 'generate-sources'
---
 viewers/wicket/graceful/pom.xml                    | 43 ++++++++++++--
 .../wicket/graceful/WicketArtifactReplacer.java    | 69 ----------------------
 2 files changed, 39 insertions(+), 73 deletions(-)

diff --git a/viewers/wicket/graceful/pom.xml b/viewers/wicket/graceful/pom.xml
index eace110696..9c20063df0 100644
--- a/viewers/wicket/graceful/pom.xml
+++ b/viewers/wicket/graceful/pom.xml
@@ -7,9 +7,9 @@
   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
@@ -31,7 +31,7 @@
     <name>Apache Isis Viewer - Wicket (Graceful)</name>
 
 	<description>
-		Helps with the CI build, that is, it replaces original Wicket artifacts at ~/.m2/repository 
+		Helps with the CI build, that is, it replaces original Wicket artifacts at ~/.m2/repository
 		with mangled variants, that do not include module-info.class entries.
 		This artifact - in its realeased form - is empty.
 	</description>
@@ -41,6 +41,41 @@
         <git-plugin.propertiesDir>org/apache/isis/viewer/wicket/graceful</git-plugin.propertiesDir>
     </properties>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <version>3.1.0</version>
+                <executions>
+                    <execution>
+                        <id>patch-wicket</id>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                        <phase>
+                             process-sources
+                        </phase>
+                        <configuration>
+                            <target>
+                                <copy
+                                        file="${project.build.testSourceDirectory}/../resources/wicket-artifacts-no-module-info/wicket-core-9.11.0.jar.mangled"
+                                        tofile="${settings.localRepository}/org/apache/wicket/wicket-core/9.11.0/wicket-core-9.11.0.jar"
+                                        overwrite="true"
+                                />
+                                <copy
+                                        file="${project.build.testSourceDirectory}/../resources/wicket-artifacts-no-module-info/wicket-util-9.11.0.jar.mangled"
+                                        tofile="${settings.localRepository}/org/apache/wicket/wicket-util/9.11.0/wicket-util-9.11.0.jar"
+                                        overwrite="true"
+                                />
+                            </target>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
     <dependencies>
 
         <dependency>
@@ -67,7 +102,7 @@
                 </exclusion>
             </exclusions>
         </dependency>
-	
+
 		<!-- TESTING -->
 
 		<dependency>
diff --git a/viewers/wicket/graceful/src/test/java/org/apache/isis/viewer/wicket/graceful/WicketArtifactReplacer.java b/viewers/wicket/graceful/src/test/java/org/apache/isis/viewer/wicket/graceful/WicketArtifactReplacer.java
deleted file mode 100644
index 7d6a7add0b..0000000000
--- a/viewers/wicket/graceful/src/test/java/org/apache/isis/viewer/wicket/graceful/WicketArtifactReplacer.java
+++ /dev/null
@@ -1,69 +0,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.
- */
-package org.apache.isis.viewer.wicket.graceful;
-
-import java.io.File;
-import java.util.Optional;
-
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
-
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-import org.apache.isis.commons.internal.base._Files;
-import org.apache.isis.commons.internal.base._Strings;
-import org.apache.isis.commons.internal.exceptions._Exceptions;
-
-import lombok.val;
-
-class WicketArtifactReplacer {
-
-    @EnabledIfSystemProperty(named = "isRunningWithSurefire", matches = "true")
-    @Test
-    void processWicketArtifacts() {
-        assertTrue(true);
-
-        val m2Repo = resolveM2Repo()
-                .orElseThrow(()->_Exceptions.unrecoverable("cannot find m2 repo, "
-                        + "where to put the patched artifacts to"));
-        val resources = resourcesDir()
-                .orElseThrow(()->_Exceptions.unrecoverable("cannot locate resources, "
-                        + "from where to read the patched artifacts"));
-
-        _Files.copy(
-                new File(resources, "wicket-core-9.11.0.jar.mangled"),
-                new File(m2Repo, "org/apache/wicket/wicket-core/9.11.0/wicket-core-9.11.0.jar"));
-        _Files.copy(
-                new File(resources, "wicket-util-9.11.0.jar.mangled"),
-                new File(m2Repo, "org/apache/wicket/wicket-util/9.11.0/wicket-util-9.11.0.jar"));
-
-    }
-
-    // -- HELPER
-
-    private Optional<File> resolveM2Repo() {
-        return _Strings.nonEmpty(System.getProperty("user.home"))
-               .flatMap(userHome->_Files.existingDirectory(new File(String.format("/%s/.m2/repository", userHome))));
-    }
-
-    private Optional<File> resourcesDir() {
-        return _Files.existingDirectory(new File("src/test/resources/wicket-artifacts-no-module-info"));
-    }
-
-}