Skip to content

Commit 3c89602

Browse files
Converts maven publication to shadow publication for all subprojects
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
1 parent c45ce27 commit 3c89602

File tree

5 files changed

+26
-54
lines changed

5 files changed

+26
-54
lines changed

.github/workflows/maven-publish.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,4 @@ jobs:
3232
export SONATYPE_PASSWORD=$(aws secretsmanager get-secret-value --secret-id maven-snapshots-password --query SecretString --output text)
3333
echo "::add-mask::$SONATYPE_USERNAME"
3434
echo "::add-mask::$SONATYPE_PASSWORD"
35-
./gradlew --no-daemon :opensearch-resource-sharing-spi:publishMavenJavaPublicationToSnapshotsRepository
36-
./gradlew --no-daemon :opensearch-security-common:publishMavenJavaPublicationToSnapshotsRepository
37-
./gradlew --no-daemon :opensearch-security-client:publishMavenJavaPublicationToSnapshotsRepository
38-
./gradlew --no-daemon publishPluginZipPublicationToSnapshotsRepository
35+
./gradlew --no-daemon publishPluginZipPublicationToSnapshotsRepository publishShadowPublicationToSnapshotsRepository

build.gradle

+10-13
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,6 @@ def splitTestConfig = [
235235
]
236236
]
237237
],
238-
resourceSharingTests: [
239-
description: "Runs most of the SSL tests.",
240-
filters: [
241-
includeTestsMatching: [
242-
"org.opensearch.security.resources.*"
243-
],
244-
excludeTestsMatching: [
245-
"org.opensearch.security.ssl.OpenSSL*"
246-
]
247-
]
248-
],
249238
] as ConfigObject
250239

251240
List<String> taskNames = splitTestConfig.keySet() as List
@@ -527,8 +516,17 @@ configurations {
527516
allprojects {
528517
configurations {
529518
integrationTestImplementation.extendsFrom implementation
519+
compile.extendsFrom compileOnly
520+
compile.extendsFrom testImplementation
530521
}
531522
dependencies {
523+
compileOnly "com.google.guava:guava:${guava_version}"
524+
// unit test framework
525+
testImplementation 'org.hamcrest:hamcrest:2.2'
526+
testImplementation 'junit:junit:4.13.2'
527+
testImplementation "org.opensearch:opensearch:${opensearch_version}"
528+
testImplementation "org.mockito:mockito-core:5.15.2"
529+
532530
//integration test framework:
533531
integrationTestImplementation('com.carrotsearch.randomizedtesting:randomizedtesting-runner:2.8.2') {
534532
exclude(group: 'junit', module: 'junit')
@@ -648,8 +646,7 @@ tasks.integrationTest.finalizedBy(jacocoTestReport) // report is always generate
648646
check.dependsOn integrationTest
649647

650648
dependencies {
651-
implementation project(path: ":opensearch-resource-sharing-spi")
652-
implementation project(path: ":opensearch-security-common")
649+
implementation project(path: ":${rootProject.name}-common", configuration: 'shadow')
653650
implementation "org.opensearch.plugin:transport-netty4-client:${opensearch_version}"
654651
implementation "org.opensearch.client:opensearch-rest-high-level-client:${opensearch_version}"
655652
implementation "org.apache.httpcomponents.client5:httpclient5-cache:${versions.httpclient5}"

client/build.gradle

+6-7
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
plugins {
77
id 'java'
88
id 'maven-publish'
9+
id 'io.github.goooler.shadow' version "8.1.7"
910
}
1011

1112
ext {
@@ -17,8 +18,6 @@ ext {
1718
version_tokens = opensearch_version.tokenize('-')
1819
opensearch_build = version_tokens[0] + '.0'
1920

20-
common_utils_version = System.getProperty("common_utils.version", '3.0.0.0-alpha1-SNAPSHOT')
21-
2221
if (buildVersionQualifier) {
2322
opensearch_build += "-${buildVersionQualifier}"
2423
}
@@ -34,10 +33,9 @@ repositories {
3433
}
3534

3635
dependencies {
37-
// Main implementation dependencies
3836
compileOnly "org.opensearch:opensearch:${opensearch_version}"
39-
implementation "org.opensearch:opensearch-security-common:${opensearch_build}"
40-
implementation "org.opensearch:opensearch-resource-sharing-spi:${opensearch_build}"
37+
// spi dependency comes through common
38+
implementation project(path: ":${rootProject.name}-common", configuration: 'shadow')
4139
}
4240

4341
java {
@@ -57,12 +55,13 @@ task javadocJar(type: Jar) {
5755

5856
publishing {
5957
publications {
60-
mavenJava(MavenPublication) {
61-
from components.java
58+
shadow(MavenPublication) { publication ->
59+
project.shadow.component(publication)
6260
artifact sourcesJar
6361
artifact javadocJar
6462
pom {
6563
name.set("OpenSearch Security Client")
64+
packaging = "jar"
6665
description.set("OpenSearch Security Client")
6766
url.set("https://github.com/opensearch-project/security")
6867
licenses {

common/build.gradle

+5-28
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,11 @@
66
plugins {
77
id 'java'
88
id 'maven-publish'
9+
id 'io.github.goooler.shadow' version "8.1.7"
910
}
1011

1112
ext {
1213
opensearch_version = System.getProperty("opensearch.version", "3.0.0-alpha1-SNAPSHOT")
13-
isSnapshot = "true" == System.getProperty("build.snapshot", "true")
14-
buildVersionQualifier = System.getProperty("build.version_qualifier", "alpha1")
15-
16-
// 2.0.0-rc1-SNAPSHOT -> 2.0.0.0-rc1-SNAPSHOT
17-
version_tokens = opensearch_version.tokenize('-')
18-
opensearch_build = version_tokens[0] + '.0'
19-
20-
common_utils_version = System.getProperty("common_utils.version", '3.0.0.0-alpha1-SNAPSHOT')
21-
22-
kafka_version = '3.7.1'
23-
open_saml_version = '5.1.3'
24-
open_saml_shib_version = "9.1.3"
25-
one_login_java_saml = '2.9.0'
26-
jjwt_version = '0.12.6'
27-
guava_version = '33.4.0-jre'
28-
jaxb_version = '2.3.9'
29-
spring_version = '5.3.39'
30-
31-
if (buildVersionQualifier) {
32-
opensearch_build += "-${buildVersionQualifier}"
33-
}
34-
if (isSnapshot) {
35-
opensearch_build += "-SNAPSHOT"
36-
}
3714
}
3815

3916
repositories {
@@ -45,8 +22,7 @@ repositories {
4522
dependencies {
4623
compileOnly "com.fasterxml.jackson.core:jackson-databind:${versions.jackson_databind}"
4724
compileOnly "org.opensearch.plugin:lang-painless:${opensearch_version}"
48-
implementation "org.opensearch:opensearch-resource-sharing-spi:${opensearch_build}"
49-
compileOnly "com.google.guava:guava:${guava_version}"
25+
implementation project(path: ":opensearch-resource-sharing-spi", configuration: 'shadow')
5026
compileOnly "org.apache.commons:commons-lang3:${versions.commonslang}"
5127
compileOnly 'com.password4j:password4j:1.8.2'
5228
}
@@ -68,12 +44,13 @@ task javadocJar(type: Jar) {
6844

6945
publishing {
7046
publications {
71-
mavenJava(MavenPublication) {
72-
from components.java
47+
shadow(MavenPublication) { publication ->
48+
project.shadow.component(publication)
7349
artifact sourcesJar
7450
artifact javadocJar
7551
pom {
7652
name.set("OpenSearch Security Common")
53+
packaging = "jar"
7754
description.set("OpenSearch Security Common")
7855
url.set("https://github.com/opensearch-project/security")
7956
licenses {

spi/build.gradle

+4-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
plugins {
77
id 'java'
88
id 'maven-publish'
9+
id 'io.github.goooler.shadow' version "8.1.7"
910
}
1011

1112
ext {
@@ -39,12 +40,13 @@ task javadocJar(type: Jar) {
3940

4041
publishing {
4142
publications {
42-
mavenJava(MavenPublication) {
43-
from components.java
43+
shadow(MavenPublication) { publication ->
44+
project.shadow.component(publication)
4445
artifact sourcesJar
4546
artifact javadocJar
4647
pom {
4748
name.set("OpenSearch Resource Sharing SPI")
49+
packaging = "jar"
4850
description.set("OpenSearch Security Resource Sharing")
4951
url.set("https://github.com/opensearch-project/security")
5052
licenses {

0 commit comments

Comments
 (0)