-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
54 lines (47 loc) · 1.5 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
import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension
import com.vanniktech.dependency.graph.generator.DependencyGraphGeneratorExtension.Generator
import guru.nidi.graphviz.attribute.Color
import guru.nidi.graphviz.attribute.Style
import guru.nidi.graphviz.model.MutableNode
import kotlin.random.Random
group = "io.github.sof3.enclavlow"
version = "1.0-SNAPSHOT"
allprojects {
repositories {
mavenLocal()
mavenCentral()
maven("https://repo1.maven.org/maven2")
}
}
subprojects {
group = "io.github.sof3.enclavlow"
version = "1.0-SNAPSHOT"
}
buildscript {
repositories {
mavenLocal()
jcenter()
}
}
plugins {
kotlin("jvm") version "1.4.10"
id("com.vanniktech.dependency.graph.generator") version "0.5.0"
}
configure<DependencyGraphGeneratorExtension> {
fun colorNode(node: MutableNode, name: String): MutableNode {
val random = Random(name.hashCode())
val r = random.nextInt(256)
val g = random.nextInt(256)
val b = random.nextInt(256)
node.add(Style.FILLED, Color.rgb((r shl 16) or (g shl 8) or b))
val light = 0.299 * r + 0.587 * g + 0.114 * b
if (light <= 152.0) {
node.add("fontcolor", "#ffffff")
}
return node
}
generators = listOf(Generator(
dependencyNode = { node, dependency -> colorNode(node, dependency.moduleGroup) },
projectNode = { node, project -> colorNode(node, project.group.toString()) }
))
}