-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
101 lines (83 loc) · 3.67 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
97
98
99
100
101
plugins {
id 'java'
id 'java-library'
}
allprojects {
ext.userHome = System.getProperty("user.home")
ext.replaceEnv = { value ->
value = value.replace("\${sketchbook.location}", sketchbookLocation)
value = value.replace("\${user.home}", userHome)
return value
}
// Getting build properties
Properties buildProperties = new Properties()
buildProperties.load(project.rootProject.file("resources/build.properties").newDataInputStream())
ext.javaTargetVersion = buildProperties.getProperty("java.target.version")
ext.sketchbookLocation = buildProperties.getProperty("sketchbook.location").replace("\${user.home}", userHome)
ext.classpathLocalLocation = replaceEnv(buildProperties.getProperty("classpath.local.location"))
ext.libName = buildProperties.getProperty("library.name")
ext.libPrettyName = buildProperties.getProperty("library.prettyName")
ext.libPackageName = buildProperties.getProperty("library.packageName")
ext.libVersion = buildProperties.getProperty("library.version")
ext.libPrettyVersion = buildProperties.getProperty("library.prettyVersion")
ext.libAuthors = buildProperties.getProperty("library.authorList")
ext.libCategory = buildProperties.getProperty("library.categories")
ext.libUrl = buildProperties.getProperty("library.url")
ext.libSentence = buildProperties.getProperty("library.sentence")
ext.libParagraph = buildProperties.getProperty("library.paragraph")
ext.compMinRevision = buildProperties.getProperty("compatible.minRevision")
ext.compMaxRevision = buildProperties.getProperty("compatible.maxRevision")
ext.includeDeps = buildProperties.getProperty("classpath.local.include").split(',')
ext.remoteDeps = buildProperties.getProperty("dependencies.remote").split(',')
ext.installedDeps = replaceEnv(buildProperties.getProperty("dependencies.installed")).split(',')
group "$libPackageName"
version "$libPrettyVersion"
sourceCompatibility = "$javaTargetVersion"
// Extracting library names from the local library dependencies
ext.installedNames = []
for (lib in installedDeps) {
if (lib) installedNames.add(lib.split("/")[-1])
}
// Putting all remote depndencies into an array to pass to the pom task
ext.remotePackages = []
ext.addRemoteDepenency = { dep ->
def parts = dep.split(':')
if (parts.length != 3) {
throw new GradleException("Malformed Gradle dependency: " + lib + "\n" +
"It needs to have three parts: group, name, and version, separated by colons.")
}
remotePackages.add([group:parts[0], name:parts[1], version:parts[2]])
}
for (dep in remoteDeps) addRemoteDepenency(dep)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
for (lib in installedDeps) {
if (lib) flatDir dirs: lib + "/library"
}
flatDir {
dirs 'lib'
}
}
}
javadoc {
source = sourceSets.main.allJava
classpath = configurations.runtimeOnly
}
dependencies {
// Processing jars from installed application package
implementation fileTree(include: includeDeps, dir: "$classpathLocalLocation")
// External dependencies available on any of the listed repositories above
for (pkg in remotePackages) {
implementation group: pkg.group, name: pkg.name, version: pkg.version
}
for (dep in installedNames) compileOnly name: dep
}
configurations {
print("$libName")
jar.archiveFileName = libName + '.jar'
processing
compile.extendsFrom processing
}
// Add processing library support
apply from: "processing-library.gradle"