status-keycard/build.gradle

104 lines
3.0 KiB
Groovy

apply plugin: 'javacard'
apply plugin: 'org.junit.platform.gradle.plugin'
buildscript {
repositories {
maven { url 'http://releases.marmeladburk.fidesmo.com/' }
mavenCentral()
}
dependencies {
classpath 'com.fidesmo:gradle-javacard:0.2.7'
classpath 'org.junit.platform:junit-platform-gradle-plugin:1.1.1'
}
}
javacard {
sdkVersion = "3.0.4"
cap {
aid = '0x53:0x74:0x61:0x74:0x75:0x73:0x57:0x61:0x6c:0x6c:0x65:0x74'
packageName = 'im.status.keycard'
applet {
aid = '0x53:0x74:0x61:0x74:0x75:0x73:0x57:0x61:0x6c:0x6c:0x65:0x74:0x41:0x70:0x70'
className = 'KeycardApplet'
}
applet {
aid = '0x53:0x74:0x61:0x74:0x75:0x73:0x57:0x61:0x6c:0x6c:0x65:0x74:0x4e:0x46:0x43'
className = 'NDEFApplet'
}
version = '2.0'
}
}
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
testCompile(files("../jcardsim/jcardsim-3.0.5-SNAPSHOT.jar"))
testCompile('org.web3j:core:2.3.1')
testCompile('org.bitcoinj:bitcoinj-core:0.14.5')
testCompile('com.github.status-im.status-keycard-java:desktop:2.0rc1')
testCompile('org.bouncycastle:bcprov-jdk15on:1.60')
testCompile("org.junit.jupiter:junit-jupiter-api:5.1.1")
testRuntime("org.junit.jupiter:junit-jupiter-engine:5.1.1")
}
junitPlatform {
filters {
tags {
exclude 'manual'
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.7'
}
task install(type: Exec) {
def gpShellScript = """
mode_211
enable_trace
establish_context
card_connect
select -AID ${project.properties['im.status.gradle.gpshell.isd']}
open_sc -security 1 -keyind 0 -keyver ${project.properties['im.status.gradle.gpshell.kvn']} -mac_key ${project.properties['im.status.gradle.gpshell.mac_key']} -enc_key ${project.properties['im.status.gradle.gpshell.enc_key']} -kek_key ${project.properties['im.status.gradle.gpshell.kek_key']}
send_apdu_nostop -sc 1 -APDU 80E400800E4F0C53746174757357616C6C6574
install_for_load -pkgAID 53746174757357616C6C6574
load -file build/javacard/im/status/keycard/javacard/keycard.cap
install_for_install -AID 53746174757357616C6C6574417070 -pkgAID 53746174757357616C6C6574 -instAID 53746174757357616C6C6574417070
install_for_install -AID 53746174757357616C6C65744e4643 -pkgAID 53746174757357616C6C6574 -instAID D2760000850101
card_disconnect
release_context
"""
executable project.properties['im.status.gradle.gpshell']
standardInput new ByteArrayInputStream(gpShellScript.getBytes("UTF-8"))
}
if (project.properties['im.status.keycard.test.simulated'] != 'true') {
tasks.install.dependsOn(convertJavacard)
tasks.test.dependsOn(install)
}
compileJava {
sourceCompatibility = 1.6
targetCompatibility = 1.6
}
compileTestJava {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
afterEvaluate {
if (project.properties['im.status.keycard.test.simulated'] == 'true') {
def junitPlatformTestTask = tasks.getByName('junitPlatformTest')
junitPlatformTestTask.jvmArgs(['-noverify', '-Dim.status.keycard.test.simulated=true'])
}
}