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

Properly identify java version #60

Merged
merged 4 commits into from
Jul 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 10 additions & 40 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
tools-deps: 1.10.1.693
Expand All @@ -39,17 +36,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
cli: 1.10.1.693
Expand All @@ -68,17 +62,14 @@ jobs:
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install clojure tools-deps
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
cli: 'latest'
Expand All @@ -100,17 +91,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install leiningen
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
lein: 2.9.1
Expand All @@ -127,17 +115,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Install boot
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
boot: 2.8.3
Expand All @@ -154,17 +139,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install babashka
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
bb: latest
Expand All @@ -181,17 +163,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install clj-kondo
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
clj-kondo: latest
Expand All @@ -208,17 +187,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install cljstyle
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
cljstyle: latest
Expand All @@ -236,17 +212,14 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install zprint
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
zprint: latest
Expand All @@ -259,17 +232,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Prepare java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '8'

- name: Install all the tools
uses: DeLaGuardo/setup-clojure@main
uses: DeLaGuardo/setup-clojure@issue-59
# uses: ./
with:
cli: 1.11.1.1149
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
java-version: '8'

- name: Install clojure tools
uses: DeLaGuardo/setup-clojure@9.0
uses: DeLaGuardo/setup-clojure@9.1
with:
# Install just one or all simultaneously
# The value must indicate a particular version of the tool, or use 'latest'
Expand Down
Binary file removed dist/JavaVersion.class
Binary file not shown.
18 changes: 11 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,20 @@ function installBoot(binScript, destinationFolder, version) {
}
function setWindowsRegistry() {
return __awaiter(this, void 0, void 0, function* () {
let java_version = '';
yield exec.exec(`java -cp dist JavaVersion`, [], {
let outString = '';
yield exec.exec(`java -XshowSettings:properties -version`, [], {
listeners: {
stdout: (data) => {
java_version += data.toString();
stderr: (data) => {
outString += data.toString();
}
}
});
yield exec.exec(`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment" /v CurrentVersion /d ${java_version.trim()} /f`);
yield exec.exec(`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\${java_version.trim()}" /v JavaHome /d "${process.env['JAVA_HOME']}" /f`);
const m = outString.match(/^\s*java\.version = (.*)$/m);
if (m) {
const java_version = m[1];
yield exec.exec(`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment" /v CurrentVersion /d ${java_version.trim()} /f`);
yield exec.exec(`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\${java_version.trim()}" /v JavaHome /d "${process.env['JAVA_HOME']}" /f`);
}
});
}

Expand Down Expand Up @@ -1137,7 +1141,7 @@ exports.isMacOS = isMacOS;

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.VERSION = void 0;
exports.VERSION = '9-0';
exports.VERSION = '9-1';


/***/ }),
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions dist/javaVersion.java

This file was deleted.

30 changes: 18 additions & 12 deletions src/boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,29 @@ async function installBoot(
}

async function setWindowsRegistry(): Promise<void> {
let java_version = ''
let outString = ''

await exec.exec(`java -cp dist JavaVersion`, [], {
await exec.exec(`java -XshowSettings:properties -version`, [], {
listeners: {
stdout: (data: Buffer) => {
java_version += data.toString()
stderr: (data: Buffer) => {
outString += data.toString()
}
}
})

await exec.exec(
`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment" /v CurrentVersion /d ${java_version.trim()} /f`
)
const m = outString.match(/^\s*java\.version = (.*)$/m)

await exec.exec(
`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\${java_version.trim()}" /v JavaHome /d "${
process.env['JAVA_HOME']
}" /f`
)
if (m) {
const java_version = m[1]

await exec.exec(
`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment" /v CurrentVersion /d ${java_version.trim()} /f`
)

await exec.exec(
`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\${java_version.trim()}" /v JavaHome /d "${
process.env['JAVA_HOME']
}" /f`
)
}
}
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '9-0'
export const VERSION = '9-1'