Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the custom node-capnp import logic. #3413

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -46,6 +46,9 @@ CFLAGS2=$(CFLAGS) -pthread -fPIC -DKJ_STD_COMPAT
# -lrt is not used by sandstorm itself, but the test app uses it. It would be
# nice if we could not link everything against it.
LIBS2=$(LIBS) deps/libsodium/build/src/libsodium/.libs/libsodium.a deps/boringssl/build/ssl/libssl.a deps/boringssl/build/crypto/libcrypto.a -lz -ldl -pthread -lrt
# Note: despite the name, we actually do build this in-tree; it is pre-built from
# perspective of npm, since we build it with ekam.
PREBUILT_NODE_CAPNP_BINARY=$(shell pwd)/tmp/node-capnp/capnp.node

define color
printf '\033[0;34m==== $1 ====\033[0m\n'
@@ -373,14 +376,17 @@ shell/public/%-m.svg: icons/%.svg
shell-build: shell/imports/* shell/imports/*/* shell/imports/*/*/* shell/imports/*/*/*/* shell/client/main.ts shell/server/main.ts shell/public/* shell/i18n/* shell/.meteor/packages shell/.meteor/release shell/.meteor/versions tmp/.shell-env
@$(call color,building meteor frontend)
@test -z "$$(find -L shell/* -type l)" || (echo "error: broken symlinks in shell: $$(find -L shell/* -type l)" >&2 && exit 1)
@OLD=`pwd` && cd shell && meteor build --directory "$$OLD/shell-build"
@OLD=`pwd` && \
cd shell && \
PREBUILT_NODE_CAPNP_BINARY="$(PREBUILT_NODE_CAPNP_BINARY)" \
meteor build --directory "$$OLD/shell-build"

# ====================================================================
# Bundle

bundle: tmp/.ekam-run shell-build make-bundle.sh localedata-C meteor-bundle-main.js
@$(call color,bundle)
@CC=$(CC) ./make-bundle.sh
@CC=$(CC) PREBUILT_NODE_CAPNP_BINARY=$(PREBUILT_NODE_CAPNP_BINARY) ./make-bundle.sh

sandstorm-$(BUILD).tar.xz: bundle
@$(call color,compress release bundle)
2 changes: 1 addition & 1 deletion deps/node-capnp
3 changes: 0 additions & 3 deletions make-bundle.sh
Original file line number Diff line number Diff line change
@@ -154,9 +154,6 @@ mkdir -p bundle/usr/include/{capnp,sandstorm}
cp src/capnp/!(*test*).capnp bundle/usr/include/capnp
cp src/sandstorm/!(*-internal).capnp bundle/usr/include/sandstorm

# Copy over node_modules.
cp -r node_modules bundle

# Copy over all necessary shared libraries.
(ldd bundle/bin/* $(find bundle -name '*.node') || true) | grep -o '[[:space:]]/[^ ]*' | copyDeps

Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import { check } from "meteor/check";

import { stripe } from "/imports/blackrock-payments/server/payments-server.js";

import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
const PaymentsRpc = Capnp.importSystem("sandstorm/payments.capnp");

function wrapAsyncAsPromise(obj, func) {
2 changes: 1 addition & 1 deletion shell/imports/sandstorm-db/scheduled-jobs-db.js
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

import Crypto from "crypto";
import { Match, check } from "meteor/check";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
import { SandstormDb } from "./db.js";

const MINIMUM_SCHEDULING_SLACK_NANO = Capnp.importSystem("sandstorm/grain.capnp").minimumSchedulingSlack;
2 changes: 1 addition & 1 deletion shell/imports/sandstorm-ui-powerbox/powerbox-server.js
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import { check } from "meteor/check";
import { _ } from "meteor/underscore";

import { SandstormPermissions } from "/imports/sandstorm-permissions/permissions.js";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";

import { waitPromise } from '../server/async-helpers.ts';

2 changes: 1 addition & 1 deletion shell/imports/server/backend.js
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@

import { Meteor } from "meteor/meteor";
import { inMeteor, waitPromise } from "/imports/server/async-helpers.ts";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
import { globalDb } from "/imports/db-deprecated.js";

let storageUsageUnimplemented = false;
2 changes: 1 addition & 1 deletion shell/imports/server/backup.js
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ import { Router } from "meteor/iron:router";

import { inMeteor, waitPromise } from "/imports/server/async-helpers.ts";

import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
import { SandstormDb } from "/imports/sandstorm-db/db.js";
import { globalDb } from "/imports/db-deprecated.js";

43 changes: 0 additions & 43 deletions shell/imports/server/capnp.js

This file was deleted.

2 changes: 1 addition & 1 deletion shell/imports/server/core.js
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ import { globalDb } from "/imports/db-deprecated.js";
import { schedulePeriodic, scheduleOneShot } from "/imports/server/scheduled-job.js";
import { makeGatewayRouter } from "/imports/server/gateway-router.js";
import { makeShellCli } from "/imports/server/shell-cli.js";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";

const PersistentHandle = Capnp.importSystem("sandstorm/supervisor.capnp").PersistentHandle;
const SandstormCore = Capnp.importSystem("sandstorm/supervisor.capnp").SandstormCore;
2 changes: 1 addition & 1 deletion shell/imports/server/drivers/external-ui-view.js
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@ import { globalDb } from "/imports/db-deprecated.js";
import Url from "url";
import Http from "http";
import Https from "https";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
const ApiSession = Capnp.importSystem("sandstorm/api-session.capnp").ApiSession;
const PersistentApiSession =
Capnp.importSystem("sandstorm/api-session-impl.capnp").PersistentApiSession;
2 changes: 1 addition & 1 deletion shell/imports/server/drivers/ip.js
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ import { PersistentImpl } from "/imports/server/persistent.js";
import Net from "net";
import Tls from "tls";
import Dgram from "dgram";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";

const IpRpc = Capnp.importSystem("sandstorm/ip.capnp");

2 changes: 1 addition & 1 deletion shell/imports/server/drivers/mail.js
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ import { makeHackSessionContext } from "/imports/server/hack-session.js";
import Crypto from "crypto";
import Net from "net";
import Url from "url";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";

const EmailRpc = Capnp.importSystem("sandstorm/email.capnp");
const EmailImpl = Capnp.importSystem("sandstorm/email-impl.capnp");
2 changes: 1 addition & 1 deletion shell/imports/server/gateway-router.js
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import { Match, check } from "meteor/check";
import { _ } from "meteor/underscore";
import { Random } from "meteor/random";

import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
import { SandstormDb } from "/imports/sandstorm-db/db.js";
import { globalDb } from "/imports/db-deprecated.js";
import { SandstormPermissions } from "/imports/sandstorm-permissions/permissions.js";
2 changes: 1 addition & 1 deletion shell/imports/server/hack-session.js
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ import { Random } from "meteor/random";
import { hashSturdyRef, checkRequirements, fetchApiToken } from "/imports/server/persistent.js";
import { inMeteor, waitPromise } from "/imports/server/async-helpers.ts";
import { ssrfSafeLookup } from "/imports/server/networking.js";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
import { SandstormDb } from "/imports/sandstorm-db/db.js";
import { globalDb } from "/imports/db-deprecated.js";

2 changes: 1 addition & 1 deletion shell/imports/server/header-whitelist.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
const WebSession = Capnp.importSystem("sandstorm/web-session.capnp").WebSession;

class HeaderWhitelist {
2 changes: 1 addition & 1 deletion shell/imports/server/identity.js
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import { globalDb } from "/imports/db-deprecated.js";
import { SandstormPermissions } from "/imports/sandstorm-permissions/permissions.js";
import { PersistentImpl } from "/imports/server/persistent.js";
import { StaticAssetImpl, IdenticonStaticAssetImpl } from "/imports/server/static-asset.js";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";

const IdentityRpc = Capnp.importSystem("sandstorm/identity-impl.capnp");
const Identity = Capnp.importSystem("sandstorm/identity.capnp").Identity;
2 changes: 1 addition & 1 deletion shell/imports/server/persistent.js
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ import { Random } from "meteor/random";

import Crypto from "crypto";
import { inMeteor } from "/imports/server/async-helpers.ts";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
import { SandstormPermissions } from "/imports/sandstorm-permissions/permissions.js";

const privateDb = Symbol("PersistentImpl.db");
2 changes: 1 addition & 1 deletion shell/imports/server/scheduled-job.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ import { Meteor } from "meteor/meteor";

import { waitPromise } from "/imports/server/async-helpers.ts";
import { fetchApiToken } from "/imports/server/persistent.js";
import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
import { SandstormDb } from "/imports/sandstorm-db/db.js";
import { globalDb } from "/imports/db-deprecated.js";

2 changes: 1 addition & 1 deletion shell/imports/server/shell-cli.js
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import { createAcmeAccount, renewCertificateNow } from "/imports/server/acme.js"
import { SandstormDb } from "/imports/sandstorm-db/db.js";
import { globalDb } from "/imports/db-deprecated.js";

import Capnp from "/imports/server/capnp.js";
import Capnp from "capnp";
const ShellCli = Capnp.importSystem("sandstorm/backend.capnp").ShellCli;

class ShellCliImpl {
6 changes: 6 additions & 0 deletions shell/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions shell/package.json
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@
"babel-runtime": "^6.26.0",
"bignum": "^0.13.0",
"body-parser": "^1.19.0",
"capnp": "file:../deps/node-capnp",
"content-type": "^1.0.4",
"fibers": "^4.0.3",
"heapdump": "^0.3.15",
@@ -46,6 +47,7 @@
"node-forge": "^0.10.0",
"nodemailer": "^2.7.2",
"nodemailer-smtp-pool": "^2.8.3",
"sandstorm": "file:../src/sandstorm",
"smtp-server": "^1.17.0",
"stripe": "^8.125.0",
"xml-crypto": "0.0.20",
11 changes: 11 additions & 0 deletions src/sandstorm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "sandstorm",
"version": "1.0.0",
"description": "Sandstorm's capnp schema.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "Apache 2.0"
}
19 changes: 0 additions & 19 deletions src/sandstorm/sandstorm.ekam-manifest
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
run-bundle bin/sandstorm
spk-standalone bin/spk
sandstorm-http-bridge bin
email.capnp node_modules/sandstorm/email.capnp
email-impl.capnp node_modules/sandstorm/email-impl.capnp
grain.capnp node_modules/sandstorm/grain.capnp
api-session.capnp node_modules/sandstorm/api-session.capnp
api-session-impl.capnp node_modules/sandstorm/api-session-impl.capnp
hack-session.capnp node_modules/sandstorm/hack-session.capnp
ip.capnp node_modules/sandstorm/ip.capnp
package.capnp node_modules/sandstorm/package.capnp
supervisor.capnp node_modules/sandstorm/supervisor.capnp
util.capnp node_modules/sandstorm/util.capnp
web-session.capnp node_modules/sandstorm/web-session.capnp
backend.capnp node_modules/sandstorm/backend.capnp
persistentuiview.capnp node_modules/sandstorm/persistentuiview.capnp
update-tool.capnp node_modules/sandstorm/update-tool.capnp
powerbox.capnp node_modules/sandstorm/powerbox.capnp
activity.capnp node_modules/sandstorm/activity.capnp
identity.capnp node_modules/sandstorm/identity.capnp
identity-impl.capnp node_modules/sandstorm/identity-impl.capnp
payments.capnp node_modules/sandstorm/payments.capnp