-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild.gradle
141 lines (113 loc) · 3.49 KB
/
build.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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'eclipse'
apply plugin: 'osgi'
group = 'net.whistlingfish'
version = '1.2.2'
sourceCompatibility = 1.7
repositories {
mavenCentral()
}
buildscript {
repositories {
mavenCentral()
}
}
configurations {
provided
}
dependencies {
// basic libraries
compile 'com.google.guava:guava:21.0'
compile 'com.fasterxml.jackson.core:jackson-core:2.8.7'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.7'
compile 'org.slf4j:slf4j-api:1.7.24'
provided 'ch.qos.logback:logback-core:1.2.1'
provided 'ch.qos.logback:logback-classic:1.2.1'
// Dependency injection
compile 'com.google.inject:guice:4.1.0'
// XMPP
compile 'org.igniterealtime.smack:smack-core:4.2.0'
compile 'org.igniterealtime.smack:smack-java7:4.2.0'
compile 'org.igniterealtime.smack:smack-tcp:4.2.0'
compile 'org.igniterealtime.smack:smack-debug:4.2.0'
// Shell
compile 'args4j:args4j:2.33'
compile 'com.martiansoftware:jsap:2.1'
testCompile 'junit:junit:4.+'
}
sourceSets {
main { compileClasspath += configurations.provided }
}
eclipse {
classpath { plusConfigurations += configurations.provided }
}
test {
systemProperties 'property': 'value'
}
ext.sharedManifest = manifest {
attributes(
'Implementation-Title': 'Java Harmony Hub Client',
'Implementation-Version': version,
'Main-Class': 'net.whistlingfish.harmony.Main'
)
}
jar {
manifest = osgiManifest {
from project.sharedManifest
classesDir = sourceSets.main.output.classesDir
classpath = sourceSets.main.runtimeClasspath
instruction 'Private-Package', 'net.whistlingfish.harmony.*'
instruction 'Import-Package', 'sun.misc;resolution:=optional,*'
instruction 'Export-Package', "net.whistlingfish.harmony;version=${version},net.whistlingfish.harmony.config;version=${version}"
}
}
task allJar(type: Jar) {
baseName = "$project.name"
classifier = "all"
from sourceSets.main.output
from { (configurations.runtime + configurations.provided).collect { it.isDirectory() ? it : zipTree(it) } }
manifest {
from project.sharedManifest
}
}
task openhabJar(type: Jar) {
baseName = "$project.name"
classifier = "openhab"
from sourceSets.main.output
from { configurations.compile }
manifest = osgiManifest {
classesDir = sourceSets.main.output.classesDir
classpath = sourceSets.main.runtimeClasspath
instruction 'Private-Package', 'net.whistlingfish.harmony.*'
instruction 'Import-Package', /net.whistlingfish.harmony.*;version="${version}",org.slf4j.*;version="[1.7,1.8)",sun.misc;resolution:=optional/
instruction 'Export-Package', "net.whistlingfish.harmony;version=${version},net.whistlingfish.harmony.config;version=${version}"
instruction 'Bundle-ClassPath', project.configurations.compile.files.collect { it.name }.join(',')+",."
}
}
assemble { dependsOn allJar, openhabJar }
uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}
artifacts {
archives allJar
archives openhabJar
}
publishing {
publications {
openhab(MavenPublication) {
from components.java
artifact openhabJar {
classifier "openhab"
}
}
}
}
task echoEclipseSourceSets() << {
eclipse.classpath.sourceSets.each { println it }
}