Skip to content

Commit d860271

Browse files
haikoscholsschuberth
authored andcommitted
feat(package-manager): Add initial support for Bazel
This starts the work on issue oss-review-toolkit#264. Signed-off-by: Haiko Schol <hs@haikoschol.com>
1 parent 2577dd0 commit d860271

26 files changed

Lines changed: 3508 additions & 0 deletions

File tree

‎analyzer/src/funTest/kotlin/PackageManagerFunTest.kt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import org.ossreviewtoolkit.model.config.PathExcludeReason
3838

3939
class PackageManagerFunTest : WordSpec({
4040
val definitionFiles = listOf(
41+
"bazel/MODULE.bazel",
4142
"bower/bower.json",
4243
"bundler/Gemfile",
4344
"cargo/Cargo.toml",
@@ -93,6 +94,7 @@ class PackageManagerFunTest : WordSpec({
9394
val managedFilesByName = managedFiles.groupByName(projectDir)
9495

9596
assertSoftly {
97+
managedFilesByName["Bazel"] should containExactly("bazel/MODULE.bazel")
9698
managedFilesByName["Bower"] should containExactly("bower/bower.json")
9799
managedFilesByName["Bundler"] should containExactly("bundler/Gemfile")
98100
managedFilesByName["Cargo"] should containExactly("cargo/Cargo.toml")

‎mlc_config.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
{
44
"pattern": "^#.*$"
55
},
6+
{
7+
"pattern": "^https://bazel.build/$"
8+
},
69
{
710
"pattern": "^https?://localhost.*$"
811
},
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright (C) 2024 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-library-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+
api(projects.utils.commonUtils) {
32+
because("This is a CommandLineTool.")
33+
}
34+
35+
api(libs.semver4j) {
36+
because("This is a CommandLineTool.")
37+
}
38+
39+
implementation(projects.downloader)
40+
implementation(projects.clients.bazelModuleRegistryClient)
41+
implementation(projects.utils.ortUtils)
42+
implementation(projects.utils.spdxUtils)
43+
44+
implementation(libs.bundles.kotlinxSerialization)
45+
implementation(libs.kotlinx.coroutines)
46+
47+
funTestImplementation(testFixtures(projects.analyzer))
48+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module(name="bazel-test-module", version="0.42.23", compatibility_level=0)
2+
3+
bazel_dep(name = "glog", version = "0.5.0", repo_name = "com_github_google_glog")
4+
bazel_dep(name = "googletest", version = "1.14.0", repo_name = "com_google_googletest", dev_dependency = True)
5+

0 commit comments

Comments
 (0)