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 }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -23,7 +20,7 @@ jobs:
|
||||
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
|
||||
@ -39,9 +36,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -49,7 +43,7 @@ jobs:
|
||||
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
|
||||
@ -68,9 +62,6 @@ jobs:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -78,7 +69,7 @@ jobs:
|
||||
java-version: '8'
|
||||
|
||||
- name: Install clojure tools-deps
|
||||
uses: DeLaGuardo/setup-clojure@main
|
||||
uses: DeLaGuardo/setup-clojure@issue-59
|
||||
# uses: ./
|
||||
with:
|
||||
cli: 'latest'
|
||||
@ -100,9 +91,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -110,7 +98,7 @@ jobs:
|
||||
java-version: '8'
|
||||
|
||||
- name: Install leiningen
|
||||
uses: DeLaGuardo/setup-clojure@main
|
||||
uses: DeLaGuardo/setup-clojure@issue-59
|
||||
# uses: ./
|
||||
with:
|
||||
lein: 2.9.1
|
||||
@ -127,9 +115,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -137,7 +122,7 @@ jobs:
|
||||
java-version: '11'
|
||||
|
||||
- name: Install boot
|
||||
uses: DeLaGuardo/setup-clojure@main
|
||||
uses: DeLaGuardo/setup-clojure@issue-59
|
||||
# uses: ./
|
||||
with:
|
||||
boot: 2.8.3
|
||||
@ -154,9 +139,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -164,7 +146,7 @@ jobs:
|
||||
java-version: '8'
|
||||
|
||||
- name: Install babashka
|
||||
uses: DeLaGuardo/setup-clojure@main
|
||||
uses: DeLaGuardo/setup-clojure@issue-59
|
||||
# uses: ./
|
||||
with:
|
||||
bb: latest
|
||||
@ -181,9 +163,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -191,7 +170,7 @@ jobs:
|
||||
java-version: '8'
|
||||
|
||||
- name: Install clj-kondo
|
||||
uses: DeLaGuardo/setup-clojure@main
|
||||
uses: DeLaGuardo/setup-clojure@issue-59
|
||||
# uses: ./
|
||||
with:
|
||||
clj-kondo: latest
|
||||
@ -208,9 +187,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -218,7 +194,7 @@ jobs:
|
||||
java-version: '8'
|
||||
|
||||
- name: Install cljstyle
|
||||
uses: DeLaGuardo/setup-clojure@main
|
||||
uses: DeLaGuardo/setup-clojure@issue-59
|
||||
# uses: ./
|
||||
with:
|
||||
cljstyle: latest
|
||||
@ -236,9 +212,6 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -246,7 +219,7 @@ jobs:
|
||||
java-version: '8'
|
||||
|
||||
- name: Install zprint
|
||||
uses: DeLaGuardo/setup-clojure@main
|
||||
uses: DeLaGuardo/setup-clojure@issue-59
|
||||
# uses: ./
|
||||
with:
|
||||
zprint: latest
|
||||
@ -259,9 +232,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Prepare java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
@ -269,7 +239,7 @@ jobs:
|
||||
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
|
||||
|
@ -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'
|
||||
|
BIN
dist/JavaVersion.class
vendored
BIN
dist/JavaVersion.class
vendored
Binary file not shown.
14
dist/index.js
vendored
14
dist/index.js
vendored
@ -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();
|
||||
}
|
||||
}
|
||||
});
|
||||
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`);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
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"));
|
||||
}
|
||||
}
|
14
src/boot.ts
14
src/boot.ts
@ -132,16 +132,21 @@ 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()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const m = outString.match(/^\s*java\.version = (.*)$/m)
|
||||
|
||||
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`
|
||||
)
|
||||
@ -151,4 +156,5 @@ async function setWindowsRegistry(): Promise<void> {
|
||||
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