mirror of
https://github.com/DeLaGuardo/setup-clojure.git
synced 2025-01-14 02:18:07 +08:00
Properly identify java version (#60)
use `java -XshowSettings:properties -version` to find java version
This commit is contained in:
parent
8d08bc1a86
commit
54d8251fe9
50
.github/workflows/smoke-tests.yml
vendored
50
.github/workflows/smoke-tests.yml
vendored
@ -13,9 +13,6 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -23,7 +20,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install clojure tools-deps
|
- name: Install clojure tools-deps
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
tools-deps: 1.10.1.693
|
tools-deps: 1.10.1.693
|
||||||
@ -39,9 +36,6 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -49,7 +43,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install clojure tools-deps
|
- name: Install clojure tools-deps
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
cli: 1.10.1.693
|
cli: 1.10.1.693
|
||||||
@ -68,9 +62,6 @@ jobs:
|
|||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -78,7 +69,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install clojure tools-deps
|
- name: Install clojure tools-deps
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
cli: 'latest'
|
cli: 'latest'
|
||||||
@ -100,9 +91,6 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -110,7 +98,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install leiningen
|
- name: Install leiningen
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
lein: 2.9.1
|
lein: 2.9.1
|
||||||
@ -127,9 +115,6 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -137,7 +122,7 @@ jobs:
|
|||||||
java-version: '11'
|
java-version: '11'
|
||||||
|
|
||||||
- name: Install boot
|
- name: Install boot
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
boot: 2.8.3
|
boot: 2.8.3
|
||||||
@ -154,9 +139,6 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -164,7 +146,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install babashka
|
- name: Install babashka
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
bb: latest
|
bb: latest
|
||||||
@ -181,9 +163,6 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -191,7 +170,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install clj-kondo
|
- name: Install clj-kondo
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
clj-kondo: latest
|
clj-kondo: latest
|
||||||
@ -208,9 +187,6 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -218,7 +194,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install cljstyle
|
- name: Install cljstyle
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
cljstyle: latest
|
cljstyle: latest
|
||||||
@ -236,9 +212,6 @@ jobs:
|
|||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -246,7 +219,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install zprint
|
- name: Install zprint
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
zprint: latest
|
zprint: latest
|
||||||
@ -259,9 +232,6 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Prepare java
|
- name: Prepare java
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@ -269,7 +239,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install all the tools
|
- name: Install all the tools
|
||||||
uses: DeLaGuardo/setup-clojure@main
|
uses: DeLaGuardo/setup-clojure@issue-59
|
||||||
# uses: ./
|
# uses: ./
|
||||||
with:
|
with:
|
||||||
cli: 1.11.1.1149
|
cli: 1.11.1.1149
|
||||||
|
@ -45,7 +45,7 @@ jobs:
|
|||||||
java-version: '8'
|
java-version: '8'
|
||||||
|
|
||||||
- name: Install clojure tools
|
- name: Install clojure tools
|
||||||
uses: DeLaGuardo/setup-clojure@9.0
|
uses: DeLaGuardo/setup-clojure@9.1
|
||||||
with:
|
with:
|
||||||
# Install just one or all simultaneously
|
# Install just one or all simultaneously
|
||||||
# The value must indicate a particular version of the tool, or use 'latest'
|
# The value must indicate a particular version of the tool, or use 'latest'
|
||||||
|
BIN
dist/JavaVersion.class
vendored
BIN
dist/JavaVersion.class
vendored
Binary file not shown.
18
dist/index.js
vendored
18
dist/index.js
vendored
@ -238,16 +238,20 @@ function installBoot(binScript, destinationFolder, version) {
|
|||||||
}
|
}
|
||||||
function setWindowsRegistry() {
|
function setWindowsRegistry() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let java_version = '';
|
let outString = '';
|
||||||
yield exec.exec(`java -cp dist JavaVersion`, [], {
|
yield exec.exec(`java -XshowSettings:properties -version`, [], {
|
||||||
listeners: {
|
listeners: {
|
||||||
stdout: (data) => {
|
stderr: (data) => {
|
||||||
java_version += data.toString();
|
outString += data.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
yield 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);
|
||||||
yield 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];
|
||||||
|
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`);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1137,7 +1141,7 @@ exports.isMacOS = isMacOS;
|
|||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
exports.VERSION = void 0;
|
exports.VERSION = void 0;
|
||||||
exports.VERSION = '9-0';
|
exports.VERSION = '9-1';
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
5
dist/javaVersion.java
vendored
5
dist/javaVersion.java
vendored
@ -1,5 +0,0 @@
|
|||||||
class JavaVersion {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
System.out.println(System.getProperty("java.version"));
|
|
||||||
}
|
|
||||||
}
|
|
30
src/boot.ts
30
src/boot.ts
@ -132,23 +132,29 @@ async function installBoot(
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function setWindowsRegistry(): Promise<void> {
|
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: {
|
listeners: {
|
||||||
stdout: (data: Buffer) => {
|
stderr: (data: Buffer) => {
|
||||||
java_version += data.toString()
|
outString += data.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await exec.exec(
|
const m = outString.match(/^\s*java\.version = (.*)$/m)
|
||||||
`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment" /v CurrentVersion /d ${java_version.trim()} /f`
|
|
||||||
)
|
|
||||||
|
|
||||||
await exec.exec(
|
if (m) {
|
||||||
`reg add "HKLM\\SOFTWARE\\JavaSoft\\Java Runtime Environment\\${java_version.trim()}" /v JavaHome /d "${
|
const java_version = m[1]
|
||||||
process.env['JAVA_HOME']
|
|
||||||
}" /f`
|
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`
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
export const VERSION = '9-0'
|
export const VERSION = '9-1'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user