Refactor script files for multi-applet projects

This commit is contained in:
Manuel Thalmann 2023-11-03 15:50:46 +01:00
parent 300aec6d85
commit 6ef2140509
17 changed files with 50 additions and 37 deletions

27
.vscode/tasks.json vendored
View file

@ -4,27 +4,40 @@
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "Flash hwb1", "label": "Flash MyApplet",
"type": "shell", "type": "shell",
"command": "${workspaceFolder}/hwb1/scripts/flash.cmd", "command": "${workspaceFolder}/scripts/flash.cmd",
"options": {
"env": {
"PACKAGE": "hwb1",
"APPLET": "MyApplet",
"PARAMS": "31323334"
}
},
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"label": "List Applets", "label": "List Applets",
"type": "shell", "type": "shell",
"command": "${workspaceFolder}/hwb1/scripts/list.cmd", "command": "${workspaceFolder}/scripts/list.cmd",
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"label": "Test hwb1 Applet", "label": "Test MyApplet",
"type": "shell", "type": "shell",
"command": "${workspaceFolder}/hwb1/scripts/test.cmd", "command": "${workspaceFolder}/scripts/test.cmd",
"options": {
"env": {
"PACKAGE": "hwb1",
"APPLET": "MyApplet"
}
},
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"label": "Delete hwb1 Applet", "label": "Delete MyApplet",
"type": "shell", "type": "shell",
"command": "${workspaceFolder}/hwb1/scripts/delete.cmd", "command": "${workspaceFolder}/scripts/delete.cmd",
"problemMatcher": [] "problemMatcher": []
} }
] ]

View file

@ -1 +0,0 @@
gp --delete 01020304050608

View file

@ -1,5 +0,0 @@
@echo off
set PACKAGE=hwb1
set APPLET=MyApplet
set "JAVA_HOME=%JAVA8_HOME%"
set "path=%JAVA_HOME%\bin;%JC_HOME%\bin;%JC_HOME%\..;%JC_HOME%\..\GPShell-1.4.4;%path%"

View file

@ -1,4 +0,0 @@
SET PIN=31323334
@rem -f to force install over old version
gp --install %~dp0..\javacard\%PACKAGE%.cap --params %PIN% -f

View file

@ -1 +0,0 @@
gp --list

View file

@ -1 +0,0 @@
gpshell %~dp0test.txt

View file

@ -1,3 +0,0 @@
SET CARD_ROOT=%~dp0..\card
call %CARD_ROOT%\e222.cmd
call %CARD_ROOT%\delete.cmd

View file

@ -1,5 +0,0 @@
@echo off
SET CARD_ROOT=%~dp0..\card
call %CARD_ROOT%\e222.cmd
call %CARD_ROOT%\c222.cmd
call %CARD_ROOT%\install.cmd

View file

@ -1,4 +0,0 @@
@echo off
SET CARD_ROOT=%~dp0..\card
call %CARD_ROOT%\e222.cmd
call %CARD_ROOT%\list.cmd

View file

@ -1,4 +0,0 @@
@echo off
SET CARD_ROOT=%~dp0..\card
call %CARD_ROOT%\e222.cmd
call %CARD_ROOT%\test.cmd

View file

@ -1,3 +1,4 @@
@rem compile applet with JcDK 2.2.2 :: compile applet with JcDK 2.2.2
javac -g -target 1.1 -source 1.2 -cp %JC_HOME%\lib\api.jar -d . %~dp0../src/%PACKAGE%/*.java CALL %~dp0setup.cmd
javac -g -target 1.1 -source 1.2 -cp %JC_HOME%\lib\api.jar -d . %~dp0../%PACKAGE%/src/%PACKAGE%/*.java
converter -exportpath "%JC_HOME%\api_export_files" -applet 0x01:0x02:0x03:0x04:0x5:0x6:0x8:0x9 %PACKAGE%.%APPLET% %PACKAGE% 0x01:0x02:0x03:0x04:0x5:0x6:0x8 1.0 converter -exportpath "%JC_HOME%\api_export_files" -applet 0x01:0x02:0x03:0x04:0x5:0x6:0x8:0x9 %PACKAGE%.%APPLET% %PACKAGE% 0x01:0x02:0x03:0x04:0x5:0x6:0x8 1.0

2
scripts/delete.cmd Normal file
View file

@ -0,0 +1,2 @@
CALL %~dp0setup.cmd
gp --delete %ID%

5
scripts/flash.cmd Normal file
View file

@ -0,0 +1,5 @@
CALL %~dp0setup.cmd
CALL %~dp0compile.cmd
:: "-f" forces overwriting old versions of the package
gp --install %~dp0..\%PACKAGE%\javacard\%PACKAGE%.cap --params %PARAMS% -f

2
scripts/list.cmd Normal file
View file

@ -0,0 +1,2 @@
CALL %~dp0setup.cmd
gp --list

16
scripts/setup.cmd Normal file
View file

@ -0,0 +1,16 @@
:: Common Environment Variables
@echo off
:: To be defined externally
SET "PACKAGE=%PACKAGE%"
SET "APPLET=%APPLET%"
SET "PARAMS=%PARAMS%"
SET "JAVA8_HOME=%JAVA8_HOME%"
SET "JC_HOME=%JC_HOME%"
SET HEXID=0x01:0x02:0x03:0x04:0x5:0x6:0x8:0x9
SET ID=%HEXID:0x0=0%
SET ID=%ID:0x=0%
SET ID=%ID::=%
SET "JAVA_HOME=%JAVA8_HOME%"
SET "PATH=%JAVA_HOME%\bin;%JC_HOME%\bin;%JC_HOME%\..;%JC_HOME%\..\GPShell-1.4.4;%PATH%"

2
scripts/test.cmd Normal file
View file

@ -0,0 +1,2 @@
CALL %~dp0setup.cmd
gpshell %~dp0..\%PACKAGE%\tests\%APPLET%.txt