forked from igniterealtime/Smack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
117 lines (98 loc) · 3.28 KB
/
build.gradle
File metadata and controls
117 lines (98 loc) · 3.28 KB
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
plugins {
// The scalastyle plugin of smack-repl wants the root project to
// have a ideaProject task, so let's add one.
id 'idea'
id 'org.igniterealtime.smack.javadoc-conventions'
}
ext {
javadocAllDir = new File(buildDir, 'javadoc')
integrationTestProjects = [
':smack-integration-test',
':smack-omemo-signal-integration-test',
].collect{ project(it) }
javadocAllProjects = subprojects - integrationTestProjects
}
version = gradle.ext.version
tasks.register('javadocAll', Javadoc) {
description = 'Generates aggregated Javadoc for all subprojects that apply the Java plugin.'
group = 'documentation'
destinationDir = javadocAllDir
options {
windowTitle = "Smack ${project.version} API Documentation"
docTitle = windowTitle
linkSource = true
use = true
overview = "$projectDir/resources/javadoc-overview.html"
}
doFirst {
def staticJxmppVersion = getResolvedVersion('org.jxmpp:jxmpp-core')
def staticMiniDnsVersion = getResolvedVersion('org.minidns:minidns-core')
options.links = [
"https://docs.oracle.com/en/java/javase/${javaMajor}/docs/api/",
"https://jxmpp.org/releases/${staticJxmppVersion}/javadoc/",
"https://minidns.org/releases/${staticMiniDnsVersion}/javadoc/",
] as String[]
}
def allJavadocTasksProvider = project.provider {
javadocAllProjects
.collect { it.tasks.named('javadoc', Javadoc).get() }
.flatten()
}
source = allJavadocTasksProvider.map { tasks -> tasks.collect { it.source } }
def classpathProvider = project.provider {
javadocAllProjects
.collect { it.sourceSets.main.compileClasspath }
}
classpath = project.files(classpathProvider)
dependsOn(allJavadocTasksProvider)
// Finally copy the javadoc doc-files from the subprojects, which
// are potentially generated, to the javadocAll directory. Note
// that we use a copy *method* and not a *task* because the inputs
// of copy tasks is determined within the configuration phase. And
// since some of the inputs are generated, they will not get
// picked up if we used a copy method. See also
// https://stackoverflow.com/a/40518516/194894
doLast {
copy {
javadocAllProjects.each {
from ("${it.projectDir}/src/javadoc") {
include '**/doc-files/*.*'
}
}
into javadocAllDir
}
}
}
task sinttest {
description = 'Verify correct functionality of Smack by running some integration tests.'
dependsOn 'smack-integration-test:run'
}
task omemoSignalIntTest {
description = 'Run integration tests of the smack-omemo module in combination with smack-omemo-signal.'
dependsOn 'smack-omemo-signal-integration-test:run'
}
task inttestFull {
description = 'Run all of Smack\'s integration tests.'
dependsOn {[
sinttest,
omemoSignalIntTest,
]}
}
def getResolvedVersion(queriedProject = 'smack-core', component) {
def configuration = project(queriedProject)
.configurations
.compileClasspath
def artifact = configuration
.resolvedConfiguration
.resolvedArtifacts
.findAll {
// 'it' is of type ResolvedArtifact, 'id' of
// Component*Artifact*Identifier, and we check the
// ComponentIdentifier.
it.id.getComponentIdentifier() instanceof org.gradle.api.artifacts.component.ModuleComponentIdentifier
}
.find {
it.id.getComponentIdentifier().toString().startsWith(component + ':')
}
artifact.getModuleVersion().getId().getVersion()
}