Skip to content

Commit 00a08aa

Browse files
committed
Add third-party license notices
Signed-off-by: Christoph Knittel <ck@cca.io>
1 parent 106645e commit 00a08aa

33 files changed

Lines changed: 9860 additions & 8 deletions

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,21 @@ jobs:
392392
cache: yarn
393393
node-version-file: .nvmrc
394394

395+
- name: Install cargo-about
396+
shell: bash
397+
env:
398+
CARGO_ABOUT_VERSION: "0.9.2"
399+
CARGO_ABOUT_SHA256: "af5169282fb6f84e13471493f405437e43ac517744c9ae12fbe2cdf0a6f0e5a8"
400+
run: |
401+
archive="cargo-about-${CARGO_ABOUT_VERSION}-aarch64-unknown-linux-musl.tar.gz"
402+
curl -fsSL \
403+
"https://github.com/EmbarkStudios/cargo-about/releases/download/${CARGO_ABOUT_VERSION}/${archive}" \
404+
-o "$RUNNER_TEMP/$archive"
405+
echo "$CARGO_ABOUT_SHA256 $RUNNER_TEMP/$archive" | sha256sum --check
406+
tar -xzf "$RUNNER_TEMP/$archive" --strip-components=1 -C "$RUNNER_TEMP" \
407+
"cargo-about-${CARGO_ABOUT_VERSION}-aarch64-unknown-linux-musl/cargo-about"
408+
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
409+
395410
- name: Download artifacts
396411
uses: actions/download-artifact@v8
397412
with:
@@ -401,11 +416,20 @@ jobs:
401416
run: .github/workflows/moveArtifacts.sh
402417
shell: bash
403418

419+
- name: Generate third-party licenses
420+
run: node scripts/generateThirdPartyLicenses.js
421+
422+
- name: Check generated third-party licenses
423+
run: node scripts/generateThirdPartyLicenses.js --check
424+
404425
- name: Check artifact list
405426
run: |
406427
node ./scripts/updateArtifactList.js
407428
git diff --exit-code packages/artifacts.json
408429
430+
- name: Check package license contents
431+
run: node scripts/checkThirdPartyLicensePackages.js
432+
409433
- name: Publish packages to pkg.pr.new
410434
id: publish
411435
run: |

.github/workflows/publish.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,21 @@ jobs:
104104
- name: Setup Node and dependencies
105105
uses: ./.github/actions/setup-node
106106

107+
- name: Install cargo-about
108+
shell: bash
109+
env:
110+
CARGO_ABOUT_VERSION: "0.9.2"
111+
CARGO_ABOUT_SHA256: "af5169282fb6f84e13471493f405437e43ac517744c9ae12fbe2cdf0a6f0e5a8"
112+
run: |
113+
archive="cargo-about-${CARGO_ABOUT_VERSION}-aarch64-unknown-linux-musl.tar.gz"
114+
curl -fsSL \
115+
"https://github.com/EmbarkStudios/cargo-about/releases/download/${CARGO_ABOUT_VERSION}/${archive}" \
116+
-o "$RUNNER_TEMP/$archive"
117+
echo "$CARGO_ABOUT_SHA256 $RUNNER_TEMP/$archive" | sha256sum --check
118+
tar -xzf "$RUNNER_TEMP/$archive" --strip-components=1 -C "$RUNNER_TEMP" \
119+
"cargo-about-${CARGO_ABOUT_VERSION}-aarch64-unknown-linux-musl/cargo-about"
120+
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
121+
107122
- name: Download artifacts
108123
uses: actions/download-artifact@v8
109124
with:
@@ -113,6 +128,9 @@ jobs:
113128
run: .github/workflows/moveArtifacts.sh
114129
shell: bash
115130

131+
- name: Generate third-party licenses
132+
run: node scripts/generateThirdPartyLicenses.js
133+
116134
- name: Publish current stable packages as latest
117135
if: needs.release-plan.outputs.publish-tag == ''
118136
run: |

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ packages/dev-playground/public/playground-bundles/*
8282
rewatch/target/
8383
rewatch/rewatch
8484

85+
# Generated into native platform packages immediately before packaging.
86+
packages/@rescript/*/THIRD_PARTY_LICENSES
87+
8588
tests/tools_tests/**/*.res.js
8689
tests/tools_tests/lib
8790
tests/analysis_tests*/lib

biome.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
"!**/tests/tests/**/src",
6565
"!**/tests/tools_tests/**/src",
6666
"!**/rewatch",
67+
"!**/licenses/toolchains/*.html",
6768
"!**/lib/es6",
6869
"!**/lib/js",
6970
"!**/lib/bs",

compiler/flow_parser/README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ This directory contains the OCaml Flow parser used by the ReScript compiler.
1010
- Original source directories: `src/parser`, `src/third-party/sedlex`,
1111
`src/third-party/sedlex-ppx`, and `src/hack_forked/utils/collections`
1212

13-
The collection helpers retain the MIT-licensed 0.267.0 sources. Their code is
14-
identical in Flow 0.320.0, but that release replaces their MIT notices with
15-
"Confidential and proprietary" notices that do not grant redistribution
16-
rights.
13+
The collection helpers retain the redistributable 0.267.0 sources. Their code
14+
is identical in Flow 0.320.0, but that release replaces their license notices
15+
with "Confidential and proprietary" notices that do not grant redistribution
16+
rights. The Meta-authored collection modules are MIT licensed. `Flow_map` and
17+
`Flow_set` are derived from the OCaml standard library and remain under LGPL
18+
2.1 with the OCaml linking exception.
1719

1820
The Dune files were adapted to build these sources as private libraries inside
1921
the ReScript repository. Sources used only by the upstream JavaScript and C API
@@ -34,6 +36,7 @@ validates both complete JavaScript programs and individual expressions.
3436
Vendored sources are excluded from the repository-wide OCamlformat check so
3537
that they remain comparable with their upstream versions.
3638

37-
The Flow parser and retained collection sources are licensed under the MIT
38-
licence in `LICENSE` and their source headers. Vendored Sedlex and collection
39-
third-party sources retain the licence files in their respective directories.
39+
The Flow parser and Meta-authored collection sources are licensed under the
40+
MIT licence in `LICENSE` and their source headers. Vendored Sedlex and the
41+
OCaml-derived collection sources retain the licence files in their respective
42+
directories.

licenses/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Third-party license inventory
2+
3+
`THIRD_PARTY_LICENSES` is generated separately for every native platform npm
4+
package. It is intentionally not distributed with the root `rescript` package,
5+
`@rescript/runtime`, or `@rescript/belt`, because those packages contain no
6+
native binaries.
7+
8+
The generated file has two inputs:
9+
10+
- `curated-components.json` and the referenced license snapshots cover
11+
vendored OCaml sources, linked OCaml libraries, and platform toolchains.
12+
- `about.toml` and `about.hbs` generate a target-specific Rust dependency
13+
section from `rewatch/Cargo.lock` using cargo-about 0.9.2.
14+
15+
After changing a vendored component, an OCaml dependency, a toolchain, or
16+
`rewatch/Cargo.lock`, update the corresponding inventory and run:
17+
18+
```sh
19+
yarn licenses:generate
20+
```
21+
22+
`yarn licenses:generate` writes the target-specific notices directly into the
23+
native platform package directories. `yarn licenses:check` verifies those
24+
generated files. They are ignored by Git and regenerated before publishing.

licenses/about.hbs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
RUST DEPENDENCIES
2+
=================
3+
4+
The following notices were generated from rewatch/Cargo.lock with cargo-about.
5+
Platform-specific dependencies are included when used by any supported release
6+
target.
7+
8+
{{#each licenses}}
9+
-------------------------------------------------------------------------------
10+
License: {{name}}
11+
Used by:
12+
{{#each used_by}}
13+
- {{crate.name}} {{crate.version}}{{#if crate.repository}} ({{crate.repository}}){{/if}}
14+
{{/each}}
15+
16+
{{text}}
17+
{{/each}}

licenses/about.toml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# License policy for the Rust build-system binary shipped in the platform npm
2+
# packages. Keep the target list aligned with the release matrix in CI.
3+
4+
accepted = [
5+
"MIT",
6+
"Apache-2.0",
7+
"Unicode-3.0",
8+
"ISC",
9+
"BSD-2-Clause",
10+
"CC0-1.0",
11+
]
12+
13+
targets = [
14+
"x86_64-unknown-linux-musl",
15+
"aarch64-unknown-linux-musl",
16+
"x86_64-apple-darwin",
17+
"aarch64-apple-darwin",
18+
"x86_64-pc-windows-gnu",
19+
]
20+
21+
ignore-build-dependencies = true
22+
ignore-dev-dependencies = true
23+
ignore-transitive-dependencies = false
24+
private = { ignore = true }

licenses/curated-components.json

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
[
2+
{
3+
"name": "Flow parser",
4+
"version": "0.320.0",
5+
"source": "https://github.com/facebook/flow/commit/7c64d4b077bc6fc45c12cee3cfa7368fdb2186ce",
6+
"license": "MIT",
7+
"scope": "bsc, rescript-editor-analysis, and rescript-tools",
8+
"notes": "Vendored and modified by ReScript. This entry also covers the MIT-licensed StringKey and SSet collection helpers.",
9+
"licenseFiles": ["compiler/flow_parser/LICENSE"]
10+
},
11+
{
12+
"name": "Sedlex",
13+
"version": "Flow commit 7c64d4b077bc6fc45c12cee3cfa7368fdb2186ce",
14+
"source": "https://github.com/facebook/flow/tree/7c64d4b077bc6fc45c12cee3cfa7368fdb2186ce/src/third-party",
15+
"license": "MIT",
16+
"scope": "Flow lexer runtime and lexer code generation",
17+
"notes": "Vendored and modified by ReScript.",
18+
"licenseFiles": ["compiler/flow_parser/flow_sedlexing/LICENSE"]
19+
},
20+
{
21+
"name": "OCaml Map and Set derivatives used by Flow",
22+
"version": "Flow 0.267.0 collection sources",
23+
"source": "https://github.com/facebook/flow/commit/9ea4062c0b7e037415c4413a7634c459ebd5c31b",
24+
"license": "LGPL-2.1-only WITH OCaml-LGPL-linking-exception",
25+
"scope": "Flow_map and Flow_set in the compiler binaries",
26+
"notes": "Derived from the OCaml standard library, with portions copyright Meta Platforms, Inc. and affiliates.",
27+
"licenseFiles": ["compiler/flow_parser/collections/third-party/LICENSE"]
28+
},
29+
{
30+
"name": "Base",
31+
"version": "v0.17.3",
32+
"source": "https://github.com/janestreet/base",
33+
"license": "MIT",
34+
"scope": "compiler binaries",
35+
"licenseFiles": ["licenses/ocaml/base-v0.17.3.txt"]
36+
},
37+
{
38+
"name": "ocaml_intrinsics_kernel",
39+
"version": "v0.17.2",
40+
"source": "https://github.com/janestreet/ocaml_intrinsics_kernel",
41+
"license": "MIT",
42+
"scope": "transitive dependency of Base",
43+
"licenseFiles": ["licenses/ocaml/ocaml_intrinsics_kernel-v0.17.2.txt"]
44+
},
45+
{
46+
"name": "sexplib0",
47+
"version": "v0.17.0",
48+
"source": "https://github.com/janestreet/sexplib0",
49+
"license": "MIT",
50+
"scope": "transitive dependency of Base and ppx_yojson_conv_lib",
51+
"licenseFiles": ["licenses/ocaml/sexplib0-v0.17.0.txt"]
52+
},
53+
{
54+
"name": "ocaml-wtf8",
55+
"version": "1.0.2",
56+
"source": "https://github.com/flowtype/ocaml-wtf8",
57+
"license": "MIT",
58+
"scope": "compiler binaries",
59+
"licenseFiles": ["licenses/ocaml/wtf8-1.0.2.txt"]
60+
},
61+
{
62+
"name": "Yojson",
63+
"version": "3.0.0",
64+
"source": "https://github.com/ocaml-community/yojson",
65+
"license": "BSD-3-Clause",
66+
"scope": "compiler, analysis, and tools binaries",
67+
"licenseFiles": ["licenses/ocaml/yojson-3.0.0.txt"]
68+
},
69+
{
70+
"name": "LSP and Jsonrpc",
71+
"version": "1.27.0",
72+
"source": "https://github.com/ocaml/ocaml-lsp",
73+
"license": "ISC",
74+
"scope": "rescript-editor-analysis and rescript-tools",
75+
"licenseFiles": ["licenses/ocaml/lsp-jsonrpc-1.27.0.txt"]
76+
},
77+
{
78+
"name": "ppx_yojson_conv_lib",
79+
"version": "v0.17.0",
80+
"source": "https://github.com/janestreet/ppx_yojson_conv_lib",
81+
"license": "MIT",
82+
"scope": "runtime dependency of LSP",
83+
"licenseFiles": ["licenses/ocaml/ppx_yojson_conv_lib-v0.17.0.txt"]
84+
},
85+
{
86+
"name": "Uutf",
87+
"version": "1.0.4",
88+
"source": "https://erratique.ch/software/uutf",
89+
"license": "ISC",
90+
"scope": "runtime dependency of LSP",
91+
"licenseFiles": ["licenses/ocaml/uutf-1.0.4.txt"]
92+
},
93+
{
94+
"name": "Cmarkit",
95+
"version": "0.4.0",
96+
"source": "https://erratique.ch/software/cmarkit",
97+
"license": "ISC",
98+
"scope": "rescript-tools",
99+
"licenseFiles": ["licenses/ocaml/cmarkit-0.4.0.txt"]
100+
},
101+
{
102+
"name": "LexiFi dead_code_analyzer",
103+
"version": "adapted source",
104+
"source": "https://github.com/LexiFi/dead_code_analyzer",
105+
"license": "MIT",
106+
"scope": "dead-code analysis in rescript-editor-analysis and rescript-tools",
107+
"notes": "Selected modules were adapted and subsequently modified by ReScript.",
108+
"licenseFiles": ["licenses/ocaml/dead-code-analyzer.txt"]
109+
},
110+
{
111+
"name": "js_of_ocaml JavaScript pretty-printer",
112+
"version": "adapted source; license snapshot from 6.4.1",
113+
"source": "https://github.com/ocsigen/js_of_ocaml",
114+
"license": "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception",
115+
"scope": "JavaScript output generation in bsc",
116+
"notes": "The incorporated pretty-printer has been heavily modified by ReScript.",
117+
"licenseFiles": ["licenses/ocaml/js_of_ocaml-6.4.1.txt"]
118+
},
119+
{
120+
"name": "OCaml runtime, standard library, and incorporated compiler sources",
121+
"version": "5.5.0",
122+
"source": "https://github.com/ocaml/ocaml/tree/5.5.0",
123+
"license": "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception",
124+
"scope": "OCaml compiler, analysis, and tools binaries, including adapted compiler and collection modules",
125+
"licenseFiles": ["licenses/toolchains/ocaml-5.5.0.txt"]
126+
},
127+
{
128+
"name": "Rust standard library",
129+
"version": "1.91.0",
130+
"source": "https://github.com/rust-lang/rust/tree/1.91.0",
131+
"license": "Multiple; see the official Rust standard-library inventory below",
132+
"scope": "rescript build-system binary",
133+
"licenseFiles": ["licenses/toolchains/rust-1.91.0-standard-library.html"]
134+
},
135+
{
136+
"name": "musl",
137+
"version": "1.2.4-2",
138+
"source": "https://packages.ubuntu.com/noble/musl-tools",
139+
"license": "Multiple permissive licenses; see the Ubuntu copyright inventory below",
140+
"scope": "statically linked Linux binaries",
141+
"platforms": ["linux"],
142+
"licenseFiles": ["licenses/toolchains/musl-1.2.4-2.txt"]
143+
},
144+
{
145+
"name": "MinGW-w64 runtime",
146+
"source": "https://github.com/mingw-w64/mingw-w64",
147+
"license": "Multiple permissive licenses; see the runtime notice below",
148+
"scope": "Windows binaries",
149+
"platforms": ["win32"],
150+
"licenseFiles": ["licenses/toolchains/mingw-w64-runtime.txt"]
151+
}
152+
]

licenses/ocaml/base-v0.17.3.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2016--2024 Jane Street Group, LLC <opensource-contacts@janestreet.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)