-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
36f169e
commit 40f6beb
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import shutil | ||
from os import listdir, remove, mkdir | ||
from os.path import isfile, join, exists | ||
|
||
# List of ignored dlls (in lowercase) | ||
ignore = [ | ||
'openal32.dll', | ||
] | ||
|
||
# Path settings | ||
in_path = '../bin/net8.0' | ||
out_path = '../bin/net8.0' | ||
out_directory = 'engine' | ||
out_full_path = f'{out_path}/{out_directory}/' | ||
|
||
# Archive settings | ||
archive_name = f'{out_directory}' | ||
archive_type = 'zip' | ||
archive_directory = f'{out_path}/' | ||
archive_location = f'{archive_directory}{archive_name}.{archive_type}' | ||
|
||
# Import file settings | ||
import_file_name = 'EngineImports.props' | ||
import_file_location = f'{out_full_path}{import_file_name}' | ||
|
||
# Getting all files | ||
files = [file for file in listdir(in_path) if isfile(join(in_path, file))] | ||
|
||
# Remove previous build | ||
if exists(out_full_path): | ||
shutil.rmtree(out_full_path) | ||
|
||
if exists(archive_location): | ||
remove(archive_location) | ||
|
||
# Creating new dictionary | ||
mkdir(f'{out_path}/{out_directory}') | ||
|
||
# Copy files and generate | ||
import_content = '<Project>\n <ItemGroup>\n' | ||
for file in files: | ||
if not file.endswith('.dll'): | ||
continue | ||
|
||
if file.lower() in ignore: | ||
continue | ||
|
||
file_name = file.replace('.dll', '') | ||
import_content += f' <Reference Include="{file_name}">\n <HintPath>..\engine\{file}</HintPath>\n </Reference>\n' | ||
shutil.copy2(f'{in_path}/{file}', f'{out_full_path}{file}') | ||
import_content += ' </ItemGroup>\n</Project>' | ||
|
||
# Create import file | ||
with open(import_file_location, 'w') as file: | ||
file.write(import_content) | ||
|
||
# Create archive | ||
shutil.make_archive(f'{archive_directory}{archive_name}', archive_type, archive_directory) |
Empty file.