-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcompile.bat
60 lines (50 loc) · 1.61 KB
/
compile.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
@echo off
setlocal
set "archive_path=Niva\Niva\build\distributions\niva-SNAPSHOT-1.0.zip"
@REM if "%1"=="" (
@REM echo use jvm or bin argument
@REM exit /b 1
@REM )
cd .\Niva\Niva\
call .\gradlew.bat distZip -quiet
cd ..\..
powershell -Command "Expand-Archive -Path '%archive_path%' -DestinationPath niva_compiler -Force"
@REM if "%1"=="jvm" (
echo jvm build...
cd niva_compiler\niva-SNAPSHOT-1.0\bin\
mkdir "%USERPROFILE%\.niva\infroProject"
xcopy /E /I /Y /Q ..\..\..\Niva\infroProject "%USERPROFILE%\.niva\infroProject"
@REM )
if "%1"=="bin" (
echo binary version is not supported on Windows yet, use Linux
exit /b 1
echo Building binary...
where native-image >nul 2>nul
if errorlevel 1 (
echo cant find native-image, on Arch linux do 'yay -S jdk21-graalvm-bin', 'nix shell nixpkgs#graalvm-ce' on nix
exit /b 1
)
cd niva_compiler\niva-SNAPSHOT-1.0\lib\
native-image --static --no-fallback -O3 -march=compatibility --initialize-at-build-time --class-path annotations-13.0.jar;kotlin-stdlib-1.9.20.jar;niva-jvm-SNAPSHOT-1.0.jar main.MainKt -o niva
move niva ..\..
cd ..\..
mkdir "%USERPROFILE%\.niva\infroProject"
xcopy /E /I /Y ..\Niva\infroProject "%USERPROFILE%\.niva\infroProject"
rmdir /s /q niva-SNAPSHOT-1.0
)
(
echo type Person name: String age: Int
echo Person say::String = (name + " saying " + say^) echo
echo person = Person name: "Alice" age: 24
echo person say: "Hello world!"
echo list = {1 2 3}
echo list2 = list filter: [it ^> 1]
echo ^>list
) > main.scala
if "%1"=="bin" (
.\niva main.scala
)
@REM if "%1"=="jvm" (
call .\niva.bat main.scala
@REM )
pause