Skip to content

Commit

Permalink
Final API fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Jul 20, 2021
1 parent 9c84d93 commit e169513
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 52 deletions.
5 changes: 1 addition & 4 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ panic = "abort"
debug = true

[profile.release]
opt-level = 's'
lto = false
panic = "unwind"
codegen-units = 16
opt-level = 3
lto = true
panic = "abort"
codegen-units = 1
debug = false
debug-assertions = false
overflow-checks = false
Expand Down
73 changes: 35 additions & 38 deletions api/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,55 +1,52 @@
[package]
name = "azul"
version = "0.0.1"
version = "1.0.0-alpha1"
authors = ["Felix Schütt <[email protected]>"]
license = "MIT"
description = '''
Azul GUI is a free, functional, immediate-mode GUI framework
for rapid development of desktop applications written in Rust,
supported by the Mozilla WebRender rendering engine
Azul GUI is a free, functional, reactive GUI framework
for rapid development of desktop applications written in Rust and C,
using the Mozilla WebRender rendering engine.
'''
homepage = "https://azul.rs/"
keywords = ["gui", "GUI", "user-interface", "svg", "graphics" ]
categories = ["gui"]
repository = "https://github.com/maps4print/azul"
readme = "../README.md"
repository = "https://github.com/fschutt/azul"
readme = "../../README.md"
exclude = ["../assets/*", "../doc/*", "../examples/*"]
autoexamples = false
edition = "2018"
build = "build.rs"
links = "azul"

[lib]
path = "lib.rs"

[dependencies]
azul-dll = { version = "0.0.1", path = "../../azul-dll", default-features = false, features = ["rlib"], optional = true }
# azul-dll = { version = "0.0.1", path = "../../azul-dll", default-features = false, features = ["rlib"], optional = true }

[features]
default = []
link_static = [
"azul-dll",
# enable all features of azul-dll
"azul-dll/std",
"azul-dll/logging",
"azul-dll/css_parser",
"azul-dll/font_loading",
"azul-dll/text_layout",
"azul-dll/svg",
"azul-dll/xml",
"azul-dll/image_loading",
"azul-dll/gif",
"azul-dll/jpeg",
"azul-dll/png",
"azul-dll/tiff",
"azul-dll/bmp",
"azul-dll/ico",
"azul-dll/tga",
"azul-dll/hdr",
"azul-dll/dxt",
"azul-dll/webp",
"azul-dll/pnm",
]
# currently blocked on gleam, allsorts, rayon and webrender not being no_std
no_std = ["link_static", "azul-dll/css_parser", "azul-dll/text_layout"]
minifb = ["azul-dll/std", "link_static"]
# [features]
# default = []
# link_static = [
# "azul-dll",
# # enable all features of azul-dll
# "azul-dll/std",
# "azul-dll/logging",
# "azul-dll/css_parser",
# "azul-dll/font_loading",
# "azul-dll/text_layout",
# "azul-dll/svg",
# "azul-dll/xml",
# "azul-dll/image_loading",
# "azul-dll/gif",
# "azul-dll/jpeg",
# "azul-dll/png",
# "azul-dll/tiff",
# "azul-dll/bmp",
# "azul-dll/ico",
# "azul-dll/tga",
# "azul-dll/hdr",
# "azul-dll/dxt",
# "azul-dll/webp",
# "azul-dll/pnm",
# ]
# # currently blocked on gleam, allsorts, rayon and webrender not being no_std
# no_std = ["link_static", "azul-dll/css_parser", "azul-dll/text_layout"]
# minifb = ["azul-dll/std", "link_static"]#
File renamed without changes.
8 changes: 4 additions & 4 deletions azul-dll/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ panic = "unwind"
debug = false

[profile.release]
opt-level = 's'
lto = false
panic = "unwind"
codegen-units = 16
opt-level = 3
lto = true
panic = "abort"
codegen-units = 1
debug = false
debug-assertions = false
overflow-checks = false
Expand Down
47 changes: 46 additions & 1 deletion build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2987,7 +2987,7 @@ def generate_api():
forward_declarations = rust_dll_result[3]

write_file(rust_dll_result[0], root_folder + "/azul-dll/src/lib.rs")
write_file(generate_rust_api(apiData, structs_map, functions_map.copy()), root_folder + "/api/rust/lib.rs")
write_file(generate_rust_api(apiData, structs_map, functions_map.copy()), root_folder + "/api/rust/src/lib.rs")
write_file(generate_c_api(apiData, structs_map), root_folder + "/api/c/azul.h")
write_file(generate_python_api(apiData, structs_map, functions_map.copy()), root_folder + "/azul-dll/src/python.rs")
write_file(generate_cpp_api(apiData, structs_map), root_folder + "/api/cpp/azul.hpp")
Expand Down Expand Up @@ -3629,6 +3629,7 @@ def generate_license():
license_authors = read_file(root_folder + "/LICENSE-WINDOWS.json")
license_json = json.loads(license_authors)
license_authors_formatted = format_license_authors(license_json)
remove_unused_crates(license_json, root_folder + "/../azul-v1.0-alpha1")
final_license_text = license_template.replace("$$CONTRIBUTORS_AND_LICENSES_SEE_PYTHON_SCRIPT$$", license_authors_formatted)
write_file(final_license_text, root_folder + "/LICENSE-WINDOWS.txt")
remove_path(root_folder + "/LICENSE-WINDOWS.json")
Expand All @@ -3649,6 +3650,50 @@ def format_license_authors(license_json):
license_txt += name + " v" + version + " licensed " + license + "\r\n by " + ", ".join(authors) + "\r\n"
return license_txt

# cargo vendor vendors a lot of unused crates for some reason
# this reduces the dependencies.zip file to a more reasonable size
# use WinDirState to see what files are taking up the most space
def remove_unused_crates(license_json, vendor_path):
license_txt = ""
added = [
"azul-dll",
"azul-desktop",
"azulc",
"azul-css",
"azul-core",
"azul-layout",
"azul-text-layout",
"azul-css-parser",
]
vendored_crates = os.listdir(vendor_path)
for crate in license_json:
name = crate["name"]
if not(name in added):
if name in vendored_crates:
vendored_crates.remove(name)

# vendored_crates now contains the list of vendored
# directories that are not used by this build
for folder in vendored_crates:
remove_path(vendor_path + "/" + folder)

blacklisted_folder_names = ["test", "tests", "doc", "benches", "examples", "ci", "fixtures"]
blacklisted_file_endings = [".xml", ".csv"]

# remove all "test" "tests", "doc", "benches" and "examples" "ci" directories
for v in os.listdir(vendor_path):
for f in os.listdir(vendor_path + "/" + v):
if f in blacklisted_folder_names:
remove_path(vendor_path + "/" + v + "/" + f)

# as well as any ".json", ".xml" and ".csv" files
for root, dirs, files in os.walk(vendor_path):
for file in files:
for b in blacklisted_file_endings:
if file.endswith(b):
print("removing " + os.path.join(root, file))
os.remove(os.path.join(root, file))

def full_test():
os.system('cd "' + root_folder + '/azul-dll" && cargo check --verbose --all-features')
os.system('cd "' + root_folder + '/azul-dll" && cargo check --verbose --examples')
Expand Down
2 changes: 1 addition & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ name = "opengl"
path = "rust/opengl.rs"

[dependencies]
azul = { version = "0.0.1", path = "../api/rust" }
azul = { version = "1.0.0-alpha1", path = "../api/rust" }
# azul-widgets = { version = "0.0.2", path = "../azul-widgets" }
# libc_alloc = { version = "1.0.2", default-features = false }

0 comments on commit e169513

Please sign in to comment.