Skip to content
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
6 changes: 3 additions & 3 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ steps:
agents:
queue: "workers"
docker: "*"
command: "./gradlew test"
command: "./gradlew --no-daemon test"
plugins:
- docker-compose#v3.0.0:
run: unit-test-test-service
Expand All @@ -13,7 +13,7 @@ steps:
agents:
queue: "workers"
docker: "*"
command: "./gradlew test"
command: "./gradlew --no-daemon test"
plugins:
- docker-compose#v3.0.0:
run: unit-test-docker-sticky-on
Expand All @@ -23,7 +23,7 @@ steps:
agents:
queue: "workers"
docker: "*"
command: "./gradlew test"
command: "./gradlew --no-daemon test"
plugins:
- docker-compose#v3.0.0:
run: unit-test-docker-sticky-off
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ target
.gradle
/build
/out
dummy
dummy
$buildDir
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "src/main/idls"]
path = src/main/idls
url = [email protected]:uber/cadence-idl.git
branch = master
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ before_install:
- wget https://www-us.apache.org/dist/thrift/0.9.3/thrift-0.9.3.tar.gz
- tar xfz thrift-0.9.3.tar.gz
- cd thrift-0.9.3
- ./configure --enable-libs=no --enable-tests=no --enable-tutorial=no --with-cpp=no --with-c_glib=no --with-java=yes --with-ruby=no --with-erlang=no --with-go=no --with-nodejs=no
- ./configure --enable-libs=no --enable-tests=no --enable-tutorial=no --with-cpp=no --with-c_glib=no --with-java=yes --with-ruby=no --with-erlang=no --with-go=no --with-nodejs=no --with-python=no
- make -j2 && sudo make install
- popd
151 changes: 79 additions & 72 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
buildscript {
dependencies {
classpath "gradle.plugin.org.jruyi.gradle:thrift-gradle-plugin:0.4.0"
classpath "gradle.plugin.org.jruyi.gradle:thrift-gradle-plugin:0.4.1"
}
}

plugins {
id 'net.minecrell.licenser' version '0.3'
id "com.github.sherter.google-java-format" version "0.6"
id "net.ltgt.errorprone" version "0.6"
id 'net.minecrell.licenser' version '0.4.1'
id 'com.github.sherter.google-java-format' version '0.8'
id 'net.ltgt.errorprone' version '1.1.1'
id 'java-library'
}

repositories {
maven {
url "https://plugins.gradle.org/m2/"
url 'https://plugins.gradle.org/m2/'
}
mavenCentral()
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: "org.jruyi.thrift"
apply plugin: 'org.jruyi.thrift'
apply plugin: 'maven-publish'
apply plugin: 'com.github.sherter.google-java-format'

if (hasProperty("signing.keyId")) {
if (hasProperty('signing.keyId')) {
apply plugin: 'signing'
signing {
sign configurations.archives
Expand All @@ -39,21 +39,26 @@ googleJavaFormat {
group = 'com.uber.cadence'
version = '2.6.3'

description = """Uber Cadence Java Client"""
description = '''Uber Cadence Java Client'''

sourceCompatibility = 1.8
targetCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

dependencies {
errorproneJavac("com.google.errorprone:javac:9+181-r4173-1")
errorprone("com.google.errorprone:error_prone_core:2.3.1")
errorproneJavac('com.google.errorprone:javac:9+181-r4173-1')
errorprone('com.google.errorprone:error_prone_core:2.3.3')

compile group: 'com.uber.tchannel', name: 'tchannel-core', version: '0.8.5'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
compile group: 'org.apache.thrift', name: 'libthrift', version: '0.9.3'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.5'
compile group: 'com.uber.m3', name: 'tally-core', version: '0.2.3'
compile group: 'com.google.guava', name: 'guava', version: '27.0.1-jre'
compile group: 'com.cronutils', name: 'cron-utils', version: '8.0.0'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
compile group: 'com.uber.m3', name: 'tally-core', version: '0.4.0'
compile group: 'com.google.guava', name: 'guava', version: '28.1-jre'
compile group: 'com.cronutils', name: 'cron-utils', version: '9.0.0'
compile group: 'io.micrometer', name: 'micrometer-core', version: '1.1.2'

testCompile group: 'junit', name: 'junit', version: '4.12'
testCompile group: 'com.googlecode.junit-toolbox', name: 'junit-toolbox', version: '2.4'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3'
Expand All @@ -64,21 +69,33 @@ license {
exclude 'com/uber/cadence/*.java' // generated code
}

compileThrift {
sourceItems "src/main/idls/thrift/cadence.thrift","src/main/idls/thrift/shared.thrift"

nowarn true
}

compileJava {
dependsOn 'googleJavaFormat'
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Werror"
options.errorprone.errorproneArgs << "-XepExcludedPaths:.*/generated-sources/.*"
options.compilerArgs << '-Xlint:none' << '-Xlint:deprecation' << '-Werror'
options.errorprone.excludedPaths = '.*/generated-sources/.*'
}

compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs << '-Xlint:none' << '-Xlint:deprecation' << '-Werror'
options.errorprone.excludedPaths = '.*/generated-sources/.*'
}

// Generation version.properties for value to be included into the request header
task createProperties(dependsOn: processResources) {
doLast {
def subdir = new File("$buildDir/resources/main/com/uber/cadence/")
def subdir = new File('$buildDir/resources/main/com/uber/cadence/')
if( !subdir.exists() ) {
subdir.mkdirs()
}
new File("$buildDir/resources/main/com/uber/cadence/version.properties").withWriter { w ->
new File('$buildDir/resources/main/com/uber/cadence/version.properties').withWriter { w ->
Properties p = new Properties()
p['cadence-client-version'] = project.version.toString()
p.store w, null
Expand All @@ -90,12 +107,6 @@ classes {
dependsOn createProperties
}

compileTestJava {
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" << "-Werror"
options.errorprone.errorproneArgs << "-XepExcludedPaths:.*/generated-sources/.*"
}

if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
Expand All @@ -109,60 +120,56 @@ javadoc {
}

task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives javadocJar, sourcesJar
}

def ossrhUsername = hasProperty('ossrhUsername') ? property('ossrhUsername') : ""
def ossrhPassword = hasProperty('ossrhPassword') ? property('ossrhPassword') : ""
def ossrhUsername = hasProperty('ossrhUsername') ? property('ossrhUsername') : ''
def ossrhPassword = hasProperty('ossrhPassword') ? property('ossrhPassword') : ''

publishing {
// Uncomment the following when we can use maven-publish to sign artifacts
// https://github.com/gradle/gradle/issues/4943

// mavenCustom(MavenPublication) {
// pom.withXml {
// asNode().with {
// appendNode('packaging', 'jar')
// appendNode('name', 'cadence-client')
// appendNode('description', description)
// appendNode('url', 'https://github.com/uber-java/cadence-client')
// appendNode('scm').with {
// appendNode('url', 'https://github.com/uber-java/cadence-client')
// appendNode('connection', '[email protected]:uber-java/cadence-client.git')
// }
// appendNode('licenses').with {
// appendNode('license').with {
// appendNode('name', 'The Apache License, Version 2.0')
// appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
// }
// }
// appendNode('developers').with {
// appendNode('maxim').with {
// appendNode('id', 'maxim')
// appendNode('name', 'Maxim Fateev')
// appendNode('email', '[email protected]')
// }
// appendNode('developer').with {
// appendNode('id', 'meiliang')
// appendNode('name', 'Liang Mei')
// appendNode('email', '[email protected]')
// }
// }
// }
// }
// }

publications {
maven(MavenPublication) {
pom.withXml {
asNode().with {
appendNode('packaging', 'jar')
appendNode('name', 'cadence-client')
appendNode('description', description)
appendNode('url', 'https://github.com/uber-java/cadence-client')
appendNode('scm').with {
appendNode('url', 'https://github.com/uber-java/cadence-client')
appendNode('connection', '[email protected]:uber-java/cadence-client.git')
}
appendNode('licenses').with {
appendNode('license').with {
appendNode('name', 'The Apache License, Version 2.0')
appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')
}
}
appendNode('developers').with {
appendNode('maxim').with {
appendNode('id', 'maxim')
appendNode('name', 'Maxim Fateev')
appendNode('email', '[email protected]')
}
appendNode('developer').with {
appendNode('id', 'meiliang')
appendNode('name', 'Liang Mei')
appendNode('email', '[email protected]')
}
}
}
}
}

mavenJava(MavenPublication) {
from components.java
artifact javadocJar
Expand All @@ -176,9 +183,9 @@ publishing {
password ossrhPassword
}
if(project.version.endsWith('-SNAPSHOT')) {
url "https://oss.sonatype.org/content/repositories/snapshots/"
url 'https://oss.sonatype.org/content/repositories/snapshots/'
} else {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
}
}
}
Expand All @@ -193,8 +200,8 @@ test {
dependsOn 'registerDomain'
dependsOn 'checkLicenseMain'
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
events 'passed', 'skipped', 'failed'
exceptionFormat 'full'
// Uncomment the following line if you want to see test logs in gradlew run.
showStandardStreams true
}
Expand All @@ -205,11 +212,11 @@ uploadArchives {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

Expand Down
12 changes: 9 additions & 3 deletions docker/buildkite/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
FROM openjdk:8
FROM openjdk:8-alpine

# Apache Thrift version
ENV APACHE_THRIFT_VERSION=0.9.3

RUN apt-get update && apt-get -y install build-essential && apt-get install -y wget
# Install dependencies using apk
RUN apk update && apk add --virtual wget ca-certificates wget && apk add --virtual build-dependencies build-base gcc

# Compile source
RUN set -ex ;\
wget http://www-us.apache.org/dist/thrift/${APACHE_THRIFT_VERSION}/thrift-${APACHE_THRIFT_VERSION}.tar.gz ;\
tar -xvf thrift-${APACHE_THRIFT_VERSION}.tar.gz ;\
rm thrift-${APACHE_THRIFT_VERSION}.tar.gz ;\
cd thrift-${APACHE_THRIFT_VERSION}/ ;\
./configure --without-python --without-cpp ;\
./configure --enable-libs=no --enable-tests=no --enable-tutorial=no --with-cpp=no --with-c_glib=no --with-java=yes --with-ruby=no --with-erlang=no --with-go=no --with-nodejs=no --with-python=no ;\
make -j2 && make install ;\
cd .. && rm -rf thrift-${APACHE_THRIFT_VERSION}

# Cleanup packages and remove cache
RUN apk del build-dependencies wget && rm -rf /var/cache/apk/*

RUN mkdir /cadence-java-client
WORKDIR /cadence-java-client
14 changes: 12 additions & 2 deletions docker/buildkite/Dockerfile-local
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
FROM openjdk:8
FROM openjdk:8-alpine

COPY --from=thrift:0.9.3 /usr/local/bin/thrift /usr/local/bin/thrift
# Apache Thrift version
ENV APACHE_THRIFT_VERSION=0.9.3

# Install dependencies using apk
RUN apk update && apk add --virtual build-dependencies build-base gcc

# Compile source
COPY --from=thrift:${APACHE_THRIFT_VERSION} /usr/local/bin/thrift /usr/local/bin/thrift

# Cleanup packages and remove cache
RUN apk del build-dependencies wget && rm -rf /var/cache/apk/*

RUN mkdir /cadence-java-client
WORKDIR /cadence-java-client
6 changes: 3 additions & 3 deletions docker/buildkite/docker-compose-local.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ services:
build:
context: ../../
dockerfile: ./docker/buildkite/Dockerfile-local
command: "./gradlew test"
command: "./gradlew --no-daemon test"
environment:
- "USER=unittest"
- "CADENCE_SEEDS=cadence"
Expand All @@ -63,7 +63,7 @@ services:
build:
context: ../../
dockerfile: ./docker/buildkite/Dockerfile-local
command: "./gradlew test"
command: "./gradlew --no-daemon test"
environment:
- "USER=unittest"
- "CADENCE_SEEDS=cadence"
Expand All @@ -82,7 +82,7 @@ services:
build:
context: ../../
dockerfile: ./docker/buildkite/Dockerfile-local
command: "./gradlew test"
command: "./gradlew --no-daemon test"
environment:
- "USER=unittest"
- "USE_DOCKER_SERVICE=false"
Expand Down
Loading