-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
96 lines (80 loc) · 3.04 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
93
94
95
96
allprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
group 'me.anutley'
version '1.2-SNAPSHOT'
ext {
dependencies {
// Creates shortcuts to avoid repeating dependencies throughout modules
jda = { [group: 'net.dv8tion', name: 'JDA', version: "5.0.2"] }
logback = { [group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.11'] }
reflections = { [group: 'org.reflections', name: 'reflections', version: '0.10.2'] }
// Sets the artifact id based on module name, i.e the root project will be called 'jdautils' whereas the commands module will be called 'jdautils-commands'
artifactId = (rootProject == project ? project.name : "$rootProject.name-$project.name").toLowerCase(Locale.ROOT)
}
}
repositories {
mavenCentral()
}
publishing {
if (project.getName() != "examples") {
publications {
maven(MavenPublication) {
groupId = project.group
artifactId = project.artifactId
version = project.version
}
}
}
// Decides whether its a snapshot or release
def type = version.toString().endsWith("SNAPSHOT") ? "snapshots" : "releases"
repositories {
maven {
url = "https://repo.anutley.me/" + type
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
}
subprojects {
apply plugin: 'java'
java {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
}
if (project.getName() != "examples") {
publishing {
publications {
maven(MavenPublication) {
from components.java
}
}
}
afterEvaluate {
rootProject.dependencies.implementation project
}
}
}
publishing {
publications {
maven(MavenPublication) {
// Creates a pom for the base module, to automagically depend on ALL the submodules if no specific one is provided
pom.withXml {
def repo = asNode().appendNode('repositories').appendNode('repository')
repo.appendNode('name', 'anutley-maven')
repo.appendNode('id', 'anutley-maven')
repo.appendNode('url', "https://repo.anutley.me/")
def deps = asNode().appendNode('dependencies')
configurations.implementation.allDependencies.each {
def dep = deps.appendNode('dependency')
dep.appendNode('groupId', it.group)
dep.appendNode('artifactId', it instanceof ProjectDependency ? it.dependencyProject.artifactId : it.name)
dep.appendNode('version', it.version)
dep.appendNode('scope', 'compile')
}
}
}
}
}