You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2021/07/05 06:28:57 UTC

[camel-quarkus] branch main updated: Fix #2869 to combine build sanity checks into a single scirpt

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

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


The following commit(s) were added to refs/heads/main by this push:
     new 7936431  Fix #2869 to combine build sanity checks into a single scirpt
7936431 is described below

commit 793643132b121eb97dcf338c6a2b6ee9ddd95b42
Author: Amos Feng <zf...@redhat.com>
AuthorDate: Mon Jul 5 10:07:53 2021 +0800

    Fix #2869 to combine build sanity checks into a single scirpt
---
 poms/build-parent/pom.xml                          | 16 +-------
 ...te-dependencies.groovy => sanity-checks.groovy} | 38 +++++++++++++++---
 tooling/scripts/validate-jvm-native-since.groovy   | 45 ----------------------
 3 files changed, 34 insertions(+), 65 deletions(-)

diff --git a/poms/build-parent/pom.xml b/poms/build-parent/pom.xml
index 0d596ad..f48b86e 100644
--- a/poms/build-parent/pom.xml
+++ b/poms/build-parent/pom.xml
@@ -191,22 +191,12 @@
                                 </goals>
                                 <phase>validate</phase>
                                 <configuration>
-                                    <source>file://${maven.multiModuleProjectDirectory}/tooling/scripts/validate-dependencies.groovy</source>
+                                    <source>file://${maven.multiModuleProjectDirectory}/tooling/scripts/sanity-checks.groovy</source>
                                     <properties>
                                         <maven.multiModuleProjectDirectory>${maven.multiModuleProjectDirectory}</maven.multiModuleProjectDirectory>
                                     </properties>
                                 </configuration>
                             </execution>
-                            <execution>
-                                <id>validate-jvm-native-since</id>
-                                <goals>
-                                    <goal>execute</goal>
-                                </goals>
-                                <phase>validate</phase>
-                                <configuration>
-                                    <source>file://${maven.multiModuleProjectDirectory}/tooling/scripts/validate-jvm-native-since.groovy</source>
-                                </configuration>
-                            </execution>
                         </executions>
                     </plugin>
                     <plugin>
@@ -271,10 +261,6 @@
                                 <id>sanity-checks</id>
                                 <phase /><!-- Speedup the check-format profile by skipping the sanity-checks  -->
                             </execution>
-                            <execution>
-                                <id>validate-jvm-native-since</id>
-                                <phase /><!-- Speedup the check-format profile by skipping the validate-jvm-native-since check  -->
-                            </execution>
                         </executions>
                     </plugin>
                 </plugins>
diff --git a/tooling/scripts/validate-dependencies.groovy b/tooling/scripts/sanity-checks.groovy
similarity index 64%
rename from tooling/scripts/validate-dependencies.groovy
rename to tooling/scripts/sanity-checks.groovy
index 4e962e1..d030266 100644
--- a/tooling/scripts/validate-dependencies.groovy
+++ b/tooling/scripts/sanity-checks.groovy
@@ -17,14 +17,11 @@
 import java.nio.file.Path
 import java.nio.file.Paths
 
+
+// check bad dependencies
 final List<String> badDeps = []
 final File pomXml = new File(project.basedir, "pom.xml")
 
-/* groupIds that contain extensions */
-final Set<String> extensionGroupIds = ["org.apache.camel.quarkus", "io.quarkus", "org.amqphub.quarkus"] as Set
-/* artifactIds from groups contained in extensionGroupIds that are not extensions */
-final Set<String> nonExtensionArtifactIds = ["quarkus-development-mode-spi", "camel-quarkus-qute-component"] as Set
-
 final Path treeRootDir = Paths.get(properties['maven.multiModuleProjectDirectory'])
 final Path relativePomPath = treeRootDir.relativize(pomXml.toPath().normalize())
 
@@ -51,3 +48,34 @@ if (!badDeps.isEmpty()) {
     }
     throw new RuntimeException(msg.toString())
 }
+
+// check jvmSince and nativeCheck not newer than current SNAPSHOT version
+final String currentVersion = project.version - '-SNAPSHOT'
+final String jvmSince    = project.properties['camel.quarkus.jvmSince']
+final String nativeSince = project.properties['camel.quarkus.nativeSince']
+
+if (jvmSince != null && compareVersion(jvmSince, currentVersion) > 0) {
+   throw new RuntimeException("jvmSince " + jvmSince + " is newer than " + project.version);
+}
+
+if (nativeSince != null && compareVersion(nativeSince, currentVersion) > 0) {
+   throw new RuntimeException("nativeSince " + nativeSince + " is newer than " + project.version);
+}
+
+int compareVersion(String a, String b) {
+    List verA = a.tokenize('.')
+    List verB = b.tokenize('.')
+
+    def commonIndices = Math.min(verA.size(), verB.size())
+
+    for (int i = 0; i < commonIndices; ++i) {
+       def numA = verA[i].toInteger()
+       def numB = verB[i].toInteger()
+
+       if (numA != numB) {
+          return numA <=> numB
+       }
+    }
+
+    return verA.size() <=> verB.size()
+}
diff --git a/tooling/scripts/validate-jvm-native-since.groovy b/tooling/scripts/validate-jvm-native-since.groovy
deleted file mode 100644
index dba3d20..0000000
--- a/tooling/scripts/validate-jvm-native-since.groovy
+++ /dev/null
@@ -1,45 +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.
- */
-final String currentVersion = project.version - '-SNAPSHOT'
-final String jvmSince    = project.properties['camel.quarkus.jvmSince']
-final String nativeSince = project.properties['camel.quarkus.nativeSince']
-
-if (jvmSince != null && compareVersion(jvmSince, currentVersion) > 0) {
-   throw new RuntimeException("jvmSince " + jvmSince + " is newer than " + project.version);
-}
-
-if (nativeSince != null && compareVersion(nativeSince, currentVersion) > 0) {
-   throw new RuntimeException("nativeSince " + nativeSince + " is newer than " + project.version);
-}
-
-int compareVersion(String a, String b) {
-    List verA = a.tokenize('.')
-    List verB = b.tokenize('.')
-
-    def commonIndices = Math.min(verA.size(), verB.size())
-
-    for (int i = 0; i < commonIndices; ++i) {
-       def numA = verA[i].toInteger()
-       def numB = verB[i].toInteger()
-
-       if (numA != numB) {
-          return numA <=> numB
-       }
-    }
-
-    return verA.size() <=> verB.size()
-}