Skip to content

Commit a0b097e

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 a0b097e

File tree

17 files changed

+828
-1
lines changed

17 files changed

+828
-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()

integrations/schemas/package-managers-schema.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"Maven",
1919
"NPM",
2020
"NuGet",
21+
"OrtProjectFile",
2122
"PIP",
2223
"Pipenv",
2324
"PNPM",

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+
"OrtProjectFile",
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: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
projectName: "Example ORT project"
2+
description: "Project X description"
3+
homepageUrl: "https://project_x.example.com"
4+
declaredLicenses:
5+
- "Apache-2.0"
6+
authors:
7+
- "John Doe"
8+
- "Foo Bar"
9+
dependencies:
10+
- purl: "pkg:maven/com.example/full@1.1.0"
11+
description: "Package with fully elaborated model."
12+
vcs:
13+
type: "Mercurial"
14+
url: "https://git.example.com/full/"
15+
revision: "master"
16+
path: "/"
17+
sourceArtifact:
18+
url: "https://repo.example.com/m2/full-1.1.0-sources.jar"
19+
hash: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
20+
declaredLicenses:
21+
- "Apache-2.0"
22+
- "MIT"
23+
homepageUrl: "https://project_x.example.com/full"
24+
labels:
25+
label: "value"
26+
label2: "value2"
27+
authors:
28+
- "John Doe"
29+
- "Foo Bar"
30+
scopes:
31+
- "main"
32+
isModified: false
33+
metadataOnly: false
34+
35+
- purl: "pkg:maven/com.example/minimal@0.1.0"
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
projectName: "Example ORT project"
2+
description: "Project X description"
3+
homepageUrl: "https://project_x.example.com"
4+
declaredLicenses:
5+
- "Apache-2.0"
6+
authors:
7+
- "John Doe"
8+
- "Foo Bar"
9+
dependencies:
10+
- purl: "pkg:maven/com.example/full@1.1.0"
11+
description: "Package with fully elaborated model."
12+
vcs:
13+
type: "Mercurial"
14+
url: "https://git.example.com/full/"
15+
revision: "master"
16+
path: "/"
17+
sourceArtifact:
18+
url: "https://repo.example.com/m2/full-1.1.0-sources.jar"
19+
hash: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
20+
declaredLicenses:
21+
- "Apache-2.0"
22+
- "MIT"
23+
homepageUrl: "https://project_x.example.com/full"
24+
labels:
25+
label: "value"
26+
label2: "value2"
27+
authors:
28+
- "John Doe"
29+
- "Foo Bar"
30+
scopes:
31+
- "main"
32+
isModified: false
33+
metadataOnly: false
34+
35+
- purl: "pkg:maven/com.example/minimal@0.1.0"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"projectName": "Example ORT project",
3+
"description": "Project X description",
4+
"homepageUrl": "https://project_x.example.com",
5+
"declaredLicenses": [
6+
"Apache-2.0"
7+
],
8+
"authors": [
9+
"John Doe",
10+
"Foo Bar"
11+
],
12+
"dependencies": [
13+
{
14+
"purl": "pkg:maven/com.example/full@1.1.0",
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+
},
22+
"sourceArtifact": {
23+
"url": "https://repo.example.com/m2/full-1.1.0-sources.jar",
24+
"hash": "da39a3ee5e6b4b0d3255bfef95601890afd80709"
25+
},
26+
"declaredLicenses": [
27+
"Apache-2.0",
28+
"MIT"
29+
],
30+
"homepageUrl": "https://project_x.example.com/full",
31+
"labels": {
32+
"label": "value",
33+
"label2": "value2"
34+
},
35+
"authors": [
36+
"John Doe",
37+
"Foo Bar"
38+
],
39+
"scopes": [
40+
"main"
41+
],
42+
"isModified": false,
43+
"metadataOnly": false
44+
},
45+
{
46+
"purl": "pkg:maven/com.example/minimal@0.1.0"
47+
}
48+
]
49+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
projectName: "Example ORT project"
2+
description: "Project X description"
3+
homepageUrl: "https://project_x.example.com"
4+
declaredLicenses:
5+
- "Apache-2.0"
6+
authors:
7+
- "John Doe"
8+
- "Foo Bar"
9+
dependencies:
10+
- description: "Package with fully elaborated model."
11+
vcs:
12+
type: "Mercurial"
13+
url: "https://git.example.com/full/"
14+
revision: "master"
15+
path: "/"
16+
sourceArtifact:
17+
url: "https://repo.example.com/m2/full-1.1.0-sources.jar"
18+
hash: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
19+
declaredLicenses:
20+
- "Apache-2.0"
21+
- "MIT"
22+
homepageUrl: "https://project_x.example.com/full"
23+
labels:
24+
label: "value"
25+
label2: "value2"
26+
authors:
27+
- "Doe John"
28+
- "Bar Foo"
29+
scopes:
30+
- "main"
31+
isModified: false
32+
metadataOnly: false
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
{
2+
"projectName": "Example ORT project",
3+
"description": "Project X description",
4+
"homepageUrl": "https://project_x.example.com",
5+
"declaredLicenses": [
6+
"Apache-2.0"
7+
],
8+
"authors": [
9+
"John Doe",
10+
"Foo Bar"
11+
],
12+
"dependencies": [
13+
{
14+
"purl": "pkg:maven/com.example/full@1.1.0",
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+
},
22+
"sourceArtifact": {
23+
"url": "https://repo.example.com/m2/full-1.1.0-sources.jar",
24+
"hash": "da39a3ee5e6b4b0d3255bfef95601890afd80709"
25+
},
26+
"declaredLicenses": [
27+
"Apache-2.0",
28+
"MIT"
29+
],
30+
"homepageUrl": "https://project_x.example.com/full",
31+
"labels": {
32+
"label": "value",
33+
"label2": "value2"
34+
},
35+
"authors": [
36+
"Doe John",
37+
"Bar Foo"
38+
],
39+
"scopes": [
40+
"main"
41+
],
42+
"isModified": false,
43+
"metadataOnly": false
44+
},
45+
{
46+
"purl": "pkg:maven/com.example/minimal@0.1.0"
47+
}
48+
]
49+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
projectName: "Example ORT project"
2+
description: "Project X description"
3+
homepageUrl: "https://project_x.example.com"
4+
declaredLicenses:
5+
- "Apache-2.0"
6+
authors:
7+
- "John Doe"
8+
- "Foo Bar"
9+
dependencies:
10+
- purl: "pkg:maven/com.example/full@1.1.0"
11+
description: "Package with fully elaborated model."
12+
vcs:
13+
type: "Mercurial"
14+
url: "https://git.example.com/full/"
15+
revision: "master"
16+
path: "/"
17+
sourceArtifact:
18+
url: "https://repo.example.com/m2/full-1.1.0-sources.jar"
19+
hash: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
20+
declaredLicenses:
21+
- "Apache-2.0"
22+
- "MIT"
23+
homepageUrl: "https://project_x.example.com/full"
24+
labels:
25+
label: "value"
26+
label2: "value2"
27+
authors:
28+
- "Doe John"
29+
- "Bar Foo"
30+
scopes:
31+
- "main"
32+
isModified: false
33+
metadataOnly: false
34+
35+
- purl: "pkg:maven/com.example/minimal@0.1.0"

0 commit comments

Comments
 (0)