Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor/kts gradle #8

Merged
merged 4 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .gitattributes

This file was deleted.

55 changes: 19 additions & 36 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,36 +1,19 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

# Ignore Gradle project-specific cache directory
.gradle

# Ignore Gradle build output directory
build

# Ignore Visual Studio Code configuration directory
.vscode

# Ignore Playground directory
playground
.*
!.github
!.gitignore
!.pre-commit-config.yaml
!gradle/wrapper/gradle-wrapper.jar
target/
target-ide/
*.iml
logs/
*.releaseBackup
*.versionsBackup
.vscode/
.settings/
.project
.env
.sdkmanrc
build/
bin/
out/
8 changes: 4 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "lib/src/proto/curp-proto"]
path = lib/src/proto/curp-proto
[submodule "curp-proto"]
path = jxline-proto/src/proto/curp-proto
url = https://github.com/xline-kv/curp-proto.git
[submodule "lib/src/proto/xline-proto"]
path = lib/src/proto/xline-proto
[submodule "xline-proto"]
path = jxline-proto/src/proto/xline-proto
url = https://github.com/xline-kv/xline-proto.git
36 changes: 36 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
fail_fast: false
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: no-commit-to-branch
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: check-toml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/crate-ci/typos
rev: v1.16.0
hooks:
- id: typos

- repo: local
hooks:
- id: conventional-commit-msg-validation
name: commit message conventional validation
language: pygrep
entry: '^(breaking|build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w `])+([\s\S]*)'
args: [ --multiline, --negate ]
stages: [ commit-msg ]

- id: commit-msg-needs-to-be-signed-off
name: commit message needs to be signed off
language: pygrep
entry: "^Signed-off-by:"
args: [ --multiline, --negate ]
stages: [ commit-msg ]
2 changes: 2 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[default.extend-words]
vertx = "vertx"
54 changes: 54 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import com.adarshr.gradle.testlogger.TestLoggerExtension
import com.adarshr.gradle.testlogger.theme.ThemeType

group = "cloud.xline"
version = "1.0-SNAPSHOT"

buildscript {
repositories {
google()
gradlePluginPortal()
}

dependencies {
classpath("org.gradle:test-retry-gradle-plugin:${libs.versions.testRetryPlugin.get()}")
classpath("com.adarshr:gradle-test-logger-plugin:${libs.versions.testLoggerPlugin.get()}")
}
}

allprojects {
repositories {
mavenLocal()
mavenCentral()
}
}

subprojects {
apply(plugin = "java-library")
apply(plugin = "org.gradle.test-retry")
apply(plugin = "com.adarshr.test-logger")

tasks {
named<JavaCompile>("compileJava") {
// Keep same java with jetcd
options.release = 11
}

named<Test>("test") {
useJUnitPlatform()

maxParallelForks = Runtime.getRuntime().availableProcessors()

// Keep same with jetcd
retry {
maxRetries = 1
maxFailures = 5
}
}
}

extensions.getByType<TestLoggerExtension>().apply {
theme = ThemeType.MOCHA_PARALLEL
showStandardStreams = false
}
}
6 changes: 0 additions & 6 deletions gradle.properties

This file was deleted.

51 changes: 51 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[versions]
jetcd = "0.7.7"
grpc = "1.61.0"
protoc = "3.25.1"
log4j = "2.22.1"
slf4j = "2.0.11"
guava = "33.0.0-jre"
assertj = "3.25.1"
junit = "5.10.1"
vertx = "4.5.1"
javaxAnnotation = "1.3.2"

protobufPlugin = "0.9.4"
testRetryPlugin = "1.5.8"
testLoggerPlugin = "4.0.0"


[libraries]
jetcd = { module = "io.etcd:jetcd-core", version.ref = "jetcd" }

slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
guava = { module = "com.google.guava:guava", version.ref = "guava" }
assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }
junit = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
protoc = { module = "com.google.protobuf:protoc", version.ref = "protoc" }
javaxAnnotation = { module = "javax.annotation:javax.annotation-api", version.ref = "javaxAnnotation" }

grpcCore = { module = "io.grpc:grpc-core", version.ref = "grpc" }
grpcNetty = { module = "io.grpc:grpc-netty", version.ref = "grpc" }
grpcProtobuf = { module = "io.grpc:grpc-protobuf", version.ref = "grpc" }
grpcStub = { module = "io.grpc:grpc-stub", version.ref = "grpc" }
grpcGrpclb = { module = "io.grpc:grpc-grpclb", version.ref = "grpc" }
grpcInprocess = { module = "io.grpc:grpc-inprocess", version.ref = "grpc" }
grpcUtil = { module = "io.grpc:grpc-util", version.ref = "grpc" }

vertxGrpc = { module = "io.vertx:vertx-grpc", version.ref = "vertx" }

log4jApi = { module = "org.apache.logging.log4j:log4j-api", version.ref = "log4j" }
log4jCore = { module = "org.apache.logging.log4j:log4j-core", version.ref = "log4j" }
log4jSlf4j = { module = "org.apache.logging.log4j:log4j-slf4j2-impl", version.ref = "log4j" }
log4j12 = { module = "org.apache.logging.log4j:log4j-1.2-api", version.ref = "log4j" }


[plugins]
protobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }

[bundles]
grpc = ["grpcCore", "grpcNetty", "grpcProtobuf", "grpcStub", "grpcGrpclb", "grpcUtil"]
log4j = ["log4jApi", "log4jCore", "log4jSlf4j", "log4j12"]
javax = ["javaxAnnotation"]
testing = ["junit", "assertj"]
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 2 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#Wed Jan 31 18:33:10 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
41 changes: 13 additions & 28 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,11 +80,13 @@ do
esac
done

# This is normally unused
# shellcheck disable=SC2034
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -131,29 +133,22 @@ location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -198,28 +193,18 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
Loading
Loading