-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdependency.gradle
73 lines (59 loc) · 1.52 KB
/
dependency.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
allprojects {
repositories {
maven {
url "https://repository.liferay.com/nexus/content/groups/public"
}
mavenCentral()
mavenLocal()
}
configurations.whenObjectAdded {
Configuration configuration ->
if (configuration.name == "compileOnly") {
configuration.dependencies.all {
transitive = false
}
}
}
task printDependencies << {
StringBuilder sb = new StringBuilder();
["compileOnly", "compileInclude", "testIntegrationRuntime"].each {
Configuration configuration = configurations.findByName it
if (configuration) {
if (configuration.name == "compileOnly") {
sb.append("compileOnly=")
}
else if (configuration.name == "compileInclude") {
sb.append("compileInclude=")
}
else {
sb.append("compileTest=")
}
configuration.files.each {
sb.append(it)
sb.append(':')
}
sb.append('\n')
def componentIds = configuration.incoming.resolutionResult.allDependencies.collect {
it.selected.id
}
def result = dependencies.createArtifactResolutionQuery()
.forComponents(componentIds)
.withArtifacts(JvmLibrary, SourcesArtifact)
.execute()
sb.append(configuration.name)
sb.append("Sources=")
for (component in result.resolvedComponents) {
component.getArtifacts(SourcesArtifact).each {
sb.append("${it.file}")
sb.append(':')
}
}
sb.append('\n')
}
}
if (sb.length() != 0) {
def file = new File(dependencyDirectory + File.separator + project.getName())
file.text = sb
}
}
}