Skip to content

Commit

Permalink
Revert "fat jar enforcer"
Browse files Browse the repository at this point in the history
This reverts commit 0c88234.
  • Loading branch information
Amali Matharaarachchi authored Sep 9, 2024
1 parent f036712 commit 6c7c9fd
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 25 deletions.
32 changes: 32 additions & 0 deletions common-gradle-scripts/java.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
// apply plugin: 'com.github.spotbugs'
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'maven-publish'
java.sourceCompatibility = JavaVersion.VERSION_11

repositories {
Expand All @@ -30,3 +31,34 @@ 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: 3 additions & 2 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.1.0-SNAPSHOT
ARG APK_VERSION=1.0-SNAPSHOT

ENV VERSION=${APK_VERSION}
ENV JAVA_OPTS=""
Expand Down Expand Up @@ -127,4 +127,5 @@ 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" -jar lib/enforcer-${VERSION}.jar

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
3 changes: 2 additions & 1 deletion gateway/enforcer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ release {
}

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

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

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

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

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

description = 'WSO2 APK Enforcer'

sourceSets {
Expand Down Expand Up @@ -99,21 +95,3 @@ 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: 51 additions & 0 deletions gateway/enforcer/resources/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

description = 'WSO2 Enforcer Distribution Resources'

dependencies {
implementation project(':org.wso2.apk.enforcer')
implementation project(':org.wso2.apk.enforcer.commons')
}
tasks.register('copy_dependencies', Copy) {
dependsOn create_lib
from configurations.default
into "$projectDir/lib"
finalizedBy build
}

tasks.register('create_lib') {
dependsOn delete_lib
finalizedBy copy_dependencies
}

tasks.register('delete_lib', Delete) {
delete "$projectDir/lib"
finalizedBy create_lib
}

tasks.named('build').configure {
dependsOn copy_dependencies
}

configurations.implementation {
exclude group: 'jline'
exclude group: 'org.slf4j', module: 'slf4j-log4j12'
exclude group: 'org.apache.logging'
exclude group: 'log4j'
exclude group: 'org.ops4j.pax.logging'
}
1 change: 1 addition & 0 deletions gateway/enforcer/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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

0 comments on commit 6c7c9fd

Please sign in to comment.