mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Revert pboProject tools removal
This commit is contained in:
parent
e6362c699d
commit
bd3f516e24
91
tools/build.py
Normal file
91
tools/build.py
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
######## GLOBALS #########
|
||||||
|
MAINPREFIX = "z"
|
||||||
|
PREFIX = "ace_"
|
||||||
|
##########################
|
||||||
|
|
||||||
|
def mod_time(path):
|
||||||
|
if not os.path.isdir(path):
|
||||||
|
return os.path.getmtime(path)
|
||||||
|
maxi = os.path.getmtime(path)
|
||||||
|
for p in os.listdir(path):
|
||||||
|
maxi = max(mod_time(os.path.join(path, p)), maxi)
|
||||||
|
return maxi
|
||||||
|
|
||||||
|
|
||||||
|
def check_for_changes(addonspath, module):
|
||||||
|
if not os.path.exists(os.path.join(addonspath, "{}{}.pbo".format(PREFIX,module))):
|
||||||
|
return True
|
||||||
|
return mod_time(os.path.join(addonspath, module)) > mod_time(os.path.join(addonspath, "{}{}.pbo".format(PREFIX,module)))
|
||||||
|
|
||||||
|
def check_for_obsolete_pbos(addonspath, file):
|
||||||
|
module = file[len(PREFIX):-4]
|
||||||
|
if not os.path.exists(os.path.join(addonspath, module)):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def main():
|
||||||
|
print("""
|
||||||
|
####################
|
||||||
|
# ACE3 Debug Build #
|
||||||
|
####################
|
||||||
|
""")
|
||||||
|
|
||||||
|
scriptpath = os.path.realpath(__file__)
|
||||||
|
projectpath = os.path.dirname(os.path.dirname(scriptpath))
|
||||||
|
addonspath = os.path.join(projectpath, "addons")
|
||||||
|
|
||||||
|
os.chdir(addonspath)
|
||||||
|
|
||||||
|
made = 0
|
||||||
|
failed = 0
|
||||||
|
skipped = 0
|
||||||
|
removed = 0
|
||||||
|
|
||||||
|
for file in os.listdir(addonspath):
|
||||||
|
if os.path.isfile(file):
|
||||||
|
if check_for_obsolete_pbos(addonspath, file):
|
||||||
|
removed += 1
|
||||||
|
print(" Removing obsolete file => " + file)
|
||||||
|
os.remove(file)
|
||||||
|
print("")
|
||||||
|
|
||||||
|
for p in os.listdir(addonspath):
|
||||||
|
path = os.path.join(addonspath, p)
|
||||||
|
if not os.path.isdir(path):
|
||||||
|
continue
|
||||||
|
if p[0] == ".":
|
||||||
|
continue
|
||||||
|
if not check_for_changes(addonspath, p):
|
||||||
|
skipped += 1
|
||||||
|
print(" Skipping {}.".format(p))
|
||||||
|
continue
|
||||||
|
|
||||||
|
print("# Making {} ...".format(p))
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess.check_output([
|
||||||
|
"makepbo",
|
||||||
|
"-NUP",
|
||||||
|
"-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p),
|
||||||
|
p,
|
||||||
|
"{}{}.pbo".format(PREFIX,p)
|
||||||
|
], stderr=subprocess.STDOUT)
|
||||||
|
except:
|
||||||
|
failed += 1
|
||||||
|
print(" Failed to make {}.".format(p))
|
||||||
|
else:
|
||||||
|
made += 1
|
||||||
|
print(" Successfully made {}.".format(p))
|
||||||
|
|
||||||
|
print("\n# Done.")
|
||||||
|
print(" Made {}, skipped {}, removed {}, failed to make {}.".format(made, skipped, removed, failed))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sys.exit(main())
|
93
tools/make.cfg
Normal file
93
tools/make.cfg
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
# EXAMPLE MAKE.CFG FILE
|
||||||
|
# Please see the comments for each option. Most options can be left
|
||||||
|
# off for sane defaults.
|
||||||
|
|
||||||
|
#################################################################
|
||||||
|
# Default make target
|
||||||
|
#################################################################
|
||||||
|
[DEFAULT]
|
||||||
|
|
||||||
|
# Project name (with @ symbol)
|
||||||
|
# This is used for naming the release files.
|
||||||
|
# Default: Current folder name
|
||||||
|
project = @ace
|
||||||
|
|
||||||
|
# Path to project secret key for signing
|
||||||
|
# Make sure this isn't in your public repository!
|
||||||
|
# Default: <work_drive>\private_keys\ace_3.0.0.biprivatekey
|
||||||
|
# key = P:\private_keys\ace_3.0.0.biprivatekey
|
||||||
|
|
||||||
|
# Path to where private keys are automatically created if the command-line parameter "key" is used
|
||||||
|
# Make sure this isn't in your public repository!
|
||||||
|
# Default: <work_drive>\private_keys
|
||||||
|
# private_key_path = P:\private_keys
|
||||||
|
|
||||||
|
# If set to True, the make system will attempt to autodetect addons in the
|
||||||
|
# current folder by looking for directories with 'config.cpp' in them.
|
||||||
|
# Default: True
|
||||||
|
# module_autodetect = True
|
||||||
|
|
||||||
|
# List of directories to ignore when autodetecting addons.
|
||||||
|
# Default: release
|
||||||
|
# ignore = release, my_unfinished_module
|
||||||
|
|
||||||
|
# If autodetect is set to False, only folders whose names are in this list
|
||||||
|
# will be built as modules.
|
||||||
|
# Default: None
|
||||||
|
# modules = my_module, my_supporting_module
|
||||||
|
|
||||||
|
# This is the folder hierarchy that will be used as prefix inside the PBO.
|
||||||
|
# Default: None
|
||||||
|
prefix = z\ace\addons
|
||||||
|
|
||||||
|
# Set the location where the addon source folders (i.e. P:\z\ace\addons)
|
||||||
|
# Default: <work_drive>\<prefix>\addons
|
||||||
|
module_root = P:\z\ace\addons
|
||||||
|
|
||||||
|
# Set the location where the optional addon source folders (i.e. P:\z\ace\optionals)
|
||||||
|
# Default: <work_drive>\<prefix>\optionals
|
||||||
|
optionals_root = P:\z\ace\optionals
|
||||||
|
|
||||||
|
|
||||||
|
# If the command-line variable test, the addons built will be copied to the following folder.
|
||||||
|
# Default: %USERPROFILE%\documents\Arma 3\<project>
|
||||||
|
# test_dir = %USERPROFILE%\documents\Arma 3\<project>
|
||||||
|
|
||||||
|
|
||||||
|
# Directory where the built addon will be saved.
|
||||||
|
# Default: release
|
||||||
|
release_dir = P:\z\ace\release
|
||||||
|
|
||||||
|
|
||||||
|
# This string will be prefixed to all build PBO file names.
|
||||||
|
# Default: None
|
||||||
|
pbo_name_prefix = ace_
|
||||||
|
|
||||||
|
# This string will be prefixed to release archive.
|
||||||
|
# Default: None
|
||||||
|
zipPrefix = ace3
|
||||||
|
|
||||||
|
# Which build tool will be used? Options: pboproject, addonbuilder
|
||||||
|
# Default: addonbuilder
|
||||||
|
build_tool = pboproject
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
# Alternate build target using a different key
|
||||||
|
###################################################################
|
||||||
|
# [DifferentKey]
|
||||||
|
# key = C:\Keys\different.biprivatekey
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
# Alternate build target ignoring some modules when detecting
|
||||||
|
###################################################################
|
||||||
|
# [IgnoreSome]
|
||||||
|
# key = C:\Keys\different.biprivatekey
|
||||||
|
# ignore = release, my_server_module, my_private_module
|
||||||
|
|
||||||
|
##################################################################
|
||||||
|
# Alternate build target with fixed build list
|
||||||
|
###################################################################
|
||||||
|
# [Fixed]
|
||||||
|
# module_autodetect = False
|
||||||
|
# modules = my_module, my_other_module
|
||||||
|
|
1444
tools/make.py
Normal file
1444
tools/make.py
Normal file
File diff suppressed because it is too large
Load Diff
119
tools/setup.py
Normal file
119
tools/setup.py
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
#######################
|
||||||
|
# ACE3 Setup Script #
|
||||||
|
#######################
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import shutil
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
|
import winreg
|
||||||
|
|
||||||
|
######## GLOBALS #########
|
||||||
|
MAINDIR = "z"
|
||||||
|
PROJECTDIR = "ace"
|
||||||
|
CBA = "P:\\x\\cba"
|
||||||
|
##########################
|
||||||
|
|
||||||
|
def main():
|
||||||
|
FULLDIR = "{}\\{}".format(MAINDIR,PROJECTDIR)
|
||||||
|
print("""
|
||||||
|
######################################
|
||||||
|
# ACE3 Development Environment Setup #
|
||||||
|
######################################
|
||||||
|
|
||||||
|
This script will create your ACE3 dev environment for you.
|
||||||
|
|
||||||
|
Before you run this, you should already have:
|
||||||
|
- The Arma 3 Tools installed properly via Steam
|
||||||
|
- A properly set up P-drive
|
||||||
|
|
||||||
|
If you have not done those things yet, please abort this script in the next step and do so first.
|
||||||
|
|
||||||
|
This script will create two hard links on your system, both pointing to your ACE3 project folder:
|
||||||
|
[Arma 3 installation directory]\\{} => ACE3 project folder
|
||||||
|
P:\\{} => ACE3 project folder
|
||||||
|
|
||||||
|
It will also copy the required CBA includes to {}, if you do not have the CBA source code already.""".format(FULLDIR,FULLDIR,CBA))
|
||||||
|
print("\n")
|
||||||
|
|
||||||
|
try:
|
||||||
|
reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
|
||||||
|
key = winreg.OpenKey(reg,
|
||||||
|
r"SOFTWARE\Wow6432Node\bohemia interactive\arma 3")
|
||||||
|
armapath = winreg.EnumValue(key,1)[1]
|
||||||
|
except:
|
||||||
|
print("Failed to determine Arma 3 Path.")
|
||||||
|
return 1
|
||||||
|
|
||||||
|
if not os.path.exists("P:\\"):
|
||||||
|
print("No P-drive detected.")
|
||||||
|
return 2
|
||||||
|
|
||||||
|
scriptpath = os.path.realpath(__file__)
|
||||||
|
projectpath = os.path.dirname(os.path.dirname(scriptpath))
|
||||||
|
|
||||||
|
print("# Detected Paths:")
|
||||||
|
print(" Arma Path: {}".format(armapath))
|
||||||
|
print(" Project Path: {}".format(projectpath))
|
||||||
|
|
||||||
|
repl = input("\nAre these correct? (y/n): ")
|
||||||
|
if repl.lower() != "y":
|
||||||
|
return 3
|
||||||
|
|
||||||
|
print("\n# Creating links ...")
|
||||||
|
|
||||||
|
if os.path.exists("P:\\{}\\{}".format(MAINDIR,PROJECTDIR)):
|
||||||
|
print("Link on P: already exists. Please finish the setup manually.")
|
||||||
|
return 4
|
||||||
|
|
||||||
|
if os.path.exists(os.path.join(armapath, MAINDIR, PROJECTDIR)):
|
||||||
|
print("Link in Arma directory already exists. Please finish the setup manually.")
|
||||||
|
return 5
|
||||||
|
|
||||||
|
try:
|
||||||
|
if not os.path.exists("P:\\{}".format(MAINDIR)):
|
||||||
|
os.mkdir("P:\\{}".format(MAINDIR))
|
||||||
|
if not os.path.exists(os.path.join(armapath, MAINDIR)):
|
||||||
|
os.mkdir(os.path.join(armapath, MAINDIR))
|
||||||
|
|
||||||
|
subprocess.call(["cmd", "/c", "mklink", "/J", "P:\\{}\\{}".format(MAINDIR,PROJECTDIR), projectpath])
|
||||||
|
subprocess.call(["cmd", "/c", "mklink", "/J", os.path.join(armapath, MAINDIR, PROJECTDIR), projectpath])
|
||||||
|
except:
|
||||||
|
raise
|
||||||
|
print("Something went wrong during the link creation. Please finish the setup manually.")
|
||||||
|
return 6
|
||||||
|
|
||||||
|
print("# Links created successfully.")
|
||||||
|
|
||||||
|
|
||||||
|
print("\n# Copying required CBA includes ...")
|
||||||
|
|
||||||
|
if os.path.exists(CBA):
|
||||||
|
print("{} already exists, skipping.".format(CBA))
|
||||||
|
return -1
|
||||||
|
|
||||||
|
try:
|
||||||
|
shutil.copytree(os.path.join(projectpath, "tools", "cba"), CBA)
|
||||||
|
except:
|
||||||
|
raise
|
||||||
|
print("Something went wrong while copying CBA includes. Please copy tools\\cba to {} manually.".format(CBA))
|
||||||
|
return 7
|
||||||
|
|
||||||
|
print("# CBA includes copied successfully to {}.".format(CBA))
|
||||||
|
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
exitcode = main()
|
||||||
|
|
||||||
|
if exitcode > 0:
|
||||||
|
print("\nSomething went wrong during the setup. Make sure you run this script as administrator. If these issues persist, please follow the instructions on the ACE3 wiki to perform the setup manually.")
|
||||||
|
else:
|
||||||
|
print("\nSetup successfully completed.")
|
||||||
|
|
||||||
|
input("\nPress enter to exit ...")
|
||||||
|
sys.exit(exitcode)
|
Loading…
Reference in New Issue
Block a user