xuxiaowei-com-cn opened a new pull request, #8194:
URL: https://github.com/apache/incubator-seata/pull/8194
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Please make sure you have read and understood the contributing
guidelines -->
- [ ] I have read the
[CONTRIBUTING.md](https://github.com/apache/incubator-seata/blob/2.x/CONTRIBUTING.md)
guidelines.
- [ ] I have registered the PR
[changes](https://github.com/apache/incubator-seata/tree/2.x/changes).
### Ⅰ. Describe what this PR did
This PR introduces **auto-generation** of `distribution/` LICENSE files
using [Apache SkyWalking Eyes
(license-eye)](https://github.com/apache/skywalking-eyes/), replacing the
previous manually-maintained approach. It also normalizes license names to SPDX
identifiers and corrects the root `LICENSE` file.
**Problems solved:**
1. **Unverifiable / unreproducible** — Previously, LICENSE files were
manually edited with no way to verify correctness against actual build
dependencies. Now they are generated by `license-eye` from the project's
Maven/npm dependency graph, making them fully reproducible.
2. **Unsorted entries** — Dependencies within each license section were not
alphabetically sorted, making review and maintenance difficult. The
auto-generation enforces consistent alphabetical ordering.
3. **Inconsistent across files** — The three LICENSE files had different
section orders and formatting styles. Now all three follow the same consistent
format.
**Changes:**
| File | Description |
|---|---|
| `.licenserc-distribution.yaml` | license-eye config for distribution
module (new) |
| `.licenserc-namingserver.yaml` | license-eye config for namingserver
module (new) |
| `.licenserc-server.yaml` | license-eye config for server module (new) |
| `.gitignore` | Added `__pycache__/` to prevent Python bytecode cache from
being committed |
| `script/license/generate-license.py` | Python script: resolves Maven/npm
dependencies via license-eye, formats output in ASF-required LICENSE format
(new, 504 lines) |
| `script/license/generate-license.sh` | Shell wrapper, ensures correct
working directory and checks prerequisites (new, 58 lines) |
| `Makefile` | Added `generate-license-all`,
`generate-license-namingserver`, `generate-license-server`,
`generate-license-distribution` targets |
| `LICENSE` | Corrected to match official Apache License 2.0 text |
| `distribution/LICENSE` | Regenerated — sorted, consistent, SPDX-normalized
|
| `distribution/LICENSE-namingserver` | Regenerated — sorted, consistent,
SPDX-normalized |
| `distribution/LICENSE-server` | Regenerated — sorted, consistent,
SPDX-normalized |
**Key features of the generation tooling:**
- Resolves transitive Maven and npm dependencies automatically
- Groups dependencies by license type with consistent alphabetical ordering
- Supports overrides for license-edge's incorrect identifications (e.g.,
Public Domain → MIT)
- Handles bundled assets (fonts) that license-eye cannot resolve
- Names licenses by SPDX identifiers (e.g., "MIT" not "MIT License",
"Apache-2.0" not "Apache License 2.0")
### Ⅱ. Does this pull request fix one issue?
<!-- If that, add "fixes #xxx" below in the next line, for example, fixes
#97. -->
Fixes https://github.com/apache/incubator-seata/issues/8193
### Ⅲ. Why don't you add test cases (unit test/integration test)?
This change primarily introduces build/generation tooling and static LICENSE
files. The verification mechanism is built into the tooling itself:
1. **Reproducibility** — Running `make generate-license-all` (or
`./script/license/generate-license.sh all`) on the same source should produce
identical output; any diff indicates drift.
2. The generation script is deterministic — given the same Maven/npm
dependency graph, it always produces the same output.
### Ⅳ. Describe how to verify it
**Prerequisites:**
```bash
# Install license-eye
brew install license-eye
# or: go install github.com/apache/skywalking-eyes/cmd/license-eye@latest
# Build all modules to populate the local Maven repository
mvn install -DskipTests
```
**Verify LICENSE files are correctly generated:**
```bash
# Generate all LICENSE files
make generate-license-all
# or: ./script/license/generate-license.sh all
```
**Manual inspection:**
- Open `distribution/LICENSE`, `distribution/LICENSE-namingserver`,
`distribution/LICENSE-server`
- Verify dependencies are grouped by license type (MIT, Apache-2.0,
BSD-3-Clause, etc.)
- Verify dependencies within each section are alphabetically sorted
- Verify the root `LICENSE` matches the [official Apache License 2.0
text](https://www.apache.org/licenses/LICENSE-2.0.txt)
### Ⅴ. Special notes for reviews
1. **`__pycache__` cleanup**: The
`script/license/__pycache__/generate-license.cpython-314.pyc` file was
accidentally included in an earlier commit and has been removed. `.gitignore`
has been updated with `__pycache__/` to prevent future recurrence.
2. **`package-lock.json`**: The
`distribution/console/src/main/resources/static/console-fe/package-lock.json`
file was added — this contains the resolved npm dependency tree for the console
frontend. It is checked in intentionally to ensure reproducible builds and is
required by license-eye for npm dependency resolution.
3. **License name normalization**: License names have been changed to SPDX
identifiers throughout. For example:
- "MIT License" → "MIT"
- "Apache License 2.0" → "Apache-2.0"
- "BSD 3-Clause" → "BSD-3-Clause"
This aligns with ASF best practices and makes the files machine-readable.
4. **License overrides**: `generate-license.py` includes a manual override
map.
5. **Future work**:
- Document the LICENSE generation process in the contributor guide
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]