Create an empty cargo project for starlark suppoprt. It doesn't do anything right now. Bug: 528225104 Change-Id: I971cd0e30ee31d4a1bc1eaf4d7a6033d6a6a6964 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/23380 Reviewed-by: Takuto Ikuta <tikuta@google.com> Commit-Queue: Matt Stark <msta@google.com>
diff --git a/src/gn/starlark/.gitignore b/src/gn/starlark/.gitignore new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/src/gn/starlark/.gitignore
@@ -0,0 +1 @@ +target/
diff --git a/src/gn/starlark/Cargo.lock b/src/gn/starlark/Cargo.lock new file mode 100644 index 0000000..979b39c --- /dev/null +++ b/src/gn/starlark/Cargo.lock
@@ -0,0 +1,47 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "gn_starlark" +version = "0.1.0" + +[[patch.unused]] +name = "allocative" +version = "0.3.6" +source = "git+https://github.com/matts1/starlark-rust.git?branch=gn_starlark#c599dd000d7f754cfa68af4bca4a4e2a622c2e1b" + +[[patch.unused]] +name = "allocative_derive" +version = "0.3.6" +source = "git+https://github.com/matts1/starlark-rust.git?branch=gn_starlark#c599dd000d7f754cfa68af4bca4a4e2a622c2e1b" + +[[patch.unused]] +name = "pagable" +version = "0.4.1" +source = "git+https://github.com/matts1/starlark-rust.git?branch=gn_starlark#c599dd000d7f754cfa68af4bca4a4e2a622c2e1b" + +[[patch.unused]] +name = "pagable_derive" +version = "0.4.1" +source = "git+https://github.com/matts1/starlark-rust.git?branch=gn_starlark#c599dd000d7f754cfa68af4bca4a4e2a622c2e1b" + +[[patch.unused]] +name = "starlark" +version = "0.14.2" +source = "git+https://github.com/matts1/starlark-rust.git?branch=gn_starlark#c599dd000d7f754cfa68af4bca4a4e2a622c2e1b" + +[[patch.unused]] +name = "starlark_derive" +version = "0.14.2" +source = "git+https://github.com/matts1/starlark-rust.git?branch=gn_starlark#c599dd000d7f754cfa68af4bca4a4e2a622c2e1b" + +[[patch.unused]] +name = "starlark_map" +version = "0.14.2" +source = "git+https://github.com/matts1/starlark-rust.git?branch=gn_starlark#c599dd000d7f754cfa68af4bca4a4e2a622c2e1b" + +[[patch.unused]] +name = "starlark_syntax" +version = "0.14.2" +source = "git+https://github.com/matts1/starlark-rust.git?branch=gn_starlark#c599dd000d7f754cfa68af4bca4a4e2a622c2e1b"
diff --git a/src/gn/starlark/Cargo.toml b/src/gn/starlark/Cargo.toml new file mode 100644 index 0000000..bcbee9d --- /dev/null +++ b/src/gn/starlark/Cargo.toml
@@ -0,0 +1,90 @@ +[package] +name = "gn_starlark" +version = "0.1.0" +edition = "2021" + +[lints] +workspace = true + +[lib] +crate-type = ["staticlib"] +test = false + +[workspace] +members = [ + ".", +] + +[workspace.dependencies] +allocative = "0.3" +anyhow = "1.0" +cxx = "1.0" +either = "1.16" +starlark = "0.14" +starlark_derive = "0.14" +thiserror = "2.0" + +# A short-lived fork until my PR gets merged. +# Basically all it does is make some pub(crate) things public, so that we can +# create records directly in rust (could only create them by running in starlark +# previously). +[patch.crates-io] +starlark = { git = "https://github.com/matts1/starlark-rust.git", branch = "gn_starlark" } +starlark_derive = { git = "https://github.com/matts1/starlark-rust.git", branch = "gn_starlark" } +starlark_map = { git = "https://github.com/matts1/starlark-rust.git", branch = "gn_starlark" } +starlark_syntax = { git = "https://github.com/matts1/starlark-rust.git", branch = "gn_starlark" } +allocative = { git = "https://github.com/matts1/starlark-rust.git", branch = "gn_starlark" } +allocative_derive = { git = "https://github.com/matts1/starlark-rust.git", branch = "gn_starlark" } +pagable = { git = "https://github.com/matts1/starlark-rust.git", branch = "gn_starlark" } +pagable_derive = { git = "https://github.com/matts1/starlark-rust.git", branch = "gn_starlark" } + +# In debug mode, we still optimize our dependencies. +# Otherwise our static library for this package is +# ~400MB and our link times go through the roof. +# This significantly improves link performance. +[profile.dev.package."*"] +opt-level = 3 +debug = false + +# Always build the code generator in release mode. +[profile.dev.build-override] +opt-level = 3 + +[workspace.lints.clippy] +borrow_as_ptr = "warn" +cast_lossless = "warn" +cloned_instead_of_copied = "warn" +elidable_lifetime_names = "warn" +explicit_into_iter_loop = "warn" +explicit_iter_loop = "warn" +flat_map_option = "warn" +format_collect = "warn" +format_push_string = "warn" +implicit_clone = "warn" +manual_let_else = "warn" +needless_for_each = "warn" +# If we dereference C++ pointers but wrap it in safety, we should not be +# required to mark the function as unsafe. +not_unsafe_ptr_arg_deref = "allow" +ptr_as_ptr = "warn" +ptr_cast_constness = "warn" +ref_as_ptr = "warn" +ref_option = "warn" +semicolon_if_nothing_returned = "warn" +single_char_pattern = "warn" +stable_sort_primitive = "warn" +uninlined_format_args = "warn" +unnecessary_literal_bound = "warn" +unnecessary_semicolon = "warn" +unnested_or_patterns = "warn" +unused_trait_names = "warn" +use_self = "warn" +useless_conversion = "warn" +while_let_loop = "warn" + +[workspace.lints.rust] +let_underscore_drop = "warn" +redundant_imports = "warn" +# &str is not a proper C type. +# However, rust::Str is defined in cxx.h and wraps it safely. +improper_ctypes = "allow"
diff --git a/src/gn/starlark/OWNERS b/src/gn/starlark/OWNERS new file mode 100644 index 0000000..a00d0ad --- /dev/null +++ b/src/gn/starlark/OWNERS
@@ -0,0 +1,5 @@ +# This directory should be owned by experts in bazel, +# in addition to the regular GN owners. +msta@google.com +philwo@google.com +richardwa@google.com \ No newline at end of file
diff --git a/src/gn/starlark/src/lib.rs b/src/gn/starlark/src/lib.rs new file mode 100644 index 0000000..b1216cc --- /dev/null +++ b/src/gn/starlark/src/lib.rs
@@ -0,0 +1,3 @@ +// Copyright 2026 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file.