Skip to content

Commit b659400

Browse files
committed
per-platform packages
1 parent 80d6156 commit b659400

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+374
-55
lines changed

Diff for: .github/workflows/get_artifact_dir_name.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as fs from "node:fs";
22
import * as os from "node:os";
33

4-
import { platformName } from "#cli/bins";
4+
import { platformName } from "#dev/paths";
55

66
// Pass artifactDirName to subsequent GitHub actions
77
fs.appendFileSync(

Diff for: .gitignore

+6-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ _build
4646
node_modules
4747
*.dump
4848
coverage
49-
*.exe
5049

5150
.ninja_log
5251
.bsdeps
@@ -82,6 +81,12 @@ tests/tools_tests/lib
8281
tests/analysis_tests*/lib
8382
tests/analysis_tests/**/*.bs.js
8483

84+
/linux/*.exe
85+
/linuxarm64/*.exe
86+
/darwin/*.exe
87+
/darwinarm64/*.exe
88+
/win32/*.exe
89+
8590
.yarn/*
8691
!.yarn/patches
8792
!.yarn/plugins

Diff for: cli/common/bins.js

+28-29
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
11
// @ts-check
22

3-
import * as path from "node:path";
4-
53
/**
6-
* For compatibility reasons, if the architecture is x64, omit it from the bin directory name.
7-
* So we'll have "darwin", "linux" and "win32" for x64 arch,
8-
* but "darwinarm64" and "linuxarm64" for arm64 arch.
9-
* Also, we do not have Windows ARM binaries yet. But the x64 binaries do work on Windows 11 ARM.
10-
* So omit the architecture for Windows, too.
4+
* @typedef {{
5+
* platformDir: string,
6+
* bsb_helper_exe: string,
7+
* bsc_exe: string,
8+
* ninja_exe: string,
9+
* rescript_exe: string,
10+
* rescript_tools_exe: string,
11+
* rescript_editor_analysis_exe: string,
12+
* rewatch_exe: string,
13+
* }} BinaryPaths
1114
*/
12-
export const platformName =
13-
process.arch === "x64" || process.platform === "win32"
14-
? process.platform
15-
: process.platform + process.arch;
16-
17-
export const platformDir = path.resolve(
18-
import.meta.dirname,
19-
"..",
20-
"..",
21-
platformName,
22-
);
23-
24-
export const bsc_exe = path.join(platformDir, "bsc.exe");
2515

26-
export const ninja_exe = path.join(platformDir, "ninja.exe");
16+
const target = `${process.platform}-${process.arch}`;
2717

28-
export const rescript_exe = path.join(platformDir, "rescript.exe");
18+
/** @type {BinaryPaths} */
19+
let binPaths;
20+
try {
21+
binPaths = await import(`@rescript/${target}/paths`);
22+
} catch (err) {
23+
console.error(`Platform ${target} is not supported!`);
24+
throw err;
25+
}
2926

30-
export const rescript_tools_exe = path.join(platformDir, "rescript-tools.exe");
31-
32-
export const rescript_editor_analysis_exe = path.join(
27+
export const {
3328
platformDir,
34-
"rescript-editor-analysis.exe",
35-
);
36-
37-
export const rewatch_exe = path.join(platformDir, "rewatch.exe");
29+
bsb_helper_exe,
30+
bsc_exe,
31+
ninja_exe,
32+
rescript_editor_analysis_exe,
33+
rescript_tools_exe,
34+
rescript_exe,
35+
rewatch_exe,
36+
} = binPaths;

Diff for: lib_dev/paths.js

+17
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@ import * as path from "node:path";
77
*/
88
export const projectDir = path.resolve(import.meta.dirname, "..");
99

10+
/**
11+
* For compatibility reasons, if the architecture is x64, omit it from the bin directory name.
12+
* So we'll have "darwin", "linux" and "win32" for x64 arch,
13+
* but "darwinarm64" and "linuxarm64" for arm64 arch.
14+
* Also, we do not have Windows ARM binaries yet. But the x64 binaries do work on Windows 11 ARM.
15+
* So omit the architecture for Windows, too.
16+
*/
17+
export const platformName =
18+
process.arch === "x64" || process.platform === "win32"
19+
? process.platform
20+
: process.platform + process.arch;
21+
22+
/**
23+
* path: `<projectDir>/<platform>` (e.g. linux, darwinarm64)
24+
*/
25+
export const platformDir = path.resolve(projectDir, platformName);
26+
1027
/**
1128
* path: `<projectDir>/compiler/`
1229
*/

Diff for: package.json

+7-5
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@
5858
"CHANGELOG.md",
5959
"CREDITS.md",
6060
"ninja.COPYING",
61-
"darwin",
62-
"darwinarm64",
63-
"linux",
64-
"linuxarm64",
65-
"win32",
6661
"docs/docson/build-schema.json",
6762
"lib",
6863
"cli"
@@ -77,6 +72,13 @@
7772
"#dev/*": "./lib_dev/*.js",
7873
"#lib/minisocket": "./lib/minisocket.js"
7974
},
75+
"optionalDependencies": {
76+
"@rescript/darwin-arm64": "12.0.0-alpha.12",
77+
"@rescript/darwin-x64": "12.0.0-alpha.12",
78+
"@rescript/linux-arm64": "12.0.0-alpha.12",
79+
"@rescript/linux-x64": "12.0.0-alpha.12",
80+
"@rescript/win32-x64": "12.0.0-alpha.12"
81+
},
8082
"devDependencies": {
8183
"@biomejs/biome": "1.9.4",
8284
"@types/node": "^20.14.9",

Diff for: packages/@rescript/darwin-arm64/bin/bsb_helper.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwinarm64/bsb_helper.exe

Diff for: packages/@rescript/darwin-arm64/bin/bsc.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwinarm64/bsc.exe

Diff for: packages/@rescript/darwin-arm64/bin/ninja.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwinarm64/ninja.exe

Diff for: packages/@rescript/darwin-arm64/bin/paths.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @ts-check
2+
3+
import * as path from "node:path";
4+
5+
export const platformDir = import.meta.dirname;
6+
7+
export const bsc_exe = path.join(platformDir, "bsc.exe");
8+
9+
export const ninja_exe = path.join(platformDir, "ninja.exe");
10+
11+
export const rescript_exe = path.join(platformDir, "rescript.exe");
12+
13+
export const rescript_tools_exe = path.join(platformDir, "rescript-tools.exe");
14+
15+
export const rescript_editor_analysis_exe = path.join(
16+
platformDir,
17+
"rescript-editor-analysis.exe",
18+
);
19+
20+
export const rewatch_exe = path.join(platformDir, "rewatch.exe");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwinarm64/rescript-editor-analysis.exe
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwinarm64/rescript-tools.exe

Diff for: packages/@rescript/darwin-arm64/bin/rescript.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwinarm64/rescript.exe

Diff for: packages/@rescript/darwin-arm64/bin/rewatch.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwinarm64/rewatch.exe

Diff for: packages/@rescript/darwin-arm64/package.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@rescript/darwin-arm64",
3+
"version": "12.0.0-alpha.12",
4+
"description": "ReScript binaries for MacOS ARM64",
5+
"type": "module",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/rescript-lang/rescript-compiler.git"
9+
},
10+
"publishConfig": {
11+
"access": "public"
12+
},
13+
"engines": {
14+
"node": ">=20.11.0"
15+
},
16+
"os": [
17+
"darwin"
18+
],
19+
"cpu": [
20+
"arm64"
21+
],
22+
"files": [
23+
"bin"
24+
],
25+
"bin": {
26+
"bsb_helper.exe": "./bin/bsb_helper.exe",
27+
"bsc.exe": "./bin/bsc.exe",
28+
"ninja.exe": "./bin/ninja.exe",
29+
"rescript-editor-analysis.exe": "./bin/rescript-editor-analysis.exe",
30+
"rescript-tools.exe": "./bin/rescript-tools.exe",
31+
"rescript.exe": "./bin/rescript.exe",
32+
"rewatch.exe": "./bin/rewatch.exe"
33+
},
34+
"exports": {
35+
"./paths": "./bin/paths.js"
36+
},
37+
"preferUnplugged": true
38+
}

Diff for: packages/@rescript/darwin-x64/bin/bsb_helper.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwin/bsb_helper.exe

Diff for: packages/@rescript/darwin-x64/bin/bsc.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwin/bsc.exe

Diff for: packages/@rescript/darwin-x64/bin/ninja.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwin/ninja.exe

Diff for: packages/@rescript/darwin-x64/bin/paths.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// @ts-check
2+
3+
import * as path from "node:path";
4+
5+
export const platformDir = import.meta.dirname;
6+
7+
export const bsc_exe = path.join(platformDir, "bsc.exe");
8+
9+
export const ninja_exe = path.join(platformDir, "ninja.exe");
10+
11+
export const rescript_exe = path.join(platformDir, "rescript.exe");
12+
13+
export const rescript_tools_exe = path.join(platformDir, "rescript-tools.exe");
14+
15+
export const rescript_editor_analysis_exe = path.join(
16+
platformDir,
17+
"rescript-editor-analysis.exe",
18+
);
19+
20+
export const rewatch_exe = path.join(platformDir, "rewatch.exe");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwin/rescript-editor-analysis.exe

Diff for: packages/@rescript/darwin-x64/bin/rescript-tools.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwin/rescript-tools.exe

Diff for: packages/@rescript/darwin-x64/bin/rescript.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwin/rescript.exe

Diff for: packages/@rescript/darwin-x64/bin/rewatch.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../darwin/rewatch.exe

Diff for: packages/@rescript/darwin-x64/package.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "@rescript/darwin-x64",
3+
"version": "12.0.0-alpha.12",
4+
"description": "ReScript binaries for MacOS x86_64",
5+
"type": "module",
6+
"repository": {
7+
"type": "git",
8+
"url": "git+https://github.com/rescript-lang/rescript-compiler.git"
9+
},
10+
"publishConfig": {
11+
"access": "public"
12+
},
13+
"engines": {
14+
"node": ">=20.11.0"
15+
},
16+
"os": [
17+
"darwin"
18+
],
19+
"cpu": [
20+
"x64"
21+
],
22+
"files": [
23+
"bin"
24+
],
25+
"bin": {
26+
"bsb_helper.exe": "./bin/bsb_helper.exe",
27+
"bsc.exe": "./bin/bsc.exe",
28+
"ninja.exe": "./bin/ninja.exe",
29+
"rescript-editor-analysis.exe": "./bin/rescript-editor-analysis.exe",
30+
"rescript-tools.exe": "./bin/rescript-tools.exe",
31+
"rescript.exe": "./bin/rescript.exe",
32+
"rewatch.exe": "./bin/rewatch.exe"
33+
},
34+
"exports": {
35+
"./paths": "./bin/paths.js"
36+
},
37+
"preferUnplugged": true
38+
}

Diff for: packages/@rescript/linux-arm64/bin/bsb_helper.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linuxarm64/bsb_helper.exe

Diff for: packages/@rescript/linux-arm64/bin/bsc.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linuxarm64/bsc.exe

Diff for: packages/@rescript/linux-arm64/bin/ninja.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linuxarm64/ninja.exe
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linuxarm64/rescript-editor-analysis.exe
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linuxarm64/rescript-tools.exe

Diff for: packages/@rescript/linux-arm64/bin/rescript.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linuxarm64/rescript.exe

Diff for: packages/@rescript/linux-arm64/bin/rewatch.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linuxarm64/rewatch.exe

Diff for: packages/@rescript/linux-arm64/package.json

+14-13
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
{
22
"name": "@rescript/linux-arm64",
33
"version": "12.0.0-alpha.12",
4-
"description": "ReScript toolchain",
4+
"description": "ReScript binaries for Linux ARM64",
55
"type": "module",
6-
"keywords": [
7-
"ReScript",
8-
"Compiler",
9-
"Types",
10-
"JavaScript",
11-
"Language"
12-
],
13-
"license": "SEE LICENSE IN LICENSE",
14-
"homepage": "http://rescript-lang.org",
156
"repository": {
167
"type": "git",
178
"url": "git+https://github.com/rescript-lang/rescript-compiler.git"
189
},
10+
"publishConfig": {
11+
"access": "public"
12+
},
1913
"engines": {
2014
"node": ">=20.11.0"
2115
},
@@ -28,10 +22,17 @@
2822
"files": [
2923
"bin"
3024
],
31-
"publishConfig": {
32-
"access": "public"
25+
"bin": {
26+
"bsb_helper.exe": "./bin/bsb_helper.exe",
27+
"bsc.exe": "./bin/bsc.exe",
28+
"ninja.exe": "./bin/ninja.exe",
29+
"rescript-editor-analysis.exe": "./bin/rescript-editor-analysis.exe",
30+
"rescript-tools.exe": "./bin/rescript-tools.exe",
31+
"rescript.exe": "./bin/rescript.exe",
32+
"rewatch.exe": "./bin/rewatch.exe"
3333
},
3434
"exports": {
3535
"./paths": "./bin/paths.js"
36-
}
36+
},
37+
"preferUnplugged": true
3738
}

Diff for: packages/@rescript/linux-x64/bin/bsb_helper.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linux/bsb_helper.exe

Diff for: packages/@rescript/linux-x64/bin/bsc.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linux/bsc.exe

Diff for: packages/@rescript/linux-x64/bin/ninja.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linux/ninja.exe
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linux/rescript-editor-analysis.exe

Diff for: packages/@rescript/linux-x64/bin/rescript-tools.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linux/rescript-tools.exe

Diff for: packages/@rescript/linux-x64/bin/rescript.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linux/rescript.exe

Diff for: packages/@rescript/linux-x64/bin/rewatch.exe

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../linux/rewatch.exe

0 commit comments

Comments
 (0)