Advertisement
Guest User

Untitled

a guest
May 28th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.28 KB | None | 0 0
  1. @ECHO OFF
  2.  
  3. rem ------ ENVIRONMENT --------------------------------------------------------
  4. rem The script depends on various environment variables to exist in order to
  5. rem run properly. The java version we want to use, the location of the java
  6. rem binaries (java home), and the project version as defined inside the pom.xml
  7. rem file, e.g. 1.0-SNAPSHOT.
  8. rem
  9. rem PROJECT_VERSION: version used in pom.xml, e.g. 1.0-SNAPSHOT
  10. rem APP_VERSION: the application version, e.g. 1.0.0, shown in "about" dialog
  11.  
  12. set JAVA_VERSION=13
  13. set MAIN_JAR=ZKP_Inspector-%PROJECT_VERSION%.jar
  14.  
  15. rem Set desired installer type: "app-image" "msi" "exe".
  16. set INSTALLER_TYPE=msi
  17.  
  18. rem ------ SETUP DIRECTORIES AND FILES ----------------------------------------
  19. rem Remove previously generated java runtime and installers. Copy all required
  20. rem jar files into the input/libs folder.
  21.  
  22. IF EXIST target\java-runtime rmdir /S /Q  .\target\java-runtime
  23. IF EXIST target\installer rmdir /S /Q target\installer
  24.  
  25. xcopy /S /Q target\libs\* target\installer\input\libs\
  26. copy target\%MAIN_JAR% target\installer\input\libs\
  27.  
  28. rem ------ REQUIRED MODULES ---------------------------------------------------
  29. rem Use jlink to detect all modules that are required to run the application.
  30. rem Starting point for the jdep analysis is the set of jars being used by the
  31. rem application.
  32.  
  33. echo detecting required modules
  34.  
  35. "%JAVA_HOME%\bin\jdeps" ^
  36.   --multi-release %JAVA_VERSION% ^
  37.   --ignore-missing-deps ^
  38.   --class-path "target\installer\input\libs\*" ^
  39.   --print-module-deps target\classes\main\Main.class > temp.txt
  40.  
  41. set /p detected_modules=<temp.txt
  42.  
  43. echo detected modules: %detected_modules%
  44.  
  45. rem ------ MANUAL MODULES -----------------------------------------------------
  46. rem jdk.crypto.ec has to be added manually bound via --bind-services or
  47. rem otherwise HTTPS does not work.
  48. rem
  49. rem See: https://bugs.openjdk.java.net/browse/JDK-8221674
  50.  
  51. set manual_modules=jdk.crypto.ec
  52. echo manual modules: %manual_modules%
  53.  
  54. rem ------ RUNTIME IMAGE ------------------------------------------------------
  55. rem Use the jlink tool to create a runtime image for our application. We are
  56. rem doing this is a separate step instead of letting jlink do the work as part
  57. rem of the jpackage tool. This approach allows for finer configuration and also
  58. rem works with dependencies that are not fully modularized, yet.
  59.  
  60. echo creating java runtime image
  61.  
  62. call "%JAVA_HOME%\bin\jlink" ^
  63.   --no-header-files ^
  64.   --no-man-pages ^
  65.   --compress=2 ^
  66.   --strip-debug ^
  67.   --add-modules %detected_modules%,%manual_modules% ^
  68.   --output target/java-runtime
  69.  
  70.  
  71. rem ------ PACKAGING ----------------------------------------------------------
  72. rem In the end we will find the package inside the target/installer directory.
  73.  
  74. call "%JAVA_HOME%\bin\jpackage" ^
  75.   --type %INSTALLER_TYPE% ^
  76.   --dest target/installer ^
  77.   --input target/installer/input/libs ^
  78.   --name ZeroKnowledgeProofInspector ^
  79.   --main-class main.AppLauncher ^
  80.   --main-jar %MAIN_JAR% ^
  81.   --java-options -Xmx2048m ^
  82.   --runtime-image target/java-runtime ^
  83.   --icon src/main/logo/windows/duke.ico ^
  84.   --app-version %APP_VERSION% ^
  85.   --vendor "ACME Inc." ^
  86.   --copyright "Copyright © 2019-20 ACME Inc." ^
  87.   --win-dir-chooser ^
  88.   --win-shortcut ^
  89.   --win-per-user-install ^
  90.   --win-menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement