Skip to content

Commit

Permalink
Merge branch 'master' into namse-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
namse authored Aug 3, 2024
2 parents bdb11b9 + 0ee2c44 commit f916b5d
Show file tree
Hide file tree
Showing 29 changed files with 478 additions and 415 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-luda-editor.yml_disabled
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:

- name: set BRANCH_NAME, STACK_NAME
run: |
BRANCH_NAME=$(echo "${{ github.event.ref }}" | tr "[:upper:]" "[:lower:]" | sed -e "s#refs/heads/##g" -e 's/\//-/g' -e 's/|/-/g')
export BRANCH_NAME=$(echo "${{ github.event.ref }}" | tr "[:upper:]" "[:lower:]" | sed -e "s#refs/heads/##g" -e 's/\//-/g' -e 's/|/-/g')
echo $BRANCH_NAME
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
STACK_NAME=$(echo $BRANCH_NAME | tr "[:upper:]" "[:lower:]" | tr -cd '[:alnum:]')
export STACK_NAME=$(echo $BRANCH_NAME | tr "[:upper:]" "[:lower:]" | tr -cd '[:alnum:]')
echo $STACK_NAME
echo "STACK_NAME=$STACK_NAME" >> $GITHUB_ENV

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/destory-luda-editor.yml_disabled
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

- name: set BRANCH_NAME, STACK_NAME
run: |
BRANCH_NAME=$(echo "${{ github.event.ref }}" | tr "[:upper:]" "[:lower:]" | sed -e "s#refs/heads/##g" -e 's/\//-/g' -e 's/|/-/g')
export BRANCH_NAME=$(echo "${{ github.event.ref }}" | tr "[:upper:]" "[:lower:]" | sed -e "s#refs/heads/##g" -e 's/\//-/g' -e 's/|/-/g')
echo $BRANCH_NAME
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
STACK_NAME=$(echo $BRANCH_NAME | tr "[:upper:]" "[:lower:]" | tr -cd '[:alnum:]')
export STACK_NAME=$(echo $BRANCH_NAME | tr "[:upper:]" "[:lower:]" | tr -cd '[:alnum:]')
echo $STACK_NAME
echo "STACK_NAME=$STACK_NAME" >> $GITHUB_ENV

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/oioi-agent-image-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
AWS_DEFAULT_REGION: ap-northeast-2
CDK_DEFAULT_ACCOUNT: 962920162112
CDK_DEFAULT_REGION: ap-northeast-2
CARGO_VERSION: 1.74.0
CARGO_VERSION: 1.80.0
RUST_CACHE_PATHS: |
~/.cargo/
oioi/agent/target/
Expand Down Expand Up @@ -125,10 +125,10 @@ jobs:
- name: Deploy test cdk
working-directory: oioi
run: |
BRANCH_NAME=$(echo "${GITHUB_REF}" | tr "[:upper:]" "[:lower:]" | sed -e "s#refs/heads/##g" -e 's/\//-/g' -e 's/|/-/g')
export BRANCH_NAME=$(echo "${GITHUB_REF}" | tr "[:upper:]" "[:lower:]" | sed -e "s#refs/heads/##g" -e 's/\//-/g' -e 's/|/-/g')
echo BRANCH_NAME = $BRANCH_NAME
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
STACK_NAME=$(echo $BRANCH_NAME | tr "[:upper:]" "[:lower:]" | tr -cd '[:alnum:]')
export STACK_NAME=$(echo $BRANCH_NAME | tr "[:upper:]" "[:lower:]" | tr -cd '[:alnum:]')
echo STACK_NAME = $STACK_NAME
echo "STACK_NAME=$STACK_NAME" >> $GITHUB_ENV
Expand Down
3 changes: 2 additions & 1 deletion .projectsignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ luda-editor/psd
luda-editor/**
namui/skia/rust-skia
namui/skia/canvas-kit-wasm-bindgen
namui/namui-drawer/wasm-runner
namui/namui-drawer/wasm-runner
namui/third-party-forks/
2 changes: 1 addition & 1 deletion for-all-projects/Cargo.lock

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

2 changes: 1 addition & 1 deletion for-all-projects/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "for-all-projects"
version = "0.1.4"
version = "0.1.5"
edition = "2021"
license = "AGPL-3.0"
description = "A tool to run cargo commands for all projects in a directory, recursively."
Expand Down
2 changes: 1 addition & 1 deletion for-all-projects/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::path::PathBuf;
include!("src/cli.rs");

fn main() -> Result<(), Error> {
if !cfg!(linux) {
if !cfg!(target_os = "linux") {
return Ok(());
}

Expand Down
45 changes: 43 additions & 2 deletions luda-adventure/Cargo.lock

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

2 changes: 1 addition & 1 deletion namui/namui-hooks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"]
[dependencies]
namui-skia = { path = "../skia" }
elsa = { version = "1.10.0", features = ["indexmap"] }
namui-type = { path = "../namui-type", features = ["namui_internal"] }
namui-type = { path = "../namui-type" }
rustc-hash = "1.1.0"
smol_str = "0.2.1"
tokio = { path = "../third-party-forks/tokio/tokio", features = ["rt"] }
Expand Down
3 changes: 0 additions & 3 deletions namui/namui-type/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"]
[features]
default = []
skia = ["dep:skia-safe"]
namui_internal = [
# for namui crate internal use. Don't use this feature if you don't know about it.
]

[dependencies]
serde = { version = "1.0", features = ["derive", "rc"] }
Expand Down
23 changes: 10 additions & 13 deletions namui/namui-type/src/types/units/time/stop_watch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,46 +3,43 @@ use std::fmt::Debug;

#[derive(PartialEq, Eq, PartialOrd, Ord, Clone)]
pub struct StopWatch {
inner: Instant,
now_fn: fn() -> Instant,
last: Instant,
key: String,
index: usize,
}

impl StopWatch {
#[cfg(feature = "namui_internal")]
pub fn new(key: String, inner: Instant, now_fn: fn() -> Instant) -> Self {
pub fn new(key: String) -> Self {
Self {
inner,
now_fn,
last: Instant::now(),
key,
index: 0,
}
}

pub fn lap(&mut self) -> Duration {
self.index += 1;
let now = (self.now_fn)();
let elapsed = now - self.inner;
self.inner = now;
let now = Instant::now();
let elapsed = now - self.last;
self.last = now;
elapsed
}

/// Note: This function also has side effect of printing the elapsed time.
/// So if you use this recursively, the outside one will have the bigger elapsed time.
/// You should test outside without inner one later.
pub fn lap_and_print(&mut self) {
let now = (self.now_fn)();
let elapsed = now - self.inner;
let now = Instant::now();
let elapsed = now - self.last;
crate::log!("StopWatch - {:?}({}): {elapsed:?}", self.key, self.index);

self.index += 1;
self.inner = (self.now_fn)();
self.last = Instant::now();
}
}

impl Debug for StopWatch {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.inner.fmt(f)
self.last.fmt(f)
}
}
2 changes: 1 addition & 1 deletion namui/namui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = "2021"
targets = ["x86_64-pc-windows-msvc", "x86_64-unknown-linux-gnu"]

[dependencies]
namui-type = { path = "../namui-type", features = ["namui_internal"] }
namui-type = { path = "../namui-type" }
namui-hooks = { path = "../namui-hooks" }
namui-skia = { path = "../skia" }
namui-cfg = { path = "../namui-cfg" }
Expand Down
2 changes: 1 addition & 1 deletion namui/namui/src/namui/system/network/http/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl Response {
///
/// - The server didn't send a `content-length` header.
/// - The response is compressed and automatically decoded (thus changing
/// the actual decoded length).
/// the actual decoded length).
pub fn content_length(&self) -> Option<u64> {
self.reqwest_response.content_length()
}
Expand Down
2 changes: 1 addition & 1 deletion namui/namui/src/namui/system/time/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn now() -> Instant {
}

pub fn stop_watch(key: impl AsRef<str>) -> StopWatch {
StopWatch::new(key.as_ref().to_string(), now(), now)
StopWatch::new(key.as_ref().to_string())
}

/// You can await on this.
Expand Down
8 changes: 4 additions & 4 deletions namui/rust-ffmpeg-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ impl ParseCallbacks for Callbacks {
let codec_flag_prefix = "AV_CODEC_FLAG_";
let error_max_size = "AV_ERROR_MAX_STRING_SIZE";

if value >= i64::min_value() && _name.starts_with(ch_layout_prefix) {
if _name.starts_with(ch_layout_prefix) {
Some(IntKind::ULongLong)
} else if value >= i32::min_value() as i64
&& value <= i32::max_value() as i64
} else if value >= i32::MIN as i64
&& value <= i32::MAX as i64
&& (_name.starts_with(codec_cap_prefix) || _name.starts_with(codec_flag_prefix))
{
Some(IntKind::UInt)
Expand All @@ -92,7 +92,7 @@ impl ParseCallbacks for Callbacks {
name: "usize",
is_signed: false,
})
} else if value >= i32::min_value() as i64 && value <= i32::max_value() as i64 {
} else if value >= i32::MIN as i64 && value <= i32::MAX as i64 {
Some(IntKind::Int)
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion namui/rust-ffmpeg-sys/src/avutil/rational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub unsafe fn av_cmp_q(a: AVRational, b: AVRational) -> c_int {
} else if a.num != 0 && b.num != 0 {
((i64::from(a.num) >> 31) - (i64::from(b.num) >> 31)) as c_int
} else {
c_int::min_value()
c_int::MIN
}
}

Expand Down
2 changes: 1 addition & 1 deletion namui/rust-ffmpeg/src/format/context/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl Input {
match avformat_seek_file(
self.as_mut_ptr(),
-1,
range.start().cloned().unwrap_or(i64::min_value()),
range.start().cloned().unwrap_or(i64::MIN),
ts,
range.end().cloned().unwrap_or(i64::max_value()),
0,
Expand Down
1 change: 1 addition & 0 deletions namui/rust-ffmpeg/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(warnings)]
#![allow(non_camel_case_types)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::module_inception)]
Expand Down
4 changes: 2 additions & 2 deletions namui/rust-ffmpeg/src/util/rational.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Rational {

#[inline]
pub fn reduce(&self) -> Rational {
match self.reduce_with_limit(i32::max_value()) {
match self.reduce_with_limit(i32::MAX) {
Ok(r) => r,
Err(r) => r,
}
Expand Down Expand Up @@ -80,7 +80,7 @@ impl From<Rational> for AVRational {
impl From<f64> for Rational {
#[inline]
fn from(value: f64) -> Rational {
unsafe { Rational::from(av_d2q(value, c_int::max_value())) }
unsafe { Rational::from(av_d2q(value, c_int::MAX)) }
}
}

Expand Down
3 changes: 1 addition & 2 deletions namui/sample/kv_store/Cargo.lock

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

1 change: 1 addition & 0 deletions namui/skia/src/render/rendering_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub enum RenderingTree {
/// Order of tree traversal is important.
/// - draw = pre-order dfs (NLR)
/// - events = Reverse post-order (RLN)
///
/// reference: https://en.wikipedia.org/wiki/Tree_traversal
impl RenderingTree {
pub fn iter(&self) -> impl Iterator<Item = &RenderingTree> {
Expand Down
2 changes: 1 addition & 1 deletion namui/third-party-forks/reqwest
Submodule reqwest updated 1 files
+1 −0 src/lib.rs
2 changes: 1 addition & 1 deletion namui/third-party-forks/rust-skia
Loading

0 comments on commit f916b5d

Please sign in to comment.