-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
162 lines (132 loc) · 5.06 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
apply plugin: "java"
apply plugin: "maven"
apply plugin: "com.diffplug.spotless"
///////////////////////////////////////////////////////////////////////////////
// CONFIGURATION
///////////////////////////////////////////////////////////////////////////////
group = groupId
archivesBaseName = artifactId
sourceCompatibility = javaSourceLevel
targetCompatibility = javaTargetLevel
// If your build script needs to use external libraries, you can add them to the script’s classpath in the
// build script itself.
// You do this using the buildscript() method, passing in a block which declares the build script classpath.
buildscript {
// Repositories where to find dependencies needed by the build process
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.diffplug.spotless:spotless-plugin-gradle:5.10.0"
}
}
// Repositories where to find dependencies needed by the project
repositories {
mavenLocal()
//use a mirror of maven_central to speed up CI build
maven {
url "https://repo.eclipse.org/service/local/repositories/maven_central/content"
}
//to import keyple snapshots
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
//to import keyple releases
maven {
url "https://oss.sonatype.org/content/repositories/releases"
}
google()
jcenter()
mavenCentral()
}
// Configures the dependency configurations for this project.
configurations {
all {
// Defines the strategies around dependency resolution.
// For example, forcing certain dependency versions, substitutions, conflict resolutions or snapshot timeouts.
resolutionStrategy {
// check for updates every build
cacheChangingModulesFor 0, "seconds"
}
}
// configuration that holds jars to include in the jar
extraLibs
}
///////////////////////////////////////////////////////////////////////////////
// CUSTOM TASKS
///////////////////////////////////////////////////////////////////////////////
// Copy license file from root folder to each generated artifact
task copyLicenceFile(type: Copy) {
from file("${projectDir}/LICENSE")
into file("${buildDir}/resources/main/META-INF/")
}
// Copy notice file from root folder to each generated artifact
task copyNoticeFile(type: Copy) {
from file("${projectDir}/NOTICE.md")
into file("${buildDir}/resources/main/META-INF/")
}
///////////////////////////////////////////////////////////////////////////////
// DEFAULT TASKS
///////////////////////////////////////////////////////////////////////////////
// additional actions before compiling classes
// spotless plugin task
spotless {
// java files format
java {
target "src/**/*.java"
importOrder "java", "javax", "org", "com", ""
removeUnusedImports()
googleJavaFormat()
}
// gradle files format
groovyGradle {
target "*.gradle" // default target of groovyGradle
greclipse()
indentWithSpaces()
}
}
classes {
dependsOn copyLicenceFile, copyNoticeFile
}
jar {
manifest {
attributes("Implementation-Title": project.description,
"Implementation-Version": project.version,
"Main-Class": "org.calypsonet.certification.calypso.Main")
}
from sourceSets.test.output
from {
configurations.extraLibs.collect { it.isDirectory() ? it : zipTree(it) }
}
}
///////////////////////////////////////////////////////////////////////////////
// PROJECT DEPENDENCIES
///////////////////////////////////////////////////////////////////////////////
dependencies {
// CALYPSO DEPENDENCIES
extraLibs "org.calypsonet.terminal:calypsonet-terminal-reader-java-api:1.0.+"
extraLibs "org.calypsonet.terminal:calypsonet-terminal-card-java-api:1.0.+"
extraLibs "org.calypsonet.terminal:calypsonet-terminal-calypso-java-api:1.0.+"
// KEYPLE DEPENDENCIES
extraLibs "org.eclipse.keyple:keyple-common-java-api:2.0.+"
extraLibs "org.eclipse.keyple:keyple-util-java-lib:2.+"
extraLibs "org.eclipse.keyple:keyple-service-java-lib:2.0.+"
extraLibs "org.eclipse.keyple:keyple-card-calypso-java-lib:2.0.+"
extraLibs "org.eclipse.keyple:keyple-plugin-pcsc-java-lib:2.0.+"
extraLibs "org.eclipse.keyple:keyple-plugin-stub-java-lib:2.0.+"
// EXTERNAL DEPENDENCIES
// https://mvnrepository.com/artifact/junit/junit
extraLibs "junit:junit:${junit_version}"
// https://search.maven.org/artifact/org.assertj/assertj-core/2.9.1/bundle
extraLibs "org.assertj:assertj-core:${assertj_version}"
// https://mvnrepository.com/artifact/org.mockito/mockito-core
extraLibs "org.mockito:mockito-core:${mockitocore_version}"
// https://mvnrepository.com/artifact/org.slf4j/slf4j-api
extraLibs "org.slf4j:slf4j-api:${slf4japi_version}"
// https://mvnrepository.com/artifact/org.slf4j/slf4j-log4j12
extraLibs "org.slf4j:slf4j-log4j12:${slf4jlog4j12_version}"
extraLibs "org.awaitility:awaitility:4.0.3"
configurations.compile.extendsFrom(configurations.extraLibs)
}