Skip to content

Commit

Permalink
Merge pull request #30 from RADAR-base/release-0.1.2
Browse files Browse the repository at this point in the history
Release 0.1.2
  • Loading branch information
yatharthranjan authored Jun 24, 2021
2 parents e9b1a1a + 8475338 commit ddcd2cf
Show file tree
Hide file tree
Showing 90 changed files with 435 additions and 1,511 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
KAFKA_CONFLUENT_VERSION=5.5.2
KAFKA_CONFLUENT_VERSION=6.1.0
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ target/
.gradletasknamecache

# Build
/build/
*.war

**/build
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gradle:6.6.1-jdk11 as builder
FROM gradle:7.0.2-jdk11 as builder

RUN mkdir /code
WORKDIR /code

ENV GRADLE_USER_HOME=/code/.gradlecache

COPY ./build.gradle.kts ./gradle.properties ./settings.gradle.kts /code/
COPY ./gradle/dependency-locks/ /code/gradle/dependency-locks/
COPY ./deprecated-javax/build.gradle.kts /code/deprecated-javax/

RUN gradle downloadDockerDependencies
RUN gradle downloadDockerDependencies --no-watch-fs

COPY ./src/ /code/src

RUN gradle distTar \
RUN gradle distTar --no-watch-fs \
&& cd build/distributions \
&& tar xzf *.tar.gz \
&& rm *.tar.gz radar-push-endpoint-*/lib/radar-push-endpoint-*.jar
Expand Down
137 changes: 83 additions & 54 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
import java.time.Duration
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.kotlin.cli.common.toBooleanLenient
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.Duration

plugins {
id("idea")
id("application")
kotlin("jvm")
id("org.unbroken-dome.test-sets") version "3.0.1"
id("com.avast.gradle.docker-compose") version "0.13.4"
id("com.avast.gradle.docker-compose") version "0.14.3"
id("com.github.ben-manes.versions") version "0.39.0"
}

group = "org.radarbase"
version = "0.1.0"
description = "RADAR Push API Gateway to handle secured data flow to backend."

dependencyLocking {
lockAllConfigurations()
allprojects {
group = "org.radarbase"
version = "0.2.0"

repositories {
mavenCentral()
}
}

repositories {
jcenter()
mavenCentral()
// Non-jcenter radar releases
maven(url = "https://dl.bintray.com/radar-cns/org.radarcns")
maven(url = "https://dl.bintray.com/radar-base/org.radarbase")
// For working with dev-branches
maven(url = "https://repo.thehyve.nl/content/repositories/snapshots")
maven(url = "https://oss.jfrog.org/artifactory/libs-snapshot/")
maven(url = "https://packages.confluent.io/maven/")
val integrationTestSourceSet = sourceSets.create("integrationTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}

val integrationTest = testSets.create("integrationTest")
val integrationTestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.testImplementation.get())
}

configurations["integrationTestRuntimeOnly"].extendsFrom(configurations.testRuntimeOnly.get())

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))

val radarCommonsVersion: String by project
implementation("org.radarbase:radar-commons:$radarCommonsVersion")
implementation("org.radarbase:radar-jersey:${project.property("radarJerseyVersion")}")
implementation("org.radarbase:lzfse-decode:${project.property("lzfseVersion")}")
val radarJerseyVersion: String by project
implementation("org.radarbase:radar-jersey:$radarJerseyVersion")

implementation("org.apache.kafka:kafka-clients:${project.property("kafkaVersion")}")
implementation("io.confluent:kafka-avro-serializer:${project.property("confluentVersion")}")
implementation(project(path = ":deprecated-javax", configuration = "shadow"))

implementation("org.radarcns:oauth-client-util:${project.property("radarOauthClientVersion")}")
implementation("org.radarbase:oauth-client-util:${project.property("radarOauthClientVersion")}")

implementation("org.slf4j:slf4j-api:${project.property("slf4jVersion")}")

Expand All @@ -58,37 +58,47 @@ dependencies {
runtimeOnly("org.glassfish.grizzly:grizzly-framework-monitoring:$grizzlyVersion")
runtimeOnly("org.glassfish.grizzly:grizzly-http-monitoring:$grizzlyVersion")
runtimeOnly("org.glassfish.grizzly:grizzly-http-server-monitoring:$grizzlyVersion")
runtimeOnly("ch.qos.logback:logback-classic:${project.property("logbackVersion")}")

val log4j2Version: String by project
runtimeOnly("org.apache.logging.log4j:log4j-slf4j-impl:$log4j2Version")
runtimeOnly("org.apache.logging.log4j:log4j-api:$log4j2Version")
runtimeOnly("org.apache.logging.log4j:log4j-jul:$log4j2Version")

val jedisVersion: String by project
implementation("redis.clients:jedis:$jedisVersion")

val junitVersion: String by project
val okhttp3Version: String by project
val radarSchemasVersion: String by project
implementation("org.radarcns:radar-schemas-commons:$radarSchemasVersion")
implementation("org.radarbase:radar-schemas-commons:$radarSchemasVersion")

testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:[2.2,3.0)")
testImplementation("com.squareup.okhttp3:mockwebserver:$okhttp3Version")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")

testImplementation("org.radarcns:radar-schemas-commons:$radarSchemasVersion")
integrationTest.implementationConfigurationName("com.squareup.okhttp3:okhttp:$okhttp3Version")
integrationTest.implementationConfigurationName("org.radarcns:radar-schemas-commons:$radarSchemasVersion")
integrationTest.implementationConfigurationName("org.radarbase:radar-commons-testing:$radarCommonsVersion")
testImplementation("org.radarbase:radar-schemas-commons:$radarSchemasVersion")
integrationTestImplementation("com.squareup.okhttp3:okhttp:$okhttp3Version")
integrationTestImplementation("org.radarbase:radar-schemas-commons:$radarSchemasVersion")
integrationTestImplementation("org.radarbase:radar-commons-testing:$radarCommonsVersion")
}

val kotlinApiVersion: String by project

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "11"
apiVersion = "1.4"
languageVersion = "1.4"
apiVersion = "1.5"
languageVersion = "1.5"
}
}

val integrationTest by tasks.registering(Test::class) {
description = "Runs integration tests."
group = "verification"
testClassesDirs = integrationTestSourceSet.output.classesDirs
classpath = integrationTestSourceSet.runtimeClasspath
shouldRunAfter("test")
}

tasks.withType<Test> {
testLogging {
showStandardStreams = true
Expand All @@ -103,25 +113,30 @@ tasks.withType<Tar> {
}

application {
mainClassName = "org.radarbase.gateway.MainKt"
mainClass.set("org.radarbase.gateway.MainKt")

applicationDefaultJvmArgs = listOf(
"-Dcom.sun.management.jmxremote",
"-Dcom.sun.management.jmxremote.local.only=false",
"-Dcom.sun.management.jmxremote.port=9010",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.ssl=false"
"-Dcom.sun.management.jmxremote",
"-Dcom.sun.management.jmxremote.local.only=false",
"-Dcom.sun.management.jmxremote.port=9010",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.ssl=false"
)
}

dockerCompose {
useComposeFiles = listOf("src/integrationTest/docker/docker-compose.yml")
val dockerComposeBuild: String? by project
val doBuild = dockerComposeBuild?.toBooleanLenient() ?: true
buildBeforeUp = doBuild
buildBeforePull = doBuild
buildAdditionalArgs = emptyList<String>()
val dockerComposeStopContainers: String? by project
stopContainers = dockerComposeStopContainers?.toBooleanLenient() ?: true
waitForTcpPortsTimeout = Duration.ofMinutes(3)
environment["SERVICES_HOST"] = "localhost"
isRequiredBy(tasks["integrationTest"])
captureContainersOutputToFiles = project.file("build/container-logs")
isRequiredBy(integrationTest)
}

idea {
Expand All @@ -130,19 +145,19 @@ idea {
}
}


tasks.register("downloadDockerDependencies") {
doFirst {
configurations["compileClasspath"].files
configurations["runtimeClasspath"].files
println("Downloaded all dependencies")
allprojects {
tasks.register("downloadDockerDependencies") {
doFirst {
configurations["compileClasspath"].files
configurations["runtimeClasspath"].files
println("Downloaded all dependencies")
}
outputs.upToDateWhen { false }
}
outputs.upToDateWhen { false }
}

tasks.register("downloadDependencies") {
doFirst {
configurations.asMap
tasks.register("downloadDependencies") {
doFirst {
configurations.asMap
.filterValues { it.isCanBeResolved }
.forEach { (name, config) ->
try {
Expand All @@ -151,11 +166,25 @@ tasks.register("downloadDependencies") {
project.logger.warn("Cannot find dependency for configuration {}", name, ex)
}
}
println("Downloaded all dependencies")
println("Downloaded all dependencies")
}
outputs.upToDateWhen { false }
}
}

fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}

tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version)
}
outputs.upToDateWhen { false }
}

tasks.wrapper {
gradleVersion = "6.6.1"
gradleVersion = "7.1"
}
38 changes: 38 additions & 0 deletions deprecated-javax/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

plugins {
id("com.github.johnrengelman.shadow") version "7.0.0"
java
}

repositories {
maven(url = "https://packages.confluent.io/maven/")
}

dependencies {
val kafkaVersion: String by project
implementation("org.apache.kafka:kafka-clients:$kafkaVersion") {
isTransitive = true
exclude(group = "org.slf4j", module = "slf4j-api")
}
val confluentVersion: String by project
implementation("io.confluent:kafka-avro-serializer:$confluentVersion") {
isTransitive = false
}
implementation("io.confluent:kafka-schema-serializer:$confluentVersion") {
isTransitive = false
}
implementation("io.confluent:kafka-schema-registry-client:$confluentVersion") {
isTransitive = false
}
implementation("org.glassfish.jersey.core:jersey-common:2.31")
implementation("io.swagger:swagger-annotations:1.6.2")
implementation("io.confluent:common-utils:$confluentVersion") {
isTransitive = false
}
}

tasks.shadowJar {
configurations = listOf(project.configurations.compileClasspath.get())
relocate("javax.ws.rs", "shadow.javax.ws.rs")
relocate("org.glassfish", "shadow.org.glassfish")
}
27 changes: 0 additions & 27 deletions gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,6 @@ kafka:
serialization:
schema.registry.url: http://schema-registry-1:8081

# Authorization settings
auth:
# ManagementPortal URL. If available, this is used to read the public key from
# ManagementPortal directly. This is the recommended method of getting public key.
managementPortalUrl: http://managementportal-app:8080
# Whether to check that the user that submits data has the reported source ID registered
# in the ManagementPortal.
#checkSourceId: true
# OAuth 2.0 resource name.
#resourceName: res_gateway
# OAuth 2.0 token issuer. If null, this is not checked.
#issuer: null
# Key store for checking the digital signature of OAuth 2.0 JWTs.
#keyStore:
# Path to the p12 key store.
#path: null
# Alias in the key store to use
#alias: null
# Password of the key store
#password: null
# Plain-text PEM public keys
#publicKeys:
# ECDSA public keys
#ecdsa: []
# RSA public keys
#rsa: []

# Push Service specific configuration
pushIntegration:
garmin:
Expand Down
29 changes: 14 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
org.gradle.jvmargs=-Xmx3072m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
dockerComposeStopContainers=true

kotlinVersion=1.4.10
okhttp3Version=4.9.+
radarJerseyVersion=0.4.3
radarCommonsVersion=0.13.+
radarSchemasVersion=0.5.15
radarOauthClientVersion=0.5.8
jacksonVersion=2.11.+
slf4jVersion=1.7.+
logbackVersion=1.2.+
grizzlyVersion=2.4.+
lzfseVersion=0.1.+
kafkaVersion=2.5.+
confluentVersion=5.5.+
junitVersion=5.+
jedisVersion=3.3.+
kotlinVersion=1.5.20
okhttp3Version=4.9.1
radarJerseyVersion=0.6.2
radarCommonsVersion=0.13.2
radarSchemasVersion=0.6.0
radarOauthClientVersion=0.7.1
jacksonVersion=2.12.3
slf4jVersion=1.7.31
log4j2Version=2.14.1
kafkaVersion=2.8.0
confluentVersion=6.2.0
junitVersion=5.7.2
jedisVersion=3.6.1
grizzlyVersion=3.0.0
3 changes: 0 additions & 3 deletions gradle/dependency-locks/annotationProcessor.lockfile

This file was deleted.

3 changes: 0 additions & 3 deletions gradle/dependency-locks/apiDependenciesMetadata.lockfile

This file was deleted.

Loading

0 comments on commit ddcd2cf

Please sign in to comment.