From 292274c4d3dfdb249dccbdf59aa09d0afb5f5eba Mon Sep 17 00:00:00 2001 From: Eugen Stan Date: Fri, 27 Sep 2024 02:51:41 +0300 Subject: [PATCH] Improved: Introduced base/util module (OFBIZ-12308) * Movend lang package to util gradle project * Moved some classes * First road block: Debug + UtilValidation, UtilProperties --- base/util/build.gradle | 25 +++++++++++++++++++ .../org/apache/ofbiz/base/lang/Appender.java | 0 .../ofbiz/base/lang/ClassInvariant.java | 0 .../ofbiz/base/lang/ComparableRange.java | 0 .../org/apache/ofbiz/base/lang/Factory.java | 0 .../org/apache/ofbiz/base/lang/IsEmpty.java | 0 .../java/org/apache/ofbiz/base/lang/JSON.java | 2 +- .../org/apache/ofbiz/base/lang/Range.java | 0 .../ofbiz/base/lang/SourceMonitored.java | 0 .../apache/ofbiz/base/lang/ThreadSafe.java | 0 .../org/apache/ofbiz/base/util/Assert.java | 1 - .../ofbiz/base/util/GeneralException.java | 0 .../base/util/GeneralRuntimeException.java | 0 .../ofbiz/base/util/IndentingWriter.java | 0 .../ofbiz/base/util/ReferenceCleaner.java | 0 dependencies.gradle | 1 + settings.gradle | 2 ++ 17 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 base/util/build.gradle rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/lang/Appender.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/lang/ClassInvariant.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/lang/ComparableRange.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/lang/Factory.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/lang/IsEmpty.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/lang/JSON.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/lang/Range.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/lang/SourceMonitored.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/lang/ThreadSafe.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/util/Assert.java (99%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/util/GeneralException.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/util/GeneralRuntimeException.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/util/IndentingWriter.java (100%) rename {framework/base => base/util}/src/main/java/org/apache/ofbiz/base/util/ReferenceCleaner.java (100%) diff --git a/base/util/build.gradle b/base/util/build.gradle new file mode 100644 index 00000000000..d6c7185ec1e --- /dev/null +++ b/base/util/build.gradle @@ -0,0 +1,25 @@ +plugins { + id 'java-library' + id 'maven-publish' +} + +dependencies { + api 'com.fasterxml.jackson.core:jackson-databind:2.15.2' + api 'commons-io:commons-io:2.15.1' + + testImplementation 'junit:junit:4.13.1' +} + +java { + withJavadocJar() + withSourcesJar() +} + +publishing { + publications { + baseUtil(MavenPublication) { + artifactId = "base-${project.name}" + from components.java + } + } +} \ No newline at end of file diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/Appender.java b/base/util/src/main/java/org/apache/ofbiz/base/lang/Appender.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/lang/Appender.java rename to base/util/src/main/java/org/apache/ofbiz/base/lang/Appender.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/ClassInvariant.java b/base/util/src/main/java/org/apache/ofbiz/base/lang/ClassInvariant.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/lang/ClassInvariant.java rename to base/util/src/main/java/org/apache/ofbiz/base/lang/ClassInvariant.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/ComparableRange.java b/base/util/src/main/java/org/apache/ofbiz/base/lang/ComparableRange.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/lang/ComparableRange.java rename to base/util/src/main/java/org/apache/ofbiz/base/lang/ComparableRange.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/Factory.java b/base/util/src/main/java/org/apache/ofbiz/base/lang/Factory.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/lang/Factory.java rename to base/util/src/main/java/org/apache/ofbiz/base/lang/Factory.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/IsEmpty.java b/base/util/src/main/java/org/apache/ofbiz/base/lang/IsEmpty.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/lang/IsEmpty.java rename to base/util/src/main/java/org/apache/ofbiz/base/lang/IsEmpty.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java b/base/util/src/main/java/org/apache/ofbiz/base/lang/JSON.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java rename to base/util/src/main/java/org/apache/ofbiz/base/lang/JSON.java index 04e9aeb85ce..fab20008a53 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/lang/JSON.java +++ b/base/util/src/main/java/org/apache/ofbiz/base/lang/JSON.java @@ -23,9 +23,9 @@ import java.io.Reader; import org.apache.commons.io.IOUtils; -import org.apache.ofbiz.base.util.Assert; import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.ofbiz.base.util.Assert; /** A JSON object. */ @ThreadSafe diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/Range.java b/base/util/src/main/java/org/apache/ofbiz/base/lang/Range.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/lang/Range.java rename to base/util/src/main/java/org/apache/ofbiz/base/lang/Range.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/SourceMonitored.java b/base/util/src/main/java/org/apache/ofbiz/base/lang/SourceMonitored.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/lang/SourceMonitored.java rename to base/util/src/main/java/org/apache/ofbiz/base/lang/SourceMonitored.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/lang/ThreadSafe.java b/base/util/src/main/java/org/apache/ofbiz/base/lang/ThreadSafe.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/lang/ThreadSafe.java rename to base/util/src/main/java/org/apache/ofbiz/base/lang/ThreadSafe.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/Assert.java b/base/util/src/main/java/org/apache/ofbiz/base/util/Assert.java similarity index 99% rename from framework/base/src/main/java/org/apache/ofbiz/base/util/Assert.java rename to base/util/src/main/java/org/apache/ofbiz/base/util/Assert.java index 1d406187cc6..aa7f3a313ef 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/Assert.java +++ b/base/util/src/main/java/org/apache/ofbiz/base/util/Assert.java @@ -19,7 +19,6 @@ import java.util.Collection; import java.util.Map; - import org.apache.ofbiz.base.lang.ThreadSafe; /** Basic assertions. The static methods in this class provide a convenient way diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/GeneralException.java b/base/util/src/main/java/org/apache/ofbiz/base/util/GeneralException.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/util/GeneralException.java rename to base/util/src/main/java/org/apache/ofbiz/base/util/GeneralException.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/GeneralRuntimeException.java b/base/util/src/main/java/org/apache/ofbiz/base/util/GeneralRuntimeException.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/util/GeneralRuntimeException.java rename to base/util/src/main/java/org/apache/ofbiz/base/util/GeneralRuntimeException.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/IndentingWriter.java b/base/util/src/main/java/org/apache/ofbiz/base/util/IndentingWriter.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/util/IndentingWriter.java rename to base/util/src/main/java/org/apache/ofbiz/base/util/IndentingWriter.java diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/ReferenceCleaner.java b/base/util/src/main/java/org/apache/ofbiz/base/util/ReferenceCleaner.java similarity index 100% rename from framework/base/src/main/java/org/apache/ofbiz/base/util/ReferenceCleaner.java rename to base/util/src/main/java/org/apache/ofbiz/base/util/ReferenceCleaner.java diff --git a/dependencies.gradle b/dependencies.gradle index 38f4138979a..18bd32bfdce 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -17,6 +17,7 @@ * under the License. */ dependencies { + implementation project (':base:util') implementation 'com.github.ben-manes.caffeine:caffeine:3.1.8' implementation 'com.google.zxing:core:3.5.3' implementation 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2' diff --git a/settings.gradle b/settings.gradle index 41f41b36083..8e60223453e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -63,3 +63,5 @@ activeComponents().each { File component -> include subProject.replaceAll(fileSep, ':') } + +include 'base:util' \ No newline at end of file