Skip to content

Commit 2cdf94e

Browse files
committed
Use CamelCase for Starlark types
1 parent 72980a3 commit 2cdf94e

File tree

35 files changed

+207
-205
lines changed

35 files changed

+207
-205
lines changed

.aspect/config.axl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
def config(ctx):
1+
def config(ctx: ConfigContext):
22
pass
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
def config(ctx):
1+
def config(ctx: ConfigContext):
22
pass

crates/axl-runtime/src/builtins/aspect/build.axl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Improvements over 'bazel build' command:
1010

1111
load("./common.axl", "tui")
1212

13-
def impl(ctx: task_context) -> int:
13+
def impl(ctx: TaskContext) -> int:
1414
stdout = ctx.std.io.stdout
1515
stderr = ctx.std.io.stderr
1616
events = True

crates/axl-runtime/src/builtins/aspect/common.axl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
def _fancy_tui(ctx: task_context, build) -> int:
1+
def _fancy_tui(ctx: TaskContext, build: bazel.build.Build) -> int:
22
events = build.events()
33
offset = 0
44
in_flight = {}
@@ -48,7 +48,7 @@ def _fancy_tui(ctx: task_context, build) -> int:
4848
last_drawn_lines = len(in_flight)
4949
offset = (offset + 1) % len(in_flight)
5050

51-
def _simple_tui(ctx: task_context, build) -> int:
51+
def _simple_tui(ctx: TaskContext, build: bazel.build.Build) -> int:
5252
for event in build.events():
5353
if event.kind == "progress":
5454
ctx.std.io.stdout.write(event.payload.stdout)
@@ -60,7 +60,7 @@ def _simple_tui(ctx: task_context, build) -> int:
6060
return exit.code
6161

6262

63-
def tui(ctx: task_context, build) -> int:
63+
def tui(ctx: TaskContext, build: bazel.build.Build) -> int:
6464
stdout = ctx.std.io.stdout
6565
if stdout.is_tty:
6666
return _fancy_tui(ctx, build)

crates/axl-runtime/src/engine/async/future.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'v> AllocValue<'v> for Box<dyn FutureAlloc> {
3636
pub type FutOutput = Result<Box<dyn FutureAlloc>, anyhow::Error>;
3737

3838
#[derive(Display, Allocative, ProvidesStaticType, NoSerialize)]
39-
#[display("future")]
39+
#[display("Future")]
4040
pub struct StarlarkFuture {
4141
#[allocative(skip)]
4242
inner: Rc<RefCell<Option<BoxFuture<'static, FutOutput>>>>,
@@ -82,7 +82,7 @@ unsafe impl<'v> Trace<'v> for StarlarkFuture {
8282

8383
impl Debug for StarlarkFuture {
8484
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
85-
f.debug_struct("StarlarkFuture").finish()
85+
f.debug_struct("Future").finish()
8686
}
8787
}
8888

@@ -103,7 +103,7 @@ impl<'v> UnpackValue<'v> for StarlarkFuture {
103103
}
104104
}
105105

106-
#[starlark_value(type = "future")]
106+
#[starlark_value(type = "Future")]
107107
impl<'v> values::StarlarkValue<'v> for StarlarkFuture {
108108
fn get_methods() -> Option<&'static Methods> {
109109
static RES: MethodsStatic = MethodsStatic::new();

crates/axl-runtime/src/engine/async/future_stream.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,24 @@ use super::future::StarlarkFuture;
1515
use super::rt::AsyncRuntime;
1616

1717
#[derive(ProvidesStaticType, Display, NoSerialize, Allocative)]
18-
#[display("<future.iter>")]
19-
pub struct FutureStream {
18+
#[display("<FutureIterator>")]
19+
pub struct FutureIterator {
2020
#[allocative(skip)]
2121
pub(super) rt: AsyncRuntime,
2222
#[allocative(skip)]
2323
pub(super) stream: Arc<RwLock<JoinSet<super::future::FutOutput>>>,
2424
}
2525

26-
impl std::fmt::Debug for FutureStream {
26+
impl std::fmt::Debug for FutureIterator {
2727
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28-
f.debug_struct("FutureStream")
28+
f.debug_struct("FutureIterator")
2929
.field("rt", &self.rt)
3030
.field("stream", &self.stream)
3131
.finish()
3232
}
3333
}
3434

35-
impl FutureStream {
35+
impl FutureIterator {
3636
pub fn new(rt: AsyncRuntime, futures: Vec<StarlarkFuture>) -> Self {
3737
let mut set = JoinSet::new();
3838
let guard = rt.enter();
@@ -47,24 +47,24 @@ impl FutureStream {
4747
}
4848
}
4949

50-
unsafe impl<'v> Trace<'v> for FutureStream {
50+
unsafe impl<'v> Trace<'v> for FutureIterator {
5151
fn trace(&mut self, _tracer: &values::Tracer<'v>) {}
5252
}
5353

54-
impl Clone for FutureStream {
54+
impl Clone for FutureIterator {
5555
fn clone(&self) -> Self {
5656
todo!()
5757
}
5858
}
5959

60-
impl<'v> AllocValue<'v> for FutureStream {
60+
impl<'v> AllocValue<'v> for FutureIterator {
6161
fn alloc_value(self, heap: &'v Heap) -> values::Value<'v> {
6262
heap.alloc_complex_no_freeze(self)
6363
}
6464
}
6565

66-
#[starlark_value(type = "future_iter")]
67-
impl<'v> values::StarlarkValue<'v> for FutureStream {
66+
#[starlark_value(type = "FutureIterator")]
67+
impl<'v> values::StarlarkValue<'v> for FutureIterator {
6868
unsafe fn iterate(
6969
&self,
7070
me: values::Value<'v>,

crates/axl-runtime/src/engine/async/mod.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ pub mod rt {
3131
}
3232

3333
#[starlark_module]
34-
fn register_type_toplevels(builder: &mut GlobalsBuilder) {
35-
const future: StarlarkValueAsType<future::StarlarkFuture> = StarlarkValueAsType::new();
34+
fn register_types(globals: &mut GlobalsBuilder) {
35+
const Future: StarlarkValueAsType<future::StarlarkFuture> = StarlarkValueAsType::new();
3636
}
3737

38-
pub fn register_toplevels(builder: &mut GlobalsBuilder) {
39-
util::register_toplevels(builder);
40-
register_type_toplevels(builder)
38+
pub fn register_globals(globals: &mut GlobalsBuilder) {
39+
register_types(globals);
40+
41+
util::register_globals(globals);
4142
}

crates/axl-runtime/src/engine/async/util.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,19 @@ use starlark::{
44

55
use crate::engine::store::AxlStore;
66

7-
use super::{future::StarlarkFuture, future_stream::FutureStream};
7+
use super::{future::StarlarkFuture, future_stream::FutureIterator};
88

9-
pub fn register_toplevels(builder: &mut GlobalsBuilder) {
10-
builder.namespace("futures", register_future_utils);
9+
pub fn register_globals(globals: &mut GlobalsBuilder) {
10+
globals.namespace("futures", register_future_utils);
1111
}
1212

1313
#[starlark_module]
14-
fn register_future_utils(_: &mut GlobalsBuilder) {
14+
fn register_future_utils(globals: &mut GlobalsBuilder) {
1515
fn iter<'v>(
1616
#[starlark(args)] futures: UnpackTuple<StarlarkFuture>,
1717
eval: &mut Evaluator<'v, '_, '_>,
18-
) -> starlark::Result<FutureStream> {
18+
) -> starlark::Result<FutureIterator> {
1919
let store = AxlStore::from_eval(eval)?;
20-
return Ok(FutureStream::new(store.rt, futures.items));
20+
return Ok(FutureIterator::new(store.rt, futures.items));
2121
}
2222
}

crates/axl-runtime/src/engine/bazel/build.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use super::stream_sink::GrpcEventStreamSink;
4040
use super::stream_tracing::TracingEventStreamSink;
4141

4242
#[derive(Debug, ProvidesStaticType, Display, Trace, NoSerialize, Allocative)]
43-
#[display("<build_status>")]
43+
#[display("<bazel.build.BuildStatus>")]
4444
pub struct BuildStatus {
4545
success: bool,
4646
code: Option<i32>,
@@ -52,7 +52,7 @@ impl<'v> AllocValue<'v> for BuildStatus {
5252
}
5353
}
5454

55-
#[starlark_value(type = "build_status")]
55+
#[starlark_value(type = "bazel.build.BuildStatus")]
5656
impl<'v> values::StarlarkValue<'v> for BuildStatus {
5757
fn get_methods() -> Option<&'static Methods> {
5858
static RES: MethodsStatic = MethodsStatic::new();
@@ -75,7 +75,7 @@ pub(crate) fn build_status_methods(registry: &mut MethodsBuilder) {
7575
}
7676

7777
#[derive(Debug, Display, ProvidesStaticType, NoSerialize, Allocative, Clone)]
78-
#[display("<build_event_sink>")]
78+
#[display("<bazel.build.BuildEventSink>")]
7979
pub enum BuildEventSink {
8080
Grpc {
8181
uri: String,
@@ -85,7 +85,7 @@ pub enum BuildEventSink {
8585

8686
starlark_simple_value!(BuildEventSink);
8787

88-
#[starlark_value(type = "build_event_sink")]
88+
#[starlark_value(type = "bazel.build.BuildEventSink")]
8989
impl<'v> values::StarlarkValue<'v> for BuildEventSink {}
9090

9191
impl<'v> UnpackValue<'v> for BuildEventSink {
@@ -108,7 +108,7 @@ impl BuildEventSink {
108108
}
109109

110110
#[derive(Debug, Display, ProvidesStaticType, Trace, NoSerialize, Allocative)]
111-
#[display("<build>")]
111+
#[display("<bazel.build.Build>")]
112112
pub struct Build {
113113
#[allocative(skip)]
114114
event_stream: RefCell<Option<EventStream>>,
@@ -214,7 +214,7 @@ impl<'v> AllocValue<'v> for Build {
214214
}
215215
}
216216

217-
#[starlark_value(type = "build")]
217+
#[starlark_value(type = "bazel.build.Build")]
218218
impl<'v> values::StarlarkValue<'v> for Build {
219219
fn get_methods() -> Option<&'static Methods> {
220220
static RES: MethodsStatic = MethodsStatic::new();

crates/axl-runtime/src/engine/bazel/iterator.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use starlark::values::ValueLike;
2727
use crate::engine::bazel::execlog_stream::{ExecLogIterator, RetryStream};
2828

2929
#[derive(Debug, ProvidesStaticType, Display, Trace, NoSerialize, Allocative)]
30-
#[display("<build_event_iterator>")]
30+
#[display("<bazel.build.BuildEventIterator>")]
3131
pub struct BuildEventIterator {
3232
#[allocative(skip)]
3333
recv: RefCell<Receiver<BuildEvent>>,
@@ -58,7 +58,7 @@ pub(crate) fn build_event_methods(registry: &mut MethodsBuilder) {
5858
}
5959
}
6060

61-
#[starlark_value(type = "build_event_iterator")]
61+
#[starlark_value(type = "bazel.build.BuildEventIterator")]
6262
impl<'v> values::StarlarkValue<'v> for BuildEventIterator {
6363
fn eval_type(&self) -> Option<Ty> {
6464
Some(Ty::iter(
@@ -93,7 +93,7 @@ impl<'v> values::StarlarkValue<'v> for BuildEventIterator {
9393
}
9494

9595
#[derive(ProvidesStaticType, Display, Trace, NoSerialize, Allocative)]
96-
#[display("<build_event_iterator>")]
96+
#[display("<bazel.build.ExecutionLogIterator>")]
9797
pub struct ExecutionLogIterator {
9898
#[allocative(skip)]
9999
execlog_iterator:
@@ -102,7 +102,7 @@ pub struct ExecutionLogIterator {
102102

103103
impl Debug for ExecutionLogIterator {
104104
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
105-
f.debug_struct("ExecutionLogIterator")
105+
f.debug_struct("bazel.build.ExecutionLogIterator")
106106
.field("execlog_iterator", &String::from("hidden"))
107107
.finish()
108108
}
@@ -128,7 +128,7 @@ impl<'v> AllocValue<'v> for ExecutionLogIterator {
128128
}
129129
}
130130

131-
#[starlark_value(type = "build_event_iterator")]
131+
#[starlark_value(type = "bazel.build.ExecutionLogIterator")]
132132
impl<'v> values::StarlarkValue<'v> for ExecutionLogIterator {
133133
fn eval_type(&self) -> Option<Ty> {
134134
Some(Ty::iter(

0 commit comments

Comments
 (0)