Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
- name: WebAssembly Build
run: pnpm run build --ci
env:
PACKAGE: "perspective-cpp,perspective,perspective-viewer,perspective-viewer-datagrid,perspective-viewer-d3fc,perspective-viewer-openlayers,perspective-workspace,perspective-cli,perspective-react"
PACKAGE: "perspective-server,perspective,perspective-viewer,perspective-viewer-datagrid,perspective-viewer-d3fc,perspective-viewer-openlayers,perspective-workspace,perspective-cli,perspective-react"
# PSP_USE_CCACHE: 1

- uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -635,7 +635,7 @@ jobs:
- name: Run Tests
run: pnpm run test
env:
PACKAGE: "perspective-cpp,perspective,perspective-viewer,perspective-viewer-datagrid,perspective-viewer-d3fc,perspective-viewer-openlayers,perspective-workspace,perspective-cli,perspective-react"
PACKAGE: "perspective-server,perspective,perspective-viewer,perspective-viewer-datagrid,perspective-viewer-d3fc,perspective-viewer-openlayers,perspective-workspace,perspective-cli,perspective-react"
# PSP_USE_CCACHE: 1

# ,--,--' . .-,--. . .
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ rust/perspective-client/src/rust/proto.rs
rust/perspective-js/src/ts/ts-rs
rust/perspective-python/LICENSE_THIRDPARTY_cargo.yml
rust/perspective-python/LICENSE.md
rust/perspective-server/cmake
rust/perspective-server/cpp
rust/perspective-server/docs/lib_gen.md
rust/perspective-viewer/src/ts/ts-rs
rust/perspective/src/ts/ts-rs
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions binder/postBuild

This file was deleted.

1 change: 0 additions & 1 deletion binder/requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion binder/runtime.txt

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"tools/perspective-test",
"tools/perspective-scripts",
"tools/perspective-esbuild-plugin",
"cpp/perspective",
"packages/perspective-react",
"packages/perspective-viewer-datagrid",
"packages/perspective-viewer-d3fc",
Expand All @@ -34,6 +33,7 @@
"rust/perspective-js",
"rust/perspective-viewer",
"rust/perspective-python",
"rust/perspective-server",
"examples/*",
"docs"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective-workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@
"@finos/perspective-esbuild-plugin": "workspace:^",
"@finos/perspective-test": "workspace:^",
"@types/lodash": "^4.17.12",
"zx": "^8.1.9"
"zx": "^8.3.0"
}
}
47 changes: 25 additions & 22 deletions pnpm-lock.yaml

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

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ packages:
- "tools/perspective-test"
- "tools/perspective-scripts"
- "tools/perspective-bench"
- "cpp/perspective"
- "packages/perspective-client"
- "tools/perspective-esbuild-plugin"
- "packages/perspective-viewer-datagrid"
Expand All @@ -17,5 +16,6 @@ packages:
- "rust/perspective-js"
- "rust/perspective-viewer"
- "rust/perspective-python"
- "rust/perspective-server"
- "examples/*"
- "docs"
4 changes: 3 additions & 1 deletion rust/perspective-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ include = [
]

[features]
default = []
default = ["generate-proto", "protobuf-src"]

# Should the project build the `proto.rs` via protoc from source or assume it
# already exists?
generate-proto = []

# Should the project build protobuf from source? If not, building this crate
# requires PROTOC be set in the environment
protobuf-src = ["dep:protobuf-src"]
Expand All @@ -52,6 +53,7 @@ talc-allocator = ["talc"]
crate-type = ["rlib"]
path = "src/rust/lib.rs"


[build-dependencies]
prost-build = { version = "0.12.3" }
protobuf-src = { version = "2.0.1", optional = true }
Expand Down
16 changes: 11 additions & 5 deletions rust/perspective-client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,20 @@ use std::io::Result;
use std::path::Path;

fn prost_build() -> Result<()> {
// This source file is included at `publish` time, but not `sbuild` time
println!(
"cargo::metadata=PROTO_PATH={}",
std::env::var("CARGO_MANIFEST_DIR").unwrap()
);

// This source file is included at `publish` time, but not `build` time
// because it is initially generated from the `perspective.proto` definition
// in the C++ source.
// in the source.
if std::env::var("CARGO_FEATURE_GENERATE_PROTO").is_ok() {
println!("cargo:warning=MESSAGE Building in development mode");
let root_dir_env = std::env::var("PSP_ROOT_DIR").expect("Must set PSP_ROOT_DIR");
let root_dir = Path::new(root_dir_env.as_str());
let proto_file = Path::join(root_dir, "cpp/protos/perspective.proto");
// let root_dir_env = std::env::var("PSP_ROOT_DIR").expect("Must set
// PSP_ROOT_DIR"); let root_dir = Path::new(root_dir_env.as_str());
// let proto_file = Path::join(root_dir, "cpp/protos/perspective.proto");
let proto_file = Path::new("./perspective.proto");
let include_path = proto_file
.parent()
.expect("Couldn't determine parent directory of proto_file")
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion rust/perspective-js/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ async function build_rust() {
}

async function build_web_assets() {
await cpy(["../../cpp/perspective/dist/web/*"], "dist/wasm");
await cpy(["../../rust/perspective-server/dist/web/*"], "dist/wasm");
await Promise.all(BUILD.map(build)).catch((e) => {
console.error(e);
process.exit(1);
Expand Down
4 changes: 2 additions & 2 deletions rust/perspective-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"ws": "^8.17.0"
},
"devDependencies": {
"@finos/perspective-cpp": "workspace:^",
"@finos/perspective-server": "workspace:^",
"@finos/perspective-esbuild-plugin": "workspace:^",
"@finos/perspective-metadata": "workspace:^",
"@finos/perspective-test": "workspace:^",
Expand All @@ -61,6 +61,6 @@
"typedoc": "^0.28.7",
"typescript": "~5.2.2",
"underscore": "^1.13.6",
"zx": "8.1.9"
"zx": "8.3.0"
}
}
1 change: 1 addition & 0 deletions rust/perspective-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ disable-cpp = []
cmake = "0.1.50"
num_cpus = "^1.15.0"
shlex = "1.3.0"
protobuf-src = { version = "2.0.1" }

[dependencies]
link-cplusplus = "1.0.9"
Expand Down
23 changes: 19 additions & 4 deletions cpp/perspective/build.mjs → rust/perspective-server/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ import os from "node:os";
import path from "node:path";
import * as url from "node:url";

import "zx/globals";

const __dirname = url.fileURLToPath(new URL(".", import.meta.url)).slice(0, -1);

const stdio = "inherit";
const env = process.env.PSP_DEBUG ? "debug" : "release";
const cwd = path.join(process.cwd(), "dist", env);

const cmake_dir = path.join(__dirname, "cpp", "perspective");

const { compress } = await import("pro_self_extracting_wasm");

delete process.env.NODE;
Expand All @@ -38,16 +42,27 @@ if (!!process.env.PSP_BUILD_VERBOSE) {
try {
execSync(`mkdirp ${cwd}`, { stdio });
process.env.CLICOLOR_FORCE = 1;
const out = await $`cargo metadata`;
const p = JSON.parse(out.stdout).packages.find(
(x) => x.name === "perspective-client"
).manifest_path;

const pp = path.parse(p);

execSync(
`emcmake cmake ${__dirname} ${cmake_flags} -DCMAKE_BUILD_TYPE=${env} -DRAPIDJSON_BUILD_EXAMPLES=OFF`,
`emcmake cmake ${cmake_dir} ${cmake_flags} \
-DCMAKE_BUILD_TYPE=${env} \
-DRAPIDJSON_BUILD_EXAMPLES=OFF \
-DPSP_PROTO_PATH=${pp.dir}`,
{
cwd,
stdio,
}
);

execSync(
`emmake make -j${process.env.PSP_NUM_CPUS || os.cpus().length
`emmake make -j${
process.env.PSP_NUM_CPUS || os.cpus().length
} ${make_flags}`,
{
cwd,
Expand All @@ -59,8 +74,8 @@ try {
execSync(`cpy node/**/* ../node`, { cwd, stdio });
if (!process.env.PSP_HEAP_INSTRUMENTS) {
compress(
`../../cpp/perspective/dist/web/perspective-server.wasm`,
`../../cpp/perspective/dist/web/perspective-server.wasm`
`./dist/web/perspective-server.wasm`,
`./dist/web/perspective-server.wasm`
);
}
} catch (e) {
Expand Down
41 changes: 0 additions & 41 deletions rust/perspective-server/build/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,11 @@

mod psp;

use std::collections::HashSet;
use std::path::Path;
use std::{fs, io};

pub fn copy_dir_all(
src: impl AsRef<Path>,
dst: impl AsRef<Path>,
skip: &HashSet<&str>,
) -> io::Result<()> {
fs::create_dir_all(&dst)?;
for entry in fs::read_dir(src)? {
let entry = entry?;
let ty = entry.file_type()?;
if ty.is_dir() {
if !skip.contains(&*entry.file_name().to_string_lossy()) {
copy_dir_all(entry.path(), dst.as_ref().join(entry.file_name()), skip)?;
}
} else {
fs::copy(entry.path(), dst.as_ref().join(entry.file_name()))?;
}
}

Ok(())
}

fn main() -> Result<(), std::io::Error> {
if std::env::var("DOCS_RS").is_ok() {
return Ok(());
}

if std::env::var("CARGO_FEATURE_EXTERNAL_CPP").is_ok() {
println!("cargo:warning=MESSAGE Building in development mode");
let root_dir_env = std::env::var("PSP_ROOT_DIR").expect("Must set PSP_ROOT_DIR");
let root_dir = Path::new(root_dir_env.as_str());
copy_dir_all(
Path::join(root_dir, "cpp"),
"cpp",
&HashSet::from(["dist", "node_modules"]),
)?;
copy_dir_all(Path::join(root_dir, "cmake"), "cmake", &HashSet::new())?;
println!(
"cargo:rerun-if-changed={}/cpp/perspective",
root_dir.display()
);
}

if std::option_env!("PSP_DISABLE_CPP").is_none()
&& std::env::var("CARGO_FEATURE_DISABLE_CPP").is_err()
{
Expand Down
Loading
Loading