-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
92 lines (78 loc) · 2.25 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
plugins {
id 'java-library'
id 'maven-publish'
id "eu.davidea.grabver" version "2.0.2"
}
versioning {
major 1
minor 0
}
group 'dk.polytope'
version versioning.name
sourceCompatibility = 1.8
jar {
manifest {
attributes(
'Implementation-Title': project.name,
'Implementation-Version': versioning.name
)
}
}
publishing {
repositories {
maven {
url = uri("https://maven.pkg.github.com/polytope/checkstyle-checks")
credentials {
username = System.getenv("GITHUB_MVN_USERNAME") ?: System.getenv("MVN_USERNAME_GITHUB")
password = System.getenv("GITHUB_MVN_TOKEN") ?: System.getenv("MVN_TOKEN_GITHUB")
}
}
}
publications {
mavenJava(MavenPublication) {
groupId = project.group
artifactId = project.name
pom {
name = 'Checkstyle Checks'
description = 'a collection of Checkstyle Checks which are used in Polytope\'s codebases.'
url = 'https://github.com/polytope/checkstyle-checks'
}
from components.java
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.puppycrawl.tools:checkstyle:8.36'
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.6.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.1")
testImplementation "org.mockito:mockito-core:2.+"
}
test {
useJUnitPlatform()
}
tasks.create("generatePomPropertiesForJar") {
File outputDirectory = file("$buildDir/pom-properties")
outputDirectory.mkdirs()
File pomProperties = file("$outputDirectory/pom.properties")
pomProperties.text = """
#Generated by Gradle
#${new Date()}
groupId=${project.group}
artifactId=${project.name}
version=${project.version}
"""
outputs.file(pomProperties)
}
jar {
dependsOn("generatePomFileForMavenJavaPublication", "generatePomPropertiesForJar")
into("META-INF/maven/${project.group}/${project.name}") {
from(generatePomFileForMavenJavaPublication) {
rename(".+", "pom.xml")
}
from(generatePomPropertiesForJar)
}
}