crocs-muni / javacard-gradle-template-edu

JavaCard project template for building CAP and running JCardSim with gradle + coverage
MIT License
19 stars 14 forks source link

Doesn't compile, missing jcardsim #9

Open 7ritn opened 1 year ago

7ritn commented 1 year ago

Hi,

this project doesn't compile when following the steps. It seems like the jcardsim dependency doesn't get pulled.

[~/Development/javacard-gradle-template-edu] git(master) ❱❱❱ gradle buildJavaCard
Starting a Gradle Daemon, 1 incompatible and 1 stopped Daemons could not be reused, use --status for details
[ant:compile] /home/triton/Development/javacard-gradle-template-edu/applet/src/main/java/main/Run.java:4: error: package com.licel.jcardsim.smartcardio does not exist
[ant:compile] import com.licel.jcardsim.smartcardio.CardSimulator;
[ant:compile]                                      ^
[ant:compile] /home/triton/Development/javacard-gradle-template-edu/applet/src/main/java/main/Run.java:5: error: package com.licel.jcardsim.utils does not exist
[ant:compile] import com.licel.jcardsim.utils.AIDUtil;
[ant:compile]                                ^
[ant:compile] /home/triton/Development/javacard-gradle-template-edu/applet/src/main/java/main/Run.java:12: error: cannot find symbol
[ant:compile]         CardSimulator simulator = new CardSimulator();
[ant:compile]         ^
[ant:compile]   symbol:   class CardSimulator
[ant:compile]   location: class Run
[ant:compile] /home/triton/Development/javacard-gradle-template-edu/applet/src/main/java/main/Run.java:12: error: cannot find symbol
[ant:compile]         CardSimulator simulator = new CardSimulator();
[ant:compile]                                       ^
[ant:compile]   symbol:   class CardSimulator
[ant:compile]   location: class Run
[ant:compile] /home/triton/Development/javacard-gradle-template-edu/applet/src/main/java/main/Run.java:15: error: cannot find symbol
[ant:compile]         AID appletAID = AIDUtil.create("F000000001");
[ant:compile]                         ^
[ant:compile]   symbol:   variable AIDUtil
[ant:compile]   location: class Run
[ant:compile] 5 errors

> Task :applet:buildJavaCard FAILED
[ant:cap] INFO: using JavaCard 3.1.0 SDK in /home/triton/Development/javacard-gradle-template-edu/libs-sdks/jc310b43_kit
[ant:cap] INFO: targeting JavaCard 3.0.4 SDK in /home/triton/Development/javacard-gradle-template-edu/libs-sdks/jc304_kit
[ant:cap] Building CAP with 1 applet from package applet (AID: 01FFFF040506070809)
[ant:cap] applet.MainApplet 01FFFF0405060708090102
[ant:compile] Compiling files from /home/triton/Development/javacard-gradle-template-edu/applet/src/main/java
[ant:compile] Compiling 3 source files to /tmp/jccpro12968740519650334899

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':applet:buildJavaCard'.
> Compile failed; see the compiler error output for details.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5s
1 actionable task: 1 executed
mistial-dev commented 1 year ago

I'd suspect it would be better to not compile the Run class at all when building for Javacard, but as a workaround it is possible to pull in jCardSim as a dependency.

In the cap section, add the dependency as follows:

        cap {
            packageName 'applet'
            version '0.1'
            aid '01:ff:ff:04:05:06:07:08:09'
            output 'applet.cap'

// ...

            dependencies {
                remote 'com.klinec:jcardsim:3.0.5.11'
            }
        }