-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
131 lines (116 loc) · 4.28 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
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
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "at.bxm.gradleplugins:gradle-svntools-plugin:2.2"
classpath "org.tmatesoft.svnkit:svnkit:1.10.1"
}
}
plugins {
id 'base'
id 'distribution'
id 'maven-publish'
}
version = '0.3.0-SNAPSHOT'
task cleanDeps {
if (gradle.startParameter.taskNames.contains("clean") && !project.gradle.startParameter.projectProperties.containsKey("moduleDep")) {
println "Deleting temporary dependency modules"
File depsCheckFile = rootProject.file("deps/dependency.txt")
if (depsCheckFile.exists()) {
File depsDir = rootProject.file("deps")
depsDir.listFiles().each() { childFile ->
if (childFile.isDirectory() && childFile.name != ".gradle") {
project.delete(childFile)
}
}
} else {
throw new Exception('Invalid dependency path')
}
}
}
clean.dependsOn cleanDeps
subprojects.each { subproject -> evaluationDependsOn(subproject.path) }
publish.dependsOn {
project(':core').subprojects.publish
project(':modules').subprojects.publish
}
if (file('deps/.downloaded').exists()) {
file('deps/.downloaded').delete()
// Performs another build task for new dependency handling
def depsLevel
if (project.gradle.startParameter.projectProperties.containsKey('moduleDep')) {
depsLevel = project.gradle.startParameter.projectProperties['moduleDep'] + 1
} else {
depsLevel = 1
println "Due to dependecy download(s) gradle build must be executed again after finishing"
}
def artefactBuild = project.tasks.create([name: "depsRebuild_${depsLevel}", type: GradleBuild])
artefactBuild.tasks = project.gradle.startParameter.taskNames
artefactBuild.setDependsOn(project.tasks['assemble'].dependsOn)
def artefactProjectProperties = artefactBuild.startParameter.projectProperties
def currentProjectProperties = project.gradle.startParameter.projectProperties
artefactProjectProperties << currentProjectProperties
artefactProjectProperties << ['moduleDep': depsLevel]
// Terminate currently invalid tasks
// TODO: Fix support for other tasks like distZip
subprojects.each { subproject ->
if (subproject.tasks.findByPath('compileJava') != null) {
subproject.tasks['compileJava'].setEnabled(false)
}
if (subproject.tasks.findByPath('compileTestJava') != null) {
subproject.tasks['compileTestJava'].setEnabled(false)
}
if (subproject.tasks.findByPath('javadoc') != null) {
subproject.tasks['javadoc'].setEnabled(false)
}
}
assemble.dependsOn("depsRebuild_${depsLevel}")
}
if (!project.gradle.startParameter.projectProperties.containsKey("moduleDep")) {
distributions {
main {
contents {
duplicatesStrategy = 'exclude'
from project.rootDir
include 'LICENSE.txt'
from 'src/dist'
include 'readme.txt'
into('lib') {
from 'lib'
}
project(':core').subprojects.each { p ->
p.plugins.withType(JavaPlugin) {
into('lib') {
from p.jar.archivePath
include '*'
from p.configurations.runtimeClasspath
include '*'
}
}
}
project(':modules').subprojects.each { p ->
p.plugins.withType(JavaPlugin) {
into('lib') {
from p.jar.archivePath
include '*'
from p.configurations.runtimeClasspath
include '*'
}
}
}
into('doc') {
from 'doc'
include '**'
}
into('resources') {
from 'resources'
include '**'
exclude 'private'
}
}
}
}
}