@@ -92,12 +92,12 @@ final class BundleSupport {
9292 boolean loadBundle ;
9393 boolean writeBundle ;
9494
95- private static final int bundleFileFormatVersionMajor = 0 ;
96- private static final int bundleFileFormatVersionMinor = 9 ;
95+ private static final int BUNDLE_FILE_FORMAT_VERSION_MAJOR = 0 ;
96+ private static final int BUNDLE_FILE_FORMAT_VERSION_MINOR = 9 ;
9797
98- private static final String bundleInfoMessagePrefix = "GraalVM Native Image Bundle Support: " ;
99- private static final String bundleTempDirPrefix = "bundleRoot-" ;
100- private static final String originalDirExtension = ".orig" ;
98+ private static final String BUNDLE_INFO_MESSAGE_PREFIX = "GraalVM Native Image Bundle Support: " ;
99+ private static final String BUNDLE_TEMP_DIR_PREFIX = "bundleRoot-" ;
100+ private static final String ORIGINAL_DIR_EXTENSION = ".orig" ;
101101
102102 private Path bundlePath ;
103103 private String bundleName ;
@@ -154,7 +154,7 @@ static BundleSupport create(NativeImage nativeImage, String bundleArg, NativeIma
154154 for (int i = buildArgs .size () - 1 ; i >= 0 ; i --) {
155155 args .push (buildArgs .get (i ));
156156 }
157- nativeImage .showVerboseMessage (nativeImage .isVerbose (), bundleInfoMessagePrefix + "Inject args: '" + String .join (" " , buildArgs ) + "'" );
157+ nativeImage .showVerboseMessage (nativeImage .isVerbose (), BUNDLE_INFO_MESSAGE_PREFIX + "Inject args: '" + String .join (" " , buildArgs ) + "'" );
158158 /* Snapshot args after in-place expansion (includes also args after this one) */
159159 bundleSupport .updatedBuildArgs = args .snapshot ();
160160 break ;
@@ -193,7 +193,7 @@ private BundleSupport(NativeImage nativeImage) {
193193 loadBundle = false ;
194194 writeBundle = true ;
195195 try {
196- rootDir = Files .createTempDirectory (bundleTempDirPrefix );
196+ rootDir = Files .createTempDirectory (BUNDLE_TEMP_DIR_PREFIX );
197197 bundleProperties = new BundleProperties ();
198198
199199 Path inputDir = rootDir .resolve ("input" );
@@ -222,11 +222,11 @@ private BundleSupport(NativeImage nativeImage, String bundleFilenameArg) {
222222 updateBundleLocation (Path .of (bundleFilenameArg ), false );
223223
224224 try {
225- rootDir = Files .createTempDirectory (bundleTempDirPrefix );
225+ rootDir = Files .createTempDirectory (BUNDLE_TEMP_DIR_PREFIX );
226226 bundleProperties = new BundleProperties ();
227227
228228 outputDir = rootDir .resolve ("output" );
229- String originalOutputDirName = outputDir .getFileName ().toString () + originalDirExtension ;
229+ String originalOutputDirName = outputDir .getFileName ().toString () + ORIGINAL_DIR_EXTENSION ;
230230
231231 Path bundleFilePath = bundlePath .resolve (bundleName + BUNDLE_FILE_EXTENSION );
232232 try (JarFile archive = new JarFile (bundleFilePath .toFile ())) {
@@ -497,14 +497,14 @@ void complete() {
497497 Path externalOutputDir = bundlePath .resolve (bundleName + "." + outputDir .getFileName ());
498498 copyFiles (outputDir , externalOutputDir , true );
499499 outputNewline .run ();
500- nativeImage .showMessage (bundleInfoMessagePrefix + "Bundle build output written to " + externalOutputDir );
500+ nativeImage .showMessage (BUNDLE_INFO_MESSAGE_PREFIX + "Bundle build output written to " + externalOutputDir );
501501 }
502502
503503 try {
504504 if (writeBundle ) {
505505 Path bundleFilePath = writeBundle ();
506506 outputNewline .run ();
507- nativeImage .showMessage (bundleInfoMessagePrefix + "Bundle written to " + bundleFilePath );
507+ nativeImage .showMessage (BUNDLE_INFO_MESSAGE_PREFIX + "Bundle written to " + bundleFilePath );
508508 }
509509 } finally {
510510 nativeImage .showNewline ();
@@ -550,7 +550,7 @@ void updateBundleLocation(Path bundleFile, boolean redefine) {
550550 }
551551
552552 private Path writeBundle () {
553- String originalOutputDirName = outputDir .getFileName ().toString () + originalDirExtension ;
553+ String originalOutputDirName = outputDir .getFileName ().toString () + ORIGINAL_DIR_EXTENSION ;
554554 Path originalOutputDir = rootDir .resolve (originalOutputDirName );
555555 if (Files .exists (originalOutputDir )) {
556556 nativeImage .deleteAllFiles (originalOutputDir );
@@ -589,10 +589,10 @@ private Path writeBundle() {
589589 if (buildArg .startsWith (nativeImage .oHPath )) {
590590 continue ;
591591 }
592- if (buildArg .equals (CmdLineOptionHandler .verboseOption )) {
592+ if (buildArg .equals (CmdLineOptionHandler .VERBOSE_OPTION )) {
593593 continue ;
594594 }
595- if (buildArg .equals (CmdLineOptionHandler .dryRunOption )) {
595+ if (buildArg .equals (CmdLineOptionHandler .DRY_RUN_OPTION )) {
596596 continue ;
597597 }
598598 if (buildArg .startsWith ("-Dllvm.bin.dir=" )) {
@@ -737,11 +737,11 @@ private void loadAndVerify() {
737737 fileVersionKey = PROPERTY_KEY_BUNDLE_FILE_VERSION_MINOR ;
738738 int minor = Integer .parseInt (properties .getOrDefault (fileVersionKey , "-1" ));
739739 String message = String .format ("The given bundle file %s was created with newer bundle-file-format version %d.%d" +
740- " (current %d.%d). Update to the latest version of native-image." , bundleFileName , major , minor , bundleFileFormatVersionMajor , bundleFileFormatVersionMinor );
741- if (major > bundleFileFormatVersionMajor ) {
740+ " (current %d.%d). Update to the latest version of native-image." , bundleFileName , major , minor , BUNDLE_FILE_FORMAT_VERSION_MAJOR , BUNDLE_FILE_FORMAT_VERSION_MINOR );
741+ if (major > BUNDLE_FILE_FORMAT_VERSION_MAJOR ) {
742742 throw NativeImage .showError (message );
743- } else if (major == bundleFileFormatVersionMajor ) {
744- if (minor > bundleFileFormatVersionMinor ) {
743+ } else if (major == BUNDLE_FILE_FORMAT_VERSION_MAJOR ) {
744+ if (minor > BUNDLE_FILE_FORMAT_VERSION_MINOR ) {
745745 NativeImage .showWarning (message );
746746 }
747747 }
@@ -761,14 +761,14 @@ private void loadAndVerify() {
761761 localDateStr = "unknown time" ;
762762 }
763763 nativeImage .showNewline ();
764- nativeImage .showMessage (String .format ("%sLoaded Bundle from %s" , bundleInfoMessagePrefix , bundleFileName ));
765- nativeImage .showMessage (String .format ("%sBundle created at '%s'" , bundleInfoMessagePrefix , localDateStr ));
766- nativeImage .showMessage (String .format ("%sUsing version: '%s'%s on platform: '%s'%s" , bundleInfoMessagePrefix , bundleVersion , currentVersion , bundlePlatform , currentPlatform ));
764+ nativeImage .showMessage (String .format ("%sLoaded Bundle from %s" , BUNDLE_INFO_MESSAGE_PREFIX , bundleFileName ));
765+ nativeImage .showMessage (String .format ("%sBundle created at '%s'" , BUNDLE_INFO_MESSAGE_PREFIX , localDateStr ));
766+ nativeImage .showMessage (String .format ("%sUsing version: '%s'%s on platform: '%s'%s" , BUNDLE_INFO_MESSAGE_PREFIX , bundleVersion , currentVersion , bundlePlatform , currentPlatform ));
767767 }
768768
769769 private void write () {
770- properties .put (PROPERTY_KEY_BUNDLE_FILE_VERSION_MAJOR , String .valueOf (bundleFileFormatVersionMajor ));
771- properties .put (PROPERTY_KEY_BUNDLE_FILE_VERSION_MINOR , String .valueOf (bundleFileFormatVersionMinor ));
770+ properties .put (PROPERTY_KEY_BUNDLE_FILE_VERSION_MAJOR , String .valueOf (BUNDLE_FILE_FORMAT_VERSION_MAJOR ));
771+ properties .put (PROPERTY_KEY_BUNDLE_FILE_VERSION_MINOR , String .valueOf (BUNDLE_FILE_FORMAT_VERSION_MINOR ));
772772 properties .put (PROPERTY_KEY_BUNDLE_FILE_CREATION_TIMESTAMP , ZonedDateTime .now ().format (DateTimeFormatter .ISO_DATE_TIME ));
773773 boolean imageBuilt = !nativeImage .isDryRun ();
774774 properties .put (PROPERTY_KEY_IMAGE_BUILT , String .valueOf (imageBuilt ));
0 commit comments