[maven-pmd-plugin] branch test-INFRA-20938 updated: Debug toolchains

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-pmd-plugin] branch test-INFRA-20938 updated: Debug toolchains

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

adangel pushed a commit to branch test-INFRA-20938
in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git


The following commit(s) were added to refs/heads/test-INFRA-20938 by this push:
     new faa82d2  Debug toolchains
faa82d2 is described below

commit faa82d296fbc84413dd0ab93aec1b8bb8895f79e
Author: Andreas Dangel <[hidden email]>
AuthorDate: Fri Nov 20 17:24:07 2020 +0100

    Debug toolchains
---
 .../MPMD-304-toolchain-support/invoker.properties  |  4 +-
 src/it/MPMD-304-toolchain-support/selector.groovy  | 47 ++++++++++++++++++++++
 2 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/src/it/MPMD-304-toolchain-support/invoker.properties b/src/it/MPMD-304-toolchain-support/invoker.properties
index d8e8d01..e0bbaad 100644
--- a/src/it/MPMD-304-toolchain-support/invoker.properties
+++ b/src/it/MPMD-304-toolchain-support/invoker.properties
@@ -24,7 +24,7 @@ invoker.java.version = 1.7+
 # https://github.com/apache/infrastructure-puppet/blob/deployment/environments/windows/modules/jenkins_node_windows/files/toolchains.xml
 
 # the jdk toolchain "11:oracle" is selected in pom.xml
-invoker.toolchain.jdk.version = 11
-invoker.toolchain.jdk.vendor = oracle
+#invoker.toolchain.jdk.version = 11
+#invoker.toolchain.jdk.vendor = oracle
 
 invoker.goals = clean verify
diff --git a/src/it/MPMD-304-toolchain-support/selector.groovy b/src/it/MPMD-304-toolchain-support/selector.groovy
new file mode 100644
index 0000000..a5f7c40
--- /dev/null
+++ b/src/it/MPMD-304-toolchain-support/selector.groovy
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+
+File testToolchains = new File( basedir, 'toolchains.xml' )
+
+File userToolchains = new File( System.getProperty( 'user.home' ), '.m2/toolchains.xml' )
+if ( userToolchains.exists() )
+{
+    System.out.println( "INFO: Found ${userToolchains.absolutePath}" )
+    System.out.println( userToolchains.text )
+
+    def toolchains = new XmlParser().parseText( userToolchains.text )
+    def result = toolchains.children().find { toolchain ->
+            toolchain.type.text() == 'jdk' &&
+            toolchain.provides.version.text() == '11' &&
+            toolchain.provides.vendor.text() == 'oracle'
+    }
+    if ( !result )
+    {
+        System.out.println( "WARNING: No jdk toolchain for 11:oracle found" )
+        throw new RuntimeException( "WARNING: No jdk toolchain for 11:oracle found in ${userToolchains.absolutePath}:\n${userToolchains.text}" )
+        return false
+    }
+
+    System.out.println( "INFO: Found toolchain: ${result}" )
+    return true
+}
+
+System.out.println( "WARNING: Skipping integration test due to missing toolchain in ${userToolchains.absolutePath}" )
+throw new RuntimeException( "WARNING: Skipping integration test due to missing toolchain in ${userToolchains.absolutePath}" )
+return false