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

fat jar enforcer #2361

Merged
merged 1 commit into from
May 10, 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
32 changes: 0 additions & 32 deletions common-gradle-scripts/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
// apply plugin: 'com.github.spotbugs'
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'maven-publish'
java.sourceCompatibility = JavaVersion.VERSION_11

repositories {
Expand All @@ -31,34 +30,3 @@ repositories {
}
}

jar {
into("META-INF/maven/$project.group/$project.name") {
from { generatePomFileForMavenPublication }
rename ".*", "pom.xml"
}
}

publishing {
publications {
maven(MavenPublication) {
from components.java
}
}

repositories {
maven {
name 'nexus'
// TODO: define public nexus repositories
url = "https://maven.wso2.org/nexus/service/local/staging/deploy/maven2/"
credentials {
username rootProject.hasProperty("nexus_username") ? nexus_username : System.getenv("NEXUS_USERNAME")
password rootProject.hasProperty("nexus_password") ? nexus_password : System.getenv("NEXUS_PASSWORD")
}
allowInsecureProtocol = false
}
}
}

tasks.named('build').configure {
finalizedBy publishToMavenLocal
}
5 changes: 2 additions & 3 deletions gateway/enforcer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ARG APK_USER_GROUP_ID=10001
ARG APK_USER_HOME=/home/${APK_USER}
ARG GRPC_HEALTH_PROBE_PATH=/bin/grpc_health_probe
ARG TARGETARCH
ARG APK_VERSION=1.0-SNAPSHOT
ARG APK_VERSION=1.1.0-SNAPSHOT

ENV VERSION=${APK_VERSION}
ENV JAVA_OPTS=""
Expand Down Expand Up @@ -127,5 +127,4 @@ COPY resources/check_health.sh .
#todo add applicationinsights.json file and point it to the appInsightsAgent jar
#Add the agent using JVM arg -javaagent:/home/wso2/conf/applicationinsights-agent-3.1.1.jar
#Add the config file using System property -Dapplicationinsights.configuration.file=/home/wso2/conf/applicationinsights.json

CMD java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="${ENFORCER_HOME}/logs/heap-dump.hprof" $JAVA_OPTS -Dlog4j.configurationFile="${ENFORCER_HOME}/conf/log4j2.properties" -DtracingEnabled="true" -cp "lib/*:lib/dropins/*" org.wso2.apk.enforcer.server.AuthServer
CMD java -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath="${ENFORCER_HOME}/logs/heap-dump.hprof" $JAVA_OPTS -Dlog4j.configurationFile="${ENFORCER_HOME}/conf/log4j2.properties" -DtracingEnabled="true" -jar lib/enforcer-${VERSION}.jar
3 changes: 1 addition & 2 deletions gateway/enforcer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ release {
}

task build{
dependsOn("resources:build")
dependsOn("org.wso2.apk.enforcer:build_enforcer")
finalizedBy docker_build
}

Expand All @@ -45,7 +45,6 @@ allprojects {

subprojects {
apply from: "$rootDir/../../common-gradle-scripts/java.gradle"
afterReleaseBuild.dependsOn publish
}

tasks.named("afterReleaseBuild").configure {
Expand Down
22 changes: 22 additions & 0 deletions gateway/enforcer/org.wso2.apk.enforcer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
*
*/

plugins {
id 'com.github.johnrengelman.shadow' version '7.1.0'
}

description = 'WSO2 APK Enforcer'

sourceSets {
Expand Down Expand Up @@ -95,3 +99,21 @@ dependencies {
implementation libs.mockito.inline
}
}
shadowJar {
baseName = 'enforcer'
version = project.version
classifier = ''

manifest {
attributes 'Main-Class': 'org.wso2.apk.enforcer.server.AuthServer'
}
mergeServiceFiles()
}
tasks.register("copyJar", Copy) {
from shadowJar.archivePath
into "../resources/lib"
}
tasks.register("build_enforcer"){
dependsOn("shadowJar")
finalizedBy("copyJar")
}
51 changes: 0 additions & 51 deletions gateway/enforcer/resources/build.gradle

This file was deleted.

1 change: 0 additions & 1 deletion gateway/enforcer/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
rootProject.name = 'enforcer-parent'
include(':org.wso2.apk.enforcer')
include(':org.wso2.apk.enforcer.commons')
include(':resources')
include(':org.wso2.apk.enforcer.analytics.publishers')

dependencyResolutionManagement {
Expand Down
Loading