Skip to content

Commit

Permalink
[build] Modularize frankenbuild.c++, assorted include cleanup
Browse files Browse the repository at this point in the history
Also adds a TODO outlining potential for future modularization
  • Loading branch information
fhanau committed Jan 11, 2025
1 parent 5055345 commit d91d52a
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 10 deletions.
3 changes: 3 additions & 0 deletions src/workerd/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ filegroup(
srcs = glob(
["**/*.c++"],
exclude = [
# TODO(cleanup): Continue shrinking the io target: Create independent targets for
# analytics-engine, kv, urlpattern and streams/compression, which either do not depend
# on io or do not have io depending on them.
"**/*test*.c++",
"data-url.c++",
"encoding.c++",
Expand Down
1 change: 1 addition & 0 deletions src/workerd/api/analytics-engine.c++
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "analytics-engine.h"

#include <workerd/api/analytics-engine.capnp.h>
#include <workerd/io/io-context.h>

namespace workerd::api {
Expand Down
1 change: 0 additions & 1 deletion src/workerd/api/analytics-engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

#include <workerd/api/analytics-engine-impl.h>
#include <workerd/api/analytics-engine.capnp.h>
#include <workerd/api/util.h>
#include <workerd/io/io-util.h>
#include <workerd/jsg/jsg.h>
Expand Down
1 change: 1 addition & 0 deletions src/workerd/api/global-scope.c++
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <workerd/api/system-streams.h>
#include <workerd/api/trace.h>
#include <workerd/api/util.h>
#include <workerd/io/compatibility-date.h>
#include <workerd/io/features.h>
#include <workerd/io/io-context.h>
#include <workerd/jsg/async-context.h>
Expand Down
18 changes: 14 additions & 4 deletions src/workerd/io/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ wd_cc_library(
srcs = [
"compatibility-date.c++",
"features.c++",
"frankenvalue.c++",
"hibernation-manager.c++",
"io-context.c++",
"io-own.c++",
Expand All @@ -70,7 +69,6 @@ wd_cc_library(
hdrs = [
"compatibility-date.h",
"features.h",
"frankenvalue.h",
"hibernation-manager.h",
"io-channels.h",
"io-context.h",
Expand Down Expand Up @@ -100,7 +98,7 @@ wd_cc_library(
":actor-id",
":actor-storage_capnp",
":cdp_capnp",
":frankenvalue_capnp",
":frankenvalue",
":io-gate",
":io-helpers",
":limit-enforcer",
Expand Down Expand Up @@ -159,6 +157,18 @@ wd_cc_library(
],
)

wd_cc_library(
name = "frankenvalue",
srcs = ["frankenvalue.c++"],
hdrs = ["frankenvalue.h"],
visibility = ["//visibility:public"],
deps = [
":frankenvalue_capnp",
"//src/workerd/jsg",
"@capnp-cpp//src/capnp:capnpc",
],
)

wd_cc_library(
name = "trace",
srcs = ["trace.c++"],
Expand Down Expand Up @@ -354,6 +364,6 @@ kj_test(
kj_test(
src = "frankenvalue-test.c++",
deps = [
":io",
":frankenvalue",
],
)
1 change: 0 additions & 1 deletion src/workerd/io/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

#include <workerd/io/compatibility-date.capnp.h>
#include <workerd/io/compatibility-date.h>
#include <workerd/jsg/jsg.h>

namespace workerd {
Expand Down
1 change: 1 addition & 0 deletions src/workerd/io/io-channels.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <workerd/io/io-util.h>
#include <workerd/io/trace.h>

#include <capnp/capability.h> // for Capability
#include <kj/debug.h>
#include <kj/string.h>

Expand Down
2 changes: 0 additions & 2 deletions src/workerd/io/io-gate.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include <kj/list.h>
#include <kj/one-of.h>

#include <type_traits>

namespace workerd {

using kj::uint;
Expand Down
2 changes: 2 additions & 0 deletions src/workerd/io/io-own.c++
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "io-context.h"

#include <workerd/jsg/util.h>

namespace workerd {

#ifdef KJ_DEBUG
Expand Down
4 changes: 3 additions & 1 deletion src/workerd/io/io-own.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#pragma once

#include <workerd/jsg/util.h>
#include <workerd/util/weak-refs.h>

#include <kj/async-io.h>
Expand All @@ -13,6 +12,9 @@
#include <typeinfo>

namespace workerd {
namespace jsg {
class Lock;
}

class IoContext;

Expand Down
2 changes: 1 addition & 1 deletion src/workerd/io/worker-entrypoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include <workerd/io/frankenvalue.capnp.h>
#include <workerd/io/frankenvalue.h>
#include <workerd/io/worker.h>

namespace workerd {
Expand Down
2 changes: 2 additions & 0 deletions src/workerd/server/alarm-scheduler.c++
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "alarm-scheduler.h"

#include <cmath>

namespace workerd::server {

int AlarmScheduler::maxJitterMsForDelay(kj::Duration delay) {
Expand Down
2 changes: 2 additions & 0 deletions src/workerd/util/sqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
#pragma once

#include <kj/filesystem.h>
#include <kj/function.h>
#include <kj/list.h>
#include <kj/one-of.h>
#include <kj/string.h>

#include <utility>

Expand Down

0 comments on commit d91d52a

Please sign in to comment.