Skip to content

Commit 637494f

Browse files
Merge pull request #20 from Moo-Ack-Productions/milestone-5-0
Milestone 0.5.0
2 parents 802e924 + 000ea81 commit 637494f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1604
-157
lines changed

.github/FUNDING.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github: StandingPadAnimations
2+
ko_fi: standingpad

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ repos:
1111
"rich==13.7.0",
1212
"typeguard==4.1.5",
1313
"types-pyyaml==6.0.12.11",
14-
"GitPython==3.1.43"
14+
"GitPython==3.1.43",
15+
"tomli==2.0.1",
16+
"packaging==24.1"
1517
]
1618

1719
- repo: https://github.com/astral-sh/ruff-pre-commit

.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.8
1+
3.9

CHANGELOG.txt

Lines changed: 232 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,238 @@
11
# Changelog
22

33

4+
# Changelog
5+
6+
## [0.5] - 2024-10-05
7+
8+
9+
### Fix: Make depends_on check occur before module loading
10+
11+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
12+
### Fix: Change action loading to account for additional actions
13+
14+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
15+
### Fix: Make extensions only install in 4.2+
16+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
17+
### Fix: Resolve verification type checks caused by Python 3.8
18+
19+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
20+
### Fix: Fix error with dataclass initialization
21+
22+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
23+
### Fix: Use language-agnostic method for copyright validation
24+
25+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
26+
27+
28+
### Docs: Add documentation on config options
29+
30+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
31+
32+
33+
### Feat: Add depends_on for actions
34+
35+
This allows defining actions that require previous actions to execute
36+
beforehand, like debug actions for specific build configurations.
37+
38+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
39+
### Feat: Add --build-extension-only flag
40+
41+
This allows building only an extension. We don't have one for legacy
42+
builds as we can't easily do that.
43+
44+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
45+
### Feat: Add legacy building to BpyBuild
46+
47+
This allows addons that need to support both extensions and legacy
48+
builds to create both in one go, thus reducing the amount of work
49+
needed to support both older and newer versions of Blender.
50+
51+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
52+
### Feat: Only load modules that are passed in the CLI
53+
54+
This is mostly to make debugging BpyBuild with MCprep slightly
55+
easier, and make it slightly faster overall
56+
57+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
58+
### Feat: Add is_extension to BabContext and compatibility checks
59+
60+
This wires the new compatibility checks in lib_bpybuild_ext to BpyBuild
61+
itself. In addition, this also adds the new is_extension variable to
62+
BabContext in order to make it easier for actions to determine when an
63+
extension is being build
64+
65+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
66+
### Feat(ext): Add the ability to check for compatibility issues
67+
68+
This is to make it easier for developers transitioning from legacy
69+
addons to extensions to find and fix known compatibility issues with
70+
extensions in legacy codebases.
71+
72+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
73+
### Feat: Make extension building the default
74+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
75+
### Feat: Add basic extension building to BpyBuild
76+
77+
This adds the ability to build extensions in BpyBuild, if
78+
build_extension is enabled in the config. At the moment, this does not
79+
handle legacy building.
80+
81+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
82+
### Feat: Return Path in build_ext
83+
84+
Since we need the path in BpyBuild in order to do operations such as
85+
installation, we'll return the path in build_ext
86+
87+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
88+
### Feat: Add validation for blender_version_max
89+
90+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
91+
### Feat: Finished manifest verification and added build generation
92+
93+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
94+
### Feat: Add basic manifest verification
95+
96+
This implements manifest verification solely based on the Blender
97+
documentation, so that my sanity doesn't dip -10. This means that
98+
LibBpyBuildExt will no longer have 100% parity with the Blender
99+
extension builder, at the cost that we can develop this much faster.
100+
101+
The exception to this is for security related checks, such as
102+
blacklisting certain control characters.
103+
104+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
105+
### Feat: Add beginnings of lib_bpybuild_ext
106+
107+
lib_bpybuild_ext (otherwise known as LibBpyBuildExt) aims to be a BSD
108+
implementation of the Blender Extension builder in order to allow
109+
BpyBuild to implement extension building. The goal is to implement 100%
110+
feature parity with the Blender Extension builder, down to verification
111+
checks.
112+
113+
Although ideally we should get this done soon, we're not really in any
114+
rush since MCprep won't move to extensions for a good while. However,
115+
without this, BpyBuild can't implement extensions, so we should try and
116+
move as fast as possible.
117+
118+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
119+
### Feat: Add 4.2+ check when building extensions
120+
121+
Extensions are a 4.2+ feature, so obviously addons that build extensions
122+
should include 4.2 or above in the range of supported versions.
123+
124+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
125+
### Feat: Enforce string restrictions on extension_settings::build_name
126+
127+
`build_name` has string restrictions enforced on it, so for
128+
consistency, `extension_settings::build_name` also has string restrictions
129+
enforced on it.
130+
131+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
132+
### Feat: Add extension_settings::remove_bl_info
133+
134+
This is intended for developers building both an extension and legacy
135+
addon. The idea is that BpyBuild will be able to remove the `bl_info`
136+
dictionary when building an addon as an extension, if and only if the
137+
developer also has extension_settings::build_legacy enabled (otherwise
138+
what's the point?).
139+
140+
This feature is planned to be opt-in, as it involves modifying an
141+
addon's source code. However, perhaps at some point we could possibly
142+
make it the default for building extensions with
143+
extension_settings::build_legacy enabled
144+
145+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
146+
### Feat: Add config options for Extensions
147+
148+
Blender 4.2 recently introduced Extensions to replace the old legacy
149+
addons. As a starting point to support Extensions, this patch adds the
150+
needed config options to support Extensions. These new config options
151+
are:
152+
- build_extension [bool]: the switch to enable extension building
153+
- extension_settings::blender_binary [str]: the path to the Blender
154+
binary needed to build extensions (4.2+)
155+
- extension_settings::build_legacy [bool]: the switch to build a legacy
156+
addon alongside the extension
157+
- extension_settings::build_name [str]: an optional alternative name for
158+
extensions. By default however, we plan to do[build_name]-extension
159+
160+
It should be noted that this patch exclusively adds new config options,
161+
the actual building of extensions is not supported yet. In addition, the
162+
current roadmap for extension support involves the developer passing in
163+
the direct path to the Blender binary, which isn't ideal for versions of
164+
Blender from the Microsoft Store, Snap repo, and Flathub. Perhaps we may
165+
implement our own extension builder.
166+
167+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
168+
169+
170+
### Python: Update minimum support to Python 3.9
171+
172+
The update to Python 3.9 is for several reasons:
173+
- Python 3.8 will be EOL in October
174+
- Python 3.9 introduces better type annotations
175+
- We don't want to be behind with dependencies
176+
177+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
178+
### Chore: Update employment disclaimer
179+
180+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
181+
### Chore: Add disclaimer regarding my employment
182+
183+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
184+
185+
186+
### Refactor: Move list of actions to execute to Api object
187+
188+
By doing this, we can add our own built-in actions at runtime trivially,
189+
without much extra effort
190+
191+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
192+
### Refactor: Move manifest verification to built-in action
193+
194+
With the actions system we have in BpyBuild, it's actually easier to
195+
make an action that performs manifest verification in the main hook.
196+
This way, we get pre-build checks for free.
197+
198+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
199+
### Refactor: Remove build_ext
200+
201+
Building extensions is simple enough, the more important part is
202+
validating the manifest and performing extension checks.
203+
204+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
205+
### Refactor: Replace sys.exit calls with exit_fail
206+
207+
To avoid typing so many characters and repeating ourselves, this patch
208+
adds util.exit_fail, which is equal to sys.exit(EXIT_FAIL), but in an
209+
easier to type fashion.
210+
211+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
212+
213+
214+
### Style: Add proper name-spacing to extension errors
215+
216+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
217+
218+
219+
### Tests: Add test for depends_on
220+
221+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
222+
### Tests: Add legacy building test
223+
224+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
225+
### Tests: Add test for regular extension building
226+
227+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
228+
### Tests: Add manifest files to tests
229+
230+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
231+
### Tests: Add new test dirs for extensions and legacy building
232+
233+
Signed-off-by: Mahid Sheikh <mahid@standingpad.org>
234+
235+
4236
## [0.4.1] - 2024-06-01
5237

6238

bpy_addon_build/__init__.py

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,16 @@
2727
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2828
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2929

30+
# Disclaimer: This is not a product from VLK Architects or VLK Experience Design,
31+
# nor is this endorsed by VLK Architects or VLK Experience Design
32+
3033
from __future__ import annotations
3134

35+
import copy
3236
from decimal import getcontext
3337
from typing import Optional
3438

39+
import attrs
3540
import yaml
3641
from rich.console import Console
3742

@@ -63,18 +68,51 @@ def main() -> None:
6368
with open(cli.path, "r") as f:
6469
data: ConfigDict = yaml.safe_load(f)
6570
config: Config = build_config(data)
66-
api: Api = Api(config, cli.path, cli.debug_mode)
71+
api: Api = Api(config, cli, cli.debug_mode)
6772
context = BuildContext(cli.path, config, cli, api)
6873

69-
if cli.debug_mode:
70-
console.print(context)
74+
if cli.debug_mode:
75+
console.print(context)
7176
if not cli.path.parent.joinpath(config.addon_folder).exists():
7277
print("Addon folder does not exist!")
7378
return
79+
7480
build_path = build(context)
7581
install(context, build_path)
7682
hooks.run_cleanup_hooks(context)
7783

84+
# Build legacy addon alongside extension
85+
#
86+
# To reduce as many issues as possible, we
87+
# treat this as if it were a separate call
88+
# of BpyBuild but with an altered config
89+
if (
90+
(config.build_extension and config.extension_settings is not None)
91+
and config.extension_settings.build_legacy
92+
and not cli.build_extension_only
93+
):
94+
# Remove extension action in a copy
95+
# of additional_actions
96+
additional_actions = copy.deepcopy(config.additional_actions)
97+
if "extension" in additional_actions:
98+
additional_actions.remove("extension")
99+
100+
override_config = attrs.evolve(
101+
config,
102+
build_name=config.build_name + "_legacy",
103+
build_extension=False,
104+
extension_settings=None,
105+
additional_actions=additional_actions,
106+
)
107+
108+
# Change the context object. This is fine
109+
# since this is ran last
110+
context.config = override_config
111+
112+
build_path = build(context)
113+
install(context, build_path)
114+
hooks.run_cleanup_hooks(context)
115+
78116

79117
if __name__ == "__main__":
80118
main()

0 commit comments

Comments
 (0)