fix for #2885 - output correct JAVA env setters in Windows bash sessions #2886
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implements the changes required for using
cs.exe
to set java environment variables in bash scripts, as described in #2885.When running
cs java --env
and similar commands from abash
session, this PR produces the output format for shell environments. Currently, inWindows
, the output is inbatch
file format, preventing shell scripts from usingcs.exe
to setJAVA_HOME
andPATH
.In
Windows
, if env varOSTYPE
is set,posix
shell format is assumed, andbatch file
format otherwise. So it will be possible to use the.bat
file (e.g.,mill.bat
) ifOSTYPE
is unset and the batch file is made executable. Running from aCMD.EXE
session is not affected.The following
Windows MINGW64 bash
sessions show the new and old format:The
Windows
batch file format results if OSTYPE is unset:The output of a successful run of
.github/scripts/generate-os-packages.sh
script is shown below.[2/7] Performing analysis... [*****] (49.6s @ 2.61GB)
16,254 (91.62%) of 17,740 classes reachable
20,683 (65.68%) of 31,492 fields reachable
73,786 (45.76%) of 161,242 methods reachable
396 classes, 121 fields, and 2,148 methods registered for reflection
81 classes, 74 fields, and 67 methods registered for JNI access
8 native libraries: advapi32, crypt32, ncrypt, ole32, psapi, shell32, version, winhttp
[3/7] Building universe... (5.5s @ 1.38GB)
[4/7] Parsing methods... [] (2.9s @ 2.12GB)
[5/7] Inlining methods... [] (1.4s @ 4.10GB)
[6/7] Compiling methods... [] (19.9s @ 3.30GB)
[7/7] Creating image... (4.1s @ 5.02GB)
28.15MB (47.42%) for code area: 44,926 compilation units
30.70MB (51.73%) for image heap: 302,862 objects and 16 resources
515.92KB ( 0.85%) for other data
59.36MB in total
Top 10 packages in code area: Top 10 object types in image heap:
1.48MB sun.security.ssl 5.90MB java.lang.Class
930.33KB java.util 5.59MB byte[] for code metadata
850.31KB coursier.install 5.15MB byte[] for java.lang.String
756.27KB java.lang.invoke 2.71MB java.lang.String
740.36KB coursier.core 2.40MB byte[] for general heap data
720.15KB coursier.cli.options 1.24MB com.oracle.svm.core.hub.DynamicHubCompanion
701.31KB com.sun.crypto.provider 880.14KB byte[] for embedded resources
691.15KB coursier.cli.install 754.61KB byte[] for reflection metadata
614.45KB scala.collection.immutable 598.32KB c.o.svm.core.hub.DynamicHub$ReflectionMetadata
471.36KB sun.security.x509 575.80KB java.lang.String[]
20.00MB for 386 more packages 4.63MB for 5011 more object types
Produced artifacts:
C:\Users\user\workspace\coursier-fork\out\cli\2.12.18\base-image\nativeImage.dest\cs.build_artifacts.txt (txt)
C:\Users\user\workspace\coursier-fork\out\cli\2.12.18\base-image\nativeImage.dest\cs.exe (executable)
Finished generating 'cs' in 1m 41s.
[512/512] copyTo
7-Zip [64] 17.05 : Copyright (c) 1999-2021 Igor Pavlov : 2017-08-28
p7zip Version 17.05 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,12 CPUs Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz (A0653),ASM,AES-NI)
Scanning the drive:
2 folders, 1 file, 62238720 bytes (60 MiB)
Creating archive: cs-x86_64-pc-win32-sdk.zip
Items to compress: 3
Files read from disk: 1
Archive size: 19730190 bytes (19 MiB)
Everything is Ok