You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2023/08/14 17:58:16 UTC

[maven-compiler-plugin] 01/01: [MCOMPILER-542] add IT

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

hboutemy pushed a commit to branch MCOMPILER-542
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git

commit cad51f3a577c0e48c1aa0c8ac0108ccb2d1872bc
Author: Hervé Boutemy <hb...@sonatype.com>
AuthorDate: Mon Aug 14 18:57:55 2023 +0100

    [MCOMPILER-542] add IT
---
 src/it/MCOMPILER-542/invoker.properties            | 18 ++++++++
 src/it/MCOMPILER-542/pom.xml                       | 50 ++++++++++++++++++++++
 .../MCOMPILER-542/src/main/java/module-info.java   | 19 ++++++++
 .../src/main/java/org/maven/test/Main.java         | 29 +++++++++++++
 src/it/MCOMPILER-542/verify.groovy                 | 30 +++++++++++++
 5 files changed, 146 insertions(+)

diff --git a/src/it/MCOMPILER-542/invoker.properties b/src/it/MCOMPILER-542/invoker.properties
new file mode 100644
index 0000000..9511718
--- /dev/null
+++ b/src/it/MCOMPILER-542/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.java.version = 9+
diff --git a/src/it/MCOMPILER-542/pom.xml b/src/it/MCOMPILER-542/pom.xml
new file mode 100644
index 0000000..d8cbe3e
--- /dev/null
+++ b/src/it/MCOMPILER-542/pom.xml
@@ -0,0 +1,50 @@
+<?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/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.compiler.it</groupId>
+  <artifactId>MCOMPILER-542</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <name>${java.specification.version}</name>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <project.build.outputTimestamp>2023-08-14T15:12:12Z</project.build.outputTimestamp>
+  </properties>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>@project.version@</version>
+          <configuration>
+            <release>${java.specification.version}</release>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>
diff --git a/src/it/MCOMPILER-542/src/main/java/module-info.java b/src/it/MCOMPILER-542/src/main/java/module-info.java
new file mode 100644
index 0000000..cfa968a
--- /dev/null
+++ b/src/it/MCOMPILER-542/src/main/java/module-info.java
@@ -0,0 +1,19 @@
+/*
+ * 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.
+ */
+module app {}
diff --git a/src/it/MCOMPILER-542/src/main/java/org/maven/test/Main.java b/src/it/MCOMPILER-542/src/main/java/org/maven/test/Main.java
new file mode 100644
index 0000000..8d17557
--- /dev/null
+++ b/src/it/MCOMPILER-542/src/main/java/org/maven/test/Main.java
@@ -0,0 +1,29 @@
+/*
+ * 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.maven.test;
+
+public class Main {
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+        System.out.println("Hello World!");
+    }
+}
diff --git a/src/it/MCOMPILER-542/verify.groovy b/src/it/MCOMPILER-542/verify.groovy
new file mode 100644
index 0000000..0ac0a7d
--- /dev/null
+++ b/src/it/MCOMPILER-542/verify.groovy
@@ -0,0 +1,30 @@
+/*
+ * 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 proc = 'javap -v target/classes/module-info.class'.execute(null,basedir)
+def sout = new StringBuilder(), serr = new StringBuilder()
+proc.consumeProcessOutput(sout, serr)
+proc.waitForOrKill(1000)
+def out = sout.toString()
+println "javap -v target/classes/module-info.class>\n$out\nerr> $serr"
+
+def module = out.substring(out.indexOf('Module:'))
+def javaVersion = System.getProperty('java.version')
+assert module.contains('// "java.base" ACC_MANDATED')
+assert !module.contains(javaVersion)