mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-22 19:22:39 +00:00
What this does: - Sets up a `migrate_cpp` tool which currently only runs `clang-tidy`. - This is intended to have more transformations in the future. - Sets up a `migrate_cpp.sh` script. - This copies the original woff2 code into a `carbon` directory and runs the `migrate_cpp` tool on it there. - Adds the initial `carbon` directory of woff2 - To be clear, this is currently only updated via `clang-tidy`. - More transformations should be expected in the future. - Minor related edits. For example: - Adjust pre-commit to skip the `carbon` directory, because it's third-party code and shouldn't be edited in the same way. - Adds `@brotli_carbon` as a local repository so that we can "build" outputs. - Makes clang-tidy from the bootstrap toolchain accessible for BUILD dependencies, as it's then used for `migrate_cpp`. What this does not do: - Any actual transformation of C++ code to Carbon Co-authored-by: Matthew Riley <mdriley@gmail.com>
36 lines
1.0 KiB
Bash
Executable File
36 lines
1.0 KiB
Bash
Executable File
#!/bin/bash -eux
|
|
#
|
|
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
# Exceptions. See /LICENSE for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
#
|
|
# Runs an example migration of woff2 C++ code.
|
|
|
|
# cd to the carbon-lang root.
|
|
cd "$(dirname "$0")/../../.."
|
|
|
|
EXAMPLE=third_party/examples/woff2
|
|
|
|
# Remove any previous conversion. Each time this is run, it should demonstrate
|
|
# on a fresh copy of woff2.
|
|
rm -rf "${EXAMPLE}/carbon/"
|
|
|
|
# Initialize the carbon directory with C++ code only.
|
|
mkdir -p "${EXAMPLE}/carbon/"
|
|
for x in LICENSE include src; do
|
|
cp -R "${EXAMPLE}/original/${x}" "${EXAMPLE}/carbon/${x}"
|
|
done
|
|
|
|
# Copy files into the carbon directory to simplify the setup.
|
|
cp "${EXAMPLE}/BUILD.original" \
|
|
"${EXAMPLE}/carbon/BUILD"
|
|
cp "${EXAMPLE}/WORKSPACE.original" \
|
|
"${EXAMPLE}/carbon/WORKSPACE"
|
|
cp "${EXAMPLE}/compile_flags.carbon.txt" \
|
|
"${EXAMPLE}/carbon/compile_flags.txt"
|
|
|
|
# Run the migration tool.
|
|
bazel build //migrate_cpp
|
|
./bazel-bin/migrate_cpp/migrate_cpp \
|
|
"${EXAMPLE}/carbon"
|