From 17f2df6f6e2ee453668e4cd8a562a93434d531d8 Mon Sep 17 00:00:00 2001 From: Himanshu Kandwal Date: Wed, 5 Jun 2024 09:50:17 -0700 Subject: [PATCH] [apache/helix] -- Enable JDK 1.8 (backward) compatibility for dependent modules of meta-client and helix-core (#2806) We would like to provide a backward compatible support to our consumers where they also have an option to use JDK-8 compiled meta-client jar, if they have such a requirement. By default we will generate JDK-11 jars and JDK-8 jars using a classifier. In this PR, we are enabling the JDK* build of full sub-tree of the helix-core and meta-client modules. This includes: helix-common, zookeeper-api, metadata-store-directory-common, metrics-common --- helix-common/pom.xml | 48 +++++++++++++++++++ .../helix/constants/InstanceConstants.java | 8 ++-- metadata-store-directory-common/pom.xml | 48 +++++++++++++++++++ metrics-common/pom.xml | 48 +++++++++++++++++++ zookeeper-api/pom.xml | 48 +++++++++++++++++++ 5 files changed, 197 insertions(+), 3 deletions(-) diff --git a/helix-common/pom.xml b/helix-common/pom.xml index 40f64043b6..82e35c86dd 100644 --- a/helix-common/pom.xml +++ b/helix-common/pom.xml @@ -89,6 +89,54 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + + JDK 8 + compile + + compile + + + ${project.build.outputDirectory}_jdk8 + 8 + true + + + + JDK 11 + compile + + compile + + + 11 + true + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + default-package-jdk11 + package + + jar + + + ${project.build.outputDirectory}_jdk8 + jdk8 + + + + org.apache.maven.plugins maven-assembly-plugin diff --git a/helix-common/src/main/java/org/apache/helix/constants/InstanceConstants.java b/helix-common/src/main/java/org/apache/helix/constants/InstanceConstants.java index 07eb4989d3..85c22c460b 100644 --- a/helix-common/src/main/java/org/apache/helix/constants/InstanceConstants.java +++ b/helix-common/src/main/java/org/apache/helix/constants/InstanceConstants.java @@ -2,6 +2,8 @@ import java.util.Set; +import com.google.common.collect.ImmutableSet; + public class InstanceConstants { public static final String INSTANCE_NOT_DISABLED = "INSTANCE_NOT_DISABLED"; @@ -9,7 +11,7 @@ public class InstanceConstants { * The set contains the InstanceOperations that are allowed to be assigned replicas by the rebalancer. */ public static final Set ASSIGNABLE_INSTANCE_OPERATIONS = - Set.of(InstanceOperation.ENABLE, InstanceOperation.DISABLE); + ImmutableSet.of(InstanceOperation.ENABLE, InstanceOperation.DISABLE); /** @@ -18,14 +20,14 @@ public class InstanceConstants { * TODO: Remove this when the deprecated HELIX_ENABLED is removed. */ public static final Set INSTANCE_DISABLED_OVERRIDABLE_OPERATIONS = - Set.of(InstanceOperation.ENABLE, InstanceOperation.DISABLE, InstanceOperation.EVACUATE); + ImmutableSet.of(InstanceOperation.ENABLE, InstanceOperation.DISABLE, InstanceOperation.EVACUATE); /** * The set of InstanceOperations that are not allowed to be populated in the RoutingTableProvider. */ public static final Set UNSERVABLE_INSTANCE_OPERATIONS = - Set.of(InstanceOperation.SWAP_IN, InstanceOperation.UNKNOWN); + ImmutableSet.of(InstanceOperation.SWAP_IN, InstanceOperation.UNKNOWN); public enum InstanceDisabledType { CLOUD_EVENT, diff --git a/metadata-store-directory-common/pom.xml b/metadata-store-directory-common/pom.xml index f173397cc4..98e2e5cb03 100644 --- a/metadata-store-directory-common/pom.xml +++ b/metadata-store-directory-common/pom.xml @@ -113,6 +113,54 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + + JDK 8 + compile + + compile + + + ${project.build.outputDirectory}_jdk8 + 8 + true + + + + JDK 11 + compile + + compile + + + 11 + true + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + default-package-jdk11 + package + + jar + + + ${project.build.outputDirectory}_jdk8 + jdk8 + + + + org.apache.maven.plugins maven-assembly-plugin diff --git a/metrics-common/pom.xml b/metrics-common/pom.xml index 2dbe016cb2..433c575aac 100644 --- a/metrics-common/pom.xml +++ b/metrics-common/pom.xml @@ -84,6 +84,54 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + + JDK 8 + compile + + compile + + + ${project.build.outputDirectory}_jdk8 + 8 + true + + + + JDK 11 + compile + + compile + + + 11 + true + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + default-package-jdk11 + package + + jar + + + ${project.build.outputDirectory}_jdk8 + jdk8 + + + + org.apache.maven.plugins maven-assembly-plugin diff --git a/zookeeper-api/pom.xml b/zookeeper-api/pom.xml index d44160fdb7..bfb993feec 100644 --- a/zookeeper-api/pom.xml +++ b/zookeeper-api/pom.xml @@ -133,6 +133,54 @@ + + org.apache.maven.plugins + maven-compiler-plugin + 3.12.1 + + + JDK 8 + compile + + compile + + + ${project.build.outputDirectory}_jdk8 + 8 + true + + + + JDK 11 + compile + + compile + + + 11 + true + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + default-package-jdk11 + package + + jar + + + ${project.build.outputDirectory}_jdk8 + jdk8 + + + + org.apache.maven.plugins maven-assembly-plugin