Browse Source

Add a script to magically change dependencies.

This changes any com.dmdirc.* dependency references into
local project references.

It doesn't yet work for the parser as that's a different
group, and doesn't have independent projects.
pull/8/head
Chris Smith 9 years ago
parent
commit
bed8d28dbf
2 changed files with 28 additions and 0 deletions
  1. 2
    0
      build.gradle
  2. 26
    0
      local-dependency-change.gradle

+ 2
- 0
build.gradle View File

2
 import java.nio.file.Paths;
2
 import java.nio.file.Paths;
3
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
3
 import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
4
 
4
 
5
+apply from: 'local-dependency-change.gradle'
6
+
5
 task createWrapper(type: Wrapper) {
7
 task createWrapper(type: Wrapper) {
6
     description 'Downloads and installs an up-to-date wrapper for gradle.'
8
     description 'Downloads and installs an up-to-date wrapper for gradle.'
7
     gradleVersion = '2.1'
9
     gradleVersion = '2.1'

+ 26
- 0
local-dependency-change.gradle View File

1
+gradle.projectsEvaluated {
2
+    def projectMap = [:]
3
+    allprojects.each { p -> projectMap[p.name] = p }
4
+
5
+    allprojects.each { p ->
6
+        def replace = []
7
+
8
+        p.configurations.each { conf ->
9
+            conf.dependencies.each { dep ->
10
+                if (dep.group == 'com.dmdirc' && dep.version == '+' && projectMap[dep.name] != null) {
11
+                    replace += [conf: conf.name, dep: dep]
12
+                }
13
+            }
14
+        }
15
+
16
+        replace.each { rep ->
17
+            logger.info("Replacing ${p.name}'s dependency on $rep.dep.name with project reference")
18
+            p.configurations.all*.exclude(group: 'com.dmdirc', module: rep.dep.name)
19
+            rep.dep.properties.excludeRules.each { ex ->
20
+                p.configurations.all*.exclude(group: ex.group, module: ex.module)
21
+            }
22
+            p.dependencies.add(rep.conf, projectMap[rep.dep.name])
23
+        }
24
+    }
25
+}
26
+

Loading…
Cancel
Save