Skip to content

Commit

Permalink
Add Bazel rules for C# packaging, distribution and documentation. (#406)
Browse files Browse the repository at this point in the history
## What is the goal of this PR?

We prepare tools for the C# driver release, namely: documentation,
packaging, and distribution.

## What are the changes implemented in this PR?

Added:
Rules for the C# nuget packages generation and distribution. These rules
are based on the rules from [the open source Selenium
repo](https://github.com/SeleniumHQ/selenium/), so thanks to them for
boosting the development by making it available! They are used and
tested in the [typedb-driver](https://github.com/vaticle/typedb-driver/)
project:
* `nuget_pack`: gets a list of C# libraries, native libs files (if
needed), a template nuget project description, a list of files to
include into the package (for example, README or logos), and produces
two files: nupkg (nuget package) and snupkg (symbol package for
debugging).
* `nuget_push`: receives the result of the previous command and pushes
the packages (with their symbols) to the target (snapshot/release) repo.

Updated:
* doxygen configuration, previously used solely for `C++`. Now it's also
convenient for `C#`, so some refactoring and additions happened.
  • Loading branch information
farost authored Apr 4, 2024
1 parent fbec2a3 commit 5e8c09d
Show file tree
Hide file tree
Showing 7 changed files with 459 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# under the License.
#

exports_files(["cpp/doxyfile.template"])
exports_files(["doxygen/doxyfile.template"])

load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@vaticle_dependencies_tool_docs//:requirements.bzl", docs_requirement = "requirement")
Expand All @@ -37,7 +37,7 @@ py_binary(
bzl_library(
name = "lib",
srcs = [
"cpp/rules.bzl",
"doxygen/rules.bzl",
"python/rules.bzl",
],
deps = [],
Expand Down
5 changes: 5 additions & 0 deletions docs/cpp/doxyfile.template → docs/doxygen/doxyfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,8 @@ GENERATE_LATEX = NO
HIDE_UNDOC_RELATIONS = YES
CLASS_GRAPH = YES
HAVE_DOT = NO ## Disables many details

#---------------------------------------------------------------------------
# Configuration options related to optional content included to the output
#---------------------------------------------------------------------------
EXTRACT_STATIC = YES
6 changes: 3 additions & 3 deletions docs/cpp/rules.bzl → docs/doxygen/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _doxygen_docs_impl(ctx):
files.extend(target.files.to_list())

replacements = {
"PROJECT_NAME": ctx.attr.project_name,
"PROJECT_NAME": '"' + ctx.attr.project_name + '"',
"PROJECT_NUMBER" : ctx.attr.version,
"PROJECT_BRIEF" : ctx.attr.desc,
"OUTPUT_DIRECTORY" : output_directory.path,
Expand Down Expand Up @@ -90,15 +90,15 @@ doxygen_docs = rule(
),
"_doxyfile_template" : attr.label(
allow_single_file = True,
default = "//docs:cpp/doxyfile.template"
default = "//docs:doxygen/doxyfile.template"
),
"_output_directory" : attr.string(
doc = "The output directory for the doxygen docs",
default = "doxygen_docs"
)
},
doc = """
Creates HTML documentation for C++ projects using Doxygen.
Creates HTML documentation for C++ and C# projects using Doxygen.
This rule is not hermetic, and requires doxygen to be installed on the host.
"""
)
16 changes: 16 additions & 0 deletions nuget/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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
#
# http://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.
Loading

0 comments on commit 5e8c09d

Please sign in to comment.