-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
152 lines (128 loc) · 4.68 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
group 'test-applet'
version '1.0-SNAPSHOT'
// Buildscript configuration for the javacard-gradle plugin.
// Do not modify this particular block. Dependencies for the project are lower.
buildscript {
repositories {
mavenCentral()
maven { url "https://javacard.pro/maven" }
maven { url "https://deadcode.me/mvn" }
// mavenLocal()
}
dependencies {
classpath 'com.klinec:gradle-javacard:1.8.0'
}
}
apply plugin: 'com.klinec.gradle.javacard'
apply plugin: 'idea'
sourceCompatibility = 1.8
// Common settings, definitions
final def rootPath = rootDir.absolutePath
final def libs = rootPath + '/libs'
final def libsSdk = rootPath + '/libs-sdks'
// Repositories for your project
repositories {
mavenCentral()
// mavenLocal() // for local maven repository if needed
// Repository with JCardSim, Globalplatform, etc, ...
maven { url "https://javacard.pro/maven" }
maven { url "https://deadcode.me/mvn" }
// Local lib repository
flatDir {
dirs libs
}
}
// Dependencies for your project
dependencies {
jcardsim 'com.klinec:jcardsim:3.0.6.0'
testImplementation 'org.testng:testng:6.1.1'
testImplementation 'org.slf4j:slf4j-api:1.7.33'
testImplementation 'org.slf4j:slf4j-log4j12:1.7.33'
testImplementation 'org.apache.logging.log4j:log4j-core:2.17.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.1'
testImplementation 'org.bouncycastle:bcprov-jdk18on:1.72'
testImplementation 'org.apache.commons:commons-lang3:3.12.0'
testImplementation 'org.apache.commons:commons-csv:1.10.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.1'
testImplementation(group: 'com.klinec', name: 'javacard-tools', version: '1.0.5') {
exclude group: "com.klinec", module: "jcardsim"
}
// Include plugin as it has bundled GP & other tools.
// Alternative: include GP manually, but the included
// version has to be compatible with the plugin.
runtimeOnly 'com.klinec:gradle-javacard:1.8.0'
}
task dumpClassPath(dependsOn: ['idea']) {
doLast {
println "Gradle classpath:\n- " + configurations.compile.files*.name.join("\n- ")
println "-------\n"
println "IDEA classpath: \n- " + file(project.name + ".iml").readLines()
.grep(~/.*"jar:.*/).collect { it.split("[\\/]")[-3].trim() }.join("\n- ")
println "-------\n"
}
}
test {
// useTestNG()
useJUnitPlatform {
excludeTags 'manual'
}
task manualTests(type: Test) {
useJUnitPlatform {
includeTags 'manual'
}
check.dependsOn it
shouldRunAfter test
}
}
// JavaCard SDKs and libraries
final def JC212 = libsSdk + '/jc212_kit'
final def JC221 = libsSdk + '/jc221_kit'
final def JC222 = libsSdk + '/jc222_kit'
final def JC303 = libsSdk + '/jc303_kit'
final def JC304 = libsSdk + '/jc304_kit'
final def JC305 = libsSdk + '/jc305u1_kit'
final def JC305u2 = libsSdk + '/jc305u2_kit'
final def JC305u3 = libsSdk + '/jc305u3_kit'
final def JC310b43 = libsSdk + '/jc310b43_kit'
// Which JavaCard SDK to use - select
// In order to compile JC222 and lower you have to have Java SDK <= 1.8
// For more info on JavaCard vs JDK version requirements inspect:
// https://github.com/martinpaljak/ant-javacard/wiki/Version-compatibility
//
// JC310b43 supports building also for lower versions (cap.targetsdk).
// If another SDK is selected, please comment the cap.targetsdk setting.
final def JC_SELECTED = JC310b43
javacard {
//noinspection GroovyAssignabilityCheck
config {
jckit JC_SELECTED
// Using custom repo with jcardsim
debugGpPro true
addImplicitJcardSim false
addImplicitJcardSimJunit false
//noinspection GroovyAssignabilityCheck
cap {
packageName 'applet'
version '0.1'
aid '01:ff:ff:04:05:06:07:08:09'
output 'applet.cap'
// JC310b43 supports compilation targeting for lower API versions.
// Here you can specify path to the SDK you want to use.
// Only JC304 and higher are supported for targeting.
// If JC310b43 is not used, targetsdk cannot be set.
targetsdk JC304
// Override java bytecode version if needed.
// javaversion '1.7'
//noinspection GroovyAssignabilityCheck
applet {
className 'applet.MainApplet'
aid '01:ff:ff:04:05:06:07:08:09:01:02'
}
//noinspection GroovyAssignabilityCheck
// dependencies {
// remote 'com.klinec:globalplatform:2.1.1'
// }
}
}
}