Skip to content

Commit

Permalink
Merge pull request #9 from Cognifide/feature/configure-release-plugin
Browse files Browse the repository at this point in the history
Configured release plugin.
  • Loading branch information
mjedraszczyk authored Oct 9, 2019
2 parents da84be7 + fedff0d commit beeed44
Show file tree
Hide file tree
Showing 3 changed files with 167 additions and 34 deletions.
51 changes: 20 additions & 31 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,42 +1,31 @@
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import pl.allegro.tech.build.axion.release.domain.TagNameSerializationConfig

description = "AEM Permisson Matrix Tester"

plugins {
id("pl.allegro.tech.build.axion-release") version "1.10.2"
kotlin("jvm") version "1.3.31" apply false
`maven-publish`
signing
}

description = "AEM Permisson Matrix Tester"

subprojects {
repositories {
mavenCentral()
}

plugins.withId("kotlin") {
tasks.named<Test>("test") {
useJUnitPlatform()
testLogging {
events = setOf(
TestLogEvent.STANDARD_OUT,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
)
}
}
scmVersion {
useHighestVersion = true
ignoreUncommittedChanges = false
tag(closureOf<TagNameSerializationConfig> {
prefix = "apmt"
})
}

tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
project.version = scmVersion.version

dependencies {
"implementation"(kotlin("stdlib-jdk8"))
"implementation"("org.junit.jupiter:junit-jupiter-api:5.5.1")
"implementation"("org.junit.jupiter:junit-jupiter-params:5.5.1")
"testRuntime"("org.junit.jupiter:junit-jupiter-engine:5.5.1")
allprojects {
group = "com.cognifide.apmt"

"implementation"("org.apache.commons:commons-lang3:3.8.1")
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
}

apply(from = "gradle/common.gradle.kts")
31 changes: 28 additions & 3 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
plugins {
kotlin("jvm")
`maven-publish`
signing
}

dependencies {
Expand All @@ -8,7 +10,30 @@ dependencies {
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.8")
implementation("com.fasterxml.jackson.core:jackson-databind:2.9.8")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8")
implementation("com.github.tomakehurst:wiremock-jre8:2.23.2")
implementation("org.junit.jupiter:junit-jupiter-api:5.5.1")
implementation("org.junit.jupiter:junit-jupiter-params:5.5.1")
implementation("org.apache.commons:commons-lang3:3.8.1")
testImplementation("com.github.tomakehurst:wiremock-jre8:2.23.2")
}

tasks.register<Jar>("sourcesJar") {
from(sourceSets.main.get().allJava)
archiveClassifier.set("sources")
}

tasks.register<Jar>("javadocJar") {
from(tasks.javadoc)
archiveClassifier.set("javadoc")
}

publishing {
publications {
create<MavenPublication>("apmt") {
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
afterEvaluate {
artifactId = "apmt"
version = rootProject.version
}
}
}
}
119 changes: 119 additions & 0 deletions gradle/common.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
/*
* ========================LICENSE_START=================================
* AEM Permission Management
* %%
* Copyright (C) 2013 Cognifide Limited
* %%
* 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.
* =========================LICENSE_END==================================
*/

import org.gradle.api.tasks.testing.logging.TestLogEvent

allprojects {
repositories {
mavenLocal()
jcenter()
}

plugins.withId("kotlin") {
tasks.withType<Test>().configureEach {
failFast = true
useJUnitPlatform()
testLogging {
events = setOf(
TestLogEvent.STANDARD_OUT,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED
)
}
}

dependencies {
"implementation"(kotlin("stdlib-jdk8"))
"implementation"("org.junit.jupiter:junit-jupiter-api:5.5.1")
"implementation"("org.junit.jupiter:junit-jupiter-params:5.5.1")
"testRuntime"("org.junit.jupiter:junit-jupiter-engine:5.5.1")
}
}

afterEvaluate {
val apmtRepositoryUsername: String? by extra
val apmtRepositoryPassword: String? by extra
extensions.findByType(PublishingExtension::class)?.apply {
publications?.findByName("apmt")?.apply {
if (this is MavenPublication) {
pom {
name.set("APMT")
description.set("AEM Permission Matrix Tester")
url.set("https://github.com/Cognifide/apmt")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
name.set("Marcin Jędraszczyk")
email.set("marcin.jedraszczyk@cognifide.com")
organization.set("Cognifide")
organizationUrl.set("https://www.cognifide.com")
}
developer {
name.set("Michał Krzyżanowski")
email.set("michal.krzyzanowski@cognifide.com")
organization.set("Cognifide")
organizationUrl.set("https://www.cognifide.com")
}
developer {
name.set("Bartosz Zbytniewski")
email.set("bartosz.zbytniewski@cognifide.com")
organization.set("Cognifide")
organizationUrl.set("https://www.cognifide.com")
}
}
scm {
connection.set("https://github.com/Cognifide/apmt.git")
developerConnection.set("https://github.com/Cognifide/apmt.git")
url.set("https://github.com/Cognifide/apmt")
}
}
}
}
repositories {
maven {
name = "OSSSonatypeOrg"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = apmtRepositoryUsername
password = apmtRepositoryPassword
}
authentication {
create<BasicAuthentication>("basic")
}
}
}
}

extensions.findByType(SigningExtension::class)?.apply {
useGpgCmd()
val publication = extensions.findByType(PublishingExtension::class)?.publications?.findByName("apmt")
if (publication != null) {
sign(publication)
}
}
}
}

0 comments on commit beeed44

Please sign in to comment.