Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boot support for MS-Windows #57

Closed
ikappaki opened this issue Jul 16, 2022 · 10 comments · Fixed by #58
Closed

boot support for MS-Windows #57

ikappaki opened this issue Jul 16, 2022 · 10 comments · Fixed by #58

Comments

@ikappaki
Copy link
Contributor

ikappaki commented Jul 16, 2022

Hi,

is there a technical reason why boot is not supported for MS-Windows? boot.exe appears to behave similar to boot.sh which is currently in use. Both available from the same source at https://github.com/boot-clj/boot-bin/releases.

      - name: Get boot version
        # Boot is not yet available for windows
        if: ${{ matrix.os != 'windows-latest' }}
        run: boot -V

Thanks

@zharinov
Copy link
Contributor

Just tried to set it up in Windows and here is what I see from action log:

D:\a\_temp\temp_321409018\boot\bin\boot.exe -u
This application requires a Java Runtime Environment 1.7.0
Error: The process 'D:\a\_temp\temp_321409018\boot\bin\boot.exe' failed with exit code 1

This problem brought me here: boot-clj/boot#694

Seems like it's more complicated than just downloading and executing .exe instead of .sh.

@ikappaki
Copy link
Contributor Author

I have been playing around with boot.exe in a github action and it appears this is a known issue:

boot-clj/boot#721

The launch4j wrapper used to create the executable tries to locate a JAVAHome entry in the windows registry, but modern distributions do not add this entry.

A hack that I've tested to work with Java 1.8 in a GH action is to add the entry in the registry using the reg command tool (example below is from running the command in PowerShell):

reg add "HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.8" /v JAVAHome /d "$env:JAVA_HOME" /f

Would you by any chance entertain the idea to add this to the action so as to make boot also work on windows? Needs to figure out how to retrieve the java version at runtime.

Boot development appears to have stopped, and the project that creates these executables have been archived, with no sign of the replacement project being either ever used or active.

https://github.com/boot-clj/boot-bin

Thanks

@zharinov
Copy link
Contributor

As an alternative, reg command can be called as an additional step being performed only for Windows platform

@ikappaki
Copy link
Contributor Author

ikappaki commented Jul 18, 2022

As an alternative, reg command can be called as an additional step being performed only for Windows platform

sorry, are you suggesting that this should be done as an additional step inside the SetupClojure action or should the user do this as a hack prior to calling SetupClojure? I was suggesting the first, thanks

@zharinov
Copy link
Contributor

I mean, the quickest workaround possible is to add manual step that fixes Windows registry issue. Personally, I would like to make it work out of the box, but can't guarantee this as soon as possible.

@ikappaki
Copy link
Contributor Author

I mean, the quickest workaround possible is to add manual step that fixes Windows registry issue. Personally, I would like to make it work out of the box, but can't guarantee this as soon as possible.

Sure no problem, I can have a look also but will also take me some time.

Currently it won't work even if I add this step because setup-clojure fails with an error message saying it's not yet supported on windows.

In the meantime, one can use the following powershell template to install boot:

  name: test

on:
  push:

jobs:
  unit-test:
    runs-on: ${{matrix.os}}
    strategy:
      fail-fast: false
      matrix:
        os: [windows-latest]
    steps:
      - uses: actions/checkout@v2.2.0
        with:
          fetch-depth: 0

      - name: Set up JDK
        uses: actions/setup-java@v1
        with:
          java-version: '8'

      - name: Install boot on MS-Windows
        if: ${{ matrix.os == 'windows-latest' }}
        run: |
          $env:BOOT_BIN_DIR="$HOME\.boot\bin"

          if (!(Test-Path $env:BOOT_BIN_DIR)) {new-item "$env:BOOT_BIN_DIR" -ItemType directory}
          iwr -Uri https://github.com/boot-clj/boot-bin/releases/download/latest/boot.exe `
          -outfile $env:BOOT_BIN_DIR/boot.exe
          echo $env:BOOT_BIN_DIR | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
          reg add "HKLM\SOFTWARE\JavaSoft\Java Development Kit\1.8" /v JAVAHome /d "$env:JAVA_HOME" /f
          & "$env:BOOT_BIN_DIR/boot.exe" -V

@DeLaGuardo
Copy link
Owner

I made a PR with a workaround to install boot on windows, but it doesn't work:

 D:\a\_temp\temp_1396401336\boot\bin\boot.exe -V
This application requires a Java Runtime Environment 1.7.0
The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.

@ikappaki
Copy link
Contributor Author

I made a PR with a workaround to install boot on windows, but it doesn't work:

 D:\a\_temp\temp_1396401336\boot\bin\boot.exe -V
This application requires a Java Runtime Environment 1.7.0
The registry refers to a nonexistent Java Runtime Environment installation or the runtime is corrupted.

Hi, apologies I should have made it clear that the "$env:JAVA_JOME" part of the command should be replaced with the contents of the JAVA_HOME environment variable. The $env:JAVA_HOME is how you do this on PowerShell.

Thanks,

@DeLaGuardo
Copy link
Owner

Hi, apologies I should have made it clear that the "$env:JAVA_JOME" part of the command should be replaced with the contents of the JAVA_HOME environment variable. The $env:JAVA_HOME is how you do this on PowerShell.

Thanks,

Perfect, thanks! Now I confirm this workaround works in the PR.

@DeLaGuardo
Copy link
Owner

However the workaround depends on a java version available at JAVA_HOME so the solution is not complete yet. Will try to fix it later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants