Skip to content

Commit 05cff73

Browse files
author
Kamil Bielecki
committed
feat: Create simple BOM file format analyzer plugin
This commit creates new plugin to analyze ORT-specific BOM file format. Signed-off-by: Kamil Bielecki <kamil.bielecki@pl.bosch.com>
1 parent a9cd867 commit 05cff73

File tree

16 files changed

+874
-1
lines changed

16 files changed

+874
-1
lines changed

analyzer/src/funTest/kotlin/PackageManagerFunTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ class PackageManagerFunTest : WordSpec({
7373
"spdx-project/project.spdx.yml",
7474
"spm-app/Package.resolved",
7575
"spm-lib/Package.swift",
76-
"stack/stack.yaml"
76+
"stack/stack.yaml",
77+
"ort-bon/ort-bom.yml"
7778
)
7879

7980
val projectDir = tempdir()

model/src/main/kotlin/config/AnalyzerConfiguration.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ data class AnalyzerConfiguration(
6060
"Maven",
6161
"NPM",
6262
"NuGet",
63+
"OrtBomFile",
6364
"PIP",
6465
"Pipenv",
6566
"PNPM",
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (C) 2025 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
* SPDX-License-Identifier: Apache-2.0
17+
* License-Filename: LICENSE
18+
*/
19+
20+
plugins {
21+
// Apply precompiled plugins.
22+
id("ort-plugin-conventions")
23+
24+
// Apply third-party plugins.
25+
alias(libs.plugins.kotlinSerialization)
26+
}
27+
28+
dependencies {
29+
api(projects.analyzer)
30+
api(projects.model)
31+
32+
implementation(projects.utils.ortUtils)
33+
34+
implementation(jacksonLibs.jacksonModuleKotlin)
35+
implementation(libs.kotlinx.serialization.core)
36+
implementation(libs.kotlinx.serialization.yaml)
37+
38+
ksp(projects.analyzer)
39+
40+
funTestImplementation(testFixtures(projects.analyzer))
41+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
projectName: "Example ORT BOM project"
2+
description: "Project X description"
3+
vcs:
4+
type: "GIT"
5+
url: "https://git.example.com/project_x/"
6+
revision: "master"
7+
path: "/"
8+
homepageUrl: "https://project_x.example.com"
9+
declaredLicenses:
10+
- "Apache-2.0"
11+
authors:
12+
- "John Doe"
13+
- "Foo Bar"
14+
dependencies:
15+
- purl: "pkg:maven/com.example/full@1.1.0"
16+
description: "Package with fully elaborated model."
17+
vcs:
18+
type: "Mercurial"
19+
url: "https://git.example.com/full/"
20+
revision: "master"
21+
path: "/"
22+
sourceArtifact:
23+
url: "https://repo.example.com/m2/full-1.1.0-sources.jar"
24+
hash: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
25+
declaredLicenses:
26+
- "Apache-2.0"
27+
- "MIT"
28+
homepageUrl: "https://project_x.example.com/full"
29+
labels:
30+
label: "value"
31+
label2: "value2"
32+
authors:
33+
- "John Doe"
34+
- "Foo Bar"
35+
scopes:
36+
- "main"
37+
isModified: false
38+
metadataOnly: false
39+
40+
- purl: "pkg:maven/com.example/minimal@0.1.0"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
projectName: "Example ORT BOM project"
2+
description: "Project X description"
3+
vcs:
4+
type: "GIT"
5+
url: "https://git.example.com/project_x/"
6+
revision: "master"
7+
path: "/"
8+
homepageUrl: "https://project_x.example.com"
9+
declaredLicenses:
10+
- "Apache-2.0"
11+
authors:
12+
- "John Doe"
13+
- "Foo Bar"
14+
dependencies:
15+
- purl: "pkg:maven/com.example/full@1.1.0"
16+
description: "Package with fully elaborated model."
17+
vcs:
18+
type: "Mercurial"
19+
url: "https://git.example.com/full/"
20+
revision: "master"
21+
path: "/"
22+
sourceArtifact:
23+
url: "https://repo.example.com/m2/full-1.1.0-sources.jar"
24+
hash: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
25+
declaredLicenses:
26+
- "Apache-2.0"
27+
- "MIT"
28+
homepageUrl: "https://project_x.example.com/full"
29+
labels:
30+
label: "value"
31+
label2: "value2"
32+
authors:
33+
- "John Doe"
34+
- "Foo Bar"
35+
scopes:
36+
- "main"
37+
isModified: false
38+
metadataOnly: false
39+
40+
- purl: "pkg:maven/com.example/minimal@0.1.0"
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"projectName": "Example ORT BOM project",
3+
"description": "Project X description",
4+
"vcs": {
5+
"type": "GIT",
6+
"url": "https://git.example.com/project_x/",
7+
"revision": "master",
8+
"path": "/"
9+
},
10+
"homepageUrl": "https://project_x.example.com",
11+
"declaredLicenses": [
12+
"Apache-2.0"
13+
],
14+
"authors": [
15+
"John Doe",
16+
"Foo Bar"
17+
],
18+
"dependencies": [
19+
{
20+
"purl": "pkg:maven/com.example/full@1.1.0",
21+
"description": "Package with fully elaborated model.",
22+
"vcs": {
23+
"type": "Mercurial",
24+
"url": "https://git.example.com/full/",
25+
"revision": "master",
26+
"path": "/"
27+
},
28+
"sourceArtifact": {
29+
"url": "https://repo.example.com/m2/full-1.1.0-sources.jar",
30+
"hash": "da39a3ee5e6b4b0d3255bfef95601890afd80709"
31+
},
32+
"declaredLicenses": [
33+
"Apache-2.0",
34+
"MIT"
35+
],
36+
"homepageUrl": "https://project_x.example.com/full",
37+
"labels": {
38+
"label": "value",
39+
"label2": "value2"
40+
},
41+
"authors": [
42+
"John Doe",
43+
"Foo Bar"
44+
],
45+
"scopes": [
46+
"main"
47+
],
48+
"isModified": false,
49+
"metadataOnly": false
50+
},
51+
{
52+
"purl": "pkg:maven/com.example/minimal@0.1.0"
53+
}
54+
]
55+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
projectName: "Example ORT BOM project"
2+
description: "Project X description"
3+
vcs:
4+
type: "GIT"
5+
url: "https://git.example.com/project_x/"
6+
revision: "master"
7+
path: "/"
8+
homepageUrl: "https://project_x.example.com"
9+
declaredLicenses:
10+
- "Apache-2.0"
11+
authors:
12+
- "John Doe"
13+
- "Foo Bar"
14+
dependencies:
15+
- description: "Package with fully elaborated model."
16+
vcs:
17+
type: "Mercurial"
18+
url: "https://git.example.com/full/"
19+
revision: "master"
20+
path: "/"
21+
sourceArtifact:
22+
url: "https://repo.example.com/m2/full-1.1.0-sources.jar"
23+
hash: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
24+
declaredLicenses:
25+
- "Apache-2.0"
26+
- "MIT"
27+
homepageUrl: "https://project_x.example.com/full"
28+
labels:
29+
label: "value"
30+
label2: "value2"
31+
authors:
32+
- "Doe John"
33+
- "Bar Foo"
34+
scopes:
35+
- "main"
36+
isModified: false
37+
metadataOnly: false
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
projectName: "Example ORT BOM project"
2+
description: "Project X description"
3+
vcs:
4+
type: "GIT"
5+
url: "https://git.example.com/project_x/"
6+
revision: "master"
7+
path: "/"
8+
homepageUrl: "https://project_x.example.com"
9+
declaredLicenses:
10+
- "Apache-2.0"
11+
authors:
12+
- "John Doe"
13+
- "Foo Bar"
14+
dependencies:
15+
- purl: "pkg:maven/com.example/full@1.1.0"
16+
id: "Maven/com.example/full@1.1.0"
17+
description: "Package with fully elaborated model."
18+
vcs:
19+
type: "Mercurial"
20+
url: "https://git.example.com/full/"
21+
revision: "master"
22+
path: "/"
23+
sourceArtifact:
24+
url: "https://repo.example.com/m2/full-1.1.0-sources.jar"
25+
hash: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
26+
declaredLicenses:
27+
- "Apache-2.0"
28+
- "MIT"
29+
homepageUrl: "https://project_x.example.com/full"
30+
labels:
31+
label: "value"
32+
label2: "value2"
33+
authors:
34+
- "Doe John"
35+
- "Bar Foo"
36+
scopes:
37+
- "main"
38+
isModified: false
39+
metadataOnly: false
40+
41+
- purl: "pkg:maven/com.example/minimal@0.1.0"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"projectName": "Example ORT BOM project with wrong format of file",
3+
"dependencies": "OK",
4+
"dependencies": [
5+
{
6+
"purl": "something:maven/com.example/full@1.1.0"
7+
}
8+
]
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"projectName": "Example ORT BOM project with wrong package name",
3+
"dependencies": [
4+
{
5+
"purl": "something:maven/com.example/full@1.1.0"
6+
}
7+
]
8+
}

0 commit comments

Comments
 (0)