Skip to content

Commit

Permalink
updated hemtt scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
R3voA3 committed Oct 12, 2024
1 parent 74ca645 commit 38724e5
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 25 deletions.
25 changes: 25 additions & 0 deletions .hemtt/hooks/post_release/rename_and_move_zip.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Renames zip file of release and deletes unused zip files

// Get releases folder
let releases = HEMTT_RFS.join("releases");

// Get "enh_latest.zip" file
let prefix = HEMTT.project().prefix();
let src = releases.join(prefix + "-latest.zip");

// Set file name to vX.X.X
let version = HEMTT.project().version();
let dst = releases.join("v" + version + ".zip");

// Sanity check
if src.is_file() // support --no-archive
{
print("Moving zip to " + dst);
if !src.move(dst)
{
fatal("Failed to move " + src + " to " + dst);
}
}

// Delete unused "enh-latest.zip"
releases.join(prefix + "-" + version + ".zip").remove_file();
8 changes: 0 additions & 8 deletions .hemtt/hooks/post_release/setVersion.rhai

This file was deleted.

14 changes: 14 additions & 0 deletions .hemtt/hooks/pre_build/set_ISDEV_macro.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Defines ISDEV macro on release, written by jokoho482 modified for 3den Enhanced by R3vo

if (HEMTT.is_release())
{
// Get "script_component.hpp" file and read it
let macro_path = HEMTT_VFS.join("addons/main/script_component.hpp");
let macro_hpp = macro_path.open_file().read();

// Replace macro definition
macro_hpp.replace("#define ISDEV", "//#define ISDEV");

// Overwrite existing file with new content
macro_path.create_file().write(macro_hpp);
}
16 changes: 0 additions & 16 deletions .hemtt/hooks/pre_build/set_is_dev_macro.rhai

This file was deleted.

10 changes: 10 additions & 0 deletions .hemtt/hooks/pre_build/set_version.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Update version in mod.cpp

// Read the contents of mod.cpp
let modcpp = HEMTT_VFS.join("mod.cpp").open_file().read();

// Replace the placeholder version with the actual version
modcpp.replace("0.0.0", HEMTT.project().version().to_string_short());

// Write the new contents over the old contents
HEMTT_VFS.join("mod.cpp").create_file().write(modcpp);
2 changes: 1 addition & 1 deletion .hemtt/project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ patch = 0
git_hash = 0

[hemtt.release]
archive = false
archive = true

[properties]
author = "R3vo"
Expand Down

0 comments on commit 38724e5

Please sign in to comment.