mirror of https://github.com/tikv/client-java.git
Fix gradle build (#50)
This commit is contained in:
parent
1d66f4effa
commit
c4b32df541
|
|
@ -60,6 +60,7 @@ bazel-*
|
||||||
# ignore gradle
|
# ignore gradle
|
||||||
.gradle
|
.gradle
|
||||||
build/
|
build/
|
||||||
|
out/
|
||||||
|
|
||||||
# Cache of project
|
# Cache of project
|
||||||
.gradletasknamecache
|
.gradletasknamecache
|
||||||
|
|
|
||||||
31
build.gradle
31
build.gradle
|
|
@ -1,5 +1,6 @@
|
||||||
apply plugin: 'java'
|
apply plugin: 'java'
|
||||||
apply plugin: 'maven'
|
apply plugin: 'maven'
|
||||||
|
apply plugin: 'idea'
|
||||||
apply plugin: "com.google.protobuf"
|
apply plugin: "com.google.protobuf"
|
||||||
|
|
||||||
group = 'org.tikv'
|
group = 'org.tikv'
|
||||||
|
|
@ -13,6 +14,14 @@ tasks.withType(JavaCompile) {
|
||||||
options.encoding = 'UTF-8'
|
options.encoding = 'UTF-8'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idea {
|
||||||
|
module {
|
||||||
|
// Marks the already(!) added srcDir as "generated"
|
||||||
|
generatedSourceDirs += file('target/generated-sources/protobuf/java')
|
||||||
|
generatedSourceDirs += file('target/generated-sources/protobuf/grpc-java')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "http://repo.maven.apache.org/maven2" }
|
maven { url "http://repo.maven.apache.org/maven2" }
|
||||||
|
|
@ -25,16 +34,18 @@ buildscript {
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
proto {
|
proto {
|
||||||
srcDir 'src/main/proto'
|
srcDir {'proto'}
|
||||||
include '**/*.proto'
|
include {'**/*.proto'}
|
||||||
}
|
}
|
||||||
java {
|
java {
|
||||||
// include self written and generated code
|
// include self written and generated code
|
||||||
srcDirs 'src/main/java', 'target/generated-sources/main/java' , 'target/generated-sources/main/grpc-java'
|
srcDirs 'src/main/java', 'target/generated-sources/protobuf/java' , 'target/generated-sources/protobuf/grpc-java'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
test {
|
test {
|
||||||
java {}
|
java {
|
||||||
|
srcDirs 'src/test/java', 'target/generated-sources/protobuf/java' , 'target/generated-sources/protobuf/grpc-java'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// remove the test configuration - at least in your example you don't have a special test proto file
|
// remove the test configuration - at least in your example you don't have a special test proto file
|
||||||
}
|
}
|
||||||
|
|
@ -127,20 +138,16 @@ task updateProtoModule(type: Exec) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava << {
|
|
||||||
println 'Compiling'
|
|
||||||
}
|
|
||||||
|
|
||||||
task copyResources(type: Copy) {
|
task copyResources(type: Copy) {
|
||||||
includeEmptyDirs = false
|
includeEmptyDirs = false
|
||||||
copy {
|
copy {
|
||||||
from "./scripts/kvproto/include/"
|
from "./kvproto/include/"
|
||||||
include "**/gogoproto/**"
|
include "**/gogoproto/**"
|
||||||
into "src/main/proto"
|
into "proto"
|
||||||
}
|
}
|
||||||
copy {
|
copy {
|
||||||
from "./scripts/kvproto/proto/", "./scripts/raft-rs/proto/", "./scripts/tipb/proto"
|
from "./kvproto/proto/", "./raft-rs/proto/", "./tipb/proto"
|
||||||
into "src/main/proto"
|
into "proto"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
#Wed Feb 27 14:56:43 CST 2019
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ public class KVErrorHandler<RespT> implements ErrorHandler<RespT> {
|
||||||
backOffer.doBackOff(
|
backOffer.doBackOff(
|
||||||
BackOffFunction.BackOffFuncType.BoStoreNotMatch, new GrpcException(error.toString()));
|
BackOffFunction.BackOffFuncType.BoStoreNotMatch, new GrpcException(error.toString()));
|
||||||
return true;
|
return true;
|
||||||
} else if (error.hasStaleEpoch()) {
|
} else if (error.hasEpochNotMatch()) {
|
||||||
// this error is reported from raftstore:
|
// this error is reported from raftstore:
|
||||||
// region has outdated version,please try later.
|
// region has outdated version,please try later.
|
||||||
logger.warn(String.format("Stale Epoch encountered for region [%s]", ctxRegion));
|
logger.warn(String.format("Stale Epoch encountered for region [%s]", ctxRegion));
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ import org.tikv.kvproto.Errorpb;
|
||||||
import org.tikv.kvproto.Errorpb.Error;
|
import org.tikv.kvproto.Errorpb.Error;
|
||||||
import org.tikv.kvproto.Errorpb.NotLeader;
|
import org.tikv.kvproto.Errorpb.NotLeader;
|
||||||
import org.tikv.kvproto.Errorpb.ServerIsBusy;
|
import org.tikv.kvproto.Errorpb.ServerIsBusy;
|
||||||
import org.tikv.kvproto.Errorpb.StaleEpoch;
|
import org.tikv.kvproto.Errorpb.EpochNotMatch;
|
||||||
import org.tikv.kvproto.Kvrpcpb;
|
import org.tikv.kvproto.Kvrpcpb;
|
||||||
import org.tikv.kvproto.Kvrpcpb.Context;
|
import org.tikv.kvproto.Kvrpcpb.Context;
|
||||||
import org.tikv.kvproto.TikvGrpc;
|
import org.tikv.kvproto.TikvGrpc;
|
||||||
|
|
@ -154,7 +154,7 @@ public class KVMockServer extends TikvGrpc.TikvImplBase {
|
||||||
} else if (errorCode == KEY_NOT_IN_REGION) {
|
} else if (errorCode == KEY_NOT_IN_REGION) {
|
||||||
errBuilder.setKeyNotInRegion(Errorpb.KeyNotInRegion.getDefaultInstance());
|
errBuilder.setKeyNotInRegion(Errorpb.KeyNotInRegion.getDefaultInstance());
|
||||||
} else if (errorCode == STALE_EPOCH) {
|
} else if (errorCode == STALE_EPOCH) {
|
||||||
errBuilder.setStaleEpoch(Errorpb.StaleEpoch.getDefaultInstance());
|
errBuilder.setEpochNotMatch(Errorpb.EpochNotMatch.getDefaultInstance());
|
||||||
} else if (errorCode == STALE_COMMAND) {
|
} else if (errorCode == STALE_COMMAND) {
|
||||||
errBuilder.setStaleCommand(Errorpb.StaleCommand.getDefaultInstance());
|
errBuilder.setStaleCommand(Errorpb.StaleCommand.getDefaultInstance());
|
||||||
} else if (errorCode == SERVER_IS_BUSY) {
|
} else if (errorCode == SERVER_IS_BUSY) {
|
||||||
|
|
@ -318,7 +318,7 @@ public class KVMockServer extends TikvGrpc.TikvImplBase {
|
||||||
Integer errorCode = errorMap.remove(keyRange.getStart());
|
Integer errorCode = errorMap.remove(keyRange.getStart());
|
||||||
if (errorCode != null) {
|
if (errorCode != null) {
|
||||||
if (STALE_EPOCH == errorCode) {
|
if (STALE_EPOCH == errorCode) {
|
||||||
errBuilder.setStaleEpoch(StaleEpoch.getDefaultInstance());
|
errBuilder.setEpochNotMatch(EpochNotMatch.getDefaultInstance());
|
||||||
} else if (NOT_LEADER == errorCode) {
|
} else if (NOT_LEADER == errorCode) {
|
||||||
errBuilder.setNotLeader(NotLeader.getDefaultInstance());
|
errBuilder.setNotLeader(NotLeader.getDefaultInstance());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue