This repository was archived by the owner on Oct 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
158 lines (144 loc) · 5.56 KB
/
build.gradle.kts
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
plugins {
kotlin("jvm") apply false
kotlin("plugin.serialization") apply false
id("org.flywaydb.flyway") apply false
// id("com.squareup.sqldelight") apply false
id("com.jfrog.bintray") apply false
id("com.vanniktech.dependency.graph.generator")
}
// Add first-class support for included/composite builds: https://github.com/jmfayard/refreshVersions/issues/205
val dummy = configurations.create("dummy") {
isCanBeConsumed = true
}
dependencies {
add(dummy.name, "com.squareup:kotlinpoet:_")
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven(url = "https://kotlin.bintray.com/ktor")
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
// maven(url = "https://dl.bintray.com/korlibs/korlibs")
maven(url = "https://dl.bintray.com/novacrypto/BIP/")
}
}
val bintrayOrg: String? = System.getenv("BINTRAY_USER")
val bintrayApiKey: String? = System.getenv("BINTRAY_API_KEY")
var bintrayRepository = "github"
val bintrayPackage = "sibyl"
group = "moe.nikky.sibyl"
description = "modular chatbot framework for matterbridge"
apply(from="${rootDir.path}/version.gradle.kts")
val isSnapshot = extra["isSnapshot"] as Boolean
if(isSnapshot) {
bintrayRepository = "snapshot"
}
subprojects {
project.group = rootProject.group
project.version = rootProject.version
plugins.withId("maven-publish") {
val artifactId = project.path.drop(1).replace(':', '-')
val publicationName = "sibyl"
val sourcesJar by tasks.creating(Jar::class) {
dependsOn(JavaPlugin.CLASSES_TASK_NAME)
archiveClassifier.set("sources")
val sourceSets = project.extensions.getByName("sourceSets") as SourceSetContainer
from(sourceSets["main"].allSource)
}
val javadocJar by tasks.creating(Jar::class) {
dependsOn(JavaPlugin.JAVADOC_TASK_NAME)
archiveClassifier.set("javadoc")
from(tasks["javadoc"])
}
configure<PublishingExtension> {
publications {
create<MavenPublication>(publicationName) {
from(components["kotlin"])
artifact(sourcesJar)
artifact(javadocJar)
this.artifactId = artifactId
}
}
// repositories {
// val publish= properties["publish"] as? String ?: "0"
// val override= properties["override"] as? String ?: "0"
// maven(url = "https://api.bintray.com/maven/$bintrayOrg/$bintrayRepository/$bintrayPackage/;publish=$publish;override=$override") {
// name = "bintray"
// credentials {
// username = bintrayOrg
// password = bintrayApiKey
// }
// }
// }
}
apply(from="${rootDir.path}/mavenPom.gradle.kts")
if (bintrayOrg == null || bintrayApiKey == null) {
logger.error("bintray credentials not configured properly")
return@withId
}
project.apply(plugin = "com.jfrog.bintray")
configure<com.jfrog.bintray.gradle.BintrayExtension> {
user = bintrayOrg
key = bintrayApiKey
publish = true
override = false
dryRun = !properties.containsKey("nodryrun")
setPublications(publicationName)
pkg(delegateClosureOf<com.jfrog.bintray.gradle.BintrayExtension.PackageConfig> {
repo = bintrayRepository
name = bintrayPackage
userOrg = bintrayOrg
version = VersionConfig().apply {
// do not put commit hashes in vcs tag
if (!isSnapshot) {
vcsTag = extra["vcsTag"] as String
}
name = project.version as String
githubReleaseNotesFile = "RELEASE_NOTES.md"
}
})
}
}
}
dependencyGraphGenerator {
generators += com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension.Generator(
name = "projects",
include = { dep ->
logger.lifecycle("include: $dep ${dep.moduleGroup} ${dep.parents}")
dep.moduleGroup == rootProject.group || dep.parents.any { it.moduleGroup == rootProject.group }
},
children = { dep ->
// logger.lifecycle("children: $dep ${dep.parents}")
// dep.moduleGroup == "Sibyl" || dep.parents.any { it.moduleGroup == "Sibyl" }
true
},
projectNode = { node, b ->
node
// .setName(b.path.drop(1).replace(':', '-'))
.add(
guru.nidi.graphviz.attribute.Color.SLATEGRAY,
guru.nidi.graphviz.attribute.Color.AQUAMARINE.background().fill(),
guru.nidi.graphviz.attribute.Style.FILLED
)
},
includeProject = { project ->
logger.lifecycle("project: $project")
project.buildFile.exists()
},
dependencyNode = { node, dep ->
logger.lifecycle("dep node $dep ${dep::class}")
node
}
)
}
tasks {
withType(com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorTask::class).all {
doFirst {
logger.lifecycle("cleaning output")
outputDirectory = outputDirectory.resolve(generator.name)
outputDirectory.deleteRecursively()
outputDirectory.mkdirs()
}
}
}