diff --git a/app/build.gradle b/app/build.gradle index 14d12b2e..a9fe4eb8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -12,8 +12,8 @@ repositories { } dependencies { - implementation project(':core') - implementation project(':config') + api project(':core') + api project(':config') implementation 'ch.qos.logback:logback-classic:1.2.7' implementation 'ch.qos.logback:logback-core:1.2.7' diff --git a/config/build.gradle b/config/build.gradle index e54f748f..1e895adc 100644 --- a/config/build.gradle +++ b/config/build.gradle @@ -16,50 +16,6 @@ javadoc { } } -publishing { - publications { - mavenJava(MavenPublication) { - artifactId = 'config-loader' - from components.java - versionMapping { - usage('java-api') { - fromResolutionOf('runtimeClasspath') - } - usage('java-runtime') { - fromResolutionResult() - } - } - pom { - name = 'Keva ConfigLoader' - description = 'Keva ConfigLoader utility' - url = 'https://keva.dev/' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'https://github.com/keva-dev/keva/blob/master/LICENSE' - } - } - developers { - developer { - id = 'tuhuynh27' - name = 'Tu Huynh' - email = 'huynhminhtufu@gmail.com' - } - } - scm { - connection = 'scm:git:git://github.com/keva-dev/keva.git' - developerConnection = 'scm:git:ssh://github.com:keva-dev/keva.git' - url = 'https://github.com/keva-dev/keva' - } - } - } - } -} - -signing { - sign publishing.publications.mavenJava -} - test { useJUnitPlatform() testLogging { diff --git a/core/build.gradle b/core/build.gradle index 24bbf525..3dfa033c 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -2,15 +2,18 @@ plugins { id 'com.adarshr.test-logger' version '2.1.0' } +evaluationDependsOn(':util') + java { withJavadocJar() withSourcesJar() } dependencies { + implementation project(':util') + implementation project(':config') implementation project(':protocol') implementation project(':store') - implementation project(':config') implementation 'io.netty:netty-handler:4.1.70.Final' implementation 'io.netty:netty-buffer:4.1.70.Final' @@ -24,17 +27,23 @@ dependencies { implementation files('libs/keva-ioc-0.1.0-SNAPSHOT.jar') testImplementation 'redis.clients:jedis:3.7.0' +} - // MTC lib depends on junit 4 - testImplementation group: 'junit', name: 'junit', version: '4.12' - // noinspection GradlePackageUpdate - testRuntimeOnly('org.junit.vintage:junit-vintage-engine:5.7.2') +jar { + dependsOn(':util:build') + dependsOn(':config:build') + dependsOn(':protocol:build') + dependsOn(':store:build') + project.configurations.implementation.canBeResolved = true + from { + configurations.implementation.collect { it.isDirectory() ? it : zipTree(it) } + } } publishing { publications { mavenJava(MavenPublication) { - artifactId = 'core' + artifactId = 'kevadb' from components.java versionMapping { usage('java-api') { @@ -45,8 +54,8 @@ publishing { } } pom { - name = 'Keva Core' - description = 'KevaDB Core' + name = 'KevaDB' + description = 'KevaDB - Low-latency in-memory key-value store, Redis drop-in alternative' url = 'https://keva.dev/' licenses { license { diff --git a/core/src/main/java/dev/keva/core/aof/AOFManager.java b/core/src/main/java/dev/keva/core/aof/AOFManager.java index 77704b91..5befe7fb 100644 --- a/core/src/main/java/dev/keva/core/aof/AOFManager.java +++ b/core/src/main/java/dev/keva/core/aof/AOFManager.java @@ -5,7 +5,7 @@ import dev.keva.ioc.annotation.Autowired; import dev.keva.ioc.annotation.Component; import dev.keva.protocol.resp.Command; -import dev.keva.protocol.resp.hashbytes.BytesKey; +import dev.keva.util.hashbytes.BytesKey; import lombok.extern.slf4j.Slf4j; import lombok.val; diff --git a/core/src/main/java/dev/keva/core/command/impl/transaction/Unwatch.java b/core/src/main/java/dev/keva/core/command/impl/transaction/Unwatch.java index e93857d9..af9d2496 100644 --- a/core/src/main/java/dev/keva/core/command/impl/transaction/Unwatch.java +++ b/core/src/main/java/dev/keva/core/command/impl/transaction/Unwatch.java @@ -5,7 +5,7 @@ import dev.keva.core.command.impl.transaction.manager.TransactionManager; import dev.keva.ioc.annotation.Autowired; import dev.keva.ioc.annotation.Component; -import dev.keva.protocol.resp.hashbytes.BytesKey; +import dev.keva.util.hashbytes.BytesKey; import dev.keva.protocol.resp.reply.StatusReply; import io.netty.channel.ChannelHandlerContext; import lombok.val; diff --git a/core/src/main/java/dev/keva/core/command/impl/transaction/Watch.java b/core/src/main/java/dev/keva/core/command/impl/transaction/Watch.java index b9df176c..cee187a8 100644 --- a/core/src/main/java/dev/keva/core/command/impl/transaction/Watch.java +++ b/core/src/main/java/dev/keva/core/command/impl/transaction/Watch.java @@ -8,8 +8,8 @@ import dev.keva.core.command.mapping.CommandMapper; import dev.keva.ioc.annotation.Autowired; import dev.keva.ioc.annotation.Component; -import dev.keva.protocol.resp.hashbytes.BytesKey; -import dev.keva.protocol.resp.hashbytes.BytesValue; +import dev.keva.util.hashbytes.BytesKey; +import dev.keva.util.hashbytes.BytesValue; import dev.keva.protocol.resp.reply.StatusReply; import dev.keva.store.KevaDatabase; import io.netty.channel.ChannelHandlerContext; diff --git a/core/src/main/java/dev/keva/core/command/impl/transaction/manager/TransactionContext.java b/core/src/main/java/dev/keva/core/command/impl/transaction/manager/TransactionContext.java index 20ba5ada..36491eb4 100644 --- a/core/src/main/java/dev/keva/core/command/impl/transaction/manager/TransactionContext.java +++ b/core/src/main/java/dev/keva/core/command/impl/transaction/manager/TransactionContext.java @@ -2,8 +2,8 @@ import dev.keva.core.command.mapping.CommandMapper; import dev.keva.protocol.resp.Command; -import dev.keva.protocol.resp.hashbytes.BytesKey; -import dev.keva.protocol.resp.hashbytes.BytesValue; +import dev.keva.util.hashbytes.BytesKey; +import dev.keva.util.hashbytes.BytesValue; import dev.keva.protocol.resp.reply.MultiBulkReply; import dev.keva.protocol.resp.reply.Reply; import dev.keva.store.KevaDatabase; diff --git a/core/src/main/java/dev/keva/core/command/mapping/CommandMapper.java b/core/src/main/java/dev/keva/core/command/mapping/CommandMapper.java index 14c8b929..07ef8eaf 100644 --- a/core/src/main/java/dev/keva/core/command/mapping/CommandMapper.java +++ b/core/src/main/java/dev/keva/core/command/mapping/CommandMapper.java @@ -11,7 +11,7 @@ import dev.keva.ioc.KevaIoC; import dev.keva.ioc.annotation.Autowired; import dev.keva.ioc.annotation.Component; -import dev.keva.protocol.resp.hashbytes.BytesKey; +import dev.keva.util.hashbytes.BytesKey; import dev.keva.protocol.resp.reply.ErrorReply; import dev.keva.protocol.resp.reply.Reply; import dev.keva.protocol.resp.reply.StatusReply; diff --git a/core/src/main/java/dev/keva/core/server/NettyChannelHandler.java b/core/src/main/java/dev/keva/core/server/NettyChannelHandler.java index ef83146e..3ac50798 100644 --- a/core/src/main/java/dev/keva/core/server/NettyChannelHandler.java +++ b/core/src/main/java/dev/keva/core/server/NettyChannelHandler.java @@ -4,7 +4,7 @@ import dev.keva.ioc.annotation.Autowired; import dev.keva.ioc.annotation.Component; import dev.keva.protocol.resp.Command; -import dev.keva.protocol.resp.hashbytes.BytesKey; +import dev.keva.util.hashbytes.BytesKey; import dev.keva.protocol.resp.reply.ErrorReply; import dev.keva.protocol.resp.reply.Reply; import io.netty.channel.ChannelHandler.Sharable; diff --git a/protocol/build.gradle b/protocol/build.gradle index 2cf93af0..1da4efd0 100644 --- a/protocol/build.gradle +++ b/protocol/build.gradle @@ -8,49 +8,9 @@ java { } dependencies { + implementation project(':util') implementation 'io.netty:netty-handler:4.1.70.Final' implementation 'io.netty:netty-buffer:4.1.70.Final' - implementation 'com.google.guava:guava:31.0.1-jre' -} - -publishing { - publications { - mavenJava(MavenPublication) { - artifactId = 'protocol-resp' - from components.java - versionMapping { - usage('java-api') { - fromResolutionOf('runtimeClasspath') - } - usage('java-runtime') { - fromResolutionResult() - } - } - pom { - name = 'Keva RESP Protocol' - description = 'Keva RESP Protocol for Netty' - url = 'https://keva.dev/' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'https://github.com/keva-dev/keva/blob/master/LICENSE' - } - } - developers { - developer { - id = 'tuhuynh27' - name = 'Tu Huynh' - email = 'huynhminhtufu@gmail.com' - } - } - scm { - connection = 'scm:git:git://github.com/keva-dev/keva.git' - developerConnection = 'scm:git:ssh://github.com:keva-dev/keva.git' - url = 'https://github.com/keva-dev/keva' - } - } - } - } } javadoc { @@ -59,10 +19,6 @@ javadoc { } } -signing { - sign publishing.publications.mavenJava -} - test { useJUnitPlatform() testLogging { diff --git a/settings.gradle b/settings.gradle index 39c908b1..73f2f561 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,8 @@ rootProject.name = 'keva' -include 'app' -include 'core' -include 'store' -include 'protocol' +include 'util' include 'config' +include 'protocol' +include 'store' +include 'core' +include 'app' diff --git a/store/build.gradle b/store/build.gradle index cd52e321..23e2c0a4 100644 --- a/store/build.gradle +++ b/store/build.gradle @@ -8,9 +8,9 @@ java { } dependencies { - implementation project(':protocol') + implementation project(':util') implementation 'net.openhft:chronicle-map:3.21.86' - implementation 'org.apache.commons:commons-lang3:3.0' + implementation 'org.apache.commons:commons-lang3:3.12.0' } javadoc { diff --git a/store/src/main/java/dev/keva/store/impl/OffHeapDatabaseImpl.java b/store/src/main/java/dev/keva/store/impl/OffHeapDatabaseImpl.java index 39f54c26..09133a21 100644 --- a/store/src/main/java/dev/keva/store/impl/OffHeapDatabaseImpl.java +++ b/store/src/main/java/dev/keva/store/impl/OffHeapDatabaseImpl.java @@ -1,7 +1,7 @@ package dev.keva.store.impl; -import dev.keva.protocol.resp.hashbytes.BytesKey; -import dev.keva.protocol.resp.hashbytes.BytesValue; +import dev.keva.util.hashbytes.BytesKey; +import dev.keva.util.hashbytes.BytesValue; import dev.keva.store.DatabaseConfig; import dev.keva.store.KevaDatabase; import dev.keva.store.lock.SpinLock; diff --git a/store/src/main/java/dev/keva/store/impl/OnHeapDatabaseImpl.java b/store/src/main/java/dev/keva/store/impl/OnHeapDatabaseImpl.java index 0b610d6f..a798a49e 100644 --- a/store/src/main/java/dev/keva/store/impl/OnHeapDatabaseImpl.java +++ b/store/src/main/java/dev/keva/store/impl/OnHeapDatabaseImpl.java @@ -1,7 +1,7 @@ package dev.keva.store.impl; -import dev.keva.protocol.resp.hashbytes.BytesKey; -import dev.keva.protocol.resp.hashbytes.BytesValue; +import dev.keva.util.hashbytes.BytesKey; +import dev.keva.util.hashbytes.BytesValue; import dev.keva.store.KevaDatabase; import dev.keva.store.lock.SpinLock; import lombok.Getter; diff --git a/util/build.gradle b/util/build.gradle new file mode 100644 index 00000000..310f5297 --- /dev/null +++ b/util/build.gradle @@ -0,0 +1,27 @@ +plugins { + id 'com.adarshr.test-logger' version '2.1.0' +} + +java { + withJavadocJar() + withSourcesJar() +} + +dependencies { + implementation 'com.google.guava:guava:31.0.1-jre' +} + +javadoc { + if (JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } +} + +test { + useJUnitPlatform() + testLogging { + events "passed", "skipped", "failed" + outputs.upToDateWhen { false } + showStandardStreams = true + } +} diff --git a/protocol/src/main/java/dev/keva/protocol/resp/hashbytes/BytesKey.java b/util/src/main/java/dev/keva/util/hashbytes/BytesKey.java similarity index 95% rename from protocol/src/main/java/dev/keva/protocol/resp/hashbytes/BytesKey.java rename to util/src/main/java/dev/keva/util/hashbytes/BytesKey.java index 4d33f318..93231433 100644 --- a/protocol/src/main/java/dev/keva/protocol/resp/hashbytes/BytesKey.java +++ b/util/src/main/java/dev/keva/util/hashbytes/BytesKey.java @@ -1,4 +1,4 @@ -package dev.keva.protocol.resp.hashbytes; +package dev.keva.util.hashbytes; import com.google.common.primitives.SignedBytes; diff --git a/protocol/src/main/java/dev/keva/protocol/resp/hashbytes/BytesValue.java b/util/src/main/java/dev/keva/util/hashbytes/BytesValue.java similarity index 96% rename from protocol/src/main/java/dev/keva/protocol/resp/hashbytes/BytesValue.java rename to util/src/main/java/dev/keva/util/hashbytes/BytesValue.java index 977f0e54..7f483e5e 100644 --- a/protocol/src/main/java/dev/keva/protocol/resp/hashbytes/BytesValue.java +++ b/util/src/main/java/dev/keva/util/hashbytes/BytesValue.java @@ -1,4 +1,4 @@ -package dev.keva.protocol.resp.hashbytes; +package dev.keva.util.hashbytes; import java.io.Serializable;