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

commit f3e604e12ef9930fed4a13b7917e478c7f226864
Author: Andreas Dangel <adan...@apache.org>
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..649ace2
--- /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.
+ */
+
+def nodename = System.getenv( "NODE_NAME" )
+
+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} on node 
${nodename}:\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 file in ${userToolchains.absolutePath}" )
+throw new RuntimeException( "WARNING: Skipping integration test due to missing 
toolchain file in ${userToolchains.absolutePath} on node ${nodename}" )
+return false

Reply via email to