Skip to content

Commit

Permalink
feat(packge-manager): Add initial support for Bazel
Browse files Browse the repository at this point in the history
This is based on oss-review-toolkit#264.

Signed-off-by: Haiko Schol <[email protected]>
  • Loading branch information
haikoschol committed Mar 13, 2024
1 parent e8b88df commit 3581696
Show file tree
Hide file tree
Showing 34 changed files with 5,443 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -564,3 +564,12 @@ ENV PATH=$PATH:$HASKELL_HOME/bin
COPY --from=haskell /opt/haskell /opt/haskell

RUN syft /opt/haskell -o spdx-json --file /usr/share/doc/ort/ort-haskell.spdx.json

# Bazel WIP

RUN DEBIAN_FRONTEND=noninteractive sudo apt install -y apt-transport-https && \
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor >bazel-archive-keyring.gpg && \
sudo mv bazel-archive-keyring.gpg /usr/share/keyrings && \
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/bazel-archive-keyring.gpg] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list && \
sudo apt update && sudo apt install bazel && \
sudo rm -rf /var/lib/apt/lists/*
60 changes: 60 additions & 0 deletions plugins/package-managers/bazel/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (C) 2024 The ORT Project Authors (see <https://github.com/oss-review-toolkit/ort/blob/main/NOTICE>)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/

import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
// Apply precompiled plugins.
id("ort-library-conventions")

// Apply third-party plugins.
alias(libs.plugins.kotlinSerialization)
}

dependencies {
api(projects.analyzer)
api(projects.model)
api(projects.utils.commonUtils) {
because("This is a CommandLineTool.")
}

api(libs.semver4j) {
because("This is a CommandLineTool.")
}

implementation(projects.downloader)
implementation(projects.clients.bazelModuleRegistryClient)
implementation(projects.utils.ortUtils)
implementation(projects.utils.spdxUtils)

implementation(libs.bundles.kotlinxSerialization)
implementation(libs.kotlinx.coroutines)

funTestImplementation(testFixtures(projects.analyzer))
}

tasks.withType<KotlinCompile>().configureEach {
val customCompilerArgs = listOf(
"-opt-in=kotlinx.serialization.ExperimentalSerializationApi"
)

compilerOptions {
freeCompilerArgs.addAll(customCompilerArgs)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module(name="bazel-test-module", version="0.42.23", compatibility_level=0)

bazel_dep(name = "glog", version = "0.5.0", repo_name = "com_github_google_glog")
bazel_dep(name = "googletest", version = "1.14.0", repo_name = "com_google_googletest", dev_dependency = True)

Loading

0 comments on commit 3581696

Please sign in to comment.