Skip to content

Commit

Permalink
Fixed imports in azul-desktop when compiling azul-dll in release mode
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Jun 3, 2020
1 parent ac303b2 commit 75c1316
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ target/
.vscode/*
*.log
.idea/*
out.txt
out.txt
*.dll
*.so
5 changes: 4 additions & 1 deletion api/gen-api.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@ def rust_bindings_call_fn_args(f, class_name, class_ptr_name, self_as_first_arg,
def generate_rust_dll(apiData):

version = list(apiData.keys())[-1]
code = "// WARNING: autogenerated code for azul api version " + str(version) + "\r\n"
code = ""
code += "#![crate_type = \"cdylib\"]\r\n"
code += "\r\n"
code += "// WARNING: autogenerated code for azul api version " + str(version) + "\r\n"
code += "\r\n\r\n"

apiData = apiData[version]
Expand Down
16 changes: 8 additions & 8 deletions azul-desktop/src/css.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
//! | `border`, `-top`, `-left`, `-right`, `-bottom` | | | | |
//! | `box-shadow`, `-top`, `-left`, `-right`, `-bottom` | | | | |
use std::time::Instant;
#[cfg(debug_assertions)]
use std::time::Duration;
#[cfg(debug_assertions)]
use std::path::PathBuf;
#[cfg(feature = "css_parser")]
use azul_css_parser::{self, CssParseError};
use {
std::time::Duration,
std::time::Instant,
std::path::PathBuf,
azul_css_parser::{self, CssParseError}
};
pub use azul_css::*;
#[cfg(feature = "css_parser")]
pub mod css_parser {
Expand Down Expand Up @@ -81,14 +81,14 @@ pub fn override_native(input: &str) -> Result<Css, CssParseError> {

/// Allows dynamic reloading of a CSS file during an applications runtime, useful for
/// changing the look & feel while the application is running.
#[cfg(all(debug_assertions, feature = "css_parser"))]
#[cfg(all(feature = "css_parser"))]
pub fn hot_reload<P: Into<PathBuf>>(file_path: P, reload_interval: Duration) -> Box<dyn HotReloadHandler> {
Box::new(azul_css_parser::HotReloader::new(file_path).with_reload_interval(reload_interval))
}

/// Same as `Self::hot_reload`, but appends the given file to the
/// `Self::native()` style before the hot-reloaded styles, similar to `override_native`.
#[cfg(all(debug_assertions, feature = "css_parser", feature = "native_style"))]
#[cfg(all(feature = "css_parser", feature = "native_style"))]
pub fn hot_reload_override_native<P: Into<PathBuf>>(file_path: P, reload_interval: Duration) -> Box<dyn HotReloadHandler> {
Box::new(HotReloadOverrideHandler::new(native(), hot_reload(file_path, reload_interval)))
}
Expand Down
2 changes: 2 additions & 0 deletions azul-dll/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![crate_type = "cdylib"]

// WARNING: autogenerated code for azul api version 0.1.0


Expand Down
4 changes: 2 additions & 2 deletions azul/src/rust/azul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4414,8 +4414,8 @@ pub mod dom {

use azul_dll::*;
use crate::str::String;
use crate::resources::{ImageId, TextId};
use crate::callbacks::{Callback, RefAny, GlCallback, IFrameCallback};
use crate::resources::{TextId, ImageId};
use crate::callbacks::{IFrameCallback, GlCallback, Callback, RefAny};
use crate::vec::StringVec;
use crate::css::CssProperty;

Expand Down
11 changes: 10 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
cd ./api && python3 ./gen-api.py && cd .. && \
set -e

cd ./api
python3 ./gen-api.py
cd ..

cd ./azul-dll
cargo build --all-features --release # build the DLL
cd ..

RUST_BACKTRACE=full cargo check --example public
# cargo doc --no-deps --open

0 comments on commit 75c1316

Please sign in to comment.