Compare commits

..

No commits in common. "98fac30ed6a96c8a6a6f051fbde169aecc747b20" and "919d242daaa90f5cff4a23409c4330937e81c896" have entirely different histories.

25 changed files with 15199 additions and 1247 deletions

1196
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,8 @@
[workspace] [workspace]
members = [ members = [
"cyberpunk-splash",
"dashboard", "dashboard",
"fluent-ergonomics", "fluent-ergonomics",
"geo-types", "geo-types",
"ifc", "ifc",
"memorycache", "memorycache",
"screenplay",
"emseries",
"coordinates",
"flow",
"sgf",
"changeset",
"hex-grid",
] ]

View File

@ -5,6 +5,42 @@ test: kifu-core/test-oneshot sgf/test-oneshot
bin: kifu-gtk bin: kifu-gtk
changeset-dev:
cd changeset && make dev
changeset-test:
cd changeset && make test
coordinates-dev:
cd coordinates && make dev
coordinates-test:
cd coordinates && make test
emseries-dev:
cd emseries && make dev
emseries-test:
cd emseries && make test
flow-dev:
cd flow && make dev
flow-test:
cd flow && make test
fluent-ergonomics-dev:
cd fluent-ergonomics && make dev
fluent-ergonomics-test:
cd fluent-ergonomics && make test
ifc-dev:
cd ifc && make dev
ifc-test:
cd ifc && make test
kifu-core/dev: kifu-core/dev:
cd kifu/core && make test cd kifu/core && make test
@ -28,3 +64,9 @@ kifu-pwa/dev:
kifu-pwa/server: kifu-pwa/server:
pushd kifu/pwa && make server pushd kifu/pwa && make server
sgf/test:
pushd sgf && make test
sgf/test-oneshot:
pushd sgf && make test-oneshot

View File

@ -2,21 +2,7 @@
set -euo pipefail set -euo pipefail
RUST_ALL_TARGETS=( RUST_ALL_TARGETS="dashboard ifc memorycache geo-types fluent-ergonomics"
"dashboard"
"ifc"
"memorycache"
"geo-types"
"fluent-ergonomics"
"cyberpunk-splash"
"screenplay"
"emseries"
"coordinates"
"flow"
"sgf"
"changeset"
"hex-grid"
)
build_rust_targets() { build_rust_targets() {
local CMD=$1 local CMD=$1
@ -34,18 +20,11 @@ if [ -z "${TARGET-}" ]; then
fi fi
if [ -z "${CMD-}" ]; then if [ -z "${CMD-}" ]; then
CMD="test release" CMD="release"
fi fi
if [ "${CMD}" == "clean" ]; then
cargo clean
exit 0
fi
for cmd in $CMD; do
if [ "${TARGET}" == "all" ]; then if [ "${TARGET}" == "all" ]; then
build_rust_targets $cmd ${RUST_ALL_TARGETS[*]} build_rust_targets $CMD $RUST_ALL_TARGETS
else else
build_rust_targets $cmd $TARGET build_rust_targets $CMD $TARGET
fi fi
done

View File

@ -17,9 +17,6 @@ case $CMD in
test) test)
$CARGO test $MODULE $PARAMS $CARGO test $MODULE $PARAMS
;; ;;
run)
$CARGO run $MODULE $PARAMS
;;
release) release)
$CARGO build --release $MODULE $PARAMS $CARGO build --release $MODULE $PARAMS
;; ;;
@ -27,10 +24,10 @@ case $CMD in
$CARGO clean $MODULE $CARGO clean $MODULE
;; ;;
"") "")
echo "No command specified. Use build | test | run | release | clean" echo "No command specified. Use build | test | release | clean"
;; ;;
*) *)
echo "$CMD is unknown. Use build | test | run | release | clean" echo "$CMD is unknown. Use build | test | release | clean"
;; ;;
esac esac

9
changeset/Makefile Normal file
View File

@ -0,0 +1,9 @@
dev:
cargo watch -x build
test:
cargo watch -x test
test-once:
cargo test

View File

@ -3,6 +3,7 @@ name = "coordinates"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
license = "GPL-3.0-only" license = "GPL-3.0-only"
license-file = "../COPYING"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

9
coordinates/Makefile Normal file
View File

@ -0,0 +1,9 @@
dev:
cargo watch -x build
test:
cargo watch -x test
test-once:
cargo test

2836
cyberpunk-splash/Cargo.nix Normal file

File diff suppressed because it is too large Load Diff

7262
dashboard/Cargo.nix Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ unic-langid = { version = "0.9" }
horrorshow = { version = "0.8" } horrorshow = { version = "0.8" }
http = { version = "*" } http = { version = "*" }
ifc = { path = "../ifc/" } ifc = { path = "../ifc/" }
memorycache = { path = "../memorycache" } memorycache = { path = "../memory_cache" }
reqwest = { version = "0.11", features = ["json"] } reqwest = { version = "0.11", features = ["json"] }
serde_derive = { version = "1" } serde_derive = { version = "1" }
serde_json = { version = "1" } serde_json = { version = "1" }

9
emseries/Makefile Normal file
View File

@ -0,0 +1,9 @@
dev:
cargo watch -x build
test:
cargo watch -x test
test-once:
cargo test

View File

@ -46,5 +46,52 @@
]; ];
LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib"; LIBCLANG_PATH="${pkgs.llvmPackages.libclang.lib}/lib";
}; };
# packages."x86_64-linux" =
# let
# pkgs = import nixpkgs { system = "x86_64-linux"; };
# standardOverride = attrs: {
# nativeBuildInputs = [
# pkgs.pkg-config
# pkgs.gtk4
# ];
# verbose = true;
# };
# customBuildInfo = pkgs: pkgs.buildRustCrate.override {
# defaultCrateOverrides = pkgs.defaultCrateOverrides // {
# cairo-sys-rs = standardOverride;
# graphene-sys = standardOverride;
# gobject-sys = standardOverride;
# pango-sys = standardOverride;
# gio-sys = standardOverride;
# gdk-pixbuf-sys = standardOverride;
# gdk4-sys = standardOverride;
# gsk4-sys = standardOverride;
# gtk4-sys = standardOverride;
# kifu-gtk = attrs: {
# nativeBuildInputs = [
# pkgs.glib
# ];
# };
# };
# };
# in {
# # gobject-sys = pkgs.buildRustCrate cargo.internal.crates.gobject-sys;
# kifu-gtk = (import ./kifu/kifu-gtk/Cargo.nix {
# inherit pkgs;
# buildRustCrateForPkgs = customBuildInfo;
# rootFeatures = [ "screenplay" ];
# release = true;
# }).rootCrate.build;
# cyberpunk-splash = (import ./cyberpunk-splash/Cargo.nix {
# inherit pkgs;
# buildRustCrateForPkgs = customBuildInfo;
# release = true;
# }).rootCrate.build;
#
# dashboard = (import ./dashboard/Cargo.nix {
# inherit pkgs;
# release = true;
# }).rootCrate.build;
# };
}; };
} }

5
flow/Makefile Normal file
View File

@ -0,0 +1,5 @@
dev:
cargo watch -x build
test:
cargo watch -x test

View File

@ -19,7 +19,6 @@ include = [
] ]
[dependencies] [dependencies]
fluent-bundle = "0.15" fluent = "0.16"
unic-langid = "0.9" unic-langid = "0.9"
fluent-syntax = "0.11" fluent-syntax = "0.11"
intl-memoizer = "*"

View File

@ -0,0 +1,9 @@
dev:
cargo watch -x build
test:
cargo watch -x test
test-once:
cargo test

View File

@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with Lum
//! The Fluent class makes it easier to load translation bundles with language fallbacks and to go //! The Fluent class makes it easier to load translation bundles with language fallbacks and to go
//! through the most common steps of translating a message. //! through the most common steps of translating a message.
//! //!
use fluent_bundle::{bundle::FluentBundle, FluentArgs, FluentError, FluentResource}; use fluent::{FluentArgs, FluentBundle, FluentError, FluentResource};
use fluent_syntax::parser::ParserError; use fluent_syntax::parser::ParserError;
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use std::collections::HashMap; use std::collections::HashMap;
@ -103,14 +103,7 @@ impl From<FromUtf8Error> for Error {
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct FluentErgo { pub struct FluentErgo {
languages: Vec<LanguageIdentifier>, languages: Vec<LanguageIdentifier>,
bundles: Arc< bundles: Arc<RwLock<HashMap<LanguageIdentifier, FluentBundle<FluentResource>>>>,
RwLock<
HashMap<
LanguageIdentifier,
FluentBundle<FluentResource, intl_memoizer::concurrent::IntlLangMemoizer>,
>,
>,
>,
} }
impl fmt::Debug for FluentErgo { impl fmt::Debug for FluentErgo {
@ -174,10 +167,7 @@ impl FluentErgo {
bundle.add_resource(res).map_err(|err| Error::from(err)) bundle.add_resource(res).map_err(|err| Error::from(err))
} }
Entry::Vacant(e) => { Entry::Vacant(e) => {
let mut bundle: FluentBundle< let mut bundle = FluentBundle::new(vec![lang]);
FluentResource,
intl_memoizer::concurrent::IntlLangMemoizer,
> = FluentBundle::new_concurrent(vec![lang]);
bundle.add_resource(res).map_err(|err| Error::from(err))?; bundle.add_resource(res).map_err(|err| Error::from(err))?;
e.insert(bundle); e.insert(bundle);
Ok(()) Ok(())
@ -230,14 +220,14 @@ impl FluentErgo {
/// A typical call with arguments would look like this: /// A typical call with arguments would look like this:
/// ///
/// ``` /// ```
/// use fluent_bundle::{FluentArgs, FluentValue}; /// use fluent::{FluentArgs, FluentValue};
/// ///
/// let eo_id = "eo".parse::<unic_langid::LanguageIdentifier>().unwrap(); /// let eo_id = "eo".parse::<unic_langid::LanguageIdentifier>().unwrap();
/// let en_id = "en-US".parse::<unic_langid::LanguageIdentifier>().unwrap(); /// let en_id = "en-US".parse::<unic_langid::LanguageIdentifier>().unwrap();
/// ///
/// let mut fluent = fluent_ergonomics::FluentErgo::new(&[eo_id, en_id]); /// let mut fluent = fluent_ergonomics::FluentErgo::new(&[eo_id, en_id]);
/// let mut args = FluentArgs::new(); /// let mut args = FluentArgs::new();
/// args.set("value", FluentValue::from("15")); /// args.insert("value", FluentValue::from("15"));
/// let r = fluent.tr("length-without-label", Some(&args)); /// let r = fluent.tr("length-without-label", Some(&args));
/// ``` /// ```
/// ///
@ -267,7 +257,7 @@ impl FluentErgo {
fn tr_( fn tr_(
&self, &self,
bundle: &FluentBundle<FluentResource, intl_memoizer::concurrent::IntlLangMemoizer>, bundle: &FluentBundle<FluentResource>,
msgid: &str, msgid: &str,
args: Option<&FluentArgs>, args: Option<&FluentArgs>,
) -> Option<String> { ) -> Option<String> {
@ -297,7 +287,7 @@ impl FluentErgo {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::FluentErgo; use super::FluentErgo;
use fluent_bundle::{FluentArgs, FluentValue}; use fluent::{FluentArgs, FluentValue};
use unic_langid::LanguageIdentifier; use unic_langid::LanguageIdentifier;
const EN_TRANSLATIONS: &'static str = " const EN_TRANSLATIONS: &'static str = "

View File

@ -3,14 +3,15 @@ name = "hex-grid"
version = "0.1.0" version = "0.1.0"
edition = "2021" edition = "2021"
license = "GPL-3.0-only" license = "GPL-3.0-only"
license-file = "../COPYING"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
cairo-rs = "0.17" cairo-rs = "0.16"
gio = "0.17" gio = "0.16"
glib = "0.17" glib = "0.16"
gtk = { version = "0.6", package = "gtk4" } gtk = { version = "0.5", package = "gtk4" }
coordinates = { path = "../coordinates" } coordinates = { path = "../coordinates" }
image = { version = "0.24" } image = { version = "0.24" }

View File

@ -228,7 +228,7 @@ impl ObjectImpl for HexGridWindowPrivate {
} }
}); });
} }
self.drawing_area.add_controller(motion_controller); self.drawing_area.add_controller(&motion_controller);
} }
} }

9
ifc/Makefile Normal file
View File

@ -0,0 +1,9 @@
dev:
cargo watch -x build
test:
cargo watch -x test
test-once:
cargo test

4918
kifu/gtk/Cargo.nix Normal file

File diff suppressed because it is too large Load Diff

6
sgf/Makefile Normal file
View File

@ -0,0 +1,6 @@
test:
cargo watch -x 'nextest run'
test-oneshot:
cargo nextest run