Skip to content

Commit

Permalink
Use only pluginZip publication of Apache Maven artifacts (opensearch-…
Browse files Browse the repository at this point in the history
…project#226)

* Use only pluginZip publication of Apache Maven artifacts

Signed-off-by: Andriy Redko <[email protected]>

* Address code review comments

Signed-off-by: Andriy Redko <[email protected]>

* Address code review comments

Signed-off-by: Andriy Redko <[email protected]>

---------

Signed-off-by: Andriy Redko <[email protected]>
  • Loading branch information
reta authored and dbwiddis committed Dec 11, 2023
1 parent 466c5bf commit 00b94ed
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ buildscript {
}
}

allprojects {
// Default to the apache license
project.ext.licenseName = 'The Apache Software License, Version 2.0'
project.ext.licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}

publishing {
publications {
Expand All @@ -86,23 +91,28 @@ publishing {
name = pluginName
description = pluginDescription
groupId = "org.opensearch.plugin"
licenses {
license {
name = "The Apache License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
name = "OpenSearch Flow Framework Plugin"
url = "https://github.com/opensearch-project/flow-framework"
}

withXml { XmlProvider xml ->
Node node = xml.asNode()
node.appendNode('inceptionYear', '2021')

Node license = node.appendNode('licenses').appendNode('license')
license.appendNode('name', project.licenseName)
license.appendNode('url', project.licenseUrl)

Node developer = node.appendNode('developers').appendNode('developer')
developer.appendNode('name', 'OpenSearch')
developer.appendNode('url', 'https://github.com/opensearch-project/flow-framework')
}
}
}
}

repositories {
maven {
name = 'staging'
url = "${rootProject.buildDir}/local-staging-repo"
}
maven {
name = "Snapshots"
url = "https://aws.oss.sonatype.org/content/repositories/snapshots"
Expand Down Expand Up @@ -261,3 +271,13 @@ diffCoverageReport {
failOnViolation = true
}
}


tasks.withType(AbstractPublishToMaven) {
def predicate = provider {
publication.name == "pluginZip"
}
onlyIf("Publishing only ZIP distributions") {
predicate.get()
}
}

0 comments on commit 00b94ed

Please sign in to comment.