Skip to content

Commit beeed44

Browse files
authored
Merge pull request #9 from Cognifide/feature/configure-release-plugin
Configured release plugin.
2 parents da84be7 + fedff0d commit beeed44

3 files changed

Lines changed: 167 additions & 34 deletions

File tree

build.gradle.kts

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,31 @@
1-
import org.gradle.api.tasks.testing.logging.TestLogEvent
21
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
import pl.allegro.tech.build.axion.release.domain.TagNameSerializationConfig
3+
4+
description = "AEM Permisson Matrix Tester"
35

46
plugins {
7+
id("pl.allegro.tech.build.axion-release") version "1.10.2"
58
kotlin("jvm") version "1.3.31" apply false
9+
`maven-publish`
10+
signing
611
}
712

8-
description = "AEM Permisson Matrix Tester"
9-
10-
subprojects {
11-
repositories {
12-
mavenCentral()
13-
}
14-
15-
plugins.withId("kotlin") {
16-
tasks.named<Test>("test") {
17-
useJUnitPlatform()
18-
testLogging {
19-
events = setOf(
20-
TestLogEvent.STANDARD_OUT,
21-
TestLogEvent.STANDARD_ERROR,
22-
TestLogEvent.FAILED,
23-
TestLogEvent.PASSED,
24-
TestLogEvent.SKIPPED
25-
)
26-
}
27-
}
13+
scmVersion {
14+
useHighestVersion = true
15+
ignoreUncommittedChanges = false
16+
tag(closureOf<TagNameSerializationConfig> {
17+
prefix = "apmt"
18+
})
19+
}
2820

29-
tasks.withType<KotlinCompile> {
30-
kotlinOptions.jvmTarget = "1.8"
31-
}
21+
project.version = scmVersion.version
3222

33-
dependencies {
34-
"implementation"(kotlin("stdlib-jdk8"))
35-
"implementation"("org.junit.jupiter:junit-jupiter-api:5.5.1")
36-
"implementation"("org.junit.jupiter:junit-jupiter-params:5.5.1")
37-
"testRuntime"("org.junit.jupiter:junit-jupiter-engine:5.5.1")
23+
allprojects {
24+
group = "com.cognifide.apmt"
3825

39-
"implementation"("org.apache.commons:commons-lang3:3.8.1")
40-
}
26+
tasks.withType<KotlinCompile> {
27+
kotlinOptions.jvmTarget = "1.8"
4128
}
4229
}
30+
31+
apply(from = "gradle/common.gradle.kts")

core/build.gradle.kts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
plugins {
22
kotlin("jvm")
3+
`maven-publish`
4+
signing
35
}
46

57
dependencies {
@@ -8,7 +10,30 @@ dependencies {
810
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.9.8")
911
implementation("com.fasterxml.jackson.core:jackson-databind:2.9.8")
1012
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.8")
11-
implementation("com.github.tomakehurst:wiremock-jre8:2.23.2")
12-
implementation("org.junit.jupiter:junit-jupiter-api:5.5.1")
13-
implementation("org.junit.jupiter:junit-jupiter-params:5.5.1")
13+
implementation("org.apache.commons:commons-lang3:3.8.1")
14+
testImplementation("com.github.tomakehurst:wiremock-jre8:2.23.2")
15+
}
16+
17+
tasks.register<Jar>("sourcesJar") {
18+
from(sourceSets.main.get().allJava)
19+
archiveClassifier.set("sources")
20+
}
21+
22+
tasks.register<Jar>("javadocJar") {
23+
from(tasks.javadoc)
24+
archiveClassifier.set("javadoc")
25+
}
26+
27+
publishing {
28+
publications {
29+
create<MavenPublication>("apmt") {
30+
from(components["java"])
31+
artifact(tasks["sourcesJar"])
32+
artifact(tasks["javadocJar"])
33+
afterEvaluate {
34+
artifactId = "apmt"
35+
version = rootProject.version
36+
}
37+
}
38+
}
1439
}

gradle/common.gradle.kts

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
/*
2+
* ========================LICENSE_START=================================
3+
* AEM Permission Management
4+
* %%
5+
* Copyright (C) 2013 Cognifide Limited
6+
* %%
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
* =========================LICENSE_END==================================
19+
*/
20+
21+
import org.gradle.api.tasks.testing.logging.TestLogEvent
22+
23+
allprojects {
24+
repositories {
25+
mavenLocal()
26+
jcenter()
27+
}
28+
29+
plugins.withId("kotlin") {
30+
tasks.withType<Test>().configureEach {
31+
failFast = true
32+
useJUnitPlatform()
33+
testLogging {
34+
events = setOf(
35+
TestLogEvent.STANDARD_OUT,
36+
TestLogEvent.STANDARD_ERROR,
37+
TestLogEvent.FAILED,
38+
TestLogEvent.PASSED,
39+
TestLogEvent.SKIPPED
40+
)
41+
}
42+
}
43+
44+
dependencies {
45+
"implementation"(kotlin("stdlib-jdk8"))
46+
"implementation"("org.junit.jupiter:junit-jupiter-api:5.5.1")
47+
"implementation"("org.junit.jupiter:junit-jupiter-params:5.5.1")
48+
"testRuntime"("org.junit.jupiter:junit-jupiter-engine:5.5.1")
49+
}
50+
}
51+
52+
afterEvaluate {
53+
val apmtRepositoryUsername: String? by extra
54+
val apmtRepositoryPassword: String? by extra
55+
extensions.findByType(PublishingExtension::class)?.apply {
56+
publications?.findByName("apmt")?.apply {
57+
if (this is MavenPublication) {
58+
pom {
59+
name.set("APMT")
60+
description.set("AEM Permission Matrix Tester")
61+
url.set("https://github.com/Cognifide/apmt")
62+
licenses {
63+
license {
64+
name.set("The Apache License, Version 2.0")
65+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
66+
}
67+
}
68+
developers {
69+
developer {
70+
name.set("Marcin Jędraszczyk")
71+
email.set("marcin.jedraszczyk@cognifide.com")
72+
organization.set("Cognifide")
73+
organizationUrl.set("https://www.cognifide.com")
74+
}
75+
developer {
76+
name.set("Michał Krzyżanowski")
77+
email.set("michal.krzyzanowski@cognifide.com")
78+
organization.set("Cognifide")
79+
organizationUrl.set("https://www.cognifide.com")
80+
}
81+
developer {
82+
name.set("Bartosz Zbytniewski")
83+
email.set("bartosz.zbytniewski@cognifide.com")
84+
organization.set("Cognifide")
85+
organizationUrl.set("https://www.cognifide.com")
86+
}
87+
}
88+
scm {
89+
connection.set("https://github.com/Cognifide/apmt.git")
90+
developerConnection.set("https://github.com/Cognifide/apmt.git")
91+
url.set("https://github.com/Cognifide/apmt")
92+
}
93+
}
94+
}
95+
}
96+
repositories {
97+
maven {
98+
name = "OSSSonatypeOrg"
99+
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
100+
credentials {
101+
username = apmtRepositoryUsername
102+
password = apmtRepositoryPassword
103+
}
104+
authentication {
105+
create<BasicAuthentication>("basic")
106+
}
107+
}
108+
}
109+
}
110+
111+
extensions.findByType(SigningExtension::class)?.apply {
112+
useGpgCmd()
113+
val publication = extensions.findByType(PublishingExtension::class)?.publications?.findByName("apmt")
114+
if (publication != null) {
115+
sign(publication)
116+
}
117+
}
118+
}
119+
}

0 commit comments

Comments
 (0)