From 9b64be7df1d3429469c83c63f0361e1c2ed3cb8f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Tue, 29 Jul 2025 02:09:39 +0000 Subject: [PATCH] Add Bazel workspace and TypeDB artifacts loading utilities Co-authored-by: joshua --- WORKSPACE | 7 ++++ dependencies/typedb/artifacts.bzl | 58 +++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 WORKSPACE create mode 100644 dependencies/typedb/artifacts.bzl diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 000000000..9eb2a83b1 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,7 @@ +workspace(name = "typedb_docs") + +# Load TypeDB artifacts +load("//dependencies/typedb:artifacts.bzl", "load_typedb_artifacts") +load_typedb_artifacts() + +# Additional workspace rules can be added here as needed \ No newline at end of file diff --git a/dependencies/typedb/artifacts.bzl b/dependencies/typedb/artifacts.bzl new file mode 100644 index 000000000..fbd1f5f02 --- /dev/null +++ b/dependencies/typedb/artifacts.bzl @@ -0,0 +1,58 @@ +""" +TypeDB artifacts loading utilities for Bazel. + +This module provides functions to load TypeDB artifacts from remote URLs. +""" + +def load_typedb_artifact(name, url, sha256 = None, strip_prefix = None, type = "zip"): + """ + Load a TypeDB artifact from a remote URL. + + Args: + name: A unique name for this artifact. + url: The URL to download the artifact from. + sha256: Optional SHA256 checksum for verification. + strip_prefix: Optional prefix to strip from extracted files. + type: Type of archive (zip, tar.gz, etc.). Defaults to "zip". + """ + if type == "zip": + native.http_archive( + name = name, + url = url, + sha256 = sha256, + strip_prefix = strip_prefix, + ) + elif type == "tar.gz": + native.http_archive( + name = name, + url = url, + sha256 = sha256, + strip_prefix = strip_prefix, + ) + elif type == "jar": + native.http_file( + name = name, + url = url, + sha256 = sha256, + downloaded_file_path = name + ".jar", + ) + else: + fail("Unsupported artifact type: {}. Supported types: zip, tar.gz, jar".format(type)) + +def load_typedb_artifacts(): + """ + Load all standard TypeDB artifacts. + + This function can be extended to include standard TypeDB dependencies + that are commonly used across projects. + """ + + # Example TypeDB artifacts - these would be replaced with actual TypeDB URLs + load_typedb_artifact( + name = "typedb_client", + url = "https://repo1.maven.org/maven2/com/vaticle/typedb/typedb-client-java/2.14.1/typedb-client-java-2.14.1.jar", + sha256 = "example_sha256_hash_here", + type = "jar" + ) + + # Add more standard TypeDB artifacts here as needed \ No newline at end of file