Skip to content

Commit

Permalink
Add a minimal starter template for writing enclave apps.
Browse files Browse the repository at this point in the history
Bug: 390021734
Change-Id: I2cb30270f218d9fac4388e632dd476f99acdf7d3
  • Loading branch information
Changochen committed Jan 22, 2025
1 parent 5fcba0a commit c1826e3
Show file tree
Hide file tree
Showing 26 changed files with 62,906 additions and 1 deletion.
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bazel/test_workspace
codelab
40 changes: 40 additions & 0 deletions codelab/.bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Bazel defaults.

# Should not be needed after Bazel 7.0 is released.
common --incompatible_enable_cc_toolchain_resolution

# Build C++ targets using C++17.
# <https://stackoverflow.com/questions/40260242/how-to-set-c-standard-version-when-build-with-bazel>
common --cxxopt=-std=c++17

# Fix Abseil "C++ versions less than C++14 are not supported".
# <https://github.com/protocolbuffers/protobuf/issues/12393#issuecomment-1504349780>
common --host_cxxopt=-std=c++17

# Required for cargo_build_script support before Bazel 7
# See: "Build script env is overridden by use_default_shell_env in Bazel 6"
# https://github.com/bazelbuild/rules_rust/issues/2665
common --incompatible_merge_fixed_and_default_shell_env

# Use nightly rustc by default
common --@rules_rust//rust/toolchain/channel=nightly

# Use a custom workspace status command so that the git revision is included in
# stamped binaries.
#common --workspace_status_command=bazel/workspace_status_command.sh

# Prevents repeated setup-teardown of sandboxes for targets that are frequently
# reused. This speeds up builds significantly in some cases, like when using a
# toolchain with a hermetic sysroot, like we do.
# See: https://github.com/bazelbuild/bazel/issues/16138
# For a good summary of potential issues, ask Gemini a question like:
# "Is there any reason I shouldn't enable --reuse_sandbox_directories" by default?
common --reuse_sandbox_directories

# https://github.com/bazelbuild/bazel/issues/9342
# --experimental_check_desugar_deps (on by default) breaks Android builds.
common --noexperimental_check_desugar_deps

# Set the rustc --sysroot flag to one generated by the toolchains. This is needed to support
# rebuilding the standard libraries for stage 0 and the restricted kernel wrapper.
common --@rules_rust//rust/settings:toolchain_generated_sysroot=True
1 change: 1 addition & 0 deletions codelab/.bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.5.0
9 changes: 9 additions & 0 deletions codelab/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Bazel ###
# gitignore template for Bazel build system
# website: https://bazel.build/

# Ignore all bazel-* symlinks. There is no full list since this can change
# based on the name of the directory bazel is cloned into.
bazel-*
# Local additional settings and overrides.
/.local.bazelrc
19 changes: 19 additions & 0 deletions codelab/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright 2025 The Project Oak Authors
#
# 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.
#

package(
licenses = ["notice"],
)
Loading

0 comments on commit c1826e3

Please sign in to comment.