You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by zh...@apache.org on 2021/07/02 07:44:13 UTC
[camel-quarkus] branch main updated: Fix #2763 to ensure jvmSince
and nativeSince not newer that current version (#2866)
This is an automated email from the ASF dual-hosted git repository.
zhfeng 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 604143c Fix #2763 to ensure jvmSince and nativeSince not newer that current version (#2866)
604143c is described below
commit 604143c663afd4e1fd9ed4d73c10960003356a06
Author: Amos Feng <zh...@gmail.com>
AuthorDate: Fri Jul 2 15:44:02 2021 +0800
Fix #2763 to ensure jvmSince and nativeSince not newer that current version (#2866)
---
poms/build-parent/pom.xml | 10 ++++++
tooling/scripts/validate-jvm-native-since.groovy | 45 ++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/poms/build-parent/pom.xml b/poms/build-parent/pom.xml
index 03d12c7..a786028 100644
--- a/poms/build-parent/pom.xml
+++ b/poms/build-parent/pom.xml
@@ -197,6 +197,16 @@
</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>
diff --git a/tooling/scripts/validate-jvm-native-since.groovy b/tooling/scripts/validate-jvm-native-since.groovy
new file mode 100644
index 0000000..dba3d20
--- /dev/null
+++ b/tooling/scripts/validate-jvm-native-since.groovy
@@ -0,0 +1,45 @@
+/*
+ * 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()
+}