-
Notifications
You must be signed in to change notification settings - Fork 35
/
build.gradle
118 lines (95 loc) · 2.83 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
defaultTasks /* Core */ 'microlog4android-core:clean', 'microlog4android-core:build', 'microlog4android-core:javadoc',
/* Core tests */ 'microlog4android-core-tests:clean', 'microlog4android-core-tests:test',
/* slf4j impl */ 'microlog4android-slf4j-impl:clean', 'microlog4android-slf4j-impl:build', 'microlog4android-slf4j-impl:javadoc',
/* package modules */ 'clean', 'packageDistribution'
allprojects {
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
repositories {
mavenCentral()
mavenRepo urls: "file://" + System.getProperty('user.home') + "/.m2/repository/"
}
sourceCompatibility = source
version = microlog4androidVersion
}
/*
* MAIN BUILD
*/
dependsOn(':microlog4android-slf4j-impl')
dependencies {
// microlog4android
compile fileTree(dir: 'microlog4android-core/build/libs', include: 'microlog4android-core*.jar')
compile fileTree(dir: 'microlog4android-slf4j-impl/build/libs', include: 'microlog4android-slf4j-impl*.jar')
}
jar {
from configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
tempJarFiles = buildDirName + '/tmp-classes'
tempDistFolder = buildDirName + '/tmp-dist'
task unpackFatJar(dependsOn: jar) << {
copy {
jarFile = findMicrologJar()
from zipTree(jarFile)
include '**/*.class'
into tempJarFiles
}
}
task deleteUnusedJar(dependsOn: unpackFatJar) << {
File micrologJar = findMicrologJar()
if(micrologJar != null) {
findMicrologJar().delete()
}
}
/*
* Returns the microlog4android jar-file.
*/
private File findMicrologJar() {
File[] distsDirContent = libsDir.listFiles()
File micrologJar = null
for(File file : distsDirContent) {
if(file.getName().contains('microlog4android')) {
micrologJar = file
}
}
return micrologJar
}
task packageJar(dependsOn: deleteUnusedJar, type: Zip) {
extension = 'jar'
from tempJarFiles
}
/*
* Copies the application files to create the dist archive file and to the integration module for the emulator tests
*/
task copyApplicationFiles(dependsOn: packageJar) << {
// Copies the javadoc from the core module to its own folder
copy {
from 'microlog4android-core/build/docs'
include '**/*'
into docsDir.getPath() + '/m4a-core'
}
// Copies the javadoc from the slf4j-impl module to its own folder
copy {
from 'microlog4android-slf4j-impl/build/docs'
include '**/*'
into docsDir.getPath() + '/m4a-slf4j-impl'
}
// Creates the temporary dist folder and copies the jar
new File(tempDistFolder).mkdirs()
copy {
from distsDir
include '*.jar'
into tempDistFolder
}
// Copies the packaged jar file into the integration-tests project
copy {
from distsDir
include '*.jar'
into 'microlog4android-integration-tests/libs'
}
}
task packageDistribution(dependsOn: copyApplicationFiles, type: Zip) {
from tempDistFolder
from docsDir
baseName = 'microlog4android-dist'
}