2
0
Fork 0
mirror of https://github.com/bazelbuild/rules_cc synced 2024-12-03 02:53:18 +00:00

Add initial content of rules_cc repo

RELNOTES: None.
PiperOrigin-RevId: 227846116
This commit is contained in:
hlopko 2019-01-04 15:14:30 +01:00 committed by Marcel Hlopko
parent 30e32836fa
commit 17818b2501
4 changed files with 150 additions and 0 deletions

28
CONTRIBUTING.md Normal file
View file

@ -0,0 +1,28 @@
# How to Contribute
We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.
## Contributor License Agreement
Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution;
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.
## Code reviews
All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.
## Community Guidelines
This project follows [Google's Open Source Community
Guidelines](https://opensource.google.com/conduct/).

36
README.md Normal file
View file

@ -0,0 +1,36 @@
# C++ rules for Bazel
This repository contains Starlark implementation of C++ rules in Bazel.
The rules are being incrementally converted from their native implementations in the [Bazel source tree](https://source.bazel.build/bazel/+/master:src/main/java/com/google/devtools/build/lib/rules/cpp/).
For the list of C++ rules, see the Bazel
[documentation](https://docs.bazel.build/versions/master/be/overview.html).
# Getting Started
There is no need to use rules from this repository just yet. If you want to use
rules\_cc anyway, add the following to your WORKSPACE file:
```
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_cc",
urls = ["https://github.com/bazelbuild/rules_cc/archive/TODO"],
sha256 = "TODO",
)
```
Then, in your BUILD files, import and use the rules:
```
load("@rules_cc//cc:rules.bzl", "cc_library")
cc_library(
...
)
```
# Migration Tools
This repository also contains migration tools that can be used to migrate your
project for Bazel incompatible changes.

1
cc/BUILD Normal file
View file

@ -0,0 +1 @@
# Intentionally left empty

85
cc/rules.bzl Normal file
View file

@ -0,0 +1,85 @@
# Copyright 2018 The Bazel Authors. All rights reserved.
#
# 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
#
# 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.
"""Starlark rules for building C++ projects."""
def cc_binary(**attrs):
"""Bazel cc_binary rule.
https://docs.bazel.build/versions/master/be/c-cpp.html#cc_binary
Args:
**attrs: Rule attributes
"""
native.cc_binary(**attrs)
def cc_test(**attrs):
"""Bazel cc_test rule.
https://docs.bazel.build/versions/master/be/c-cpp.html#cc_test
Args:
**attrs: Rule attributes
"""
native.cc_test(**attrs)
def cc_library(**attrs):
"""Bazel cc_library rule.
https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library
Args:
**attrs: Rule attributes
"""
native.cc_library(**attrs)
def cc_import(**attrs):
"""Bazel cc_import rule.
https://docs.bazel.build/versions/master/be/c-cpp.html#cc_import
Args:
**attrs: Rule attributes
"""
native.cc_import(**attrs)
def cc_proto_library(**attrs):
"""Bazel cc_proto_library rule.
https://docs.bazel.build/versions/master/be/c-cpp.html#cc_proto_library
Args:
**attrs: Rule attributes
"""
native.cc_proto_library(**attrs)
def fdo_prefetch_hints(**attrs):
"""Bazel fdo_prefetch_hints rule.
https://docs.bazel.build/versions/master/be/c-cpp.html#fdo_prefetch_hints
Args:
**attrs: Rule attributes
"""
native.fdo_prefetch_hints(**attrs)
def fdo_profile(**attrs):
"""Bazel fdo_profile rule.
https://docs.bazel.build/versions/master/be/c-cpp.html#fdo_profile
Args:
**attrs: Rule attributes
"""
native.fdo_profile(**attrs)