Skip to content

Wrap building applet, reader and common with Nix - #38

Merged
J08nY merged 9 commits into
crocs-muni:masterfrom
quapka:build-rest-with-nix
Jul 14, 2025
Merged

Wrap building applet, reader and common with Nix#38
J08nY merged 9 commits into
crocs-muni:masterfrom
quapka:build-rest-with-nix

Conversation

@quapka

@quapka quapka commented Jun 20, 2025

Copy link
Copy Markdown
Collaborator

Added simple wrappers around the Gradle build targets to build via Nix. The updates in the README.md are a bit lacking.

@quapka

quapka commented Jun 20, 2025

Copy link
Copy Markdown
Collaborator Author
  • Add building the new targets to CI pipeline

@quapka

quapka commented Jun 21, 2025

Copy link
Copy Markdown
Collaborator Author

I've tried cherry-picking 8c1bcb8, but building 2.2.1 version was failing anyways. The error was (both with ./gradlew :applet:buildJavaCard or when built via Nix):

[ant:compile] [REDACTED]/ec2/applet/src/main/java/cz/crcs/ectester/applet/EC_Consts.java:1487: warning: [fallthrough] possible fall-through into case
[ant:compile]             case X962_COMPRESSED: /* fallthrough */
[ant:compile]             ^
[ant:compile] 1 warning
[ant:convert] Verifier Error: Incorrect value of stop bit for exception handler 0

> Task :applet:buildJavaCard FAILED
[ant:cap] INFO: using JavaCard 2.2.1 SDK in [REDACTED]/ec2/ext/sdks/jc221_kit
[ant:cap] Building CAP with 1 applet from package cz.crcs.ectester.applet (AID: 4543546573746572)
[ant:cap] cz.crcs.ectester.applet.ECTesterApplet 454354657374657230333320323231
[ant:compile] Compiling files from [REDACTED]/ec2/applet/src/main/java
[ant:compile] Compiling 7 source files to /tmp/jccpro8394964778032680176

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':applet:buildJavaCard'.
> Java returned: 1

* 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 9.0.

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

For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 1s
1 actionable task: 1 executed

However, the 2.2.1 built successfully for me, when I used the epare branch. The changes for 2.2.1 will require updating the gradle.lock, which is produced by gradle2nix, in particular, the v2 version/branch from https://github.com/tadfisher/gradle2nix. I am using the following bash script (source from tadfisher/gradle2nix#77 (comment), with the last line removed):

# set JAVA_HOME for gradle2nix
# this is faster, but requires openjdk-21 in /nix/store
# export JAVA_HOME=$(ls -d /nix/store/*-openjdk-21* | grep -v '.drv$' | sort -V | tail -n1)
export JAVA_HOME=$(nix-build --no-out-link '<nixpkgs>' -A jdk21)

# nix run github:tadfisher/gradle2nix/v2
function gradle2nix() {
  nix run github:tadfisher/gradle2nix/v2 -- "$@"
}

quapka added 4 commits June 21, 2025 14:21
I've prefix the build path with a dot (`'.?submodules=1'` instead of
`'?submodules=1'`). With an older Nix, the dot was needed. Also,
the whole submodules part might not be necessary anymore, but I need it
on my local machines and thus prefer to keep it for now.
@J08nY

J08nY commented Jul 3, 2025

Copy link
Copy Markdown
Member

Can we merge this? Then epare can be merged afterwards and we can work out what is the issue with the 2.2.1.

@quapka

quapka commented Jul 14, 2025

Copy link
Copy Markdown
Collaborator Author

Can we merge this? Then epare can be merged afterwards and we can work out what is the issue with the 2.2.1.

Yes, it can be merged.

@J08nY
J08nY merged commit ba6657f into crocs-muni:master Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants