@@ -35,18 +35,29 @@ repositories {
35
35
36
36
import org.yaml.snakeyaml.Yaml
37
37
38
+ class JarConfig {
39
+ boolean enabled
40
+ String source
41
+
42
+ JarConfig (Map<String , Object > config ) {
43
+ enabled = config[' enabled' ] ?: false
44
+ source = config[' source' ] ?: ' '
45
+ }
46
+ }
47
+
38
48
class NgConfig {
39
49
String name
40
50
String version
41
51
boolean enabledLink
42
- List<String > jars
52
+ List<JarConfig > jars
43
53
44
54
@SuppressWarnings (' GroovyAssignabilityCheck' )
45
55
NgConfig (Map<String , Object > configs ) {
46
56
name = configs. containsKey(' name' ) ? configs[' name' ] : ' bot4j'
47
- version = configs. containsKey(' version' ) ? configs[' version' ] : ' v1 .0.0'
57
+ version = configs. containsKey(' version' ) ? configs[' version' ] : ' v0 .0.0'
48
58
enabledLink = configs. containsKey(' enabled_link' ) ? configs[' enabled_link' ] : false
49
- jars = configs. containsKey(' jars' ) ? configs[' jars' ] : []
59
+ // jars = configs.containsKey('jars') ? configs['jars'] : [] // List<String> jars
60
+ jars = configs. containsKey(' jars' ) ? configs[' jars' ]. collect { new JarConfig (it) } : []
50
61
}
51
62
}
52
63
@@ -87,15 +98,15 @@ tasks.jar {
87
98
version = " ${ ngConfig.getVersion()} "
88
99
89
100
// Handle duplicates
90
- // <code>
91
101
// duplicatesStrategy = DuplicatesStrategy.EXCLUDE
92
- // </code>
93
102
// Compressing the external JAR files listed in gradle.yml using zipTree if enabled_link is true
94
103
if (ngConfig. isEnabledLink() && ! ngConfig. getJars(). isEmpty()) {
95
104
ngConfig. getJars(). each { jar ->
96
- println (" 📦 Jar compressing... [${ jar} ]" )
97
- from {
98
- zipTree(file(jar))
105
+ if (jar. isEnabled() && ! jar. getSource(). isEmpty()) {
106
+ println (" 📦 Jar compressing... [${ jar.getSource()} ]" )
107
+ from {
108
+ zipTree(file(jar. getSource()))
109
+ }
99
110
}
100
111
}
101
112
} else {
@@ -108,8 +119,10 @@ dependencies {
108
119
// Add the dependencies listed in the gradle.yml file
109
120
if (! ngConfig. getJars(). isEmpty()) {
110
121
ngConfig. getJars(). each { jar ->
111
- println (" 🔄 Jar mounting... [${ jar} ]" )
112
- implementation files(jar)
122
+ if (! jar. getSource(). isEmpty()) {
123
+ println (" 🔄 Jar mounting... [${ jar.getSource()} ]" )
124
+ implementation files(jar. getSource())
125
+ }
113
126
}
114
127
} else {
115
128
println ' ⚠️ No JAR files specified in gradle.yml for dependencies.'
0 commit comments