👍️[Update] Build : npm run release-all でcpu/cudaの実行ファイルのzipを作成できるようにした
This commit is contained in:
@@ -17,7 +17,10 @@
|
|||||||
"dev-ui": "npm-run-all --parallel vite tauri-dev",
|
"dev-ui": "npm-run-all --parallel vite tauri-dev",
|
||||||
"build": "npm run build-python && npm run vite-build && npm run tauri build",
|
"build": "npm run build-python && npm run vite-build && npm run tauri build",
|
||||||
"build-cuda": "npm run build-python-cuda && npm run vite-build && npm run tauri build",
|
"build-cuda": "npm run build-python-cuda && npm run vite-build && npm run tauri build",
|
||||||
"build-ui": "npm run vite-build && npm run tauri build"
|
"build-ui": "npm run vite-build && npm run tauri build",
|
||||||
|
"release": "python zip.py --zip_name VRCT.zip",
|
||||||
|
"release-cuda": "python zip.py --zip_name VRCT_cuda.zip",
|
||||||
|
"release-all": "npm run build && npm run release && npm run build-cuda && npm run release-cuda"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.0",
|
"@emotion/react": "^11.13.0",
|
||||||
|
|||||||
37
zip.py
Normal file
37
zip.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import os
|
||||||
|
import zipfile
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
def zip_files_and_directory(zip_name, file_paths, dir_paths):
|
||||||
|
# ZIPファイルを作成
|
||||||
|
with zipfile.ZipFile(zip_name, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
||||||
|
# ファイルを追加
|
||||||
|
for file_path in file_paths:
|
||||||
|
if os.path.isfile(file_path):
|
||||||
|
zipf.write(file_path, os.path.basename(file_path))
|
||||||
|
print(f"Add file: {file_path}")
|
||||||
|
|
||||||
|
# ディレクトリを追加
|
||||||
|
for dir_path in dir_paths:
|
||||||
|
if os.path.isdir(dir_path):
|
||||||
|
for foldername, subfolders, filenames in os.walk(dir_path):
|
||||||
|
for filename in filenames:
|
||||||
|
file_full_path = os.path.join(foldername, filename)
|
||||||
|
# ディレクトリを保持しつつ、ルートに配置
|
||||||
|
arcname = os.path.join(
|
||||||
|
os.path.basename(dir_path),
|
||||||
|
os.path.relpath(file_full_path, dir_path)
|
||||||
|
)
|
||||||
|
zipf.write(file_full_path, arcname)
|
||||||
|
print(f"Add file: {file_full_path}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("--zip_name", type=str, default="VRCT.zip")
|
||||||
|
parser.add_argument("--file_paths", type=str, nargs="*", default=["src-tauri/target/release/VRCT.exe", "src-tauri/target/release/backend.exe"])
|
||||||
|
parser.add_argument("--dir_paths", type=str, nargs="*", default=["src-tauri/target/release/_internal"])
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
zip_files_and_directory(args.zip_name, args.file_paths, args.dir_paths)
|
||||||
|
print("Complete!")
|
||||||
Reference in New Issue
Block a user