Generate license information
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 161
- PR merge metrics
- No merged PRs in 30d
Description
See also https://github.com/google/closure-compiler/issues/3551
Given closure-compiler will always emit a "Copyright The Closure Library Authors.", "SPDX-License-Identifier: Apache-2.0" on any closure output which includes base.js (required to use j2cl output), I propose that j2cl should either take license information as an input, or read it from standard sources (such as SPDX-License-Identifier headers in .java or NOTICE.txt or LICENSE.txt files in src jar `META-INF/` dirs.
Without a feature like this, a j2cl_application with no handwritten JS included will generate output which claims only to be apache licensed, and owned by "The Closure Library Authors".
Making it part of the bazel rules could be reasonable as well, generating a standalone JS file who's only purpose is to list the license that covers at least some other files in the project. To make the solution bazel-only and complete, this may need to also traverse other upstream dependencies and collect the license defined in the .java files or in `java_library` licenses? If passed to J2clTranspiler as a flag or if read from raw .java inputs, it could write to the generated .java.js files, if handled directly by j2cl_library() it could emit a single .js file and synthesize goog.provides/requires as needed to ensure it is included in output, or could prepend the license comment to some/all of the .java.js output.
Based on what the j2cl team thinks is appropriate here, we can plan on what external build tools should do to propagate these licenses correctly - maven has some license conventions for example, which could either be passed to J2clTranspiler or emitted in individual .js files etc.
Not a lawyer territory: given the discussion in the linked issue, it seems plausible that jre.js should include a `@license` header, and possibly google/jsinterop-base's jsinterop.js should as well.
Contributor guide
Assessment
This issue has not been assessed yet.