Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/packagedcode/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ def parse(cls, location, package_only=True):
@classmethod
def assign_package_to_resources(cls, package, resource, codebase, package_adder):
models.DatafileHandler.assign_package_to_parent_tree(
package_=package,
package=package,
resource=resource,
codebase=codebase,
package_adder=package_adder,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"packages": [],
"dependencies": [],
"files": [
{
"path": "METADATA.bzl",
"type": "file",
"package_data": [
{
"type": "github",
"namespace": null,
"name": "example/example",
"version": "0.0.1",
"qualifiers": {},
"subpath": null,
"primary_language": null,
"description": null,
"release_date": null,
"parties": [
{
"type": "organization",
"role": "maintainer",
"name": "example_org",
"email": null,
"url": null
}
],
"keywords": [],
"homepage_url": "https://github.com/example/example",
"download_url": null,
"size": null,
"sha1": null,
"md5": null,
"sha256": null,
"sha512": null,
"bug_tracking_url": null,
"code_view_url": null,
"vcs_url": "https://github.com/example/example.git",
"copyright": null,
"holder": null,
"declared_license_expression": null,
"declared_license_expression_spdx": null,
"license_detections": [],
"other_license_expression": null,
"other_license_expression_spdx": null,
"other_license_detections": [],
"extracted_license_statement": "BSD-3-Clause",
"notice_text": null,
"source_packages": [],
"file_references": [],
"is_private": "no",
"is_virtual": "no",
"extra_data": {
"vcs_commit_hash": "deadbeef"
},
"dependencies": [],
"repository_homepage_url": null,
"repository_download_url": null,
"api_data_url": null,
"datasource_id": "buck_metadata",
"purl": "pkg:github/example/[email protected]"
}
],
"for_packages": [],
"scan_errors": []
}
]
}
7 changes: 7 additions & 0 deletions tests/packagedcode/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ def test_end2end_scan_can_detect_bazel(self):
run_scan_click(['--package', test_file, '--json-pp', result_file])
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)

def test_end2end_scan_can_detect_MetadataBazel(self):
test_file = self.get_test_loc('metadatabzl/new-format/METADATA.bzl')
expected_file = self.get_test_loc('metadatabzl/new-format/metadatabzl-expected.json')
result_file = self.get_temp_file('results.json')
run_scan_click(['--package', test_file, '--json-pp', result_file])
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)

def test_end2end_scan_can_detect_buck(self):
test_file = self.get_test_loc('buck/end2end')
expected_file = self.get_test_loc('buck/end2end-expected.json')
Expand Down
Loading