Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyONeal committed Nov 16, 2024
1 parent 163f624 commit 56ed607
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
10 changes: 10 additions & 0 deletions azure-pipelines/e2e-ports/vcpkg-license-bsd-feature/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "vcpkg-license-bsd-feature",
"version": "0",
"features": {
"enable-license": {
"description": "Enable license",
"license": "BSD-3-Clause"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "vcpkg-license-bsd-on-mit-feature",
"version": "0",
"license": "BSD-3-Clause",
"features": {
"enable-license": {
"description": "Enable license",
"dependencies": [
"vcpkg-license-mit-feature"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
10 changes: 10 additions & 0 deletions azure-pipelines/e2e-ports/vcpkg-license-mit-feature/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "vcpkg-license-mit-feature",
"version": "0",
"features": {
"enable-license": {
"description": "Enable license",
"license": "MIT"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
10 changes: 10 additions & 0 deletions azure-pipelines/e2e-ports/vcpkg-license-null-feature/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "vcpkg-license-null-feature",
"version": "0",
"features": {
"enable-license": {
"description": "Enable license",
"license": null
}
}
}
38 changes: 27 additions & 11 deletions src/vcpkg/commands.install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,32 @@ namespace vcpkg
}
}

static void add_licenses(LicenseReport& report, const SourceControlFileAndLocation* scfl)
{
if (!scfl)
{
return;
}

auto scf = scfl->source_control_file.get();
if (auto license = scf->core_paragraph->license.get())
{
report.named_licenses.insert(*license);
}
else
{
report.any_unknown_licenses = true;
}

for (auto&& feature : scf->feature_paragraphs)
{
if (auto license = feature->license.get())
{
report.named_licenses.insert(*license);
}
}
}

InstallSummary install_execute_plan(const VcpkgCmdArguments& args,
const VcpkgPaths& paths,
Triplet host_triplet,
Expand Down Expand Up @@ -609,17 +635,7 @@ namespace vcpkg
args, paths, host_triplet, build_options, action, status_db, binary_cache, build_logs_recorder);
if (result.code == BuildResult::Succeeded)
{
if (auto scfl = action.source_control_file_and_location.get())
{
if (auto license = scfl->source_control_file->core_paragraph->license.get())
{
summary.license_report.named_licenses.insert(*license);
}
else
{
summary.license_report.any_unknown_licenses = true;
}
}
add_licenses(summary.license_report, action.source_control_file_and_location.get());
}
else
{
Expand Down
2 changes: 2 additions & 0 deletions src/vcpkg/spdx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,8 @@ namespace vcpkg
{
obj.insert(JsonIdHomepage, cpgh.homepage);
}

// FIXME this needs to consider features
obj.insert(SpdxLicenseConcluded, conclude_license(cpgh.license));
obj.insert(SpdxLicenseDeclared, SpdxNoAssertion);
obj.insert(SpdxCopyrightText, SpdxNoAssertion);
Expand Down

0 comments on commit 56ed607

Please sign in to comment.