Skip to content

Commit 21709c8

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

37 files changed

Lines changed: 9886 additions & 9 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

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757

5858
#### :house: Internal
5959

60+
- Distribute generated, target-specific third-party license notices with the native platform npm packages. https://github.com/rescript-lang/rescript/pull/8594
6061
- Upgrade the development toolchain and primary CI builds to OCaml 5.5 while retaining OCaml 5.0 as the minimum supported version. https://github.com/rescript-lang/rescript/pull/8589
6162
- Upgrade the vendored Flow parser from 0.267.0 to 0.320.0, the final release of the OCaml implementation. https://github.com/rescript-lang/rescript/pull/8588
6263
- Vendor the Flow parser 0.267.0 sources used by the compiler, removing the external `flow_parser` dependency and establishing a maintained baseline for future OCaml upgrades. https://github.com/rescript-lang/rescript/pull/8587

CONTRIBUTING.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ To make sure that no files are added to or removed from the `rescript`, `@rescri
151151

152152
After adding a new file to the repository that should go into one of the npm packages - e.g., a new stdlib module -, run `make artifacts`.
153153

154+
The native platform packages additionally contain a generated
155+
`THIRD_PARTY_LICENSES` file. It is not managed through `packages/artifacts.json`
156+
or committed to Git; it is generated and checked before publishing. When a
157+
vendored component, linked OCaml dependency, platform toolchain, or Rust
158+
dependency changes, follow the inventory maintenance instructions in
159+
[`licenses/README.md`](licenses/README.md).
160+
154161
## Test the compiler
155162

156163
### Single file
@@ -523,7 +530,13 @@ Then attempt to rebuild your project as you would normally.
523530
524531
## Contribution Licensing
525532
526-
Since ReScript is distributed under the terms of the [LGPL Version 3](LICENSE), contributions that you make are licensed under the same terms. In order for us to be able to accept your contributions, we will need explicit confirmation from you that you are able and willing to provide them under these terms, and the mechanism we use to do this is called a Developer's Certificate of Origin [DCO](DCO.md). This is very similar to the process used by the Linux(R) kernel, Samba, and many other major open source projects.
533+
ReScript contains components under multiple licenses, as documented in
534+
[`LICENSE`](LICENSE). Contributions are made under the license of the component
535+
being changed. In order for us to accept your contributions, we need explicit
536+
confirmation that you are able and willing to provide them under the applicable
537+
terms. The mechanism we use for this is called a Developer's Certificate of
538+
Origin [DCO](DCO.md). This is very similar to the process used by the Linux(R)
539+
kernel, Samba, and many other major open source projects.
527540
528541
To participate under these terms, all that you must do is include a line like the following as the last line of the commit message for each commit in your contribution:
529542

LICENSE

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ This repository contains code under multiple licenses.
33
- compiler/: LGPL-3.0-or-later
44
- compiler/syntax/: MIT
55
- packages/@rescript/runtime/: MIT
6+
- packages/@rescript/belt/: MIT
67
- rewatch/: MIT
78

89
See full license texts:
910

1011
- LGPL-3.0-or-later: COPYING.LESSER (and COPYING where applicable)
1112
- MIT: LICENSE.MIT
13+
14+
Native platform packages also contain third-party software. The generated
15+
THIRD_PARTY_LICENSES file in each native package contains the applicable
16+
notices and license texts. See licenses/README.md for the source inventory and
17+
generation process.

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,15 @@ ReScript uses multiple licenses in this monorepo:
9797
- `compiler/`: LGPL-3.0-or-later
9898
- `compiler/syntax/`: MIT
9999
- `packages/@rescript/runtime/`: MIT
100+
- `packages/@rescript/belt/`: MIT
100101
- `rewatch/`: MIT
101102

102103
See the repository license index in [`LICENSE`](LICENSE) and full license texts in [`COPYING.LESSER`](COPYING.LESSER) and [`LICENSE.MIT`](LICENSE.MIT).
103104

105+
Native platform packages also contain third-party software. Their generated
106+
`THIRD_PARTY_LICENSES` files and the source inventory used to produce them are
107+
documented in [`licenses/README.md`](licenses/README.md).
108+
104109
## 🏅 Acknowledgments
105110

106111
ReScript was originally created by [Hongbo Zhang](https://github.com/bobzhang) in 2015.

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.

0 commit comments

Comments
 (0)