Skip to content
Open
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
106 changes: 97 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ props.load(new FileInputStream("$projectDir/all-modules.properties"))
project.ext.allModuleNames = props['modules.common.all']
project.ext.modulesDistsDir = file("${project.buildDir}/modulesZip")

// Jenkins sets BUILD_NUMBER incrementally. It can be overridden in the command line
// (E.g.: ./gradlew -Pbuild_number=127 info). If not provided, it gets a default 'manual'
String buildNumber = project.hasProperty('build_number') ? build_number
: (System.env["BUILD_NUMBER"] ?: 'manual')

repositories {
mavenLocal()
if (project.hasProperty('additional_repositories')){
Expand Down Expand Up @@ -284,7 +289,7 @@ tasks.withType(JavaCompile) {
}
artifacts {
tasks.each{ task ->
if (task.name.startsWith("jar_com.alkacon.")){
if (task.name.startsWith("jar_org.opencms.")){
def moduleName=task.baseName
archives task
archives tasks["javadocJar_$moduleName"]
Expand All @@ -298,21 +303,21 @@ install {
mavenInstaller {
artifacts.each{ arch ->
def filterName=arch.name
if (filterName.startsWith("com.alkacon")){
if (filterName.startsWith("org.opencms") && filterName.endsWith(".jar")){
filterName=filterName.substring(0, filterName.lastIndexOf(".jar"))
addFilter(filterName){artifact, file ->
artifact.name.startsWith(filterName)
}
pom(filterName).project {
name 'Alkacon OAMP'
description 'Alkacon OAMP'
name "The OpenCms Apollo Template - $filterName"
description "The OpenCms Apollo Template - $filterName"
packaging 'jar'
groupId 'com.alkacon'
groupId 'org.opencms'
url 'http://www.alkacon.com'
scm {
url 'scm:[email protected]:alkacon/alkacon-oamp.git'
connection 'scm:[email protected]:alkacon/alkacon-oamp.git'
developerConnection 'scm:[email protected]:alkacon/alkacon-oamp.git'
url 'scm:[email protected]:alkacon/apollo-template.git'
connection 'scm:[email protected]:alkacon/apollo-template.git'
developerConnection 'scm:[email protected]:alkacon/apollo-template.git'
}
licenses {
license {
Expand All @@ -336,4 +341,87 @@ install {
}
}
}
}
}

// Configure zip artifacts for publishing
if (project.hasProperty('publish_repository')) {
// Add all distributables modules
artifacts {
tasks.findAll { task -> task.name.startsWith('dist_') }.each { distTask ->
archives distTask
}
}

uploadArchives {
repositories {
mavenDeployer {
repository(url: publish_repository) {
authentication(userName: publish_user, password: publish_password)
}
tasks.findAll { task -> task.name.startsWith('dist_') }.each { distTask ->
// E.g. distTask ":dist_org.opencms.apollo.template.core"
// distTask.baseName = "org.opencms.apollo.template.core"
String filterName = distTask.baseName
addFilter(filterName) { artifact, file ->
// E.g. artifact:
// artifact.name = "org.opencms.apollo.template.core"
// artifact.ext = "zip"
// artifact.type = "zip"
artifact.name == filterName
}
pom(filterName).project {
name "The OpenCms Apollo Template - $filterName"
version = "${distTask.version}.${buildNumber}"
description "The OpenCms Apollo Template - $filterName"
packaging 'zip'
groupId 'org.opencms'
url 'http://www.alkacon.com'
scm {
url 'scm:[email protected]:alkacon/apollo-template.git'
connection 'scm:[email protected]:alkacon/apollo-template.git'
developerConnection 'scm:[email protected]:alkacon/apollo-template.git'
}
licenses {
license {
name 'GNU General Public License'
url 'http://www.gnu.org/licenses/gpl.html'
distribution 'repo'
}
}
organization {
name 'Alkacon Software'
url 'http://www.alkacon.com'
}
developers {
developer {
name 'Alkacon Software'
url 'http://www.alkacon.com'
}
}
}
}
}
}
}
}

// Configure versioning for jar artifacts
tasks.findAll { task -> task.name.startsWith('jar_org.opencms.') }.each { jarTask ->
String filterName = jarTask.baseName
def uploaders = [install.repositories.mavenInstaller]
if (project.hasProperty('publish_repository')) {
uploaders << uploadArchives.repositories.mavenDeployer
}

uploaders*.pom(filterName)*.project {
version = "${jarTask.moduleVersion}.${buildNumber}"
}
}

tasks.withType(Javadoc) {
options.addStringOption("sourcepath", "")
if (JavaVersion.current().isJava8Compatible()) {
options.addStringOption("Xdoclint:none", "-quiet")
options.addBooleanOption("-allow-script-in-comments",true);
}
}