[maven-pmd-plugin] branch master updated: [MPMD-304] Use proper toolchain config in integration tests

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 master updated: [MPMD-304] Use proper toolchain config in integration tests

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 2a39340  [MPMD-304] Use proper toolchain config in integration tests
2a39340 is described below

commit 2a393407180ce9b29f26dc4aeb76d3d52cb87751
Author: Andreas Dangel <[hidden email]>
AuthorDate: Mon Oct 26 18:06:08 2020 +0100

    [MPMD-304] Use proper toolchain config in integration tests
   
    Thanks to INFRA-20938 there is exists now a toolchains.xml
    under Windows as well.
---
 .../MPMD-304-toolchain-support/invoker.properties  | 16 +++---
 src/it/MPMD-304-toolchain-support/selector.groovy  | 65 ----------------------
 .../toolchains.windows.xml                         | 36 ------------
 3 files changed, 7 insertions(+), 110 deletions(-)

diff --git a/src/it/MPMD-304-toolchain-support/invoker.properties b/src/it/MPMD-304-toolchain-support/invoker.properties
index 198db8b..d8e8d01 100644
--- a/src/it/MPMD-304-toolchain-support/invoker.properties
+++ b/src/it/MPMD-304-toolchain-support/invoker.properties
@@ -19,14 +19,12 @@ invoker.java.version = 1.7+
 
 # available toolchains under linux:
 # https://github.com/apache/infrastructure-p6/blob/production/modules/build_nodes/files/toolchains.xml
-# the jdk toolchain "11:oracle" is selected in pom.xml
+# https://github.com/apache/infrastructure-puppet/blob/deployment/modules/build_slaves/files/toolchains.xml
+# available toolchains under windows:
+# https://github.com/apache/infrastructure-puppet/blob/deployment/environments/windows/modules/jenkins_node_windows/files/toolchains.xml
 
-# since the toolchains are only configured under linux slaves
-# we don't use invoker selections here, but selector.groovy
-#invoker.toolchain.jdk.version = 11
-#invoker.toolchain.jdk.vendor = oracle
+# the jdk toolchain "11:oracle" is selected in pom.xml
+invoker.toolchain.jdk.version = 11
+invoker.toolchain.jdk.vendor = oracle
 
-# the file toolchains.xml will be created by selector.groovy
-# - for linux, ${user.home}/.m2/toolchains.xml will be copied
-# - for windows, a new file will be created using toolchains.windows.xml, see selector.groovy
-invoker.goals = clean verify --toolchains toolchains.xml
+invoker.goals = clean verify
diff --git a/src/it/MPMD-304-toolchain-support/selector.groovy b/src/it/MPMD-304-toolchain-support/selector.groovy
deleted file mode 100644
index 55abd8b..0000000
--- a/src/it/MPMD-304-toolchain-support/selector.groovy
+++ /dev/null
@@ -1,65 +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.
- */
-
-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: Copying ${userToolchains.absolutePath} to ${testToolchains.absolutePath}" )
-    testToolchains.text = userToolchains.text
-}
-else
-{
-    System.out.println( "WARNING: File ${userToolchains.absolutePath} not found" )
-    if ( System.getProperty( 'os.name' ).startsWith( 'Windows' ) )
-    {
-        String jdk11Windows = 'f:\\jenkins\\tools\\java\\latest11'
-        File windowsToolchains = new File( basedir, 'toolchains.windows.xml' )
-        System.out.println( "INFO: Creating ${testToolchains.absolutePath} with jdk:11:oracle=${jdk11Windows}" )
-
-        String placeholder = '@jdk.home@'
-        String replacement = jdk11Windows
-        // extra escaping of backslashes in the path for Windows
-        replacement = replacement.replaceAll("\\\\", "\\\\\\\\")
-        testToolchains.text = windowsToolchains.text.replaceAll( placeholder, replacement )
-        System.out.println( "Replaced '${placeholder}' with '${replacement}' in '${testToolchains.absolutePath}'." )
-    }
-}
-
-if ( testToolchains.exists() )
-{
-    def toolchains = new XmlParser().parseText( testToolchains.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" )
-        return false
-    }
-
-    System.out.println( "INFO: Found toolchain: ${result}" )
-    return true
-}
-
-System.out.println( "WARNING: Skipping integration test due to missing toolchain" )
-return false
diff --git a/src/it/MPMD-304-toolchain-support/toolchains.windows.xml b/src/it/MPMD-304-toolchain-support/toolchains.windows.xml
deleted file mode 100644
index e3acb90..0000000
--- a/src/it/MPMD-304-toolchain-support/toolchains.windows.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF8"?>
-
-<!--
-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.
--->
-
-<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0"
-            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-            xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 http://maven.apache.org/xsd/toolchains-1.1.0.xsd">
-    <toolchain>
-        <type>jdk</type>
-        <provides>
-            <version>11</version>
-            <vendor>oracle</vendor>
-        </provides>
-        <configuration>
-            <!-- this placeholder will be replaced by selector.groovy -->
-            <jdkHome>@jdk.home@</jdkHome>
-        </configuration>
-    </toolchain>
-</toolchains>