Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSII Breaks on non SPDX License #1775

Open
henrysachs opened this issue Feb 12, 2025 · 5 comments
Open

JSII Breaks on non SPDX License #1775

henrysachs opened this issue Feb 12, 2025 · 5 comments
Labels
bug Something isn't working p2

Comments

@henrysachs
Copy link

henrysachs commented Feb 12, 2025

Describe the bug

Hi there,

I was trying to set a custom License in my package.json like this: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#license

Expected Behavior

The best for me would be to set non-SPDX licenses like "LicenseRef-MyCoolLicense" as spdx describes here: https://spdx.github.io/spdx-spec/v2-draft/SPDX-license-expressions/

Current Behavior

[ERROR] Invalid license identifier "SEE LICENSE IN LICENSE", see valid license identifiers at https://spdx.org/licenses/

Reproduction Steps

create a cdk construct library via projen
set the license like

project.package.addField('license', 'SEE LICENSE IN LICENSE');

run the build command

Possible Solution

No response

Additional Information/Context

No response

SDK version used

5.4.0

Environment details (OS name and version, etc.)

MacOs 15.3

Kind Regards

Henry

@henrysachs henrysachs added the bug Something isn't working label Feb 12, 2025
@iliapolo iliapolo transferred this issue from aws/jsii Feb 16, 2025
@iliapolo
Copy link
Contributor

Hi @henrysachs, thanks for reporting this.

As a workaround (albeit somewhat nasty), you can do:

project.package.addField('license', 'UNLICENSED');

See https://github.com/aws/jsii-compiler/blob/main/src/project-info.ts#L470C15-L472

To get past jsii compilation, and then rewrite the license field to SEE LICENSE IN LICENSE after complication succeeds.
Looks like we are missing non SPDX license handling.

@iliapolo iliapolo added the p2 label Feb 16, 2025
@henrysachs
Copy link
Author

Hi @henrysachs, thanks for reporting this.

As a workaround (albeit somewhat nasty), you can do:

project.package.addField('license', 'UNLICENSED');

See https://github.com/aws/jsii-compiler/blob/main/src/project-info.ts#L470C15-L472

To get past jsii compilation, and then rewrite the license field to SEE LICENSE IN LICENSE after complication succeeds. Looks like we are missing non SPDX license handling.

Would it be okay to contribute code to also check if the license string starts with LicenseRef implying that its a non spdx license?

@iliapolo
Copy link
Contributor

@henrysachs mm just to double check though, does SPDX say the LicenceRef can refer to a non SPDX license? I'm not super versed in it but the format (LicenseRef-[idString]) can also be interpeted as a ref to user defined, but still SPDX, license?

@henrysachs
Copy link
Author

@iliapolo as I understood it LicenseRef is only used for nonspdx licenses. But maybe I read that spdx document wrong

@henrysachs
Copy link
Author

I would read

a user defined license reference denoted by the LicenseRef-[idString]

As "non spdx"

I think user defined means not defined by spdx in this context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p2
Projects
None yet
Development

No branches or pull requests

2 participants