Skip to content

Commit

Permalink
Merge pull request #1636 from arturo-lang/add-tests-for-bundling
Browse files Browse the repository at this point in the history
Fix bundler issues on Windows
  • Loading branch information
drkameleon authored May 20, 2024
2 parents c99c6bf + 90a2558 commit 28965c2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
run: |
echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
./bin/arturo tools/tester.art
# curl -L https://arturo-lang.s3.amazonaws.com/libcrypto-1_1-x64.dll -o libcrypto-1_1-x64.dll
Expand Down
20 changes: 15 additions & 5 deletions src/vm/bundle/generator.nim
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ proc copyDirRecursively(source: string, dest: string) =
copyFile(path, dest / noSource, {cfSymlinkAsIs})

proc commandExists(cmd: string) =
let (_, exitCode) = execCmdEx("[ -x \"$(command -v " & cmd & ")\" ]")
if exitCode != 0:
if findExe(cmd) == "":
echo "\t`" & cmd & "` command required; cannot proceed!"
quit(1)
# let (_, exitCode) = execCmdEx("[ -x \"$(command -v " & cmd & ")\" ]")
# if exitCode != 0:
# echo "\t`" & cmd & "` command required; cannot proceed!"
# quit(1)

proc startVM() =
var str = ""
Expand Down Expand Up @@ -368,15 +371,22 @@ proc buildExecutable(conf: BundleConfig) =
if forceFull:
mode = ""

let (outp, res) = execCmdEx("./build.nims build " & conf.configFile() & " --bundle " & mode & " " & forceFlags & " --log --as " & conf.name)
if res != 0:
let (outp, err) = execCmdEx("nim build.nims build " & conf.configFile() & " --bundle " & mode & " " & forceFlags & " --log --as " & conf.name)

if err != 0:
echo "\tSomething went wrong went building the project..."
echo outp
quit(1)

setCurrentDir(currentFolder)

copyFile(TmpFolder / "bin" / conf.name, currentFolder / conf.name)
let finalName =
when defined(windows):
conf.name & ".exe"
else:
conf.name

copyFile(TmpFolder / "bin" / finalName, currentFolder / finalName)

proc cleanUp() =
removeDir(TmpFolder)
Expand Down

0 comments on commit 28965c2

Please sign in to comment.