Переглянути джерело

Add a 'provided' scope.

This prevents DMDirc's transitive dependencies from being bundled
in plugins. e.g. DMDirc includes SLF4J, so any plugin that depends
on it (or depends on another project that depends on SLF4J) should
not include it in the plugin jar to avoid having duplicate classes
from different class loaders.
pull/477/head
Chris Smith 7 роки тому
джерело
коміт
7569769934
2 змінених файлів з 31 додано та 3 видалено
  1. 24
    0
      README.md
  2. 7
    3
      build.gradle

+ 24
- 0
README.md Переглянути файл

@@ -0,0 +1,24 @@
1
+DMDirc plugins
2
+================================================================================
3
+
4
+This repository contains plugins for [DMDirc](https://www.dmdirc.com/), a Java
5
+IRC client.
6
+
7
+Development information
8
+--------------------------------------------------------------------------------
9
+
10
+### Gradle configurations
11
+
12
+We have two custom configurations for use when defining plugin dependencies:
13
+
14
+The **bundle** configuration allows dependencies to be bundled together into
15
+the plugin's jar file. This should be used for dependencies required at runtime
16
+that are not included in the main DMDirc client, or accessed via other plugins.
17
+Most of a plugin's dependencies should end up in the bundle configuration.
18
+
19
+The **provided** configuration works like the Maven 'provided' scope. It
20
+defines dependencies required to compile and run the plugin that will be
21
+provided to it somehow externally. Anything in the provided configuration
22
+(including transitive dependencies) will *not* be bundled into the plugin jar.
23
+The provided configuration is used for the main DMDirc client, and should be
24
+used for any intra-plugin dependencies.

+ 7
- 3
build.gradle Переглянути файл

@@ -16,7 +16,11 @@ subprojects {
16 16
     }
17 17
 
18 18
     configurations {
19
-        bundle
19
+        provided
20
+
21
+        bundle {
22
+            extendsFrom provided
23
+        }
20 24
 
21 25
         compile {
22 26
             extendsFrom bundle
@@ -33,7 +37,7 @@ subprojects {
33 37
     }
34 38
 
35 39
     dependencies {
36
-        compile group: 'com.dmdirc', name: 'client', version: '+', changing: true
40
+        provided group: 'com.dmdirc', name: 'client', version: '+', changing: true
37 41
 
38 42
         compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1'
39 43
         compile group: 'com.squareup.dagger', name: 'dagger-compiler', version: '1.2.4'
@@ -98,7 +102,7 @@ subprojects {
98 102
             into 'META-INF'
99 103
         }
100 104
 
101
-        from { configurations.bundle.collect { it.isDirectory() ? it : zipTree(it) } } {
105
+        from { configurations.bundle.minus(configurations.provided).collect { it.isDirectory() ? it : zipTree(it) } } {
102 106
             exclude 'META-INF/**'
103 107
         }
104 108
     }

Завантаження…
Відмінити
Зберегти