GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Moosync/defs.bzl at main · Moosync/Moosync

Expand file tree

/

defs.bzl

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
113 lines (100 loc) · 3.47 KB
/

defs.bzl

Copy path

File metadata and controls

113 lines (100 loc) · 3.47 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
load("@rules_cc//cc:cc_toolchain_config_lib.bzl", "tool_path")
load("@rules_cc//cc/common:cc_common.bzl", "cc_common")
load("@rules_cc//cc/toolchains:cc_toolchain_config_info.bzl", "CcToolchainConfigInfo")
load("@rules_rust//rust:defs.bzl", "rust_binary")
def _flutter_app_bundle_impl(ctx):
out_dir = ctx.actions.declare_directory(ctx.attr.name)
# Find the tree artifact containing the build bundle
tree_artifact = None
for f in ctx.files.app:
if f.is_directory:
tree_artifact = f
break
if not tree_artifact:
fail("Could not find build artifacts directory in app")
rust_lib = ctx.file.moosync_rust
platform = ctx.attr.platform
if platform == "linux":
script = """
rm -rf "{out}"
mkdir -p "{out}"
cp -RL "{src_dir}"/* "{out}/"
mkdir -p "{out}/lib"
cp -f "{rust_lib}" "{out}/lib/"
""".format(
out = out_dir.path,
src_dir = tree_artifact.path,
rust_lib = rust_lib.path,
)
elif platform == "macos":
script = """
rm -rf "{out}"
mkdir -p "{out}"
cp -RL "{src_dir}"/* "{out}/"
app_dir=$(find "{out}" -maxdepth 2 -name "*.app" | head -n 1)
if [ -n "$app_dir" ]; then
mkdir -p "$app_dir/Contents/Frameworks"
cp -f "{rust_lib}" "$app_dir/Contents/Frameworks/"
else
echo "Error: Could not find .app directory in macOS build" >&2
exit 1
fi
""".format(
out = out_dir.path,
src_dir = tree_artifact.path,
rust_lib = rust_lib.path,
)
elif platform == "windows":
script = """
rm -rf "{out}"
mkdir -p "{out}"
cp -RL "{src_dir}"/* "{out}/"
cp -f "{rust_lib}" "{out}/"
""".format(
out = out_dir.path,
src_dir = tree_artifact.path,
rust_lib = rust_lib.path,
)
else:
fail("Unsupported platform for bundling: " + platform)
ctx.actions.run_shell(
inputs = [tree_artifact, rust_lib],
outputs = [out_dir],
command = script,
mnemonic = "BundleFlutterApp",
progress_message = "Bundling Flutter App with Rust library for %s (%s)" % (ctx.label.name, platform),
)
return [DefaultInfo(files = depset([out_dir]))]
flutter_app_bundle = rule(
implementation = _flutter_app_bundle_impl,
attrs = {
"app": attr.label(mandatory = True),
"moosync_rust": attr.label(mandatory = True, allow_single_file = True),
"platform": attr.string(mandatory = True, values = ["linux", "macos", "windows"]),
},
)
def _platform_transition_impl(settings, attr):
return {"//command_line_option:platforms": [str(attr.platform)]}
platform_transition = transition(
implementation = _platform_transition_impl,
inputs = [],
outputs = ["//command_line_option:platforms"],
)
def _platform_transition_rule_impl(ctx):
return [DefaultInfo(files = depset(ctx.files.src))]
platform_transition_rule = rule(
implementation = _platform_transition_rule_impl,
attrs = {
"src": attr.label(mandatory = True),
"platform": attr.label(mandatory = True),
"_allowlist_function_transition": attr.label(
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
),
},
cfg = platform_transition,
)
def rust_benchmark(name, **kwargs):
rust_binary(
name = name,
**kwargs
)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.