First Commit
This commit is contained in:
234
apps/DatabaseExporter/DatabaseExporter.ps1
Normal file
234
apps/DatabaseExporter/DatabaseExporter.ps1
Normal file
@@ -0,0 +1,234 @@
|
||||
########################################################################################
|
||||
# SETTINGS #
|
||||
########################################################################################
|
||||
$mysql_host = "127.0.0.1"
|
||||
$mysql_user = "export"
|
||||
$mysql_password = "export"
|
||||
$mysql_database_auth = "acore_auth"
|
||||
$mysql_database_characters = "acore_characters"
|
||||
$mysql_database_world = "acore_world"
|
||||
########################################################################################
|
||||
# SETTINGS END #
|
||||
########################################################################################
|
||||
|
||||
# Set MySQL password as temporary env var
|
||||
$env:MYSQL_PWD = $mysql_password
|
||||
|
||||
# Get the directory to sql\base directory
|
||||
$scriptDirectory = $PSScriptRoot
|
||||
$relativePath = "..\..\data\sql\base"
|
||||
$combinedPath = Join-Path -Path $scriptDirectory -ChildPath $relativePath
|
||||
$fullPath = Resolve-Path -Path $combinedPath
|
||||
|
||||
# Define the output directory (using database name)
|
||||
$output_directory_auth = "$fullPath\db_auth"
|
||||
$output_directory_characters = "$fullPath\db_characters"
|
||||
$output_directory_world = "$fullPath\db_world"
|
||||
|
||||
Write-Host " ___ _ _ ___ "
|
||||
Write-Host "/ \ ___ ___ _ _ ___ | |_ | |_ / __| ___ _ _ ___ "
|
||||
Write-Host "| - ||_ // -_)| '_|/ _ \| _|| \ | (__ / _ \| '_|/ -_)"
|
||||
Write-Host "|_|_|/__|\___||_| \___/ \__||_||_| \___|\___/|_| \___|"
|
||||
Write-Host "AzerothCore 3.3.5a - www.azerothcore.org"
|
||||
Write-Host ""
|
||||
Write-Host "Welcome to the AzerothCore Database Exporter for database squashes!"
|
||||
Write-Host ""
|
||||
Write-Host "You have configured:"
|
||||
Write-Host "Database Auth: '$mysql_database_auth'"
|
||||
Write-Host "Database Characters: '$mysql_database_characters'"
|
||||
Write-Host "Database World: '$mysql_database_world'"
|
||||
Write-Host "Output Dir Auth: '$output_directory_auth'"
|
||||
Write-Host "Output Dir Characters: '$output_directory_characters'"
|
||||
Write-Host "Output Dir World: '$output_directory_world'"
|
||||
Write-Host ""
|
||||
Write-Host "Make sure you read the entire process before you continue."
|
||||
Write-Host "https://github.com/azerothcore/azerothcore-wotlk/blob/master/data/sql/base/database-squash.md"
|
||||
Write-Host "https://github.com/azerothcore/azerothcore-wotlk/blob/master/apps/DatabaseExporter/databaseexporter.md"
|
||||
Write-Host ""
|
||||
|
||||
# Check if the user wants to continue using the tool
|
||||
do {
|
||||
$confirmation = Read-Host "Do you want to continue using the tool? (Y/N)"
|
||||
|
||||
if ($confirmation -eq 'Y' -or $confirmation -eq 'y') {
|
||||
# Continue the script
|
||||
Write-Host "AzerothCore Database Exporter starts."
|
||||
$continue = $true
|
||||
}
|
||||
elseif ($confirmation -eq 'N' -or $confirmation -eq 'n') {
|
||||
# Exit the script
|
||||
Write-Host "Exiting the AzerothCore Database Exporter."
|
||||
exit
|
||||
}
|
||||
else {
|
||||
Write-Host "Invalid input. Please enter Y or N."
|
||||
$continue = $null
|
||||
}
|
||||
} while ($continue -eq $null)
|
||||
|
||||
# Remove the output directory if it exist
|
||||
if (Test-Path $output_directory_auth) {
|
||||
Remove-Item -Path $output_directory_auth -Recurse -Force
|
||||
Write-Host "Deleted directory $output_directory_auth"
|
||||
}
|
||||
if (Test-Path $output_directory_characters) {
|
||||
Remove-Item -Path $output_directory_characters -Recurse -Force
|
||||
Write-Host "Deleted directory $output_directory_characters"
|
||||
}
|
||||
if (Test-Path $output_directory_world) {
|
||||
Remove-Item -Path $output_directory_world -Recurse -Force
|
||||
Write-Host "Deleted directory $output_directory_world"
|
||||
}
|
||||
|
||||
# Create the output directory if it doesn't exist
|
||||
if (-not (Test-Path -Path $output_directory_auth)) {
|
||||
New-Item -ItemType Directory -Force -Path $output_directory_auth
|
||||
Write-Host "Created directory $output_directory_auth"
|
||||
}
|
||||
if (-not (Test-Path -Path $output_directory_characters)) {
|
||||
New-Item -ItemType Directory -Force -Path $output_directory_characters
|
||||
Write-Host "Created directory $output_directory_characters"
|
||||
}
|
||||
if (-not (Test-Path -Path $output_directory_world)) {
|
||||
New-Item -ItemType Directory -Force -Path $output_directory_world
|
||||
Write-Host "Created directory $output_directory_world"
|
||||
}
|
||||
|
||||
# Fix for dumping TIMESTAMP data
|
||||
$timezone = "+01:00"
|
||||
$mysqlCommand = "SET time_zone = '$timezone';"
|
||||
$mysqlExec = "mysql -h $mysql_host -u $mysql_user -p$mysql_password -e `"$mysqlCommand`""
|
||||
Invoke-Expression -Command $mysqlExec
|
||||
|
||||
# PS script uses non-utf-8 encoding by default
|
||||
# https://stackoverflow.com/a/58438716
|
||||
# Save the current encoding and switch to UTF-8.
|
||||
$prev = [Console]::OutputEncoding
|
||||
[Console]::OutputEncoding = [System.Text.UTF8Encoding]::new()
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "#########################################################"
|
||||
Write-Host "EXPORT AUTH DATABASE START"
|
||||
Write-Host "#########################################################"
|
||||
Write-Host ""
|
||||
Write-Host "Please enter your password for user '$mysql_user'"
|
||||
|
||||
# Export Auth Database
|
||||
# Connect to MySQL and get all the tables
|
||||
$tables_auth = mysql -h $mysql_host -u $mysql_user -D $mysql_database_auth -e "SHOW TABLES;" | Select-Object -Skip 1
|
||||
# Iterate through each table and export both the structure and contents into the same SQL file
|
||||
foreach ($table in $tables_auth) {
|
||||
# Define the output file path for this table
|
||||
$output_file = "$output_directory_auth\$table.sql"
|
||||
|
||||
# Clear the content of the output file if it exists, or create a new one
|
||||
if (Test-Path $output_file) {
|
||||
Clear-Content -Path $output_file
|
||||
}
|
||||
|
||||
# Export the table structure (CREATE TABLE) and table data (INSERT) to the SQL file
|
||||
$create_table_command = "mysqldump -h $mysql_host -u $mysql_user --skip-tz-utc $mysql_database_auth $table"
|
||||
$create_table_output = Invoke-Expression -Command $create_table_command
|
||||
# write file with utf-8 encoding
|
||||
# https://stackoverflow.com/a/32951824
|
||||
[IO.File]::WriteAllLines($output_file, $create_table_output)
|
||||
|
||||
# Format the INSERT values to be on seperate lines.
|
||||
$content = Get-Content -Raw $output_file
|
||||
$formattedContent = $content -replace 'VALUES \(', "VALUES`r`n("
|
||||
$formattedContent = $formattedContent -replace '\),', "),`r`n"
|
||||
$formattedContent | Set-Content $output_file
|
||||
|
||||
Write-Host "Exported structure and data for table $table to $output_file"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "#########################################################"
|
||||
Write-Host "EXPORT AUTH DATABASE END"
|
||||
Write-Host "#########################################################"
|
||||
Write-Host ""
|
||||
Write-Host "#########################################################"
|
||||
Write-Host "EXPORT CHARACTERS DATABASE START"
|
||||
Write-Host "#########################################################"
|
||||
Write-Host ""
|
||||
Write-Host "Please enter your password for user '$mysql_user'"
|
||||
|
||||
# Export Characters Database
|
||||
# Connect to MySQL and get all the tables
|
||||
$tables_characters = mysql -h $mysql_host -u $mysql_user -D $mysql_database_characters -e "SHOW TABLES;" | Select-Object -Skip 1
|
||||
# Iterate through each table and export both the structure and contents into the same SQL file
|
||||
foreach ($table in $tables_characters) {
|
||||
# Define the output file path for this table
|
||||
$output_file = "$output_directory_characters\$table.sql"
|
||||
|
||||
# Clear the content of the output file if it exists, or create a new one
|
||||
if (Test-Path $output_file) {
|
||||
Clear-Content -Path $output_file
|
||||
}
|
||||
|
||||
# Export the table structure (CREATE TABLE) and table data (INSERT) to the SQL file
|
||||
$create_table_command = "mysqldump -h $mysql_host -u $mysql_user --skip-tz-utc $mysql_database_characters $table"
|
||||
$create_table_output = Invoke-Expression -Command $create_table_command
|
||||
# write file with utf-8 encoding
|
||||
# https://stackoverflow.com/a/32951824
|
||||
[IO.File]::WriteAllLines($output_file, $create_table_output)
|
||||
|
||||
# Format the INSERT values to be on seperate lines.
|
||||
$content = Get-Content -Raw $output_file
|
||||
$formattedContent = $content -replace 'VALUES \(', "VALUES`r`n("
|
||||
$formattedContent = $formattedContent -replace '\),', "),`r`n"
|
||||
$formattedContent | Set-Content $output_file
|
||||
|
||||
Write-Host "Exported structure and data for table $table to $output_file"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "#########################################################"
|
||||
Write-Host "EXPORT CHARACTERS DATABASE END"
|
||||
Write-Host "#########################################################"
|
||||
Write-Host ""
|
||||
Write-Host "#########################################################"
|
||||
Write-Host "EXPORT WORLD DATABASE START"
|
||||
Write-Host "#########################################################"
|
||||
Write-Host ""
|
||||
Write-Host "Please enter your password for user '$mysql_user'"
|
||||
|
||||
# Export World Database
|
||||
# Connect to MySQL and get all the tables
|
||||
$tables_world = mysql -h $mysql_host -u $mysql_user -D $mysql_database_world -e "SHOW TABLES;" | Select-Object -Skip 1
|
||||
# Iterate through each table and export both the structure and contents into the same SQL file
|
||||
foreach ($table in $tables_world) {
|
||||
# Define the output file path for this table
|
||||
$output_file = "$output_directory_world\$table.sql"
|
||||
|
||||
# Clear the content of the output file if it exists, or create a new one
|
||||
if (Test-Path $output_file) {
|
||||
Clear-Content -Path $output_file
|
||||
}
|
||||
|
||||
# Export the table structure (CREATE TABLE) and table data (INSERT) to the SQL file
|
||||
$create_table_command = "mysqldump -h $mysql_host -u $mysql_user --skip-tz-utc $mysql_database_world $table"
|
||||
$create_table_output = Invoke-Expression -Command $create_table_command
|
||||
# write file with utf-8 encoding
|
||||
# https://stackoverflow.com/a/32951824
|
||||
[IO.File]::WriteAllLines($output_file, $create_table_output)
|
||||
|
||||
# Format the INSERT values to be on seperate lines.
|
||||
$content = Get-Content -Raw $output_file
|
||||
$formattedContent = $content -replace 'VALUES \(', "VALUES`r`n("
|
||||
$formattedContent = $formattedContent -replace '\),', "),`r`n"
|
||||
$formattedContent | Set-Content $output_file
|
||||
|
||||
Write-Host "Exported structure and data for table $table to $output_file"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "#########################################################"
|
||||
Write-Host "EXPORT WORLD DATABASE END"
|
||||
Write-Host "#########################################################"
|
||||
Write-Host ""
|
||||
Write-Host "Database Exporter completed."
|
||||
Write-Host "Have a nice day :)"
|
||||
|
||||
# Restore the previous encoding.
|
||||
[Console]::OutputEncoding = $prev
|
||||
85
apps/DatabaseExporter/databaseexporter.md
Normal file
85
apps/DatabaseExporter/databaseexporter.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# The AzerothCore Database Exporter for Database Squashes
|
||||
|
||||
> [!CAUTION]
|
||||
> These steps are only for project maintainers who intend to update base files.
|
||||
|
||||
## Manual setting updates
|
||||
|
||||
Update the settings in `DatabaseExporter.ps1` to reflect your setup by opening it with your preffered text editor.
|
||||
|
||||
> [!NOTE]
|
||||
> Only update the settings within the SETTINGS block.
|
||||
|
||||
These are the default settings:
|
||||
```ps
|
||||
########################################################################################
|
||||
# SETTINGS #
|
||||
########################################################################################
|
||||
$mysql_host = "127.0.0.1"
|
||||
$mysql_user = "export"
|
||||
$mysql_password = "export"
|
||||
$mysql_database_auth = "acore_auth"
|
||||
$mysql_database_characters = "acore_characters"
|
||||
$mysql_database_world = "acore_world"
|
||||
########################################################################################
|
||||
# SETTINGS END #
|
||||
########################################################################################
|
||||
```
|
||||
|
||||
## Description of the tool
|
||||
|
||||
This tool updates the base files automatically. Hence, it must run from this directory.
|
||||
|
||||
This is how it works step-by-step:
|
||||
|
||||
1. Check that all paths look correct.
|
||||
2. Accept to continue using the tool.
|
||||
3. The tool will delete the `db_auth` `db_characters` `db_world` directories in `..\..\data\sql\base\`
|
||||
4. The tool will create the `db_auth` `db_characters` `db_world` directories in `..\..\data\sql\base\`
|
||||
5. The tool will export the `db_auth` table into `..\..\data\sql\base\db_auth\`
|
||||
6. The tool will export the `db_characters` table into `..\..\data\sql\base\db_characters\`
|
||||
7. The tool will export the `db_world` table into `..\..\data\sql\base\db_world\`
|
||||
|
||||
## Run the tool
|
||||
|
||||
> [!IMPORTANT]
|
||||
> This tool CAN NOT be moved outside this directory. If you do it will create files in the wrong places.
|
||||
|
||||
1. Make sure you have MySQL installed on your system and that the mysqldump tool is accessible by your PATH system variable. If it is not set you will encounter errors.
|
||||
|
||||
- Go into System Variables
|
||||
- Open the PATH variable
|
||||
- Add the path to your $\MySQL Server\bin\ - e.g. C:\Program Files\MySQL\MySQL Server 8.4\bin\
|
||||
|
||||
2. If you haven't run PowerShell scripts before, you'll need to adjust the execution policy.
|
||||
|
||||
- Open PowerShell as an Administrator.
|
||||
- Run the following command to allow running scripts:
|
||||
```ps
|
||||
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
```
|
||||
- This allows scripts to run on your system, but they need to be locally created or downloaded from trusted sources.
|
||||
|
||||
3. Open PowerShell (PS)
|
||||
|
||||
- Press Win + X and select Windows PowerShell (Admin) / Terminal (Admin)
|
||||
|
||||
4. Navigate to the script
|
||||
|
||||
- In PS, use the `cd` command to change the directory
|
||||
```ps
|
||||
cd "C:\AzerothCore\apps\DatabaseExporter"
|
||||
```
|
||||
|
||||
5. Run the script
|
||||
|
||||
- In PS, run the script
|
||||
```ps
|
||||
.\DatabaseExporter.ps1
|
||||
```
|
||||
|
||||
6. Follow the instructions given by the tool.
|
||||
|
||||
7. Now refer back to the database-squash.md instructions. (Located in ..\..\data\sql\base\)
|
||||
|
||||
Completed :)
|
||||
163
apps/EnumUtils/enumutils_describe.py
Normal file
163
apps/EnumUtils/enumutils_describe.py
Normal file
@@ -0,0 +1,163 @@
|
||||
from re import compile, MULTILINE
|
||||
from os import walk, getcwd
|
||||
|
||||
notice = ('''/*
|
||||
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by the
|
||||
* Free Software Foundation; either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
''')
|
||||
|
||||
if not getcwd().endswith('src'):
|
||||
print('Run this from the src directory!')
|
||||
print('(Invoke as \'python ../apps/EnumUtils/enumutils_describe.py\')')
|
||||
exit(1)
|
||||
|
||||
EnumPattern = compile(r'//\s*EnumUtils: DESCRIBE THIS(?:\s*\(in ([^\)]+)\))?\s+enum\s+([0-9A-Za-z]+)[^\n]*\s*{([^}]+)};')
|
||||
EnumValuesPattern = compile(r'\s+\S.+?(,|$)[^\n]*')
|
||||
EnumValueNamePattern = compile(r'^\s*([a-zA-Z0-9_]+)', flags=MULTILINE)
|
||||
EnumValueSkipLinePattern = compile(r'^\s*//')
|
||||
EnumValueCommentPattern = compile(r'//,?[ \t]*([^\n]+)$')
|
||||
CommentMatchFormat = compile(r'^(((TITLE +(.+?))|(DESCRIPTION +(.+?))) *){1,2}$')
|
||||
CommentSkipFormat = compile(r'^SKIP *$')
|
||||
|
||||
def strescape(str):
|
||||
res = ''
|
||||
for char in str:
|
||||
if char in ('\\', '"') or not (32 <= ord(char) < 127):
|
||||
res += ('\\%03o' % ord(char))
|
||||
else:
|
||||
res += char
|
||||
return '"' + res + '"'
|
||||
|
||||
def processFile(path, filename):
|
||||
input = open('%s/%s.h' % (path, filename),'r')
|
||||
if input is None:
|
||||
print('Failed to open %s.h' % filename)
|
||||
return
|
||||
|
||||
file = input.read()
|
||||
|
||||
enums = []
|
||||
for enum in EnumPattern.finditer(file):
|
||||
prefix = enum.group(1) or ''
|
||||
name = enum.group(2)
|
||||
values = []
|
||||
for value in EnumValuesPattern.finditer(enum.group(3)):
|
||||
valueData = value.group(0)
|
||||
|
||||
valueNameMatch = EnumValueNamePattern.search(valueData)
|
||||
if valueNameMatch is None:
|
||||
if EnumValueSkipLinePattern.search(valueData) is None:
|
||||
print('Name of value not found: %s' % repr(valueData))
|
||||
continue
|
||||
valueName = valueNameMatch.group(1)
|
||||
|
||||
valueCommentMatch = EnumValueCommentPattern.search(valueData)
|
||||
valueComment = None
|
||||
if valueCommentMatch:
|
||||
valueComment = valueCommentMatch.group(1)
|
||||
|
||||
valueTitle = None
|
||||
valueDescription = None
|
||||
|
||||
if valueComment is not None:
|
||||
if CommentSkipFormat.match(valueComment) is not None:
|
||||
continue
|
||||
commentMatch = CommentMatchFormat.match(valueComment)
|
||||
if commentMatch is not None:
|
||||
valueTitle = commentMatch.group(4)
|
||||
valueDescription = commentMatch.group(6)
|
||||
else:
|
||||
valueDescription = valueComment
|
||||
|
||||
if valueTitle is None:
|
||||
valueTitle = valueName
|
||||
if valueDescription is None:
|
||||
valueDescription = ''
|
||||
|
||||
values.append((valueName, valueTitle, valueDescription))
|
||||
|
||||
enums.append((prefix + name, prefix, values))
|
||||
print('%s.h: Enum %s parsed with %d values' % (filename, name, len(values)))
|
||||
|
||||
if not enums:
|
||||
return
|
||||
|
||||
print('Done parsing %s.h (in %s)\n' % (filename, path))
|
||||
output = open('%s/enuminfo_%s.cpp' % (path, filename), 'w')
|
||||
if output is None:
|
||||
print('Failed to create enuminfo_%s.cpp' % filename)
|
||||
return
|
||||
|
||||
# write output file
|
||||
output.write(notice)
|
||||
output.write('#include "%s.h"\n' % filename)
|
||||
output.write('#include "Define.h"\n')
|
||||
output.write('#include "SmartEnum.h"\n')
|
||||
output.write('#include <stdexcept>\n')
|
||||
output.write('\n')
|
||||
output.write('namespace Acore::Impl::EnumUtilsImpl\n')
|
||||
output.write('{\n')
|
||||
for name, prefix, values in enums:
|
||||
tag = ('data for enum \'%s\' in \'%s.h\' auto-generated' % (name, filename))
|
||||
output.write('\n')
|
||||
output.write('/*' + ('*'*(len(tag)+2)) + '*\\\n')
|
||||
output.write('|* ' + tag + ' *|\n')
|
||||
output.write('\\*' + ('*'*(len(tag)+2)) + '*/\n')
|
||||
output.write('template <>\n')
|
||||
output.write('AC_API_EXPORT EnumText EnumUtils<%s>::ToString(%s value)\n' % (name, name))
|
||||
output.write('{\n')
|
||||
output.write(' switch (value)\n')
|
||||
output.write(' {\n')
|
||||
for label, title, description in values:
|
||||
output.write(' case %s: return { %s, %s, %s };\n' % (prefix + label, strescape(label), strescape(title), strescape(description)))
|
||||
output.write(' default: throw std::out_of_range("value");\n')
|
||||
output.write(' }\n')
|
||||
output.write('}\n')
|
||||
output.write('\n')
|
||||
output.write('template <>\n')
|
||||
output.write('AC_API_EXPORT size_t EnumUtils<%s>::Count() { return %d; }\n' % (name, len(values)))
|
||||
output.write('\n')
|
||||
output.write('template <>\n')
|
||||
output.write('AC_API_EXPORT %s EnumUtils<%s>::FromIndex(size_t index)\n' % (name, name))
|
||||
output.write('{\n')
|
||||
output.write(' switch (index)\n')
|
||||
output.write(' {\n')
|
||||
for (i, (label, title, description)) in enumerate(values):
|
||||
output.write(' case %d: return %s;\n' % (i, prefix + label))
|
||||
output.write(' default: throw std::out_of_range("index");\n')
|
||||
output.write(' }\n')
|
||||
output.write('}\n')
|
||||
output.write('\n')
|
||||
output.write('template <>\n')
|
||||
output.write('AC_API_EXPORT size_t EnumUtils<%s>::ToIndex(%s value)\n' % (name, name))
|
||||
output.write('{\n')
|
||||
output.write(' switch (value)\n')
|
||||
output.write(' {\n')
|
||||
for (i, (label, title, description)) in enumerate(values):
|
||||
output.write(' case %s: return %d;\n' % (prefix + label, i))
|
||||
output.write(' default: throw std::out_of_range("value");\n')
|
||||
output.write(' }\n')
|
||||
output.write('}\n')
|
||||
|
||||
output.write('}\n')
|
||||
|
||||
FilenamePattern = compile(r'^(.+)\.h$')
|
||||
for root, dirs, files in walk('.'):
|
||||
for n in files:
|
||||
nameMatch = FilenamePattern.match(n)
|
||||
if nameMatch is not None:
|
||||
processFile(root, nameMatch.group(1))
|
||||
238
apps/Fmt/FormatReplace.py
Normal file
238
apps/Fmt/FormatReplace.py
Normal file
@@ -0,0 +1,238 @@
|
||||
import pathlib
|
||||
from os import getcwd
|
||||
|
||||
if not getcwd().endswith('src') and not getcwd().endswith('modules'):
|
||||
print('Run this from the src or modules directory!')
|
||||
print('(Invoke as \'python ../apps/Fmt/FormatReplace.py\')')
|
||||
exit(1)
|
||||
|
||||
def isASSERT(line):
|
||||
substring = 'ASSERT'
|
||||
if substring in line:
|
||||
return True
|
||||
else :
|
||||
return False
|
||||
|
||||
def isABORTMSG(line):
|
||||
substring = 'ABORT_MSG'
|
||||
if substring in line:
|
||||
return True
|
||||
else :
|
||||
return False
|
||||
|
||||
def islog(line):
|
||||
substring = 'LOG_'
|
||||
if substring in line:
|
||||
return True
|
||||
else :
|
||||
return False
|
||||
|
||||
# def isSendSysMessage(line):
|
||||
# substring = 'SendSysMessage'
|
||||
# if substring in line:
|
||||
# return True
|
||||
# else :
|
||||
# return False
|
||||
|
||||
# def isPSendSysMessage(line):
|
||||
# substring = 'PSendSysMessage'
|
||||
# if substring in line:
|
||||
# return True
|
||||
# else :
|
||||
# return False
|
||||
|
||||
def isPQuery(line):
|
||||
substring = 'PQuery'
|
||||
if substring in line:
|
||||
return True
|
||||
else :
|
||||
return False
|
||||
|
||||
def isPExecute(line):
|
||||
substring = 'PExecute'
|
||||
if substring in line:
|
||||
return True
|
||||
else :
|
||||
return False
|
||||
|
||||
def isPAppend(line):
|
||||
substring = 'PAppend'
|
||||
if substring in line:
|
||||
return True
|
||||
else :
|
||||
return False
|
||||
|
||||
def isStringFormat(line):
|
||||
substring = 'StringFormat'
|
||||
if substring in line:
|
||||
return True
|
||||
else :
|
||||
return False
|
||||
|
||||
def haveDelimeter(line):
|
||||
if ';' in line:
|
||||
return True
|
||||
else :
|
||||
return False
|
||||
|
||||
def checkSoloLine(line):
|
||||
if isABORTMSG(line):
|
||||
line = line.replace("ABORT_MSG", "ABORT");
|
||||
return handleCleanup(line), False
|
||||
elif isASSERT(line):
|
||||
return handleCleanup(line), False
|
||||
elif islog(line):
|
||||
return handleCleanup(line), False
|
||||
elif isPExecute(line):
|
||||
line = line.replace("PExecute", "Execute");
|
||||
return handleCleanup(line), False
|
||||
elif isPQuery(line):
|
||||
line = line.replace("PQuery", "Query");
|
||||
return handleCleanup(line), False
|
||||
elif isPAppend(line):
|
||||
line = line.replace("PAppend", "Append");
|
||||
return handleCleanup(line), False
|
||||
# elif isSendSysMessage(line):
|
||||
# return handleCleanup(line), False
|
||||
# elif isPSendSysMessage(line):
|
||||
# return handleCleanup(line), False
|
||||
elif isStringFormat(line):
|
||||
return handleCleanup(line), False
|
||||
else:
|
||||
return line, False
|
||||
|
||||
def startMultiLine(line):
|
||||
if isABORTMSG(line):
|
||||
line = line.replace("ABORT_MSG", "ABORT");
|
||||
return handleCleanup(line), True
|
||||
elif isASSERT(line):
|
||||
return handleCleanup(line), True
|
||||
elif islog(line):
|
||||
return handleCleanup(line), True
|
||||
# elif isSendSysMessage(line):
|
||||
# return handleCleanup(line), True
|
||||
# elif isPSendSysMessage(line):
|
||||
# return handleCleanup(line), True
|
||||
elif isPQuery(line):
|
||||
line = line.replace("PQuery", "Query");
|
||||
return handleCleanup(line), True
|
||||
elif isPExecute(line):
|
||||
line = line.replace("PExecute", "Execute");
|
||||
return handleCleanup(line), True
|
||||
elif isPAppend(line):
|
||||
line = line.replace("PAppend", "Append");
|
||||
return handleCleanup(line), True
|
||||
elif isStringFormat(line):
|
||||
return handleCleanup(line), True
|
||||
else :
|
||||
return line, False
|
||||
|
||||
def continueMultiLine(line, existPrevLine):
|
||||
if haveDelimeter(line):
|
||||
existPrevLine = False;
|
||||
return handleCleanup(line), existPrevLine
|
||||
|
||||
def checkTextLine(line, existPrevLine):
|
||||
if existPrevLine:
|
||||
return continueMultiLine(line, existPrevLine)
|
||||
else :
|
||||
if haveDelimeter(line):
|
||||
return checkSoloLine(line)
|
||||
else :
|
||||
return startMultiLine(line)
|
||||
|
||||
def handleCleanup(line):
|
||||
line = line.replace("%s", "{}");
|
||||
line = line.replace("%u", "{}");
|
||||
line = line.replace("%hu", "{}");
|
||||
line = line.replace("%lu", "{}");
|
||||
line = line.replace("%llu", "{}");
|
||||
line = line.replace("%zu", "{}");
|
||||
line = line.replace("%02u", "{:02}");
|
||||
line = line.replace("%03u", "{:03}");
|
||||
line = line.replace("%04u", "{:04}");
|
||||
line = line.replace("%05u", "{:05}");
|
||||
line = line.replace("%02i", "{:02}");
|
||||
line = line.replace("%03i", "{:03}");
|
||||
line = line.replace("%04i", "{:04}");
|
||||
line = line.replace("%05i", "{:05}");
|
||||
line = line.replace("%02d", "{:02}");
|
||||
line = line.replace("%03d", "{:03}");
|
||||
line = line.replace("%04d", "{:04}");
|
||||
line = line.replace("%05d", "{:05}");
|
||||
line = line.replace("%d", "{}");
|
||||
line = line.replace("%i", "{}");
|
||||
line = line.replace("%x", "{:x}");
|
||||
line = line.replace("%X", "{:X}");
|
||||
line = line.replace("%lx", "{:x}");
|
||||
line = line.replace("%lX", "{:X}");
|
||||
line = line.replace("%02X", "{:02X}");
|
||||
line = line.replace("%08X", "{:08X}");
|
||||
line = line.replace("%f", "{}");
|
||||
line = line.replace("%.1f", "{0:.1f}");
|
||||
line = line.replace("%.2f", "{0:.2f}");
|
||||
line = line.replace("%.3f", "{0:.3f}");
|
||||
line = line.replace("%.4f", "{0:.4f}");
|
||||
line = line.replace("%.5f", "{0:.5f}");
|
||||
line = line.replace("%3.1f", "{:3.1f}");
|
||||
line = line.replace("%%", "%");
|
||||
line = line.replace(".c_str()", "");
|
||||
line = line.replace("\" SZFMTD \"", "{}");
|
||||
line = line.replace("\" UI64FMTD \"", "{}");
|
||||
# line = line.replace("\" STRING_VIEW_FMT \"", "{}");
|
||||
# line = line.replace("STRING_VIEW_FMT_ARG", "");
|
||||
return line
|
||||
|
||||
def getDefaultfile(name):
|
||||
file1 = open(name, "r+", encoding="utf8", errors='replace')
|
||||
|
||||
result = ''
|
||||
|
||||
while True:
|
||||
line = file1.readline()
|
||||
|
||||
if not line:
|
||||
break
|
||||
|
||||
result += line
|
||||
|
||||
file1.close
|
||||
return result
|
||||
|
||||
def getModifiedfile(name):
|
||||
file1 = open(name, "r+", encoding="utf8", errors='replace')
|
||||
|
||||
prevLines = False
|
||||
result = ''
|
||||
|
||||
while True:
|
||||
line = file1.readline()
|
||||
|
||||
if not line:
|
||||
break
|
||||
|
||||
line, prevLines = checkTextLine(line, prevLines)
|
||||
result += line
|
||||
|
||||
file1.close
|
||||
return result
|
||||
|
||||
def updModifiedfile(name, text):
|
||||
file = open(name, "w", encoding="utf8", errors='replace')
|
||||
file.write(text)
|
||||
file.close()
|
||||
|
||||
def handlefile(name):
|
||||
oldtext = getDefaultfile(name)
|
||||
newtext = getModifiedfile(name)
|
||||
|
||||
if oldtext != newtext:
|
||||
updModifiedfile(name, newtext)
|
||||
|
||||
p = pathlib.Path('.')
|
||||
for i in p.glob('**/*'):
|
||||
fname = i.absolute()
|
||||
if '.cpp' in i.name:
|
||||
handlefile(fname)
|
||||
if '.h' in i.name:
|
||||
handlefile(fname)
|
||||
132
apps/VersionUpdater/VersionUpdater.ps1
Normal file
132
apps/VersionUpdater/VersionUpdater.ps1
Normal file
@@ -0,0 +1,132 @@
|
||||
# Get the directory to acore.json
|
||||
$scriptDirectory = $PSScriptRoot
|
||||
$relativePath = "..\.."
|
||||
$combinedPath = Join-Path -Path $scriptDirectory -ChildPath $relativePath
|
||||
$fullPath = Resolve-Path -Path $combinedPath
|
||||
$jsonFilePath = "$fullPath\acore.json"
|
||||
# Get the directory for SQL update
|
||||
$relativePathDbWorldUpdate = "..\..\data\sql\updates\db_world"
|
||||
$combinedPathDbWorldUpdate = Join-Path -Path $scriptDirectory -ChildPath $relativePathDbWorldUpdate
|
||||
$fullPathDbWorldUpdate = Resolve-Path -Path $combinedPathDbWorldUpdate
|
||||
|
||||
Write-Host " ___ _ _ ___ "
|
||||
Write-Host "/ \ ___ ___ _ _ ___ | |_ | |_ / __| ___ _ _ ___ "
|
||||
Write-Host "| - ||_ // -_)| '_|/ _ \| _|| \ | (__ / _ \| '_|/ -_)"
|
||||
Write-Host "|_|_|/__|\___||_| \___/ \__||_||_| \___|\___/|_| \___|"
|
||||
Write-Host "AzerothCore 3.3.5a - www.azerothcore.org"
|
||||
Write-Host ""
|
||||
Write-Host "Welcome to the AzerothCore Version Updater for database squashes!"
|
||||
Write-Host ""
|
||||
Write-Host "You have configured:"
|
||||
Write-Host "acore.json Path: '$jsonFilePath'"
|
||||
Write-Host "World SQL Updates path: '$fullPathDbWorldUpdate'"
|
||||
Write-Host ""
|
||||
Write-Host "Make sure you read the entire process before you continue."
|
||||
Write-Host "https://github.com/azerothcore/azerothcore-wotlk/blob/master/data/sql/base/database-squash.md"
|
||||
Write-Host "https://github.com/azerothcore/azerothcore-wotlk/blob/master/apps/VersionUpdater/versionupdater.md"
|
||||
Write-Host ""
|
||||
|
||||
# Check if the user wants to continue using the tool
|
||||
do {
|
||||
$confirmation = Read-Host "Do you want to continue using the tool? (Y/N)"
|
||||
|
||||
if ($confirmation -eq 'Y' -or $confirmation -eq 'y') {
|
||||
# Continue the script
|
||||
Write-Host "AzerothCore Version Updater starts."
|
||||
Write-Host ""
|
||||
$continue = $true
|
||||
}
|
||||
elseif ($confirmation -eq 'N' -or $confirmation -eq 'n') {
|
||||
# Exit the script
|
||||
Write-Host "Exiting the AzerothCore Version Updater."
|
||||
exit
|
||||
}
|
||||
else {
|
||||
Write-Host "Invalid input. Please enter Y or N."
|
||||
$continue = $null
|
||||
}
|
||||
} while ($continue -eq $null)
|
||||
|
||||
# Read the JSON file and convert it to a PowerShell object
|
||||
$jsonContent = Get-Content -Path $jsonFilePath | ConvertFrom-Json
|
||||
|
||||
# Get the current version
|
||||
$currentVersion = $jsonContent.version
|
||||
|
||||
# Match version components (major.minor.patch and optional suffix like -dev or -alpha)
|
||||
if ($currentVersion -match '(\d+)\.(\d+)\.(\d+)(-.*)?') {
|
||||
$major = $matches[1]
|
||||
$minor = $matches[2]
|
||||
$patch = $matches[3]
|
||||
$suffix = $matches[4]
|
||||
|
||||
# Increment the major version
|
||||
$major = [int]$major + 1
|
||||
|
||||
# Reset minor and patch version to 0 (if incrementing major)
|
||||
$minor = 0
|
||||
$patch = 0
|
||||
|
||||
# Reassemble the version with the suffix if it exists
|
||||
$newVersion = "$major.$minor.$patch$suffix"
|
||||
|
||||
# Update the version in the JSON object
|
||||
$jsonContent.version = $newVersion
|
||||
} else {
|
||||
Write-Host "Unknown error in $jsonFilePath. Exiting."
|
||||
exit
|
||||
}
|
||||
|
||||
# Convert the updated object back to JSON format
|
||||
$newJsonContent = $jsonContent | ConvertTo-Json -Depth 3
|
||||
|
||||
# Write the updated content back to the file
|
||||
$newJsonContent | Set-Content -Path $jsonFilePath
|
||||
|
||||
Write-Host "acore.json version updated to $newVersion"
|
||||
|
||||
# Create the SQL Version update file.
|
||||
# Get today's date in the format YYYY_MM_DD
|
||||
$today = Get-Date -Format "yyyy_MM_dd"
|
||||
|
||||
# Get the list of files in the directory that match the pattern "YYYY_MM_DD_versionNumber.sql"
|
||||
$existingFiles = Get-ChildItem -Path $fullPathDbWorldUpdate -Filter "$today*_*.sql"
|
||||
|
||||
# If no files exist for today, start with version number 00
|
||||
if ($existingFiles.Count -eq 0) {
|
||||
[int]$newVersionNumber = 0
|
||||
} else {
|
||||
# Extract the version number from the existing files (e.g., YYYY_MM_DD_versionNumber.sql)
|
||||
$maxVersionNumber = $existingFiles | ForEach-Object {
|
||||
if ($_ -match "$today_(\d{2})\.sql") {
|
||||
[int]$matches[1]
|
||||
}
|
||||
} | Measure-Object -Maximum | Select-Object -ExpandProperty Maximum
|
||||
|
||||
# Increment the version number by 1
|
||||
[int]$newVersionNumber = $maxVersionNumber + 1
|
||||
}
|
||||
|
||||
# Format the new version number as a two-digit number (e.g., 01, 02, etc.)
|
||||
$formattedVersionNumber = $newVersionNumber.ToString("D2")
|
||||
|
||||
# Define the new filename using the date and incremented version number
|
||||
$newFileName = "$today" + "_$formattedVersionNumber.sql"
|
||||
$newFilePath = Join-Path -Path $fullPathDbWorldUpdate -ChildPath $newFileName
|
||||
|
||||
# Define the SQL content to write to the file
|
||||
$tableName = '`version`'
|
||||
$db_version = '`db_version`'
|
||||
$db_version_content = "'ACDB 335.$major-dev'"
|
||||
$cache_id = '`cache_id`'
|
||||
$sqlContent = "UPDATE $tableName SET $db_version=$db_version_content, $cache_id=$major LIMIT 1;"
|
||||
|
||||
# Write the content to the new SQL file
|
||||
$sqlContent | Set-Content -Path $newFilePath
|
||||
|
||||
Write-Host "SQL file created: $newFilePath"
|
||||
Write-Host "SQL content: $sqlContent"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Version Updater completed."
|
||||
Write-Host "Have a nice day :)"
|
||||
53
apps/VersionUpdater/versionupdater.md
Normal file
53
apps/VersionUpdater/versionupdater.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# The AzerothCore Version Updater for Database Squashes
|
||||
|
||||
> [!CAUTION]
|
||||
> These steps are only for project maintainers who intend to update base files.
|
||||
|
||||
## Description of the tool
|
||||
|
||||
This tool updates the version in DB and acore.json automatically. Hence, it must run from this directory.
|
||||
|
||||
This is how it works step-by-step:
|
||||
|
||||
1. Check that all paths look correct.
|
||||
2. Accept to continue using the tool.
|
||||
3. The tool will update the acore.json file and increment it by 1.
|
||||
4. The tool will create a file with the proper UPDATE for world database in `..\..\data\sql\updates\db_world`.
|
||||
|
||||
## Run the tool
|
||||
|
||||
> [!IMPORTANT]
|
||||
> This tool CAN NOT be moved outside this directory. If you do it will create files in the wrong places.
|
||||
|
||||
1. If you haven't run PowerShell scripts before, you'll need to adjust the execution policy.
|
||||
|
||||
- Open PowerShell as an Administrator.
|
||||
- Run the following command to allow running scripts:
|
||||
```ps
|
||||
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
|
||||
```
|
||||
- This allows scripts to run on your system, but they need to be locally created or downloaded from trusted sources.
|
||||
|
||||
2. Open PowerShell (PS)
|
||||
|
||||
- Press Win + X and select Windows PowerShell (Admin) / Terminal (Admin)
|
||||
|
||||
3. Navigate to the script
|
||||
|
||||
- In PS, use the `cd` command to change the directory
|
||||
```ps
|
||||
cd "C:\AzerothCore\apps\VersionUpdater"
|
||||
```
|
||||
|
||||
4. Run the script
|
||||
|
||||
- In PS, run the script
|
||||
```ps
|
||||
.\VersionUpdater.ps1
|
||||
```
|
||||
|
||||
5. Follow the instructions given by the tool.
|
||||
|
||||
6. Now refer back to the database-squash.md instructions. (Located in ..\..\data\sql\base\)
|
||||
|
||||
Completed :)
|
||||
26
apps/bash_shared/common.sh
Normal file
26
apps/bash_shared/common.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
function registerHooks() { acore_event_registerHooks "$@"; }
|
||||
function runHooks() { acore_event_runHooks "$@"; }
|
||||
|
||||
source "$AC_PATH_CONF/dist/config.sh" # include dist to avoid missing conf variables
|
||||
|
||||
# first check if it's defined in env, otherwise use the default
|
||||
USER_CONF_PATH=${USER_CONF_PATH:-"$AC_PATH_CONF/config.sh"}
|
||||
|
||||
if [ -f "$USER_CONF_PATH" ]; then
|
||||
source "$USER_CONF_PATH" # should overwrite previous
|
||||
else
|
||||
echo "NOTICE: file <$USER_CONF_PATH> not found, we use default configuration only."
|
||||
fi
|
||||
|
||||
#
|
||||
# Load modules
|
||||
#
|
||||
|
||||
for entry in "$AC_PATH_MODULES/"*/include.sh
|
||||
do
|
||||
if [ -e "$entry" ]; then
|
||||
source "$entry"
|
||||
fi
|
||||
done
|
||||
|
||||
ACORE_VERSION=$("$AC_PATH_DEPS/jsonpath/JSONPath.sh" -f "$AC_PATH_ROOT/acore.json" -b '$.version')
|
||||
28
apps/bash_shared/defines.sh
Normal file
28
apps/bash_shared/defines.sh
Normal file
@@ -0,0 +1,28 @@
|
||||
unamestr=$(uname)
|
||||
if [[ "$unamestr" == 'Darwin' ]]; then
|
||||
if ! command -v brew &>/dev/null ; then
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
fi
|
||||
if ! [ "${BASH_VERSINFO}" -ge 4 ]; then
|
||||
brew install bash
|
||||
fi
|
||||
if ! command -v greadlink &>/dev/null ; then
|
||||
brew install coreutils
|
||||
fi
|
||||
AC_PATH_ROOT=$(greadlink -f "$AC_PATH_APPS/../")
|
||||
else
|
||||
AC_PATH_ROOT=$(readlink -f "$AC_PATH_APPS/../")
|
||||
fi
|
||||
|
||||
case $AC_PATH_ROOT in
|
||||
/*) AC_PATH_ROOT=$AC_PATH_ROOT;;
|
||||
*) AC_PATH_ROOT=$PWD/$AC_PATH_ROOT;;
|
||||
esac
|
||||
|
||||
AC_PATH_CONF="$AC_PATH_ROOT/conf"
|
||||
|
||||
AC_PATH_MODULES="$AC_PATH_ROOT/modules"
|
||||
|
||||
AC_PATH_DEPS="$AC_PATH_ROOT/deps"
|
||||
|
||||
AC_PATH_VAR="$AC_PATH_ROOT/var"
|
||||
16
apps/bash_shared/includes.sh
Normal file
16
apps/bash_shared/includes.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
[[ ${GUARDYVAR:-} -eq 1 ]] && return || readonly GUARDYVAR=1 # include it once
|
||||
|
||||
# force default language for applications
|
||||
LC_ALL=C
|
||||
|
||||
AC_PATH_APPS="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
|
||||
|
||||
AC_PATH_SHARED="$AC_PATH_APPS/bash_shared"
|
||||
|
||||
source "$AC_PATH_SHARED/defines.sh"
|
||||
|
||||
source "$AC_PATH_DEPS/acore/bash-lib/src/event/hooks.sh"
|
||||
|
||||
source "$AC_PATH_SHARED/common.sh"
|
||||
|
||||
[[ "$OSTYPE" = "msys" ]] && AC_BINPATH_FULL="$BINPATH" || AC_BINPATH_FULL="$BINPATH/bin"
|
||||
8
apps/ci/ci-compile.sh
Normal file
8
apps/ci/ci-compile.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "compile core"
|
||||
export AC_CCACHE=true
|
||||
./acore.sh "compiler" "all"
|
||||
|
||||
69
apps/ci/ci-conf-core-pch.sh
Normal file
69
apps/ci/ci-conf-core-pch.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cat >>conf/config.sh <<CONFIG_SH
|
||||
MTHREADS=$(($(grep -c ^processor /proc/cpuinfo) + 2))
|
||||
CWARNINGS=ON
|
||||
CDEBUG=OFF
|
||||
CTYPE=Release
|
||||
CTOOLS_BUILD=none
|
||||
CSCRIPTS=static
|
||||
CMODULES=static
|
||||
CBUILD_TESTING=ON
|
||||
CSCRIPTPCH=ON
|
||||
CCOREPCH=ON
|
||||
CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"'
|
||||
CONFIG_SH
|
||||
|
||||
case $COMPILER in
|
||||
|
||||
# this is in order to use the "default" gcc version of the OS, without forcing a specific version
|
||||
"gcc" )
|
||||
time sudo apt-get install -y gcc g++
|
||||
echo "CCOMPILERC=\"gcc\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc8" )
|
||||
time sudo apt-get install -y gcc-8 g++-8
|
||||
echo "CCOMPILERC=\"gcc-8\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-8\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc10" )
|
||||
time sudo apt-get install -y gcc-10 g++-10
|
||||
echo "CCOMPILERC=\"gcc-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
# this is in order to use the "default" clang version of the OS, without forcing a specific version
|
||||
"clang" )
|
||||
time sudo apt-get install -y clang
|
||||
echo "CCOMPILERC=\"clang\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang10" )
|
||||
time sudo apt-get install -y clang-10
|
||||
echo "CCOMPILERC=\"clang-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang11" )
|
||||
time sudo apt-get install -y clang-11
|
||||
echo "CCOMPILERC=\"clang-11\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-11\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang12" )
|
||||
time sudo apt-get install -y clang-12
|
||||
echo "CCOMPILERC=\"clang-12\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-12\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "Unknown compiler $COMPILER"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
69
apps/ci/ci-conf-core.sh
Normal file
69
apps/ci/ci-conf-core.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cat >>conf/config.sh <<CONFIG_SH
|
||||
MTHREADS=$(($(grep -c ^processor /proc/cpuinfo) + 2))
|
||||
CWARNINGS=ON
|
||||
CDEBUG=OFF
|
||||
CTYPE=Release
|
||||
CTOOLS_BUILD=none
|
||||
CSCRIPTS=static
|
||||
CMODULES=static
|
||||
CBUILD_TESTING=ON
|
||||
CSCRIPTPCH=OFF
|
||||
CCOREPCH=OFF
|
||||
CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"'
|
||||
CONFIG_SH
|
||||
|
||||
case $COMPILER in
|
||||
|
||||
# this is in order to use the "default" gcc version of the OS, without forcing a specific version
|
||||
"gcc" )
|
||||
time sudo apt-get install -y gcc g++
|
||||
echo "CCOMPILERC=\"gcc\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc8" )
|
||||
time sudo apt-get install -y gcc-8 g++-8
|
||||
echo "CCOMPILERC=\"gcc-8\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-8\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc10" )
|
||||
time sudo apt-get install -y gcc-10 g++-10
|
||||
echo "CCOMPILERC=\"gcc-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
# this is in order to use the "default" clang version of the OS, without forcing a specific version
|
||||
"clang" )
|
||||
time sudo apt-get install -y clang
|
||||
echo "CCOMPILERC=\"clang\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang10" )
|
||||
time sudo apt-get install -y clang-10
|
||||
echo "CCOMPILERC=\"clang-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang11" )
|
||||
time sudo apt-get install -y clang-11
|
||||
echo "CCOMPILERC=\"clang-11\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-11\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang12" )
|
||||
time sudo apt-get install -y clang-12
|
||||
echo "CCOMPILERC=\"clang-12\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-12\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "Unknown compiler $COMPILER"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
36
apps/ci/ci-conf-db.sh
Normal file
36
apps/ci/ci-conf-db.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cat >>conf/config.sh <<CONFIG_SH
|
||||
MTHREADS=$(($(grep -c ^processor /proc/cpuinfo) + 2))
|
||||
CWARNINGS=ON
|
||||
CDEBUG=OFF
|
||||
CTYPE=Release
|
||||
CAPPS_BUILD=none
|
||||
CTOOLS_BUILD=db-only
|
||||
CSCRIPTPCH=OFF
|
||||
CCOREPCH=OFF
|
||||
CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"'
|
||||
CONFIG_SH
|
||||
|
||||
case $COMPILER in
|
||||
|
||||
# this is in order to use the "default" clang version of the OS, without forcing a specific version
|
||||
"clang" )
|
||||
time sudo apt-get install -y clang
|
||||
echo "CCOMPILERC=\"clang\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang12" )
|
||||
time sudo apt-get install -y clang-12
|
||||
echo "CCOMPILERC=\"clang-12\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-12\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "Unknown compiler $COMPILER"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
67
apps/ci/ci-conf-tools.sh
Normal file
67
apps/ci/ci-conf-tools.sh
Normal file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cat >>conf/config.sh <<CONFIG_SH
|
||||
MTHREADS=$(($(grep -c ^processor /proc/cpuinfo) + 2))
|
||||
CWARNINGS=ON
|
||||
CDEBUG=OFF
|
||||
CTYPE=Release
|
||||
CAPPS_BUILD=none
|
||||
CTOOLS_BUILD=maps-only
|
||||
CSCRIPTPCH=OFF
|
||||
CCOREPCH=OFF
|
||||
CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"'
|
||||
CONFIG_SH
|
||||
|
||||
case $COMPILER in
|
||||
|
||||
# this is in order to use the "default" gcc version of the OS, without forcing a specific version
|
||||
"gcc" )
|
||||
time sudo apt-get install -y gcc g++
|
||||
echo "CCOMPILERC=\"gcc\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc8" )
|
||||
time sudo apt-get install -y gcc-8 g++-8
|
||||
echo "CCOMPILERC=\"gcc-8\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-8\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc10" )
|
||||
time sudo apt-get install -y gcc-10 g++-10
|
||||
echo "CCOMPILERC=\"gcc-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
# this is in order to use the "default" clang version of the OS, without forcing a specific version
|
||||
"clang" )
|
||||
time sudo apt-get install -y clang
|
||||
echo "CCOMPILERC=\"clang\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang10" )
|
||||
time sudo apt-get install -y clang-10
|
||||
echo "CCOMPILERC=\"clang-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang11" )
|
||||
time sudo apt-get install -y clang-11
|
||||
echo "CCOMPILERC=\"clang-11\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-11\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang12" )
|
||||
time sudo apt-get install -y clang-12
|
||||
echo "CCOMPILERC=\"clang-12\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-12\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "Unknown compiler $COMPILER"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
15
apps/ci/ci-dry-run.sh
Normal file
15
apps/ci/ci-dry-run.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# Start mysql
|
||||
sudo systemctl start mysql
|
||||
|
||||
source "$CURRENT_PATH/ci-gen-server-conf-files.sh" $1 "etc" "bin" "root"
|
||||
|
||||
(cd ./env/dist/bin/ && timeout 5m ./$APP_NAME -dry-run)
|
||||
|
||||
# Stop mysql
|
||||
sudo systemctl stop mysql
|
||||
18
apps/ci/ci-error-check.sh
Normal file
18
apps/ci/ci-error-check.sh
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ERRORS_FILE="./env/dist/bin/Errors.log";
|
||||
|
||||
echo "Checking Startup Errors"
|
||||
echo
|
||||
|
||||
if [[ -s ${ERRORS_FILE} ]]; then
|
||||
printf "The Errors.log file contains startup errors:\n\n";
|
||||
cat ${ERRORS_FILE};
|
||||
printf "\nPlease solve the startup errors listed above!\n";
|
||||
exit 1;
|
||||
else
|
||||
echo "> No startup errors found in Errors.log";
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Done"
|
||||
15
apps/ci/ci-gen-server-conf-files.sh
Normal file
15
apps/ci/ci-gen-server-conf-files.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
APP_NAME=$1
|
||||
CONFIG_FOLDER=${2:-"etc"}
|
||||
BIN_FOLDER=${3-"bin"}
|
||||
MYSQL_ROOT_PASSWORD=${4:-""}
|
||||
|
||||
# copy dist files to conf files
|
||||
cp ./env/dist/$CONFIG_FOLDER/$APP_NAME.conf.dist ./env/dist/$CONFIG_FOLDER/$APP_NAME.conf
|
||||
|
||||
# replace login info
|
||||
sed -i "s/127.0.0.1;3306;acore;acore/localhost;3306;root;$MYSQL_ROOT_PASSWORD/" ./env/dist/$CONFIG_FOLDER/$APP_NAME.conf
|
||||
|
||||
if [[ $APP_NAME == "worldserver" ]]; then
|
||||
sed -i 's/DataDir = \".\"/DataDir = \".\/data"/' ./env/dist/$CONFIG_FOLDER/$APP_NAME.conf
|
||||
git clone --depth=1 --branch=master --single-branch https://github.com/ac-data/ac-data.git ./env/dist/$BIN_FOLDER/data
|
||||
fi
|
||||
107
apps/ci/ci-install-modules.sh
Normal file
107
apps/ci/ci-install-modules.sh
Normal file
@@ -0,0 +1,107 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "install modules"
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-1v1-arena modules/mod-1v1-arena
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-account-mounts modules/mod-account-mounts
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-ah-bot modules/mod-ah-bot
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-anticheat modules/mod-anticheat
|
||||
# NOTE: disabled because it does not compile right now with latest AC
|
||||
# git clone --depth=1 --branch=master https://github.com/azerothcore/mod-antifarming modules/mod-antifarming
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-arena-3v3-solo-queue modules/mod-arena-3v3-solo-queue
|
||||
git clone --depth=1 --branch=main https://github.com/azerothcore/mod-arena-replay modules/mod-arena-replay
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-auto-revive modules/mod-auto-revive
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-autobalance modules/mod-autobalance
|
||||
# NOTE: disabled because it causes DB error
|
||||
# git clone --depth=1 --branch=master https://github.com/azerothcore/mod-azerothshard.git modules/mod-azerothshard
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-better-item-reloading modules/mod-better-item-reloading
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-bg-item-reward modules/mod-bg-item-reward
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-bg-reward modules/mod-bg-reward
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-boss-announcer modules/mod-boss-announcer
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-breaking-news-override modules/mod-breaking-news-override
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-buff-command modules/mod-buff-command
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-cfbg modules/mod-cfbg
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-character-tools modules/mod-character-tools
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-chat-login modules/mod-chat-login
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-chat-transmitter modules/mod-chat-transmitter
|
||||
# NOTE: disabled because it causes DB startup error
|
||||
# git clone --depth=1 --branch=master https://github.com/azerothcore/mod-chromie-xp modules/mod-chromie-xp
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-congrats-on-level modules/mod-congrats-on-level
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-costumes modules/mod-costumes
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-cta-switch modules/mod-cta-switch
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-custom-login modules/mod-custom-login
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-desertion-warnings modules/mod-desertion-warnings
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-detailed-logging modules/mod-detailed-logging
|
||||
git clone --depth=1 --branch=main https://github.com/azerothcore/mod-dmf-switch modules/mod-dmf-switch
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-duel-reset modules/mod-duel-reset
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-dynamic-xp modules/mod-dynamic-xp
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-eluna modules/mod-eluna
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-emblem-transfer modules/mod-emblem-transfer
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-fireworks-on-level modules/mod-fireworks-on-level
|
||||
git clone --depth=1 --branch=main https://github.com/azerothcore/mod-global-chat modules/mod-global-chat
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-guild-zone-system modules/mod-guild-zone-system
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-guildhouse modules/mod-guildhouse
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-individual-xp modules/mod-individual-xp
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-instance-reset modules/mod-instance-reset
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-instanced-worldbosses modules/mod-instanced-worldbosses
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-ip-tracker modules/mod-ip-tracker
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-item-level-up modules/mod-item-level-up
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-keep-out modules/mod-keep-out
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-learn-highest-talent modules/mod-learn-highest-talent
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-learn-spells modules/mod-learn-spells
|
||||
git clone --depth=1 --branch=main https://github.com/azerothcore/mod-low-level-arena modules/mod-low-level-arena
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-low-level-rbg modules/mod-low-level-rbg
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-mall-teleport modules/mod-mall-teleport
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-morph-all-players modules/mod-morph-all-players
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-morphsummon modules/mod-morphsummon
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-multi-client-check modules/mod-multi-client-check
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-notify-muted modules/mod-notify-muted
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-all-mounts modules/mod-npc-all-mounts
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-beastmaster modules/mod-npc-beastmaster
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-buffer modules/mod-npc-buffer
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-codebox modules/mod-npc-codebox
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-enchanter modules/mod-npc-enchanter
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-free-professions modules/mod-npc-free-professions
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-gambler modules/mod-npc-gambler
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-morph modules/mod-npc-morph
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-services modules/mod-npc-services
|
||||
# not yet on azerothcore github
|
||||
git clone --depth=1 --branch=master https://github.com/gozzim/mod-npc-spectator modules/mod-npc-spectator
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-talent-template modules/mod-npc-talent-template
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-npc-titles-tokens modules/mod-npc-titles-tokens
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-phased-duels modules/mod-phased-duels
|
||||
# outdated
|
||||
# git clone --depth=1 --branch=master https://github.com/azerothcore/mod-playerbots modules/mod-playerbots
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-pocket-portal modules/mod-pocket-portal
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-premium modules/mod-premium
|
||||
git clone --depth=1 --branch=main https://github.com/azerothcore/mod-progression-system.git modules/mod-progression-system
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-promotion-azerothcore modules/mod-promotion-azerothcore
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-pvp-quests modules/mod-pvp-quests
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-pvp-titles modules/mod-pvp-titles
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-pvp-zones modules/mod-pvp-zones
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-pvpscript modules/mod-pvpscript
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-pvpstats-announcer modules/mod-pvpstats-announcer
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-quest-status modules/mod-quest-status
|
||||
git clone --depth=1 --branch=main https://github.com/azerothcore/mod-queue-list-cache modules/mod-queue-list-cache
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-quick-teleport modules/mod-quick-teleport
|
||||
git clone --depth=1 --branch=main https://github.com/azerothcore/mod-racial-trait-swap modules/mod-racial-trait-swap
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-random-enchants modules/mod-random-enchants
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-rdf-expansion modules/mod-rdf-expansion
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-resurrection-scroll modules/mod-resurrection-scroll
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-reward-played-time modules/mod-reward-played-time
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-reward-shop modules/mod-reward-shop
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-server-auto-shutdown.git modules/mod-server-auto-shutdown
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-solocraft modules/mod-solocraft
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-skip-dk-starting-area modules/mod-skip-dk-starting-area
|
||||
# has core patch file
|
||||
# git clone --depth=1 --branch=master https://github.com/azerothcore/mod-spell-regulator modules/mod-spell-regulator
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-starter-guild modules/mod-starter-guild
|
||||
git clone --depth=1 --branch=main https://github.com/azerothcore/mod-system-vip modules/mod-system-vip
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-tic-tac-toe modules/mod-tic-tac-toe
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-top-arena modules/mod-top-arena
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-transmog modules/mod-transmog
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-war-effort modules/mod-war-effort
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-weekend-xp modules/mod-weekend-xp
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-who-logged modules/mod-who-logged
|
||||
git clone --depth=1 --branch=master https://github.com/azerothcore/mod-zone-difficulty modules/mod-zone-difficulty
|
||||
74
apps/ci/ci-install.sh
Normal file
74
apps/ci/ci-install.sh
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cat >>conf/config.sh <<CONFIG_SH
|
||||
MTHREADS=$(($(grep -c ^processor /proc/cpuinfo) + 2))
|
||||
CWARNINGS=ON
|
||||
CDEBUG=OFF
|
||||
CTYPE=Release
|
||||
CSCRIPTS=static
|
||||
CBUILD_TESTING=ON
|
||||
CSERVERS=ON
|
||||
CTOOLS=ON
|
||||
CSCRIPTPCH=OFF
|
||||
CCOREPCH=OFF
|
||||
CCUSTOMOPTIONS='-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"'
|
||||
CONFIG_SH
|
||||
|
||||
time sudo apt-get update -y
|
||||
# time sudo apt-get upgrade -y
|
||||
time sudo apt-get install -y git lsb-release sudo
|
||||
time ./acore.sh install-deps
|
||||
|
||||
case $COMPILER in
|
||||
|
||||
# this is in order to use the "default" gcc version of the OS, without forcing a specific version
|
||||
"gcc" )
|
||||
time sudo apt-get install -y gcc g++
|
||||
echo "CCOMPILERC=\"gcc\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc8" )
|
||||
time sudo apt-get install -y gcc-8 g++-8
|
||||
echo "CCOMPILERC=\"gcc-8\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-8\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"gcc10" )
|
||||
time sudo apt-get install -y gcc-10 g++-10
|
||||
echo "CCOMPILERC=\"gcc-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"g++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
# this is in order to use the "default" clang version of the OS, without forcing a specific version
|
||||
"clang" )
|
||||
time sudo apt-get install -y clang
|
||||
echo "CCOMPILERC=\"clang\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang10" )
|
||||
time sudo apt-get install -y clang-10
|
||||
echo "CCOMPILERC=\"clang-10\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-10\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang11" )
|
||||
time sudo apt-get install -y clang-11
|
||||
echo "CCOMPILERC=\"clang-11\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-11\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
"clang12" )
|
||||
time sudo apt-get install -y clang-12
|
||||
echo "CCOMPILERC=\"clang-12\"" >> ./conf/config.sh
|
||||
echo "CCOMPILERCXX=\"clang++-12\"" >> ./conf/config.sh
|
||||
;;
|
||||
|
||||
* )
|
||||
echo "Unknown compiler $COMPILER"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
54
apps/ci/ci-pending-changelogs.ts
Normal file
54
apps/ci/ci-pending-changelogs.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import * as semver from "https://deno.land/x/semver/mod.ts";
|
||||
|
||||
// specify the needed paths here
|
||||
const CHANGELOG_PATH = "doc/changelog";
|
||||
const CHANGELOG_PENDING_PATH = `${CHANGELOG_PATH}/pendings`;
|
||||
const CHANGELOG_MASTER_FILE = `${CHANGELOG_PATH}/master.md`;
|
||||
const ACORE_JSON = "./acore.json";
|
||||
|
||||
// read the acore.json file to work with the versioning
|
||||
const decoder = new TextDecoder("utf-8");
|
||||
const data = await Deno.readFile(ACORE_JSON);
|
||||
const acoreInfo = JSON.parse(decoder.decode(data));
|
||||
|
||||
let changelogText = await Deno.readTextFile(CHANGELOG_MASTER_FILE);
|
||||
|
||||
const currentVersion = acoreInfo.version;
|
||||
|
||||
const res=Deno.run({ cmd: [ "git", "rev-parse",
|
||||
"HEAD"],
|
||||
stdout: 'piped',
|
||||
stderr: 'piped',
|
||||
stdin: 'null' });
|
||||
await res.status();
|
||||
const gitVersion = new TextDecoder().decode(await res.output());
|
||||
|
||||
|
||||
for await (const dirEntry of Deno.readDir(CHANGELOG_PENDING_PATH)) {
|
||||
if (!dirEntry.isFile || !dirEntry.name.endsWith(".md")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Upgrade the prerelease version number (e.g. 1.0.0-dev.1 -> 1.0.0-dev.2)
|
||||
acoreInfo.version = semver.inc(acoreInfo.version, "prerelease", {
|
||||
includePrerelease: true,
|
||||
});
|
||||
|
||||
// read the pending file found and add it at the beginning of the changelog text
|
||||
const data = await Deno.readTextFile(
|
||||
`${CHANGELOG_PENDING_PATH}/${dirEntry.name}`,
|
||||
);
|
||||
changelogText = `## ${acoreInfo.version} | Commit: [${gitVersion}](https://github.com/azerothcore/azerothcore-wotlk/commit/${gitVersion}\n\n${data}\n${changelogText}`;
|
||||
|
||||
// remove the pending file
|
||||
await Deno.remove(`${CHANGELOG_PENDING_PATH}/${dirEntry.name}`);
|
||||
}
|
||||
|
||||
// write to acore.json and master.md only if new version is available
|
||||
if (currentVersion != acoreInfo.version) {
|
||||
console.log(`Changelog version upgraded from ${currentVersion} to ${acoreInfo.version}`)
|
||||
Deno.writeTextFile(CHANGELOG_MASTER_FILE, changelogText);
|
||||
Deno.writeTextFile(ACORE_JSON, JSON.stringify(acoreInfo, null, 2)+"\n");
|
||||
} else {
|
||||
console.log("No changelogs to add")
|
||||
}
|
||||
74
apps/ci/ci-pending-sql.sh
Normal file
74
apps/ci/ci-pending-sql.sh
Normal file
@@ -0,0 +1,74 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CURRENT_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
source "$CURRENT_PATH/../bash_shared/includes.sh"
|
||||
|
||||
UPDATES_PATH="$AC_PATH_ROOT/data/sql/updates"
|
||||
|
||||
# get_next_index "data/sql/updates/db_world/2024_10_14_22.sql"
|
||||
# => 23
|
||||
# get_next_index ""
|
||||
# => 00
|
||||
function get_next_index() {
|
||||
if [[ -n "$1" ]]; then
|
||||
# PREV_COUNT should be a non-zero padded number
|
||||
PREV_COUNT="$(
|
||||
# grabs the filename of the first argument, removes ".sql" suffix.
|
||||
basename "$1" .sql |
|
||||
# get the last number
|
||||
cut -f4 -d_ |
|
||||
# retrieve the last number, without zero padding
|
||||
grep -oE "[1-9][0-9]*$"
|
||||
)"
|
||||
|
||||
printf '%02d' "$((PREV_COUNT + 1))"
|
||||
else
|
||||
echo "00"
|
||||
fi
|
||||
}
|
||||
|
||||
# lists all SQL files in the appropriate data/sql/updates/db_$1, and then moves them to a standard format, ordered by date and how many imports have happened that day. The name should be in this format:
|
||||
#
|
||||
# /path/to/data/sql/updates/db_NAME/YYYY_MM_DD_INDEX.sql
|
||||
#
|
||||
# Where INDEX is a number with a minimum with a minimum width (0-padded) of 2
|
||||
#
|
||||
# for example, "data/sql/updates/db_world/2024_10_01_03.sql" translates to "the third update in the world database from October 01, 2024"
|
||||
|
||||
TODAY="$(date +%Y_%m_%d)"
|
||||
function import() {
|
||||
PENDING_PATH="$AC_PATH_ROOT/data/sql/updates/pending_db_$1"
|
||||
UPDATES_DIR="$UPDATES_PATH/db_$1"
|
||||
|
||||
# Get the most recent SQL file applied to this database. Used for the header comment
|
||||
LATEST_UPDATE="$(find "$UPDATES_DIR" -iname "*.sql" | sort -h | tail -n 1)"
|
||||
# Get latest SQL file applied to this database, today. This could be empty.
|
||||
LATEST_UPDATE_TODAY="$(find "$UPDATES_DIR" -iname "$TODAY*.sql" | sort -h | tail -n 1)"
|
||||
|
||||
for entry in "$PENDING_PATH"/*.sql; do
|
||||
if [[ -f "$entry" ]]; then
|
||||
INDEX="$(get_next_index "$LATEST_UPDATE_TODAY")"
|
||||
OUTPUT_FILE="${UPDATES_DIR}/${TODAY}_${INDEX}.sql"
|
||||
|
||||
# ensure a note is added as a header comment
|
||||
echo "-- DB update $(basename "$LATEST_UPDATE" .sql) -> $(basename "$OUTPUT_FILE" .sql)" >"$OUTPUT_FILE"
|
||||
# fill in the SQL contents under that
|
||||
cat "$entry" >>"$OUTPUT_FILE"
|
||||
# remove the unneeded file
|
||||
rm -f "$entry"
|
||||
# set the newest file to the file we just moved
|
||||
LATEST_UPDATE_TODAY="$OUTPUT_FILE"
|
||||
LATEST_UPDATE="$OUTPUT_FILE"
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
import "world"
|
||||
import "characters"
|
||||
import "auth"
|
||||
|
||||
echo "Done."
|
||||
3
apps/ci/ci-run-unit-tests.sh
Normal file
3
apps/ci/ci-run-unit-tests.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
time var/build/obj/src/test/unit_tests
|
||||
43
apps/ci/mac/ci-compile.sh
Normal file
43
apps/ci/mac/ci-compile.sh
Normal file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)
|
||||
|
||||
export CCACHE_CPP2=true
|
||||
export CCACHE_MAXSIZE='500M'
|
||||
export CCACHE_COMPRESS=1
|
||||
export CCACHE_COMPRESSLEVEL=9
|
||||
ccache -s
|
||||
|
||||
cd var/build/obj
|
||||
|
||||
mysql_include_path=$(brew --prefix mysql)/include/mysql
|
||||
mysql_lib_path=$(brew --prefix mysql)/lib/libmysqlclient.dylib
|
||||
|
||||
if [ ! -d "$mysql_include_path" ]; then
|
||||
echo "Original mysql include directory doesn't exist. Lets try to use the first available folder in mysql dir."
|
||||
base_dir=$(brew --cellar mysql)/$(basename $(ls -d $(brew --cellar mysql)/*/ | head -n 1))
|
||||
echo "Trying the next mysql base dir: $base_dir"
|
||||
mysql_include_path=$base_dir/include/mysql
|
||||
mysql_lib_path=$base_dir/lib/libmysqlclient.dylib
|
||||
fi
|
||||
|
||||
time cmake ../../../ \
|
||||
-DTOOLS_BUILD=all \
|
||||
-DSCRIPTS=static \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DMYSQL_ADD_INCLUDE_PATH=$mysql_include_path \
|
||||
-DMYSQL_LIBRARY=$mysql_lib_path \
|
||||
-DREADLINE_INCLUDE_DIR=$(brew --prefix readline)/include \
|
||||
-DREADLINE_LIBRARY=$(brew --prefix readline)/lib/libreadline.dylib \
|
||||
-DOPENSSL_INCLUDE_DIR="$OPENSSL_ROOT_DIR/include" \
|
||||
-DOPENSSL_SSL_LIBRARIES="$OPENSSL_ROOT_DIR/lib/libssl.dylib" \
|
||||
-DOPENSSL_CRYPTO_LIBRARIES="$OPENSSL_ROOT_DIR/lib/libcrypto.dylib" \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DUSE_SCRIPTPCH=0 \
|
||||
-DUSE_COREPCH=0 \
|
||||
;
|
||||
|
||||
time make -j $(($(sysctl -n hw.ncpu ) + 2))
|
||||
|
||||
ccache -s
|
||||
263
apps/codestyle/codestyle-cpp.py
Normal file
263
apps/codestyle/codestyle-cpp.py
Normal file
@@ -0,0 +1,263 @@
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
# Get the src directory of the project
|
||||
src_directory = os.path.join(os.getcwd(), 'src')
|
||||
|
||||
# Global variables
|
||||
error_handler = False
|
||||
results = {
|
||||
"Multiple blank lines check": "Passed",
|
||||
"Trailing whitespace check": "Passed",
|
||||
"GetCounter() check": "Passed",
|
||||
"Misc codestyle check": "Passed",
|
||||
"GetTypeId() check": "Passed",
|
||||
"NpcFlagHelpers check": "Passed",
|
||||
"ItemFlagHelpers check": "Passed",
|
||||
"ItemTemplateFlagHelpers check": "Passed"
|
||||
}
|
||||
|
||||
# Main function to parse all the files of the project
|
||||
def parsing_file(directory: str) -> None:
|
||||
print("Starting AzerothCore CPP Codestyle check...")
|
||||
print(" ")
|
||||
print("Please read the C++ Code Standards for AzerothCore:")
|
||||
print("https://www.azerothcore.org/wiki/cpp-code-standards")
|
||||
print(" ")
|
||||
for root, _, files in os.walk(directory):
|
||||
for file in files:
|
||||
if not file.endswith('.ico'): # Skip .ico files that cannot be read
|
||||
file_path = os.path.join(root, file)
|
||||
file_name = file
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
multiple_blank_lines_check(file, file_path)
|
||||
trailing_whitespace_check(file, file_path)
|
||||
get_counter_check(file, file_path)
|
||||
if not file_name.endswith('.cmake') and file_name != 'CMakeLists.txt':
|
||||
misc_codestyle_check(file, file_path)
|
||||
if file_name != 'Object.h':
|
||||
get_typeid_check(file, file_path)
|
||||
if file_name != 'Unit.h':
|
||||
npcflags_helpers_check(file, file_path)
|
||||
if file_name != 'Item.h':
|
||||
itemflag_helpers_check(file, file_path)
|
||||
if file_name != 'ItemTemplate.h':
|
||||
itemtemplateflag_helpers_check(file, file_path)
|
||||
except UnicodeDecodeError:
|
||||
print(f"\nCould not decode file {file_path}")
|
||||
sys.exit(1)
|
||||
# Output the results
|
||||
print("")
|
||||
for check, result in results.items():
|
||||
print(f"{check} : {result}")
|
||||
if error_handler:
|
||||
print("\nPlease fix the codestyle issues above.")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print(f"\nEverything looks good")
|
||||
|
||||
# Codestyle patterns checking for multiple blank lines
|
||||
def multiple_blank_lines_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
check_failed = False
|
||||
consecutive_blank_lines = 0
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if line.strip() == '':
|
||||
consecutive_blank_lines += 1
|
||||
if consecutive_blank_lines > 1:
|
||||
print(f"Multiple blank lines found in {file_path} at line {line_number - 1}")
|
||||
check_failed = True
|
||||
else:
|
||||
consecutive_blank_lines = 0
|
||||
# Additional check for the end of the file
|
||||
if consecutive_blank_lines >= 1:
|
||||
print(f"Multiple blank lines found at the end of: {file_path}")
|
||||
check_failed = True
|
||||
# Handle the script error and update the result output
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["Multiple blank lines check"] = "Failed"
|
||||
|
||||
# Codestyle patterns checking for whitespace at the end of the lines
|
||||
def trailing_whitespace_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if line.endswith(' \n'):
|
||||
print(f"Trailing whitespace found: {file_path} at line {line_number}")
|
||||
if not error_handler:
|
||||
error_handler = True
|
||||
results["Trailing whitespace check"] = "Failed"
|
||||
|
||||
# Codestyle patterns checking for ObjectGuid::GetCounter()
|
||||
def get_counter_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if 'ObjectGuid::GetCounter()' in line:
|
||||
print(f"Please use ObjectGuid::ToString().c_str() instead ObjectGuid::GetCounter(): {file_path} at line {line_number}")
|
||||
if not error_handler:
|
||||
error_handler = True
|
||||
results["GetCounter() check"] = "Failed"
|
||||
|
||||
# Codestyle patterns checking for GetTypeId()
|
||||
def get_typeid_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
check_failed = False
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if 'GetTypeId() == TYPEID_ITEM' in line or 'GetTypeId() != TYPEID_ITEM' in line:
|
||||
print(f"Please use IsItem() instead of GetTypeId(): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'GetTypeId() == TYPEID_UNIT' in line or 'GetTypeId() != TYPEID_UNIT' in line:
|
||||
print(f"Please use IsCreature() instead of GetTypeId(): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'GetTypeId() == TYPEID_PLAYER' in line or 'GetTypeId() != TYPEID_PLAYER' in line:
|
||||
print(f"Please use IsPlayer() instead of GetTypeId(): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'GetTypeId() == TYPEID_GAMEOBJECT' in line or 'GetTypeId() != TYPEID_GAMEOBJECT' in line:
|
||||
print(f"Please use IsGameObject() instead of GetTypeId(): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'GetTypeId() == TYPEID_DYNOBJECT' in line or 'GetTypeId() != TYPEID_DYNOBJECT' in line:
|
||||
print(f"Please use IsDynamicObject() instead of GetTypeId(): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
# Handle the script error and update the result output
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["GetTypeId() check"] = "Failed"
|
||||
|
||||
# Codestyle patterns checking for NpcFlag helpers
|
||||
def npcflags_helpers_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
check_failed = False
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if 'GetUInt32Value(UNIT_NPC_FLAGS)' in line:
|
||||
print(
|
||||
f"Please use GetNpcFlags() instead of GetUInt32Value(UNIT_NPC_FLAGS): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'HasFlag(UNIT_NPC_FLAGS,' in line:
|
||||
print(
|
||||
f"Please use HasNpcFlag() instead of HasFlag(UNIT_NPC_FLAGS, ...): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'SetUInt32Value(UNIT_NPC_FLAGS,' in line:
|
||||
print(
|
||||
f"Please use ReplaceAllNpcFlags() instead of SetUInt32Value(UNIT_NPC_FLAGS, ...): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'SetFlag(UNIT_NPC_FLAGS,' in line:
|
||||
print(
|
||||
f"Please use SetNpcFlag() instead of SetFlag(UNIT_NPC_FLAGS, ...): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'RemoveFlag(UNIT_NPC_FLAGS,' in line:
|
||||
print(
|
||||
f"Please use RemoveNpcFlag() instead of RemoveFlag(UNIT_NPC_FLAGS, ...): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
# Handle the script error and update the result output
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["NpcFlagHelpers check"] = "Failed"
|
||||
|
||||
# Codestyle patterns checking for ItemFlag helpers
|
||||
def itemflag_helpers_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
check_failed = False
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if 'HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE)' in line:
|
||||
print(
|
||||
f"Please use IsRefundable() instead of HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_REFUNDABLE): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE)' in line:
|
||||
print(
|
||||
f"Please use IsBOPTradable() instead of HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED)' in line:
|
||||
print(
|
||||
f"Please use IsWrapped() instead of HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED): {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
# Handle the script error and update the result output
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["ItemFlagHelpers check"] = "Failed"
|
||||
|
||||
# Codestyle patterns checking for ItemTemplate helpers
|
||||
def itemtemplateflag_helpers_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
check_failed = False
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if 'Flags & ITEM_FLAG' in line:
|
||||
print(
|
||||
f"Please use HasFlag(ItemFlag) instead of 'Flags & ITEM_FLAG_': {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'Flags2 & ITEM_FLAG2' in line:
|
||||
print(
|
||||
f"Please use HasFlag2(ItemFlag2) instead of 'Flags2 & ITEM_FLAG2_': {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if 'FlagsCu & ITEM_FLAGS_CU' in line:
|
||||
print(
|
||||
f"Please use HasFlagCu(ItemFlagsCustom) instead of 'FlagsCu & ITEM_FLAGS_CU_': {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
# Handle the script error and update the result output
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["ItemTemplateFlagHelpers check"] = "Failed"
|
||||
|
||||
# Codestyle patterns checking for various codestyle issues
|
||||
def misc_codestyle_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
check_failed = False
|
||||
|
||||
# used to check for "if/else (...) {" "} else" ignores "if/else (...) {...}" "#define ... if/else (...) {"
|
||||
ifelse_curlyregex = r"^[^#define].*\s+(if|else)(\s*\(.*\))?\s*{[^}]*$|}\s*else(\s*{[^}]*$)"
|
||||
# used to catch double semicolons ";;" ignores "(;;)"
|
||||
double_semiregex = r"(?<!\()\s*;;(?!\))"
|
||||
# used to catch tabs
|
||||
tab_regex = r"\t"
|
||||
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if 'const auto&' in line:
|
||||
print(
|
||||
f"Please use the 'auto const&' syntax instead of 'const auto&': {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if re.search(r'\bconst\s+\w+\s*\*\b', line):
|
||||
print(
|
||||
f"Please use the 'Class/ObjectType const*' syntax instead of 'const Class/ObjectType*': {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if [match for match in [' if(', ' if ( '] if match in line]:
|
||||
print(
|
||||
f"Please use the 'if (XXXX)' syntax instead of 'if(XXXX)': {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if re.match(ifelse_curlyregex, line):
|
||||
print(
|
||||
f"Curly brackets are not allowed to be leading or trailing if/else statements. Place it on a new line: {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if re.search(double_semiregex, line):
|
||||
print(
|
||||
f"Double semicolon (;;) found in {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if re.match(tab_regex, line):
|
||||
print(
|
||||
f"Tab found! Replace it to 4 spaces: {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
|
||||
# Handle the script error and update the result output
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["Misc codestyle check"] = "Failed"
|
||||
|
||||
# Main function
|
||||
parsing_file(src_directory)
|
||||
330
apps/codestyle/codestyle-sql.py
Normal file
330
apps/codestyle/codestyle-sql.py
Normal file
@@ -0,0 +1,330 @@
|
||||
import io
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
import glob
|
||||
|
||||
# Get the pending directory of the project
|
||||
base_dir = os.getcwd()
|
||||
pattern = os.path.join(base_dir, 'data/sql/updates/pending_db_*')
|
||||
src_directory = glob.glob(pattern)
|
||||
|
||||
# Global variables
|
||||
error_handler = False
|
||||
results = {
|
||||
"Multiple blank lines check": "Passed",
|
||||
"Trailing whitespace check": "Passed",
|
||||
"SQL codestyle check": "Passed",
|
||||
"INSERT & DELETE safety usage check": "Passed",
|
||||
"Missing semicolon check": "Passed",
|
||||
"Backtick check": "Passed"
|
||||
}
|
||||
|
||||
# Collect all files in all directories
|
||||
def collect_files_from_directories(directories: list) -> list:
|
||||
all_files = []
|
||||
for directory in directories:
|
||||
for root, _, files in os.walk(directory):
|
||||
for file in files:
|
||||
if not file.endswith('.sh'): # Skip .sh files
|
||||
all_files.append(os.path.join(root, file))
|
||||
return all_files
|
||||
|
||||
# Main function to parse all the files of the project
|
||||
def parsing_file(files: list) -> None:
|
||||
print("Starting AzerothCore SQL Codestyle check...")
|
||||
print(" ")
|
||||
print("Please read the SQL Standards for AzerothCore:")
|
||||
print("https://www.azerothcore.org/wiki/sql-standards")
|
||||
print(" ")
|
||||
|
||||
# Iterate over all files
|
||||
for file_path in files:
|
||||
try:
|
||||
with open(file_path, 'r', encoding='utf-8') as file:
|
||||
multiple_blank_lines_check(file, file_path)
|
||||
trailing_whitespace_check(file, file_path)
|
||||
sql_check(file, file_path)
|
||||
insert_delete_safety_check(file, file_path)
|
||||
semicolon_check(file, file_path)
|
||||
backtick_check(file, file_path)
|
||||
except UnicodeDecodeError:
|
||||
print(f"\n❌ Could not decode file {file_path}")
|
||||
sys.exit(1)
|
||||
|
||||
# Output the results
|
||||
print("\n ")
|
||||
for check, result in results.items():
|
||||
print(f"{check} : {result}")
|
||||
if error_handler:
|
||||
print("\n ")
|
||||
print("\n❌ Please fix the codestyle issues above.")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("\n ")
|
||||
print(f"\n✅ Everything looks good")
|
||||
|
||||
# Codestyle patterns checking for multiple blank lines
|
||||
def multiple_blank_lines_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
check_failed = False
|
||||
consecutive_blank_lines = 0
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if line.strip() == '':
|
||||
consecutive_blank_lines += 1
|
||||
if consecutive_blank_lines > 1:
|
||||
print(f"❌ Multiple blank lines found in {file_path} at line {line_number - 1}")
|
||||
check_failed = True
|
||||
else:
|
||||
consecutive_blank_lines = 0
|
||||
# Additional check for the end of the file
|
||||
if consecutive_blank_lines >= 1:
|
||||
print(f"❌ Multiple blank lines found at the end of: {file_path}")
|
||||
check_failed = True
|
||||
# Handle the script error and update the result output
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["Multiple blank lines check"] = "Failed"
|
||||
|
||||
# Codestyle patterns checking for whitespace at the end of the lines
|
||||
def trailing_whitespace_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
check_failed = False
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if line.endswith(' \n'):
|
||||
print(f"❌ Trailing whitespace found: {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["Trailing whitespace check"] = "Failed"
|
||||
|
||||
# Codestyle patterns checking for various codestyle issues
|
||||
def sql_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
check_failed = False
|
||||
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if [match for match in ['broadcast_text'] if match in line]:
|
||||
print(
|
||||
f"❌ DON'T EDIT broadcast_text TABLE UNLESS YOU KNOW WHAT YOU ARE DOING!\nThis error can safely be ignored if the changes are approved to be sniffed: {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if "EntryOrGuid" in line:
|
||||
print(
|
||||
f"❌ Please use entryorguid syntax instead of EntryOrGuid in {file_path} at line {line_number}\nWe recommend to use keira to have the right syntax in auto-query generation")
|
||||
check_failed = True
|
||||
if [match for match in [';;'] if match in line]:
|
||||
print(
|
||||
f"❌ Double semicolon (;;) found in {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
if re.match(r"\t", line):
|
||||
print(
|
||||
f"❌ Tab found! Replace it to 4 spaces: {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
|
||||
last_line = line[-1].strip()
|
||||
if last_line:
|
||||
print(
|
||||
f"❌ The last line is not a newline. Please add a newline: {file_path}")
|
||||
check_failed = True
|
||||
|
||||
# Handle the script error and update the result output
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["SQL codestyle check"] = "Failed"
|
||||
|
||||
def insert_delete_safety_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0) # Reset file pointer to the beginning
|
||||
not_delete = ["creature_template", "gameobject_template", "item_template", "quest_template"]
|
||||
check_failed = False
|
||||
previous_line = ""
|
||||
|
||||
# Parse all the file
|
||||
for line_number, line in enumerate(file, start = 1):
|
||||
if line.startswith("--"):
|
||||
continue
|
||||
if "INSERT" in line and "DELETE" not in previous_line:
|
||||
print(f"❌ No DELETE keyword found before the INSERT in {file_path} at line {line_number}\nIf this error is intended, please notify a maintainer")
|
||||
check_failed = True
|
||||
previous_line = line
|
||||
match = re.match(r"DELETE FROM\s+`([^`]+)`", line, re.IGNORECASE)
|
||||
if match:
|
||||
table_name = match.group(1)
|
||||
if table_name in not_delete:
|
||||
print(
|
||||
f"❌ Entries from {table_name} should not be deleted! {file_path} at line {line_number}\nIf this error is intended, please notify a maintainer")
|
||||
check_failed = True
|
||||
|
||||
# Handle the script error and update the result output
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["INSERT & DELETE safety usage check"] = "Failed"
|
||||
|
||||
def semicolon_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
|
||||
file.seek(0) # Reset file pointer to the start
|
||||
check_failed = False
|
||||
|
||||
sql_statement_regex = re.compile(r'^\s*(SELECT|INSERT|UPDATE|DELETE|REPLACE|SET)\b', re.IGNORECASE)
|
||||
block_comment_start = re.compile(r'/\*')
|
||||
block_comment_end = re.compile(r'\*/')
|
||||
inline_comment = re.compile(r'--.*')
|
||||
|
||||
query_open = False
|
||||
in_block_comment = False
|
||||
inside_values_block = False
|
||||
|
||||
lines = file.readlines()
|
||||
total_lines = len(lines)
|
||||
|
||||
def get_next_non_blank_line(start):
|
||||
""" Get the next non-blank, non-comment line starting from `start` """
|
||||
for idx in range(start, total_lines):
|
||||
next_line = lines[idx].strip()
|
||||
if next_line and not next_line.startswith('--') and not next_line.startswith('/*'):
|
||||
return next_line
|
||||
return None
|
||||
|
||||
for line_number, line in enumerate(lines, start=1):
|
||||
stripped_line = line.strip()
|
||||
|
||||
# Skip single-line comments
|
||||
if stripped_line.startswith('--'):
|
||||
continue
|
||||
|
||||
# Handle block comments
|
||||
if in_block_comment:
|
||||
if '*/' in stripped_line:
|
||||
in_block_comment = False
|
||||
stripped_line = stripped_line.split('*/', 1)[1].strip()
|
||||
else:
|
||||
continue
|
||||
else:
|
||||
if '/*' in stripped_line:
|
||||
query_open = False # Reset query state at start of block comment
|
||||
in_block_comment = True
|
||||
stripped_line = stripped_line.split('/*', 1)[0].strip()
|
||||
|
||||
# Skip empty lines (unless inside values block)
|
||||
if not stripped_line and not inside_values_block:
|
||||
continue
|
||||
|
||||
# Remove inline comments after SQL
|
||||
stripped_line = stripped_line.split('--', 1)[0].strip()
|
||||
|
||||
if stripped_line.upper().startswith("SET") and not stripped_line.endswith(";"):
|
||||
print(f"❌ Missing semicolon in {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
|
||||
# Detect query start
|
||||
if not query_open and any(keyword in stripped_line.upper() for keyword in ["SELECT", "INSERT", "UPDATE", "DELETE", "REPLACE"]):
|
||||
query_open = True
|
||||
|
||||
# Detect start of multi-line VALUES block
|
||||
if any(kw in stripped_line.upper() for kw in ["INSERT", "REPLACE"]) and "VALUES" in stripped_line.upper():
|
||||
inside_values_block = True
|
||||
query_open = True # Ensure query is marked open too
|
||||
|
||||
if inside_values_block:
|
||||
if not stripped_line:
|
||||
continue # Allow blank lines inside VALUES block
|
||||
|
||||
if stripped_line.startswith('('):
|
||||
# Get next non-blank line to detect if we're at the last row
|
||||
next_line = get_next_non_blank_line(line_number)
|
||||
|
||||
if next_line and next_line.startswith('('):
|
||||
# Expect comma if another row follows
|
||||
if not stripped_line.endswith(','):
|
||||
print(f"❌ Missing comma in {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
else:
|
||||
# Expect semicolon if this is the final row
|
||||
if not stripped_line.endswith(';'):
|
||||
print(f"❌ Missing semicolon in {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
inside_values_block = False
|
||||
query_open = False
|
||||
else:
|
||||
inside_values_block = False # Close block if semicolon was found
|
||||
|
||||
elif query_open and not inside_values_block:
|
||||
# Normal query handling (outside multi-row VALUES block)
|
||||
if line_number == total_lines and not stripped_line.endswith(';'):
|
||||
print(f"❌ Missing semicolon in {file_path} at the last line {line_number}")
|
||||
check_failed = True
|
||||
query_open = False
|
||||
elif stripped_line.endswith(';'):
|
||||
query_open = False
|
||||
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["Missing semicolon check"] = "Failed"
|
||||
|
||||
def backtick_check(file: io, file_path: str) -> None:
|
||||
global error_handler, results
|
||||
file.seek(0)
|
||||
check_failed = False
|
||||
|
||||
# Find SQL clauses
|
||||
pattern = re.compile(
|
||||
r'\b(SELECT|FROM|JOIN|WHERE|GROUP BY|ORDER BY|DELETE FROM|UPDATE|INSERT INTO|SET|REPLACE|REPLACE INTO)\s+(.*?)(?=;$|(?=\b(?:WHERE|SET|VALUES)\b)|$)',
|
||||
re.IGNORECASE | re.DOTALL
|
||||
)
|
||||
|
||||
# Make sure to ignore values enclosed in single- and doublequotes
|
||||
quote_pattern = re.compile(r"'(?:\\'|[^'])*'|\"(?:\\\"|[^\"])*\"")
|
||||
|
||||
for line_number, line in enumerate(file, start=1):
|
||||
# Ignore comments
|
||||
if line.startswith('--'):
|
||||
continue
|
||||
|
||||
# Sanitize single- and doublequotes to prevent false positives
|
||||
sanitized_line = quote_pattern.sub('', line)
|
||||
matches = pattern.findall(sanitized_line)
|
||||
|
||||
for clause, content in matches:
|
||||
# Find all words and exclude @variables
|
||||
words = re.findall(r'\b(?<!@)([a-zA-Z_][a-zA-Z0-9_]*)\b', content)
|
||||
|
||||
for word in words:
|
||||
# Skip MySQL keywords
|
||||
if word.upper() in {"SELECT", "FROM", "JOIN", "WHERE", "GROUP", "BY", "ORDER",
|
||||
"DELETE", "UPDATE", "INSERT", "INTO", "SET", "VALUES", "AND",
|
||||
"IN", "OR", "REPLACE", "NOT", "BETWEEN",
|
||||
"DISTINCT", "HAVING", "LIMIT", "OFFSET", "AS", "ON", "INNER",
|
||||
"LEFT", "RIGHT", "FULL", "OUTER", "CROSS", "NATURAL",
|
||||
"EXISTS", "LIKE", "IS", "NULL", "UNION", "ALL", "ASC", "DESC",
|
||||
"CASE", "WHEN", "THEN", "ELSE", "END", "CREATE", "TABLE",
|
||||
"ALTER", "DROP", "DATABASE", "INDEX", "VIEW", "TRIGGER",
|
||||
"PROCEDURE", "FUNCTION", "PRIMARY", "KEY", "FOREIGN", "REFERENCES",
|
||||
"CONSTRAINT", "DEFAULT", "AUTO_INCREMENT", "UNIQUE", "CHECK",
|
||||
"SHOW", "DESCRIBE", "EXPLAIN", "USE", "GRANT", "REVOKE",
|
||||
"BEGIN", "COMMIT", "ROLLBACK", "SAVEPOINT", "LOCK", "UNLOCK",
|
||||
"WITH", "RECURSIVE", "COLUMN", "ENGINE", "CHARSET", "COLLATE",
|
||||
"IF", "ELSEIF", "LOOP", "WHILE", "DO", "HANDLER", "LEAVE",
|
||||
"ITERATE", "DECLARE", "CURSOR", "FETCH", "OPEN", "CLOSE"}:
|
||||
continue
|
||||
|
||||
# Make sure the word is enclosed in backticks
|
||||
if not re.search(rf'`{re.escape(word)}`', content):
|
||||
print(f"❌ Missing backticks around ({word}). {file_path} at line {line_number}")
|
||||
check_failed = True
|
||||
|
||||
if check_failed:
|
||||
error_handler = True
|
||||
results["Backtick check"] = "Failed"
|
||||
|
||||
# Collect all files from matching directories
|
||||
all_files = collect_files_from_directories(src_directory)
|
||||
|
||||
# Main function
|
||||
parsing_file(all_files)
|
||||
2
apps/compiler/.gitignore
vendored
Normal file
2
apps/compiler/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
config.sh
|
||||
|
||||
32
apps/compiler/README.md
Normal file
32
apps/compiler/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
## How to compile:
|
||||
|
||||
first of all, if you need some custom configuration you have to copy
|
||||
/conf/dist/config.sh in /conf/config.sh and configure it
|
||||
|
||||
* for a "clean" compilation you must run all scripts in their order:
|
||||
|
||||
./1-clean.sh
|
||||
./2-configure.sh
|
||||
./3-build.sh
|
||||
|
||||
* if you add/rename/delete some sources and you need to compile it you have to run:
|
||||
|
||||
./2-configure.sh
|
||||
./3-build.sh
|
||||
|
||||
* if you have modified code only, you just need to run
|
||||
|
||||
./3-build.sh
|
||||
|
||||
|
||||
## compiler.sh
|
||||
|
||||
compiler.sh script contains an interactive menu to clean/compile/build. You can also run actions directly by command lines specifying the option.
|
||||
Ex:
|
||||
./compiler.sh 3
|
||||
|
||||
It will start the build process (it's equivalent to ./3-build.sh)
|
||||
|
||||
## Note:
|
||||
|
||||
For an optimal development process and **really faster** compilation time, is suggested to use clang instead of gcc
|
||||
76
apps/compiler/compiler.sh
Normal file
76
apps/compiler/compiler.sh
Normal file
@@ -0,0 +1,76 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_PATH/includes/includes.sh"
|
||||
|
||||
function run_option() {
|
||||
re='^[0-9]+$'
|
||||
if [[ $1 =~ $re ]] && test "${comp_functions[$1-1]+'test'}"; then
|
||||
${comp_functions[$1-1]}
|
||||
elif [ -n "$(type -t comp_$1)" ] && [ "$(type -t comp_$1)" = function ]; then
|
||||
fun="comp_$1"
|
||||
$fun
|
||||
else
|
||||
echo "invalid option, use --help option for the commands list"
|
||||
fi
|
||||
}
|
||||
|
||||
function comp_quit() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
comp_options=(
|
||||
"build: Configure and compile"
|
||||
"clean: Clean build files"
|
||||
"configure: Run CMake"
|
||||
"compile: Compile only"
|
||||
"all: clean, configure and compile"
|
||||
"ccacheClean: Clean ccache files, normally not needed"
|
||||
"ccacheShowStats: show ccache statistics"
|
||||
"quit: Close this menu")
|
||||
comp_functions=(
|
||||
"comp_build"
|
||||
"comp_clean"
|
||||
"comp_configure"
|
||||
"comp_compile"
|
||||
"comp_all"
|
||||
"comp_ccacheClean"
|
||||
"comp_ccacheShowStats"
|
||||
"comp_quit")
|
||||
|
||||
PS3='[ Please enter your choice ]: '
|
||||
|
||||
runHooks "ON_AFTER_OPTIONS" #you can create your custom options
|
||||
|
||||
function _switch() {
|
||||
_reply="$1"
|
||||
_opt="$2"
|
||||
|
||||
case $_reply in
|
||||
""|"--help")
|
||||
echo "Available commands:"
|
||||
printf '%s\n' "${options[@]}"
|
||||
;;
|
||||
*)
|
||||
run_option $_reply $_opt
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
while true
|
||||
do
|
||||
# run option directly if specified in argument
|
||||
[ ! -z $1 ] && _switch $@
|
||||
[ ! -z $1 ] && exit 0
|
||||
|
||||
select opt in "${comp_options[@]}"
|
||||
do
|
||||
echo "==== ACORE COMPILER ===="
|
||||
_switch $REPLY
|
||||
break;
|
||||
done
|
||||
done
|
||||
7
apps/compiler/includes/defines.sh
Normal file
7
apps/compiler/includes/defines.sh
Normal file
@@ -0,0 +1,7 @@
|
||||
# you can choose build type from cmd argument
|
||||
if [ ! -z $1 ]
|
||||
then
|
||||
CCTYPE=$1
|
||||
CCTYPE=${CCTYPE^} # capitalize first letter if it's not yet
|
||||
fi
|
||||
|
||||
170
apps/compiler/includes/functions.sh
Normal file
170
apps/compiler/includes/functions.sh
Normal file
@@ -0,0 +1,170 @@
|
||||
|
||||
function comp_clean() {
|
||||
DIRTOCLEAN=${BUILDPATH:-var/build/obj}
|
||||
PATTERN="$DIRTOCLEAN/*"
|
||||
|
||||
echo "Cleaning build files in $DIRTOCLEAN"
|
||||
|
||||
[ -d "$DIRTOCLEAN" ] && rm -rf $PATTERN
|
||||
}
|
||||
|
||||
function comp_ccacheEnable() {
|
||||
[ "$AC_CCACHE" != true ] && return
|
||||
|
||||
export CCACHE_MAXSIZE=${CCACHE_MAXSIZE:-'1000MB'}
|
||||
#export CCACHE_DEPEND=true
|
||||
export CCACHE_SLOPPINESS=${CCACHE_SLOPPINESS:-pch_defines,time_macros,include_file_mtime}
|
||||
export CCACHE_CPP2=${CCACHE_CPP2:-true} # optimization for clang
|
||||
export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1}
|
||||
export CCACHE_COMPRESSLEVEL=${CCACHE_COMPRESSLEVEL:-9}
|
||||
export CCACHE_COMPILERCHECK=${CCACHE_COMPILERCHECK:-content}
|
||||
export CCACHE_LOGFILE=${CCACHE_LOGFILE:-"$CCACHE_DIR/cache.debug"}
|
||||
#export CCACHE_NODIRECT=true
|
||||
|
||||
export CCUSTOMOPTIONS="$CCUSTOMOPTIONS -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||
}
|
||||
|
||||
function comp_ccacheClean() {
|
||||
[ "$AC_CCACHE" != true ] && echo "ccache is disabled" && return
|
||||
|
||||
echo "Cleaning ccache"
|
||||
ccache -C
|
||||
ccache -s
|
||||
}
|
||||
|
||||
function comp_ccacheResetStats() {
|
||||
[ "$AC_CCACHE" != true ] && return
|
||||
|
||||
ccache -zc
|
||||
}
|
||||
|
||||
function comp_ccacheShowStats() {
|
||||
[ "$AC_CCACHE" != true ] && return
|
||||
|
||||
ccache -s
|
||||
}
|
||||
|
||||
function comp_configure() {
|
||||
CWD=$(pwd)
|
||||
|
||||
cd $BUILDPATH
|
||||
|
||||
echo "Build path: $BUILDPATH"
|
||||
echo "DEBUG info: $CDEBUG"
|
||||
echo "Compilation type: $CTYPE"
|
||||
echo "CCache: $AC_CCACHE"
|
||||
# -DCMAKE_BUILD_TYPE=$CCTYPE disable optimization "slow and huge amount of ram"
|
||||
# -DWITH_COREDEBUG=$CDEBUG compiled with debug information
|
||||
|
||||
#-DSCRIPTS_COMMANDS=$CSCRIPTS -DSCRIPTS_CUSTOM=$CSCRIPTS -DSCRIPTS_EASTERNKINGDOMS=$CSCRIPTS -DSCRIPTS_EVENTS=$CSCRIPTS -DSCRIPTS_KALIMDOR=$CSCRIPTS \
|
||||
#-DSCRIPTS_NORTHREND=$CSCRIPTS -DSCRIPTS_OUTDOORPVP=$CSCRIPTS -DSCRIPTS_OUTLAND=$CSCRIPTS -DSCRIPTS_PET=$CSCRIPTS -DSCRIPTS_SPELLS=$CSCRIPTS -DSCRIPTS_WORLD=$CSCRIPTS \
|
||||
#-DAC_WITH_UNIT_TEST=$CAC_UNIT_TEST -DAC_WITH_PLUGINS=$CAC_PLG \
|
||||
|
||||
local DCONF=""
|
||||
if [ ! -z "$CONFDIR" ]; then
|
||||
DCONF="-DCONF_DIR=$CONFDIR"
|
||||
fi
|
||||
|
||||
comp_ccacheEnable
|
||||
|
||||
OSOPTIONS=""
|
||||
|
||||
|
||||
echo "Platform: $OSTYPE"
|
||||
case "$OSTYPE" in
|
||||
darwin*)
|
||||
OSOPTIONS=" -DMYSQL_ADD_INCLUDE_PATH=/usr/local/include -DMYSQL_LIBRARY=/usr/local/lib/libmysqlclient.dylib -DREADLINE_INCLUDE_DIR=/usr/local/opt/readline/include -DREADLINE_LIBRARY=/usr/local/opt/readline/lib/libreadline.dylib -DOPENSSL_INCLUDE_DIR=/usr/local/opt/openssl@3/include -DOPENSSL_SSL_LIBRARIES=/usr/local/opt/openssl@3/lib/libssl.dylib -DOPENSSL_CRYPTO_LIBRARIES=/usr/local/opt/openssl@3/lib/libcrypto.dylib "
|
||||
;;
|
||||
msys*)
|
||||
OSOPTIONS=" -DMYSQL_INCLUDE_DIR=C:\tools\mysql\current\include -DMYSQL_LIBRARY=C:\tools\mysql\current\lib\mysqlclient.lib "
|
||||
;;
|
||||
esac
|
||||
|
||||
cmake $SRCPATH -DCMAKE_INSTALL_PREFIX=$BINPATH $DCONF \
|
||||
-DAPPS_BUILD=$CAPPS_BUILD \
|
||||
-DTOOLS_BUILD=$CTOOLS_BUILD \
|
||||
-DSCRIPTS=$CSCRIPTS \
|
||||
-DMODULES=$CMODULES \
|
||||
-DBUILD_TESTING=$CBUILD_TESTING \
|
||||
-DUSE_SCRIPTPCH=$CSCRIPTPCH \
|
||||
-DUSE_COREPCH=$CCOREPCH \
|
||||
-DCMAKE_BUILD_TYPE=$CTYPE \
|
||||
-DWITH_WARNINGS=$CWARNINGS \
|
||||
-DCMAKE_C_COMPILER=$CCOMPILERC \
|
||||
-DCMAKE_CXX_COMPILER=$CCOMPILERCXX \
|
||||
$CBUILD_APPS_LIST $CBUILD_TOOLS_LIST $OSOPTIONS $CCUSTOMOPTIONS
|
||||
|
||||
cd $CWD
|
||||
|
||||
runHooks "ON_AFTER_CONFIG"
|
||||
}
|
||||
|
||||
function comp_compile() {
|
||||
[ $MTHREADS == 0 ] && MTHREADS=$(grep -c ^processor /proc/cpuinfo) && MTHREADS=$(($MTHREADS + 2))
|
||||
|
||||
echo "Using $MTHREADS threads"
|
||||
|
||||
pushd "$BUILDPATH" >> /dev/null || exit 1
|
||||
|
||||
comp_ccacheEnable
|
||||
|
||||
comp_ccacheResetStats
|
||||
|
||||
time cmake --build . --config $CTYPE -j $MTHREADS
|
||||
|
||||
comp_ccacheShowStats
|
||||
|
||||
echo "Platform: $OSTYPE"
|
||||
case "$OSTYPE" in
|
||||
msys*)
|
||||
cmake --install . --config $CTYPE
|
||||
|
||||
popd >> /dev/null || exit 1
|
||||
|
||||
echo "Done"
|
||||
;;
|
||||
linux*|darwin*)
|
||||
local confDir=${CONFDIR:-"$AC_BINPATH_FULL/../etc"}
|
||||
|
||||
# create the folders before installing to
|
||||
# set the current user and permissions
|
||||
echo "Creating $AC_BINPATH_FULL..."
|
||||
mkdir -p "$AC_BINPATH_FULL"
|
||||
echo "Creating $confDir..."
|
||||
mkdir -p "$confDir"
|
||||
|
||||
echo "Cmake install..."
|
||||
sudo cmake --install . --config $CTYPE
|
||||
|
||||
popd >> /dev/null || exit 1
|
||||
|
||||
# set all aplications SUID bit
|
||||
echo "Setting permissions on binary files"
|
||||
find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec sudo chown root:root -- {} +
|
||||
find "$AC_BINPATH_FULL" -mindepth 1 -maxdepth 1 -type f -exec sudo chmod u+s -- {} +
|
||||
|
||||
if [[ -n "$DOCKER" ]]; then
|
||||
[[ -f "$confDir/worldserver.conf.dist" ]] && \
|
||||
cp -nv "$confDir/worldserver.conf.dist" "$confDir/worldserver.conf"
|
||||
[[ -f "$confDir/authserver.conf.dist" ]] && \
|
||||
cp -nv "$confDir/authserver.conf.dist" "$confDir/authserver.conf"
|
||||
[[ -f "$confDir/dbimport.conf.dist" ]] && \
|
||||
cp -nv "$confDir/dbimport.conf.dist" "$confDir/dbimport.conf"
|
||||
fi
|
||||
|
||||
echo "Done"
|
||||
;;
|
||||
esac
|
||||
|
||||
runHooks "ON_AFTER_BUILD"
|
||||
}
|
||||
|
||||
function comp_build() {
|
||||
comp_configure
|
||||
comp_compile
|
||||
}
|
||||
|
||||
function comp_all() {
|
||||
comp_clean
|
||||
comp_build
|
||||
}
|
||||
23
apps/compiler/includes/includes.sh
Normal file
23
apps/compiler/includes/includes.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_PATH/../../bash_shared/includes.sh"
|
||||
|
||||
AC_PATH_COMPILER="$AC_PATH_APPS/compiler"
|
||||
|
||||
if [ -f "$AC_PATH_COMPILER/config.sh" ]; then
|
||||
source "$AC_PATH_COMPILER/config.sh" # should overwrite previous
|
||||
fi
|
||||
|
||||
function ac_on_after_build() {
|
||||
# move the run engine
|
||||
cp -rvf "$AC_PATH_APPS/startup-scripts/"* "$BINPATH"
|
||||
}
|
||||
|
||||
registerHooks "ON_AFTER_BUILD" ac_on_after_build
|
||||
|
||||
source "$AC_PATH_COMPILER/includes/defines.sh"
|
||||
|
||||
source "$AC_PATH_COMPILER/includes/functions.sh"
|
||||
|
||||
mkdir -p $BUILDPATH
|
||||
mkdir -p $BINPATH
|
||||
22
apps/config-merger/README.md
Normal file
22
apps/config-merger/README.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# ==== PHP merger (index.php + merge.php) ====
|
||||
|
||||
This is a PHP script for merging a new .dist file with your existing .conf file (worldserver.conf.dist and authserver.conf.dist)
|
||||
|
||||
It uses sessions so it is multi user safe, it adds any options that are removed to the bottom of the file commented out, just in case it removes something it shouldn't.
|
||||
If you add your custom patch configs below "# Custom" they will be copied exactly as they are.
|
||||
|
||||
Your new config will be found under $basedir/session_id/newconfig.conf.merge
|
||||
|
||||
If you do not run a PHP server on your machiene you can read this guide on ["How to execute PHP code using command line?"](https://www.geeksforgeeks.org/how-to-execute-php-code-using-command-line/) on geeksforgeeks.org.
|
||||
|
||||
```
|
||||
php -S localhost:port -t E:\Azerothcore-wotlk\apps\config-merger\
|
||||
```
|
||||
|
||||
Change port to an available port to use. i.e 8000
|
||||
|
||||
Then go to your browser and type:
|
||||
|
||||
```
|
||||
localhost:8000/index.php
|
||||
```
|
||||
44
apps/config-merger/index.php
Normal file
44
apps/config-merger/index.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/*
|
||||
* Project Name: Config File Merge For Mangos/Trinity/AzerothCore Server
|
||||
* Date: 01.01.2010 inital version (0.0.1a)
|
||||
* Author: Paradox
|
||||
* Copyright: Paradox
|
||||
* Email: iamparadox@netscape.net (paypal email)
|
||||
* License: GNU General Public License v2(GPL)
|
||||
*/
|
||||
?>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
|
||||
<FORM enctype="multipart/form-data" ACTION="merge.php" METHOD="POST">
|
||||
Dist File (.conf.dist)
|
||||
<br />
|
||||
<INPUT name="File1" TYPE="file">
|
||||
<br />
|
||||
<br />
|
||||
Current Conf File (.conf)
|
||||
<br />
|
||||
<INPUT name="File2" TYPE="file">
|
||||
<br />
|
||||
<br />
|
||||
<INPUT TYPE=RADIO NAME="eol" VALUE="0" CHECKED >Windows -
|
||||
<INPUT TYPE=RADIO NAME="eol" VALUE="1" >UNIX/Linux
|
||||
<br />
|
||||
<br />
|
||||
<INPUT TYPE="submit" VALUE="Submit">
|
||||
<br />
|
||||
<br />
|
||||
If you have any custom settings, such as from patches,
|
||||
<br />
|
||||
make sure they are at the bottom of the file following
|
||||
<br />
|
||||
this block (add it if it's not there)
|
||||
<br />
|
||||
###############################################################################
|
||||
<br />
|
||||
# Custom
|
||||
<br />
|
||||
###############################################################################
|
||||
<br />
|
||||
<br />
|
||||
|
||||
</FORM>
|
||||
179
apps/config-merger/merge.php
Normal file
179
apps/config-merger/merge.php
Normal file
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
/*
|
||||
* Project Name: Config File Merge For Mangos/Trinity Server
|
||||
* Date: 01.01.2010 inital version (0.0.1a)
|
||||
* Author: Paradox
|
||||
* Copyright: Paradox
|
||||
* Email: iamparadox@netscape.net (paypal email)
|
||||
* License: GNU General Public License v2(GPL)
|
||||
*/
|
||||
|
||||
error_reporting(0);
|
||||
|
||||
if (!empty($_FILES['File1']) && !empty($_FILES['File2']))
|
||||
{
|
||||
session_id();
|
||||
session_start();
|
||||
$basedir = "merge";
|
||||
$eol = "\r\n";
|
||||
if ($_POST['eol'])
|
||||
$eol = "\n";
|
||||
else
|
||||
$eol = "\r\n";
|
||||
if (!file_exists($basedir))
|
||||
mkdir($basedir);
|
||||
if (!file_exists($basedir."/".session_id()))
|
||||
mkdir($basedir."/".session_id());
|
||||
$upload1 = $basedir."/".session_id()."/".basename($_FILES['File1']['name']);
|
||||
$upload2 = $basedir."/".session_id()."/".basename($_FILES['File2']['name']);
|
||||
|
||||
if (strpos($upload1, "worldserver") !== false)
|
||||
$newconfig = $basedir."/".session_id()."/worldserver.conf.merge";
|
||||
else if (strpos($upload1, "authserver") !== false)
|
||||
$newconfig = $basedir."/".session_id()."/authserver.conf.merge";
|
||||
else
|
||||
$newconfig = $basedir."/".session_id()."/UnkownConfigFile.conf.merge";
|
||||
|
||||
$out_file = fopen($newconfig, "w");
|
||||
$success = false;
|
||||
if (move_uploaded_file($_FILES['File1']['tmp_name'], $upload1))
|
||||
{
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$success = false;
|
||||
}
|
||||
if (move_uploaded_file($_FILES['File2']['tmp_name'], $upload2))
|
||||
{
|
||||
$success = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$success = false;
|
||||
}
|
||||
|
||||
if ($success)
|
||||
{
|
||||
$custom_found = false;
|
||||
$in_file1 = fopen($upload1,"r");
|
||||
$in_file2 = fopen($upload2,"r");
|
||||
$array1 = array();
|
||||
$array2 = array();
|
||||
$line = trim(fgets($in_file1));
|
||||
while (!feof($in_file1))
|
||||
{
|
||||
if ((substr($line,0,1) != '#' && substr($line,0,1) != ''))
|
||||
{
|
||||
list($key, $val) = explode("=",$line);
|
||||
$key = trim($key);
|
||||
$val = trim($val);
|
||||
$array1[$key] = $val;
|
||||
}
|
||||
$line = trim(fgets($in_file1));
|
||||
}
|
||||
$line = trim(fgets($in_file2));
|
||||
while (!feof($in_file2) && !$custom_found)
|
||||
{
|
||||
if (substr($line,0,1) != '#' && substr($line,0,1) != '')
|
||||
{
|
||||
list($key, $val) = explode("=",$line);
|
||||
$key = trim($key);
|
||||
$val = trim($val);
|
||||
$array2[$key] = $val;
|
||||
}
|
||||
if (strtolower($line) == "# custom")
|
||||
$custom_found = true;
|
||||
else
|
||||
$line = trim(fgets($in_file2));
|
||||
}
|
||||
fclose($in_file1);
|
||||
foreach($array2 as $k => $v)
|
||||
{
|
||||
if (array_key_exists($k, $array1))
|
||||
{
|
||||
$array1[$k] = $v;
|
||||
unset($array2[$k]);
|
||||
}
|
||||
}
|
||||
$in_file1 = fopen($upload1,"r");
|
||||
$line = trim(fgets($in_file1));
|
||||
while (!feof($in_file1))
|
||||
{
|
||||
if (substr($line,0,1) != '#' && substr($line,0,1) != '')
|
||||
{
|
||||
$array = array();
|
||||
while (substr($line,0,1) != '#' && substr($line,0,1) != '')
|
||||
{
|
||||
list($key, $val) = explode("=",$line);
|
||||
$key = trim($key);
|
||||
$val = trim($val);
|
||||
$array[$key] = $val;
|
||||
$line = trim(fgets($in_file1));
|
||||
}
|
||||
foreach($array as $k => $v)
|
||||
{
|
||||
if (array_key_exists($k, $array1))
|
||||
fwrite($out_file, $k."=".$array1[$k].$eol);
|
||||
else
|
||||
continue;
|
||||
}
|
||||
unset($array);
|
||||
if (!feof($in_file1))
|
||||
fwrite($out_file, $line.$eol);
|
||||
}
|
||||
else
|
||||
fwrite($out_file, $line.$eol);
|
||||
$line = trim(fgets($in_file1));
|
||||
}
|
||||
if ($custom_found)
|
||||
{
|
||||
fwrite($out_file, $eol);
|
||||
fwrite($out_file, "###############################################################################".$eol);
|
||||
fwrite($out_file, "# Custom".$eol);
|
||||
$line = trim(fgets($in_file2));
|
||||
while (!feof($in_file2))
|
||||
{
|
||||
fwrite($out_file, $line.$eol);
|
||||
$line = trim(fgets($in_file2));
|
||||
}
|
||||
}
|
||||
$first = true;
|
||||
foreach($array2 as $k => $v)
|
||||
{
|
||||
if ($first)
|
||||
{
|
||||
fwrite($out_file, $eol);
|
||||
fwrite($out_file, "###############################################################################".$eol);
|
||||
fwrite($out_file, "# The Following values were removed from the config.".$eol);
|
||||
$first = false;
|
||||
}
|
||||
fwrite($out_file, "# ".$k."=".$v.$eol);
|
||||
}
|
||||
|
||||
if (strpos($upload1, "worldserver") !== false)
|
||||
{
|
||||
file_put_contents($newconfig, str_replace("]=","]",file_get_contents($newconfig)));
|
||||
}
|
||||
else if (strpos($upload1, "authserver") !== false)
|
||||
{
|
||||
file_put_contents($newconfig, str_replace("]=","]",file_get_contents($newconfig)));
|
||||
}
|
||||
|
||||
unset($array1);
|
||||
unset($array2);
|
||||
fclose($in_file1);
|
||||
fclose($in_file2);
|
||||
fclose($out_file);
|
||||
unlink($upload1);
|
||||
unlink($upload2);
|
||||
|
||||
echo "Process done";
|
||||
echo "<br /><a href=".$newconfig.">Click here to retrieve your merged conf</a>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "An error has occurred";
|
||||
}
|
||||
?>
|
||||
1
apps/db_exporter/.gitignore
vendored
Normal file
1
apps/db_exporter/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
config.sh
|
||||
12
apps/db_exporter/README.md
Normal file
12
apps/db_exporter/README.md
Normal file
@@ -0,0 +1,12 @@
|
||||
This script is used by devs to export the databases to base directories
|
||||
|
||||
You should use it on clean databases
|
||||
|
||||
## USAGE
|
||||
|
||||
NOTE: this script is only working under unix currently
|
||||
|
||||
1) You must create a config.sh file changing DB connection configurations
|
||||
of /conf/config.sh.dist
|
||||
|
||||
2) Run the db_export.sh script and wait
|
||||
52
apps/db_exporter/db_export.sh
Normal file
52
apps/db_exporter/db_export.sh
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
ROOTPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../../" && pwd )"
|
||||
|
||||
source "$ROOTPATH/apps/bash_shared/includes.sh"
|
||||
|
||||
if [ -f "./config.sh" ]; then
|
||||
source "./config.sh" # should overwrite previous
|
||||
fi
|
||||
|
||||
echo "This is a dev-only procedure to export the DB into the SQL base files. All base files will be overwritten."
|
||||
read -p "Are you sure you want to continue (y/N)? " choice
|
||||
case "$choice" in
|
||||
y|Y ) echo "Exporting the DB into the SQL base files...";;
|
||||
* ) return;;
|
||||
esac
|
||||
|
||||
echo "===== STARTING PROCESS ====="
|
||||
|
||||
|
||||
function export() {
|
||||
echo "Working on: "$1
|
||||
database=$1
|
||||
|
||||
var_base_path="DB_"$database"_PATHS"
|
||||
base_path=${!var_base_path%/}
|
||||
|
||||
base_conf="TPATH="$base_path";\
|
||||
CLEANFOLDER=1; \
|
||||
CHMODE=0; \
|
||||
TEXTDUMPS=0; \
|
||||
PARSEDUMP=1; \
|
||||
FULL=0; \
|
||||
DUMPOPTS='--skip-comments --skip-set-charset --routines --extended-insert --order-by-primary --single-transaction --quick'; \
|
||||
"
|
||||
|
||||
var_base_conf="DB_"$database"_CONF"
|
||||
base_conf=$base_conf${!var_base_conf}
|
||||
|
||||
var_base_name="DB_"$database"_NAME"
|
||||
base_name=${!var_base_name}
|
||||
|
||||
|
||||
bash "$AC_PATH_DEPS/acore/mysql-tools/mysql-tools" "dump" "" "$base_name" "" "$base_conf"
|
||||
}
|
||||
|
||||
for db in ${DATABASES[@]}
|
||||
do
|
||||
export "$db"
|
||||
done
|
||||
|
||||
echo "===== DONE ====="
|
||||
259
apps/docker/Dockerfile
Normal file
259
apps/docker/Dockerfile
Normal file
@@ -0,0 +1,259 @@
|
||||
ARG UBUNTU_VERSION=22.04 # lts
|
||||
ARG TZ=Etc/UTC
|
||||
|
||||
# This target lays out the general directory skeleton for AzerothCore,
|
||||
# This target isn't intended to be directly used
|
||||
FROM ubuntu:$UBUNTU_VERSION AS skeleton
|
||||
|
||||
ARG DOCKER=1
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
ENV AC_FORCE_CREATE_DB=1
|
||||
|
||||
RUN mkdir -pv \
|
||||
/azerothcore/bin \
|
||||
/azerothcore/data \
|
||||
/azerothcore/deps \
|
||||
/azerothcore/env/dist/bin \
|
||||
/azerothcore/env/dist/data/Cameras \
|
||||
/azerothcore/env/dist/data/dbc \
|
||||
/azerothcore/env/dist/data/maps \
|
||||
/azerothcore/env/dist/data/mmaps \
|
||||
/azerothcore/env/dist/data/vmaps \
|
||||
/azerothcore/env/dist/logs \
|
||||
/azerothcore/env/dist/temp \
|
||||
/azerothcore/env/dist/etc \
|
||||
/azerothcore/modules \
|
||||
/azerothcore/src \
|
||||
/azerothcore/build
|
||||
|
||||
# Configure Timezone
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends tzdata ca-certificates \
|
||||
&& ln -snf "/usr/share/zoneinfo/$TZ" /etc/localtime \
|
||||
&& echo "$TZ" > /etc/timezone \
|
||||
&& dpkg-reconfigure --frontend noninteractive tzdata \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /azerothcore
|
||||
|
||||
# This target builds the docker image
|
||||
# This target can be useful to inspect the explicit outputs from the build,
|
||||
FROM skeleton AS build
|
||||
|
||||
ARG CTOOLS_BUILD="all"
|
||||
ARG CTYPE="RelWithDebInfo"
|
||||
ARG CCACHE_CPP2="true"
|
||||
ARG CSCRIPTPCH="OFF"
|
||||
ARG CSCRIPTS="static"
|
||||
ARG CMODULES="static"
|
||||
ARG CSCRIPTS_DEFAULT_LINKAGE="static"
|
||||
ARG CWITH_WARNINGS="ON"
|
||||
ARG CMAKE_EXTRA_OPTIONS=""
|
||||
ARG GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
||||
|
||||
ARG CCACHE_DIR="/ccache"
|
||||
ARG CCACHE_MAXSIZE="1000MB"
|
||||
ARG CCACHE_SLOPPINESS="pch_defines,time_macros,include_file_mtime"
|
||||
ARG CCACHE_COMPRESS=""
|
||||
ARG CCACHE_COMPRESSLEVEL="9"
|
||||
ARG CCACHE_COMPILERCHECK="content"
|
||||
ARG CCACHE_LOGFILE=""
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
build-essential ccache libtool cmake-data make cmake clang \
|
||||
git lsb-base curl unzip default-mysql-client openssl \
|
||||
default-libmysqlclient-dev libboost-all-dev libssl-dev libmysql++-dev \
|
||||
libreadline-dev zlib1g-dev libbz2-dev libncurses5-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY CMakeLists.txt /azerothcore/CMakeLists.txt
|
||||
COPY conf /azerothcore/conf
|
||||
COPY deps /azerothcore/deps
|
||||
COPY src /azerothcore/src
|
||||
COPY modules /azerothcore/modules
|
||||
|
||||
ARG CACHEBUST=1
|
||||
|
||||
WORKDIR /azerothcore/build
|
||||
|
||||
RUN --mount=type=cache,target=/ccache,sharing=locked \
|
||||
# This may seem silly (and it is), but AzerothCore wants the git repo at
|
||||
# build time. The git repo is _huge_ and it's not something that really
|
||||
# makes sense to mount into the container, but this way we can let the build
|
||||
# have the information it needs without including the hundreds of megabytes
|
||||
# of git repo into the container.
|
||||
--mount=type=bind,target=/azerothcore/.git,source=.git \
|
||||
git config --global --add safe.directory /azerothcore \
|
||||
&& cmake /azerothcore \
|
||||
-DCMAKE_INSTALL_PREFIX="/azerothcore/env/dist" \
|
||||
-DAPPS_BUILD="all" \
|
||||
-DTOOLS_BUILD="$CTOOLS_BUILD" \
|
||||
-DSCRIPTS="$CSCRIPTS" \
|
||||
-DMODULES="$CMODULES" \
|
||||
-DWITH_WARNINGS="$CWITH_WARNINGS" \
|
||||
-DCMAKE_BUILD_TYPE="$CTYPE" \
|
||||
-DCMAKE_CXX_COMPILER="clang++" \
|
||||
-DCMAKE_C_COMPILER="clang" \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
|
||||
-DBoost_USE_STATIC_LIBS="ON" \
|
||||
&& cmake --build . --config "$CTYPE" -j $(($(nproc) + 1)) \
|
||||
&& cmake --install . --config "$CTYPE"
|
||||
|
||||
#############################
|
||||
# Base runtime for services #
|
||||
#############################
|
||||
|
||||
FROM skeleton AS runtime
|
||||
|
||||
ARG USER_ID=1000
|
||||
ARG GROUP_ID=1000
|
||||
ARG DOCKER_USER=acore
|
||||
|
||||
ENV ACORE_COMPONENT=undefined
|
||||
|
||||
# Install base dependencies for azerothcore
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
libmysqlclient21 libreadline8 \
|
||||
gettext-base default-mysql-client && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=build /azerothcore/env/dist/etc/ /azerothcore/env/ref/etc
|
||||
|
||||
VOLUME /azerothcore/env/dist/etc
|
||||
|
||||
ENV PATH="/azerothcore/env/dist/bin:$PATH"
|
||||
|
||||
RUN groupadd --gid "$GROUP_ID" "$DOCKER_USER" && \
|
||||
useradd -d /azerothcore --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" && \
|
||||
passwd -d "$DOCKER_USER" && \
|
||||
chown -R "$DOCKER_USER:$DOCKER_USER" /azerothcore
|
||||
|
||||
COPY --chown=$USER_ID:$GROUP_ID \
|
||||
--chmod=755 \
|
||||
apps/docker/entrypoint.sh /azerothcore/entrypoint.sh
|
||||
|
||||
USER $DOCKER_USER
|
||||
|
||||
ENTRYPOINT ["/usr/bin/env", "bash", "/azerothcore/entrypoint.sh"]
|
||||
|
||||
###############
|
||||
# Auth Server #
|
||||
###############
|
||||
|
||||
FROM runtime AS authserver
|
||||
LABEL description="AzerothCore Auth Server"
|
||||
|
||||
ENV ACORE_COMPONENT=authserver
|
||||
# Don't run database migrations. We can leave that up to the db-import container
|
||||
ENV AC_UPDATES_ENABLE_DATABASES=0
|
||||
# This disables user prompts. The console is still active, however
|
||||
ENV AC_DISABLE_INTERACTIVE=1
|
||||
ENV AC_CLOSE_IDLE_CONNECTIONS=0
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER \
|
||||
--from=build \
|
||||
/azerothcore/env/dist/bin/authserver /azerothcore/env/dist/bin/authserver
|
||||
|
||||
|
||||
CMD ["authserver"]
|
||||
|
||||
################
|
||||
# World Server #
|
||||
################
|
||||
|
||||
FROM runtime AS worldserver
|
||||
|
||||
LABEL description="AzerothCore World Server"
|
||||
|
||||
ENV ACORE_COMPONENT=worldserver
|
||||
# Don't run database migrations. We can leave that up to the db-import container
|
||||
ENV AC_UPDATES_ENABLE_DATABASES=0
|
||||
# This disables user prompts. The console is still active, however
|
||||
ENV AC_DISABLE_INTERACTIVE=1
|
||||
ENV AC_CLOSE_IDLE_CONNECTIONS=0
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER \
|
||||
--from=build \
|
||||
/azerothcore/env/dist/bin/worldserver /azerothcore/env/dist/bin/worldserver
|
||||
|
||||
VOLUME /azerothcore/env/dist/etc
|
||||
|
||||
CMD ["worldserver"]
|
||||
|
||||
#############
|
||||
# DB Import #
|
||||
#############
|
||||
|
||||
FROM runtime AS db-import
|
||||
|
||||
LABEL description="AzerothCore Database Import tool"
|
||||
|
||||
USER $DOCKER_USER
|
||||
|
||||
ENV ACORE_COMPONENT=dbimport
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER \
|
||||
data data
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER \
|
||||
modules modules
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER\
|
||||
--from=build \
|
||||
/azerothcore/env/dist/bin/dbimport /azerothcore/env/dist/bin/dbimport
|
||||
|
||||
CMD [ "/azerothcore/env/dist/bin/dbimport" ]
|
||||
|
||||
###############
|
||||
# Client Data #
|
||||
###############
|
||||
|
||||
FROM skeleton AS client-data
|
||||
|
||||
LABEL description="AzerothCore client-data"
|
||||
|
||||
ENV DATAPATH=/azerothcore/env/dist/data
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl unzip && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER apps apps
|
||||
|
||||
VOLUME /azerothcore/env/dist/data
|
||||
|
||||
USER $DOCKER_USER
|
||||
|
||||
CMD ["bash", "-c", "source /azerothcore/apps/installer/includes/functions.sh && inst_download_client_data" ]
|
||||
|
||||
##################
|
||||
# Map Extractors #
|
||||
##################
|
||||
|
||||
FROM runtime AS tools
|
||||
|
||||
LABEL description="AzerothCore Tools"
|
||||
|
||||
WORKDIR /azerothcore/env/dist/
|
||||
|
||||
RUN mkdir -pv /azerothcore/env/dist/Cameras \
|
||||
/azerothcore/env/dist/dbc \
|
||||
/azerothcore/env/dist/maps \
|
||||
/azerothcore/env/dist/mmaps \
|
||||
/azerothcore/env/dist/vmaps
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
|
||||
/azerothcore/env/dist/bin/map_extractor /azerothcore/env/dist/bin/map_extractor
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
|
||||
/azerothcore/env/dist/bin/mmaps_generator /azerothcore/env/dist/bin/mmaps_generator
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
|
||||
/azerothcore/env/dist/bin/vmap4_assembler /azerothcore/env/dist/bin/vmap4_assembler
|
||||
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER --from=build \
|
||||
/azerothcore/env/dist/bin/vmap4_extractor /azerothcore/env/dist/bin/vmap4_extractor
|
||||
108
apps/docker/Dockerfile.dev-server
Normal file
108
apps/docker/Dockerfile.dev-server
Normal file
@@ -0,0 +1,108 @@
|
||||
#syntax=docker/dockerfile:1.2
|
||||
|
||||
#================================================================
|
||||
#
|
||||
# DEV: Stage used for the development environment
|
||||
# and the locally built services
|
||||
#
|
||||
#=================================================================
|
||||
|
||||
FROM ubuntu:24.04 as dev
|
||||
ARG USER_ID=1000
|
||||
ARG GROUP_ID=1000
|
||||
ARG DOCKER_USER=acore
|
||||
ARG TZ=Etc/UTC
|
||||
|
||||
LABEL description="AC base image for dev containers"
|
||||
|
||||
# List of timezones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
|
||||
ENV DOCKER=1
|
||||
|
||||
# Ensure ac-dev-server can properly pull versions
|
||||
ENV GIT_DISCOVERY_ACROSS_FILESYSTEM=1
|
||||
|
||||
# set timezone environment variable
|
||||
ENV TZ=$TZ
|
||||
|
||||
# set noninteractive mode so tzdata doesn't ask to set timezone on install
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
# Classic install
|
||||
git \
|
||||
clang lldb lld clang-format clang-tidy \
|
||||
make cmake \
|
||||
gcc g++ \
|
||||
libmysqlclient-dev \
|
||||
libssl-dev \
|
||||
libbz2-dev \
|
||||
libreadline-dev \
|
||||
libncurses-dev \
|
||||
mysql-server \
|
||||
libboost-all-dev \
|
||||
# Other
|
||||
curl \
|
||||
unzip \
|
||||
sudo \
|
||||
gdb gdbserver \
|
||||
libtool \
|
||||
build-essential \
|
||||
cmake-data \
|
||||
openssl \
|
||||
google-perftools libgoogle-perftools-dev \
|
||||
libmysql++-dev \
|
||||
ccache \
|
||||
tzdata \
|
||||
# Utility for column command used by dashboard
|
||||
util-linux \
|
||||
# Certificates for downloading client data
|
||||
ca-certificates \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Ensure git will work with the AzerothCore source directory
|
||||
RUN git config --global --add safe.directory /azerothcore
|
||||
|
||||
# change timezone in container
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime \
|
||||
&& echo $TZ > /etc/timezone && dpkg-reconfigure --frontend noninteractive tzdata
|
||||
|
||||
# Create a non-root user
|
||||
RUN userdel --remove ubuntu \
|
||||
&& addgroup --gid "$GROUP_ID" "$DOCKER_USER" \
|
||||
&& adduser --disabled-password --gecos '' --uid "$USER_ID" --gid "$GROUP_ID" "$DOCKER_USER" \
|
||||
&& passwd -d "$DOCKER_USER" \
|
||||
&& echo "$DOCKER_USER ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
|
||||
# must be created to set the correct permissions on them
|
||||
RUN mkdir -p \
|
||||
/azerothcore/env/dist/bin \
|
||||
/azerothcore/env/dist/data/Cameras \
|
||||
/azerothcore/env/dist/data/dbc \
|
||||
/azerothcore/env/dist/data/maps \
|
||||
/azerothcore/env/dist/data/mmaps \
|
||||
/azerothcore/env/dist/data/vmaps \
|
||||
/azerothcore/env/dist/logs \
|
||||
/azerothcore/env/dist/temp \
|
||||
/azerothcore/env/dist/etc \
|
||||
/azerothcore/var/build/obj
|
||||
|
||||
# Correct permissions for non-root operations
|
||||
RUN chown -R $DOCKER_USER:$DOCKER_USER /home/acore /run /opt /azerothcore
|
||||
|
||||
USER $DOCKER_USER
|
||||
|
||||
# copy only necessary files for the acore dashboard
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER apps /azerothcore/apps
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER bin /azerothcore/bin
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER conf /azerothcore/conf
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER data /azerothcore/data
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER deps /azerothcore/deps
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER acore.json /azerothcore/acore.json
|
||||
COPY --chown=$DOCKER_USER:$DOCKER_USER acore.sh /azerothcore/acore.sh
|
||||
|
||||
# Download deno and make sure the dashboard works
|
||||
RUN bash /azerothcore/acore.sh quit
|
||||
|
||||
WORKDIR /azerothcore
|
||||
41
apps/docker/README.md
Normal file
41
apps/docker/README.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Docker
|
||||
|
||||
Full documentation is [on our wiki](https://www.azerothcore.org/wiki/install-with-docker#installation)
|
||||
|
||||
## Building
|
||||
|
||||
### Prerequisites
|
||||
|
||||
Ensure that you have docker, docker compose (v2), and the docker buildx command
|
||||
installed.
|
||||
|
||||
It's all bundled with [Docker Desktop](https://docs.docker.com/get-docker/),
|
||||
though if you're using Linux you can install them through your distribution's
|
||||
package manage or by using the [documentation from docker](https://docs.docker.com/engine/install/)
|
||||
|
||||
### Running the Build
|
||||
|
||||
1. Build containers with command
|
||||
|
||||
```console
|
||||
$ docker compose build
|
||||
```
|
||||
|
||||
1. Note that the initial build will take a long time, though subsequent builds should be faster
|
||||
|
||||
2. Start containers with command
|
||||
|
||||
```console
|
||||
$ docker compose up -d
|
||||
# Skip the build step
|
||||
$ docker compose up -d --build
|
||||
```
|
||||
|
||||
1. Note that this command may take a while the first time, for the database import
|
||||
|
||||
3. (on first install) You'll need to attach to the worldserver and create an Admin account
|
||||
|
||||
```console
|
||||
$ docker compose attach ac-worldserver
|
||||
AC> account create admin password 3 -1
|
||||
```
|
||||
216
apps/docker/docker-cmd.sh
Normal file
216
apps/docker/docker-cmd.sh
Normal file
@@ -0,0 +1,216 @@
|
||||
#!/bin/bash
|
||||
|
||||
# TODO(michaeldelago) decide if we need a wrapper like this around docker
|
||||
# commands.
|
||||
#
|
||||
# Running the docker commands should be simple and familiar.
|
||||
# Introducting extra steps through the dashboard can cause issues with people
|
||||
# getting started, especially if they already know docker.
|
||||
#
|
||||
# If a new user knows docker, they will feel (pretty close) to right at home.
|
||||
# If a new user doesn't know docker, it's easy to learn and the knowledge
|
||||
# applies to much more than azerothcore
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
COMPOSE_DOCKER_CLI_BUILD="1"
|
||||
DOCKER_BUILDKIT="1"
|
||||
# BUILDKIT_INLINE_CACHE="1"
|
||||
|
||||
function usage () {
|
||||
cat <<EOF
|
||||
Wrapper for shell scripts around docker
|
||||
|
||||
usage: $(basename $0) ACTION [ ACTION... ] [ ACTION_ARG... ]
|
||||
|
||||
actions:
|
||||
EOF
|
||||
# the `-s` will remove the "#" and properly space the action and description
|
||||
cat <<EOF | column -t -l2 -s'#'
|
||||
> start:app # Start the development worldserver and authserver
|
||||
> start:app:d # Start the development worldserver and authserver in detached mode
|
||||
> build # build the development worldserver and authserver
|
||||
> pull # pull the development worldserver and authserver
|
||||
> build:nocache # build the development worldserver and authserver without cache
|
||||
> clean:build # clean build artifacts from the dev server
|
||||
> client-data # download client data in the dev server
|
||||
> dev:up start # the dev server
|
||||
> dev:build # compile azerothcore using the dev server
|
||||
> dev:dash # execute the dashboard in the dev server container
|
||||
> dev:shell [ ARGS... ] # open a bash shell in the dev server
|
||||
> prod:build # Build the service containers used by acore-docker
|
||||
> prod:pull # Pull the containers used by acore-docker
|
||||
> prod:up # Start the services used by acore-docker
|
||||
> prod:up:d # start the services used by acore-docker in the background
|
||||
> attach SERVICE # attach to a service currently running in docker compose
|
||||
EOF
|
||||
}
|
||||
|
||||
# If no args, just spit usage and exit
|
||||
[[ $# -eq 0 ]] && usage && exit
|
||||
|
||||
# loop through commands passed
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
start:app)
|
||||
set -x
|
||||
docker compose up
|
||||
set +x
|
||||
# pop the head off of the queue of args
|
||||
# After this, the value of $1 is the value of $2
|
||||
shift
|
||||
;;
|
||||
|
||||
start:app:d)
|
||||
set -x
|
||||
docker compose up -d
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
build)
|
||||
set -x
|
||||
docker compose build
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
pull)
|
||||
set -x
|
||||
docker compose pull
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
build:nocache)
|
||||
set -x
|
||||
docker compose build --no-cache
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
clean:build)
|
||||
set -x
|
||||
# Don't run 'docker buildx prune' since it may "escape" our bubble
|
||||
# and affect other projects on the user's workstation/server
|
||||
cat <<EOF
|
||||
This command has been deprecated, and at the moment does not do anything.
|
||||
If you'd like to build without cache, use the command './acore.sh docker build:nocache' or look into the 'docker buildx prune command'
|
||||
|
||||
> https://docs.docker.com/engine/reference/commandline/buildx_prune/
|
||||
EOF
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
client-data)
|
||||
set -x
|
||||
docker compose up ac-client-data-init
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
dev:up)
|
||||
set -x
|
||||
docker compose --profile dev up ac-dev-server -d
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
dev:build)
|
||||
set -x
|
||||
docker compose --profile dev run --rm ac-dev-server bash /azerothcore/acore.sh compiler build
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
dev:dash)
|
||||
set -x
|
||||
docker compose --profile dev run --rm ac-dev-server bash /azerothcore/acore.sh ${@:2}
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
dev:shell)
|
||||
set -x
|
||||
docker compose --profile dev up -d ac-dev-server
|
||||
docker compose --profile dev exec ac-dev-server bash ${@:2}
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
build:prod|prod:build)
|
||||
cat <<EOF
|
||||
This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
|
||||
|
||||
./acore.sh docker build
|
||||
|
||||
The build will continue in 3 seconds
|
||||
EOF
|
||||
sleep 3
|
||||
set -x
|
||||
docker compose build
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
pull:prod|prod:pull)
|
||||
cat <<EOF
|
||||
This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
|
||||
|
||||
./acore.sh docker pull
|
||||
|
||||
The image pull will continue in 3 seconds
|
||||
EOF
|
||||
sleep 3
|
||||
set -x
|
||||
docker compose pull
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
prod:up|start:prod)
|
||||
cat <<EOF
|
||||
This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
|
||||
|
||||
./acore.sh docker start:app
|
||||
|
||||
The containers will start in 3 seconds
|
||||
EOF
|
||||
sleep 3
|
||||
set -x
|
||||
docker compose up
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
prod:up:d|start:prod:d)
|
||||
cat <<EOF
|
||||
This command is deprecated and is scheduled to be removed. Please update any scripts or automation accordingly to use the other command:
|
||||
|
||||
./acore.sh docker start:app:d
|
||||
|
||||
The containers will start in 3 seconds
|
||||
EOF
|
||||
sleep 3
|
||||
set -x
|
||||
docker compose up -d
|
||||
set +x
|
||||
shift
|
||||
;;
|
||||
|
||||
attach)
|
||||
SERVICE="$2"
|
||||
set -x
|
||||
docker compose attach "$SERVICE"
|
||||
set +x
|
||||
shift
|
||||
shift # Second to pass the argument
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown or empty arg"
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
54
apps/docker/entrypoint.sh
Normal file
54
apps/docker/entrypoint.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
CONF_DIR="${CONF_DIR:-/azerothcore/env/dist/etc}"
|
||||
LOGS_DIR="${LOGS_DIR:-/azerothcore/env/dist/logs}"
|
||||
|
||||
if ! touch "$CONF_DIR/.write-test" || ! touch "$LOGS_DIR/.write-test"; then
|
||||
cat <<EOF
|
||||
===== WARNING =====
|
||||
The current user doesn't have write permissions for
|
||||
the configuration dir ($CONF_DIR) or logs dir ($LOGS_DIR).
|
||||
It's likely that services will fail due to this.
|
||||
|
||||
This is usually caused by cloning the repository as root,
|
||||
so the files are owned by root (uid 0).
|
||||
|
||||
To resolve this, you can set the ownership of the
|
||||
configuration directory with the command on the host machine.
|
||||
Note that if the files are owned as root, the ownership must
|
||||
be changed as root (hence sudo).
|
||||
|
||||
$ sudo chown -R $(id -u):$(id -g) /path/to$CONF_DIR /path/to$LOGS_DIR
|
||||
|
||||
Alternatively, you can set the DOCKER_USER environment
|
||||
variable (on the host machine) to "root", though this
|
||||
isn't recommended.
|
||||
|
||||
$ DOCKER_USER=root docker-compose up -d
|
||||
====================
|
||||
EOF
|
||||
fi
|
||||
|
||||
[[ -f "$CONF_DIR/.write-test" ]] && rm -f "$CONF_DIR/.write-test"
|
||||
[[ -f "$LOGS_DIR/.write-test" ]] && rm -f "$LOGS_DIR/.write-test"
|
||||
|
||||
# Copy all default config files to env/dist/etc if they don't already exist
|
||||
# -r == recursive
|
||||
# -n == no clobber (don't overwrite)
|
||||
# -v == be verbose
|
||||
cp -rnv /azerothcore/env/ref/etc/* "$CONF_DIR"
|
||||
|
||||
CONF="$CONF_DIR/$ACORE_COMPONENT.conf"
|
||||
CONF_DIST="$CONF_DIR/$ACORE_COMPONENT.conf.dist"
|
||||
|
||||
# Copy the "dist" file to the "conf" if the conf doesn't already exist
|
||||
if [[ -f "$CONF_DIST" ]]; then
|
||||
cp -vn "$CONF_DIST" "$CONF"
|
||||
else
|
||||
touch "$CONF"
|
||||
fi
|
||||
|
||||
echo "Starting $ACORE_COMPONENT..."
|
||||
|
||||
exec "$@"
|
||||
83
apps/extractor/extractor.bat
Normal file
83
apps/extractor/extractor.bat
Normal file
@@ -0,0 +1,83 @@
|
||||
@ECHO OFF
|
||||
CLS
|
||||
|
||||
:MENU
|
||||
ECHO.
|
||||
ECHO ...............................................
|
||||
ECHO AzerothCore dbc, maps, vmaps, mmaps extractor
|
||||
ECHO ...............................................
|
||||
ECHO PRESS 1, 2, 3 OR 4 to select your task, or 5 to EXIT.
|
||||
ECHO ...............................................
|
||||
ECHO.
|
||||
ECHO WARNING! when extracting the vmaps extractor will
|
||||
ECHO output the text below, it's intended and not an error:
|
||||
ECHO ..........................................
|
||||
ECHO Extracting World\Wmo\Band\Final_Stage.wmo
|
||||
ECHO No such file.
|
||||
ECHO Couldn't open RootWmo!!!
|
||||
ECHO Done!
|
||||
ECHO ..........................................
|
||||
ECHO.
|
||||
ECHO Press 1, 2, 3 or 4 to start extracting or 5 to exit.
|
||||
ECHO 1 - Extract base files (NEEDED) and cameras.
|
||||
ECHO 2 - Extract vmaps (needs maps to be extracted before you run this) (OPTIONAL, highly recommended)
|
||||
ECHO 3 - Extract mmaps (needs vmaps to be extracted before you run this, may take hours) (OPTIONAL, highly recommended)
|
||||
ECHO 4 - Extract all (may take hours)
|
||||
ECHO 5 - EXIT
|
||||
ECHO.
|
||||
SET /P M=Type 1, 2, 3, 4 or 5 then press ENTER:
|
||||
IF %M%==1 GOTO MAPS
|
||||
IF %M%==2 GOTO VMAPS
|
||||
IF %M%==3 GOTO MMAPS
|
||||
IF %M%==4 GOTO ALL
|
||||
IF %M%==5 GOTO :EOF
|
||||
|
||||
:MAPS
|
||||
start /b /w map_extractor.exe
|
||||
GOTO MENU
|
||||
|
||||
:VMAPS
|
||||
start /b /w vmap4_extractor.exe
|
||||
if exist vmaps\ (
|
||||
echo folder found.
|
||||
) else (
|
||||
echo creating folder "vmaps".
|
||||
mkdir "vmaps"
|
||||
)
|
||||
start /b /w vmap4_assembler.exe Buildings vmaps
|
||||
rmdir Buildings /s /q
|
||||
GOTO MENU
|
||||
|
||||
:MMAPS
|
||||
ECHO This may take a few hours to complete. Please be patient.
|
||||
PAUSE
|
||||
if exist mmaps\ (
|
||||
echo folder found.
|
||||
) else (
|
||||
echo creating folder "mmaps".
|
||||
mkdir "mmaps"
|
||||
)
|
||||
start /b /w mmaps_generator.exe
|
||||
GOTO MENU
|
||||
|
||||
:ALL
|
||||
ECHO This may take a few hours to complete. Please be patient.
|
||||
PAUSE
|
||||
if exist vmaps\ (
|
||||
echo folder found.
|
||||
) else (
|
||||
echo creating folder "vmaps".
|
||||
mkdir "vmaps"
|
||||
)
|
||||
if exist mmaps\ (
|
||||
echo folder found.
|
||||
) else (
|
||||
echo creating folder "mmaps".
|
||||
mkdir "mmaps"
|
||||
)
|
||||
start /b /w map_extractor.exe
|
||||
start /b /w vmap4_extractor.exe
|
||||
start /b /w vmap4_assembler.exe Buildings vmaps
|
||||
rmdir Buildings /s /q
|
||||
start /b /w mmaps_generator.exe
|
||||
GOTO MENU
|
||||
83
apps/extractor/extractor_es.bat
Normal file
83
apps/extractor/extractor_es.bat
Normal file
@@ -0,0 +1,83 @@
|
||||
@ECHO OFF
|
||||
CLS
|
||||
|
||||
:MENU
|
||||
ECHO.
|
||||
ECHO ...............................................
|
||||
ECHO AzerothCore dbc, maps, vmaps, mmaps extractor
|
||||
ECHO ...............................................
|
||||
ECHO PRESIONE 1, 2, 3 O 4 para seleccionar su tarea, o 5 para SALIR.
|
||||
ECHO ...............................................
|
||||
ECHO.
|
||||
ECHO ADVERTENCIA: al extraer los vmaps del extractor
|
||||
ECHO la salida del texto de abajo, es intencional y no un error:
|
||||
ECHO ..........................................
|
||||
ECHO Extracting World\Wmo\Band\Final_Stage.wmo
|
||||
ECHO No such file.
|
||||
ECHO Couldn't open RootWmo!!!
|
||||
ECHO Done!
|
||||
ECHO ..........................................
|
||||
ECHO.
|
||||
ECHO Pulse 1, 2, 3 o 4 para iniciar la extraccion o 5 para salir.
|
||||
ECHO 1 - Extraer los archivos base (NECESARIOS) y las cámaras.
|
||||
ECHO 2 - Extraer vmaps (necesita que los mapas se extraigan antes de ejecutar esto) (OPCIONAL, muy recomendable)
|
||||
ECHO 3 - Extraer mmaps (necesita que los vmaps se extraigan antes de ejecutar esto, puede llevar horas) (OPCIONAL, muy recomendable)
|
||||
ECHO 4 - Extraer todo (puede llevar varias horas)
|
||||
ECHO 5 - SALIR
|
||||
ECHO.
|
||||
SET /P M=Escriba 1, 2, 3, 4 o 5 y pulse ENTER:
|
||||
IF %M%==1 GOTO MAPS
|
||||
IF %M%==2 GOTO VMAPS
|
||||
IF %M%==3 GOTO MMAPS
|
||||
IF %M%==4 GOTO ALL
|
||||
IF %M%==5 GOTO :EOF
|
||||
|
||||
:MAPS
|
||||
start /b /w map_extractor.exe
|
||||
GOTO MENU
|
||||
|
||||
:VMAPS
|
||||
start /b /w vmap4_extractor.exe
|
||||
if exist vmaps\ (
|
||||
echo folder found.
|
||||
) else (
|
||||
echo creating folder "vmaps".
|
||||
mkdir "vmaps"
|
||||
)
|
||||
start /b /w vmap4_assembler.exe Buildings vmaps
|
||||
rmdir Buildings /s /q
|
||||
GOTO MENU
|
||||
|
||||
:MMAPS
|
||||
ECHO Esto puede tardar unas horas en completarse. Por favor, tenga paciencia.
|
||||
PAUSE
|
||||
if exist mmaps\ (
|
||||
echo folder found.
|
||||
) else (
|
||||
echo creating folder "mmaps".
|
||||
mkdir "mmaps"
|
||||
)
|
||||
start /b /w mmaps_generator.exe
|
||||
GOTO MENU
|
||||
|
||||
:ALL
|
||||
ECHO Esto puede tardar unas horas en completarse. Por favor, tenga paciencia.
|
||||
PAUSE
|
||||
if exist vmaps\ (
|
||||
echo folder found.
|
||||
) else (
|
||||
echo creating folder "vmaps".
|
||||
mkdir "vmaps"
|
||||
)
|
||||
if exist mmaps\ (
|
||||
echo folder found.
|
||||
) else (
|
||||
echo creating folder "mmaps".
|
||||
mkdir "mmaps"
|
||||
)
|
||||
start /b /w map_extractor.exe
|
||||
start /b /w vmap4_extractor.exe
|
||||
start /b /w vmap4_assembler.exe Buildings vmaps
|
||||
rmdir Buildings /s /q
|
||||
start /b /w mmaps_generator.exe
|
||||
GOTO MENU
|
||||
5
apps/git_tools/setup_git_commit_template.sh
Normal file
5
apps/git_tools/setup_git_commit_template.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
## Set a local git commit template
|
||||
git config --local commit.template ".git_commit_template.txt" ;
|
||||
echo "--- Successfully set the default commit template for this repository only. Verify with: git config -e"
|
||||
34
apps/git_tools/subrepo-update.sh
Normal file
34
apps/git_tools/subrepo-update.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#######################
|
||||
#
|
||||
# README
|
||||
#
|
||||
# This script is used to automatically update
|
||||
# submodules and subrepos included in this project
|
||||
# Subrepo are updated in bidirectional way (pull + push)
|
||||
# because they are intended to be developed by this organization
|
||||
#
|
||||
# NOTE: only maintainers and CI should run this script and
|
||||
# keep it updated
|
||||
#
|
||||
#######################
|
||||
|
||||
set -e
|
||||
ROOT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/../../"
|
||||
# update all submodules
|
||||
git submodule update --init --recursive
|
||||
git submodule foreach git pull origin master
|
||||
# include libraries for git subrepo
|
||||
source "$ROOT_PATH/deps/git-subrepo/.rc"
|
||||
source "$ROOT_PATH/deps/acore/bash-lib/src/git-utils/subrepo.sh"
|
||||
|
||||
echo "> Pulling and update all subrepos"
|
||||
|
||||
subrepoUpdate https://github.com/azerothcore/bash-lib master deps/acore/bash-lib
|
||||
|
||||
subrepoUpdate https://github.com/azerothcore/cmake-utils master deps/acore/cmake-utils
|
||||
|
||||
subrepoUpdate https://github.com/azerothcore/mysql-tools master deps/acore/mysql-tools
|
||||
|
||||
subrepoUpdate https://github.com/azerothcore/joiner master deps/acore/joiner
|
||||
1319
apps/grafana/1_General.json
Normal file
1319
apps/grafana/1_General.json
Normal file
File diff suppressed because it is too large
Load Diff
691
apps/grafana/2_Maps.json
Normal file
691
apps/grafana/2_Maps.json
Normal file
@@ -0,0 +1,691 @@
|
||||
{
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": "-- Grafana --",
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
},
|
||||
{
|
||||
"datasource": "Influx",
|
||||
"enable": true,
|
||||
"iconColor": "#C0C6BE",
|
||||
"iconSize": 13,
|
||||
"lineColor": "rgba(255, 96, 96, 0.592157)",
|
||||
"name": "Global Events",
|
||||
"query": "select title, text from events where $timeFilter and realm =~ /$realm$/",
|
||||
"showLine": true,
|
||||
"textColumn": "text",
|
||||
"titleColumn": "title"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"gnetId": null,
|
||||
"graphTooltip": 0,
|
||||
"id": 6,
|
||||
"iteration": 1595939001794,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": "Influx",
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"fill": 1,
|
||||
"fillGradient": 0,
|
||||
"grid": {},
|
||||
"gridPos": {
|
||||
"h": 7,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"hiddenSeries": false,
|
||||
"id": 2,
|
||||
"isNew": true,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 2,
|
||||
"links": [],
|
||||
"nullPointMode": "connected",
|
||||
"options": {
|
||||
"dataLinks": []
|
||||
},
|
||||
"percentage": false,
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [
|
||||
{
|
||||
"alias": "Unload tile",
|
||||
"transform": "negative-Y"
|
||||
}
|
||||
],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"alias": "Load tile",
|
||||
"dsType": "influxdb",
|
||||
"groupBy": [
|
||||
{
|
||||
"params": [
|
||||
"$interval"
|
||||
],
|
||||
"type": "time"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"0"
|
||||
],
|
||||
"type": "fill"
|
||||
}
|
||||
],
|
||||
"query": "SELECT count(\"title\") FROM \"map_events\" WHERE \"realm\" =~ /$realm$/ AND \"title\" = 'LoadMapTile' AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"rawQuery": true,
|
||||
"refId": "A",
|
||||
"resultFormat": "time_series",
|
||||
"select": [
|
||||
[
|
||||
{
|
||||
"params": [
|
||||
"value"
|
||||
],
|
||||
"type": "field"
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"type": "mean"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tags": []
|
||||
},
|
||||
{
|
||||
"alias": "Unload tile",
|
||||
"dsType": "influxdb",
|
||||
"groupBy": [
|
||||
{
|
||||
"params": [
|
||||
"$interval"
|
||||
],
|
||||
"type": "time"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"null"
|
||||
],
|
||||
"type": "fill"
|
||||
}
|
||||
],
|
||||
"query": "SELECT count(\"title\") FROM \"map_events\" WHERE \"realm\" =~ /$realm$/ AND \"title\" = 'UnloadMapTile' AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"rawQuery": true,
|
||||
"refId": "B",
|
||||
"resultFormat": "time_series",
|
||||
"select": [
|
||||
[
|
||||
{
|
||||
"params": [
|
||||
"value"
|
||||
],
|
||||
"type": "field"
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"type": "mean"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tags": []
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeRegions": [],
|
||||
"timeShift": null,
|
||||
"title": "Map",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "cumulative"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "short",
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
}
|
||||
],
|
||||
"yaxis": {
|
||||
"align": false,
|
||||
"alignLevel": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": "Influx",
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"fill": 1,
|
||||
"fillGradient": 0,
|
||||
"grid": {},
|
||||
"gridPos": {
|
||||
"h": 7,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 7
|
||||
},
|
||||
"hiddenSeries": false,
|
||||
"id": 1,
|
||||
"isNew": true,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 2,
|
||||
"links": [],
|
||||
"nullPointMode": "connected",
|
||||
"options": {
|
||||
"dataLinks": []
|
||||
},
|
||||
"percentage": false,
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"alias": "Pathfinding queries",
|
||||
"dsType": "influxdb",
|
||||
"groupBy": [
|
||||
{
|
||||
"params": [
|
||||
"$interval"
|
||||
],
|
||||
"type": "time"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"null"
|
||||
],
|
||||
"type": "fill"
|
||||
}
|
||||
],
|
||||
"query": "SELECT count(\"title\") FROM \"mmap_events\" WHERE \"realm\" =~ /$realm$/ AND \"title\" = 'CalculatePath' AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"rawQuery": true,
|
||||
"refId": "A",
|
||||
"resultFormat": "time_series",
|
||||
"select": [
|
||||
[
|
||||
{
|
||||
"params": [
|
||||
"value"
|
||||
],
|
||||
"type": "field"
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"type": "mean"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tags": []
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeRegions": [],
|
||||
"timeShift": null,
|
||||
"title": "MMap",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "cumulative"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "short",
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
}
|
||||
],
|
||||
"yaxis": {
|
||||
"align": false,
|
||||
"alignLevel": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": null,
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"fill": 5,
|
||||
"fillGradient": 0,
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 14
|
||||
},
|
||||
"hiddenSeries": false,
|
||||
"id": 4,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"hideEmpty": false,
|
||||
"hideZero": true,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 1,
|
||||
"nullPointMode": "null",
|
||||
"options": {
|
||||
"dataLinks": []
|
||||
},
|
||||
"percentage": false,
|
||||
"pointradius": 2,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"alias": "Map $tag_map_id Instance $tag_map_instanceid",
|
||||
"groupBy": [
|
||||
{
|
||||
"params": [
|
||||
"$__interval"
|
||||
],
|
||||
"type": "time"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"map_id"
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"map_instanceid"
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"none"
|
||||
],
|
||||
"type": "fill"
|
||||
}
|
||||
],
|
||||
"measurement": "map_creatures",
|
||||
"orderByTime": "ASC",
|
||||
"policy": "default",
|
||||
"refId": "A",
|
||||
"resultFormat": "time_series",
|
||||
"select": [
|
||||
[
|
||||
{
|
||||
"params": [
|
||||
"value"
|
||||
],
|
||||
"type": "field"
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"type": "mean"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"key": "realm",
|
||||
"operator": "=~",
|
||||
"value": "/^$realm$/"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeRegions": [],
|
||||
"timeShift": null,
|
||||
"title": "Creatures",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
}
|
||||
],
|
||||
"yaxis": {
|
||||
"align": false,
|
||||
"alignLevel": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": null,
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"fill": 5,
|
||||
"fillGradient": 0,
|
||||
"gridPos": {
|
||||
"h": 8,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 22
|
||||
},
|
||||
"hiddenSeries": false,
|
||||
"id": 5,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"hideEmpty": false,
|
||||
"hideZero": true,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 1,
|
||||
"nullPointMode": "null",
|
||||
"options": {
|
||||
"dataLinks": []
|
||||
},
|
||||
"percentage": false,
|
||||
"pointradius": 2,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"alias": "Map $tag_map_id Instance $tag_map_instanceid",
|
||||
"groupBy": [
|
||||
{
|
||||
"params": [
|
||||
"$__interval"
|
||||
],
|
||||
"type": "time"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"map_id"
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"map_instanceid"
|
||||
],
|
||||
"type": "tag"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"none"
|
||||
],
|
||||
"type": "fill"
|
||||
}
|
||||
],
|
||||
"measurement": "map_gameobjects",
|
||||
"orderByTime": "ASC",
|
||||
"policy": "default",
|
||||
"refId": "A",
|
||||
"resultFormat": "time_series",
|
||||
"select": [
|
||||
[
|
||||
{
|
||||
"params": [
|
||||
"value"
|
||||
],
|
||||
"type": "field"
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"type": "mean"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"key": "realm",
|
||||
"operator": "=~",
|
||||
"value": "/^$realm$/"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeRegions": [],
|
||||
"timeShift": null,
|
||||
"title": "Gameobjects",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "individual"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"label": null,
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
}
|
||||
],
|
||||
"yaxis": {
|
||||
"align": false,
|
||||
"alignLevel": null
|
||||
}
|
||||
}
|
||||
],
|
||||
"refresh": "1m",
|
||||
"schemaVersion": 25,
|
||||
"style": "dark",
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"allFormat": "regex values",
|
||||
"allValue": null,
|
||||
"current": {
|
||||
"text": "Acore",
|
||||
"value": "Acore"
|
||||
},
|
||||
"datasource": "Influx",
|
||||
"definition": "",
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"multiFormat": "regex values",
|
||||
"name": "realm",
|
||||
"options": [],
|
||||
"query": "show tag values from events with key = realm",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 0,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"time": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"now": true,
|
||||
"refresh_intervals": [
|
||||
"10s",
|
||||
"30s",
|
||||
"1m",
|
||||
"5m",
|
||||
"15m",
|
||||
"30m",
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
],
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Maps, vmaps and mmaps",
|
||||
"uid": "6IhqWiWGz",
|
||||
"version": 2
|
||||
}
|
||||
280
apps/grafana/3_Network.json
Normal file
280
apps/grafana/3_Network.json
Normal file
@@ -0,0 +1,280 @@
|
||||
{
|
||||
"annotations": {
|
||||
"list": [
|
||||
{
|
||||
"builtIn": 1,
|
||||
"datasource": "-- Grafana --",
|
||||
"enable": true,
|
||||
"hide": true,
|
||||
"iconColor": "rgba(0, 211, 255, 1)",
|
||||
"name": "Annotations & Alerts",
|
||||
"type": "dashboard"
|
||||
},
|
||||
{
|
||||
"datasource": "Influx",
|
||||
"enable": true,
|
||||
"iconColor": "#C0C6BE",
|
||||
"iconSize": 13,
|
||||
"lineColor": "rgba(255, 96, 96, 0.592157)",
|
||||
"name": "Global Events",
|
||||
"query": "select title, text from events where $timeFilter and realm =~ /$realm$/",
|
||||
"showLine": true,
|
||||
"textColumn": "text",
|
||||
"titleColumn": "title"
|
||||
}
|
||||
]
|
||||
},
|
||||
"editable": true,
|
||||
"gnetId": null,
|
||||
"graphTooltip": 0,
|
||||
"id": 7,
|
||||
"iteration": 1595939048589,
|
||||
"links": [],
|
||||
"panels": [
|
||||
{
|
||||
"aliasColors": {},
|
||||
"bars": false,
|
||||
"dashLength": 10,
|
||||
"dashes": false,
|
||||
"datasource": "Influx",
|
||||
"editable": true,
|
||||
"error": false,
|
||||
"fieldConfig": {
|
||||
"defaults": {
|
||||
"custom": {}
|
||||
},
|
||||
"overrides": []
|
||||
},
|
||||
"fill": 1,
|
||||
"fillGradient": 0,
|
||||
"grid": {},
|
||||
"gridPos": {
|
||||
"h": 7,
|
||||
"w": 24,
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"hiddenSeries": false,
|
||||
"id": 1,
|
||||
"isNew": true,
|
||||
"legend": {
|
||||
"avg": false,
|
||||
"current": false,
|
||||
"max": false,
|
||||
"min": false,
|
||||
"show": true,
|
||||
"total": false,
|
||||
"values": false
|
||||
},
|
||||
"lines": true,
|
||||
"linewidth": 2,
|
||||
"links": [],
|
||||
"nullPointMode": "connected",
|
||||
"options": {
|
||||
"dataLinks": []
|
||||
},
|
||||
"percentage": false,
|
||||
"pointradius": 5,
|
||||
"points": false,
|
||||
"renderer": "flot",
|
||||
"seriesOverrides": [],
|
||||
"spaceLength": 10,
|
||||
"stack": false,
|
||||
"steppedLine": false,
|
||||
"targets": [
|
||||
{
|
||||
"alias": "Processed packets",
|
||||
"dsType": "influxdb",
|
||||
"groupBy": [
|
||||
{
|
||||
"params": [
|
||||
"$interval"
|
||||
],
|
||||
"type": "time"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"0"
|
||||
],
|
||||
"type": "fill"
|
||||
}
|
||||
],
|
||||
"measurement": "processed_packets",
|
||||
"query": "SELECT sum(\"value\") FROM \"processed_packets\" WHERE \"realm\" =~ /$realm$/ AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"refId": "A",
|
||||
"resultFormat": "time_series",
|
||||
"select": [
|
||||
[
|
||||
{
|
||||
"params": [
|
||||
"value"
|
||||
],
|
||||
"type": "field"
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"type": "sum"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"key": "realm",
|
||||
"operator": "=~",
|
||||
"value": "/$realm$/"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"alias": "Processed packets / mean per session",
|
||||
"dsType": "influxdb",
|
||||
"groupBy": [
|
||||
{
|
||||
"params": [
|
||||
"$interval"
|
||||
],
|
||||
"type": "time"
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
"0"
|
||||
],
|
||||
"type": "fill"
|
||||
}
|
||||
],
|
||||
"measurement": "processed_packets",
|
||||
"query": "SELECT mean(\"value\") FROM \"processed_packets\" WHERE \"realm\" =~ /$realm$/ AND $timeFilter GROUP BY time($interval) fill(0)",
|
||||
"refId": "B",
|
||||
"resultFormat": "time_series",
|
||||
"select": [
|
||||
[
|
||||
{
|
||||
"params": [
|
||||
"value"
|
||||
],
|
||||
"type": "field"
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"type": "mean"
|
||||
}
|
||||
]
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"key": "realm",
|
||||
"operator": "=~",
|
||||
"value": "/$realm$/"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"thresholds": [],
|
||||
"timeFrom": null,
|
||||
"timeRegions": [],
|
||||
"timeShift": null,
|
||||
"title": "Processed packets",
|
||||
"tooltip": {
|
||||
"shared": true,
|
||||
"sort": 0,
|
||||
"value_type": "cumulative"
|
||||
},
|
||||
"type": "graph",
|
||||
"xaxis": {
|
||||
"buckets": null,
|
||||
"mode": "time",
|
||||
"name": null,
|
||||
"show": true,
|
||||
"values": []
|
||||
},
|
||||
"yaxes": [
|
||||
{
|
||||
"format": "short",
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
},
|
||||
{
|
||||
"format": "short",
|
||||
"logBase": 1,
|
||||
"max": null,
|
||||
"min": null,
|
||||
"show": true
|
||||
}
|
||||
],
|
||||
"yaxis": {
|
||||
"align": false,
|
||||
"alignLevel": null
|
||||
}
|
||||
}
|
||||
],
|
||||
"refresh": "1m",
|
||||
"schemaVersion": 25,
|
||||
"style": "dark",
|
||||
"tags": [],
|
||||
"templating": {
|
||||
"list": [
|
||||
{
|
||||
"allFormat": "regex values",
|
||||
"allValue": null,
|
||||
"current": {
|
||||
"text": "Acore",
|
||||
"value": "Acore"
|
||||
},
|
||||
"datasource": "Influx",
|
||||
"definition": "",
|
||||
"hide": 0,
|
||||
"includeAll": false,
|
||||
"label": null,
|
||||
"multi": false,
|
||||
"multiFormat": "regex values",
|
||||
"name": "realm",
|
||||
"options": [],
|
||||
"query": "show tag values from events with key = realm",
|
||||
"refresh": 1,
|
||||
"regex": "",
|
||||
"skipUrlSync": false,
|
||||
"sort": 0,
|
||||
"tagValuesQuery": "",
|
||||
"tags": [],
|
||||
"tagsQuery": "",
|
||||
"type": "query",
|
||||
"useTags": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"time": {
|
||||
"from": "now-15m",
|
||||
"to": "now"
|
||||
},
|
||||
"timepicker": {
|
||||
"now": true,
|
||||
"refresh_intervals": [
|
||||
"10s",
|
||||
"30s",
|
||||
"1m",
|
||||
"5m",
|
||||
"15m",
|
||||
"30m",
|
||||
"1h",
|
||||
"2h",
|
||||
"1d"
|
||||
],
|
||||
"time_options": [
|
||||
"5m",
|
||||
"15m",
|
||||
"1h",
|
||||
"6h",
|
||||
"12h",
|
||||
"24h",
|
||||
"2d",
|
||||
"7d",
|
||||
"30d"
|
||||
]
|
||||
},
|
||||
"timezone": "browser",
|
||||
"title": "Network",
|
||||
"uid": "_QtkMmWMk",
|
||||
"version": 2
|
||||
}
|
||||
1677
apps/grafana/4_Performance_profiling.json
Normal file
1677
apps/grafana/4_Performance_profiling.json
Normal file
File diff suppressed because it is too large
Load Diff
253
apps/installer/includes/functions.sh
Normal file
253
apps/installer/includes/functions.sh
Normal file
@@ -0,0 +1,253 @@
|
||||
function inst_configureOS() {
|
||||
echo "Platform: $OSTYPE"
|
||||
case "$OSTYPE" in
|
||||
solaris*) echo "Solaris is not supported yet" ;;
|
||||
darwin*) source "$AC_PATH_INSTALLER/includes/os_configs/osx.sh" ;;
|
||||
linux*)
|
||||
# If $OSDISTRO is set, use this value (from config.sh)
|
||||
if [ ! -z "$OSDISTRO" ]; then
|
||||
DISTRO=$OSDISTRO
|
||||
# If available, use LSB to identify distribution
|
||||
elif command -v lsb_release >/dev/null 2>&1 ; then
|
||||
DISTRO=$(lsb_release -is)
|
||||
# Otherwise, use release info file
|
||||
else
|
||||
DISTRO=$(ls -d /etc/[A-Za-z]*[_-][rv]e[lr]* | grep -v "lsb" | cut -d'/' -f3 | cut -d'-' -f1 | cut -d'_' -f1)
|
||||
fi
|
||||
|
||||
case $DISTRO in
|
||||
# add here distro that are debian or ubuntu based
|
||||
# TODO: find a better way, maybe checking the existance
|
||||
# of a package manager
|
||||
"neon" | "ubuntu" | "Ubuntu")
|
||||
DISTRO="ubuntu"
|
||||
;;
|
||||
"debian" | "Debian")
|
||||
DISTRO="debian"
|
||||
;;
|
||||
*)
|
||||
echo "Distro: $DISTRO, is not supported. If your distribution is based on debian or ubuntu,
|
||||
please set the 'OSDISTRO' environment variable to one of these distro (you can use config.sh file)"
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
DISTRO=${DISTRO,,}
|
||||
|
||||
echo "Distro: $DISTRO"
|
||||
|
||||
# TODO: implement different configurations by distro
|
||||
source "$AC_PATH_INSTALLER/includes/os_configs/$DISTRO.sh"
|
||||
;;
|
||||
*bsd*) echo "BSD is not supported yet" ;;
|
||||
msys*) source "$AC_PATH_INSTALLER/includes/os_configs/windows.sh" ;;
|
||||
*) echo "This platform is not supported" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
function inst_updateRepo() {
|
||||
cd "$AC_PATH_ROOT"
|
||||
if [ ! -z $INSTALLER_PULL_FROM ]; then
|
||||
git pull "$ORIGIN_REMOTE" "$INSTALLER_PULL_FROM"
|
||||
else
|
||||
git pull "$ORIGIN_REMOTE" $(git rev-parse --abbrev-ref HEAD)
|
||||
fi
|
||||
}
|
||||
|
||||
function inst_resetRepo() {
|
||||
cd "$AC_PATH_ROOT"
|
||||
git reset --hard $(git rev-parse --abbrev-ref HEAD)
|
||||
git clean -f
|
||||
}
|
||||
|
||||
function inst_compile() {
|
||||
comp_configure
|
||||
comp_build
|
||||
}
|
||||
|
||||
function inst_cleanCompile() {
|
||||
comp_clean
|
||||
inst_compile
|
||||
}
|
||||
|
||||
function inst_allInOne() {
|
||||
inst_configureOS
|
||||
inst_compile
|
||||
dbasm_import true true true
|
||||
}
|
||||
|
||||
function inst_getVersionBranch() {
|
||||
local res="master"
|
||||
local v="not-defined"
|
||||
local MODULE_MAJOR=0
|
||||
local MODULE_MINOR=0
|
||||
local MODULE_PATCH=0
|
||||
local MODULE_SPECIAL=0;
|
||||
local ACV_MAJOR=0
|
||||
local ACV_MINOR=0
|
||||
local ACV_PATCH=0
|
||||
local ACV_SPECIAL=0;
|
||||
local curldata=$(curl -f --silent -H 'Cache-Control: no-cache' "$1" || echo "{}")
|
||||
local parsed=$(echo "$curldata" | "$AC_PATH_DEPS/jsonpath/JSONPath.sh" -b '$.compatibility.*.[version,branch]')
|
||||
|
||||
semverParseInto "$ACORE_VERSION" ACV_MAJOR ACV_MINOR ACV_PATCH ACV_SPECIAL
|
||||
|
||||
if [[ ! -z "$parsed" ]]; then
|
||||
readarray -t vers < <(echo "$parsed")
|
||||
local idx
|
||||
res="none"
|
||||
# since we've the pair version,branch alternated in not associative and one-dimensional
|
||||
# array, we've to simulate the association with length/2 trick
|
||||
for idx in `seq 0 $((${#vers[*]}/2-1))`; do
|
||||
semverParseInto "${vers[idx*2]}" MODULE_MAJOR MODULE_MINOR MODULE_PATCH MODULE_SPECIAL
|
||||
if [[ $MODULE_MAJOR -eq $ACV_MAJOR && $MODULE_MINOR -le $ACV_MINOR ]]; then
|
||||
res="${vers[idx*2+1]}"
|
||||
v="${vers[idx*2]}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
echo "$v" "$res"
|
||||
}
|
||||
|
||||
function inst_module_search {
|
||||
|
||||
local res="$1"
|
||||
local idx=0;
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Type what to search or leave blank for full list"
|
||||
read -p "Insert name: " res
|
||||
fi
|
||||
|
||||
local search="+$res"
|
||||
|
||||
echo "Searching $res..."
|
||||
echo "";
|
||||
|
||||
readarray -t MODS < <(curl --silent "https://api.github.com/search/repositories?q=org%3Aazerothcore${search}+fork%3Atrue+topic%3Acore-module+sort%3Astars&type=" \
|
||||
| "$AC_PATH_DEPS/jsonpath/JSONPath.sh" -b '$.items.*.name')
|
||||
while (( ${#MODS[@]} > idx )); do
|
||||
mod="${MODS[idx++]}"
|
||||
read v b < <(inst_getVersionBranch "https://raw.githubusercontent.com/azerothcore/$mod/master/acore-module.json")
|
||||
|
||||
if [[ "$b" != "none" ]]; then
|
||||
echo "-> $mod (tested with AC version: $v)"
|
||||
else
|
||||
echo "-> $mod (no revision available for AC v$AC_VERSION, it could not work!)"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "";
|
||||
echo "";
|
||||
}
|
||||
|
||||
function inst_module_install {
|
||||
local res
|
||||
if [ -z "$1" ]; then
|
||||
echo "Type the name of the module to install"
|
||||
read -p "Insert name: " res
|
||||
else
|
||||
res="$1"
|
||||
fi
|
||||
|
||||
read v b < <(inst_getVersionBranch "https://raw.githubusercontent.com/azerothcore/$res/master/acore-module.json")
|
||||
|
||||
if [[ "$b" != "none" ]]; then
|
||||
Joiner:add_repo "https://github.com/azerothcore/$res" "$res" "$b" && echo "Done, please re-run compiling and db assembly. Read instruction on module repository for more information"
|
||||
else
|
||||
echo "Cannot install $res module: it doesn't exists or no version compatible with AC v$ACORE_VERSION are available"
|
||||
fi
|
||||
|
||||
echo "";
|
||||
echo "";
|
||||
}
|
||||
|
||||
function inst_module_update {
|
||||
local res;
|
||||
local _tmp;
|
||||
local branch;
|
||||
local p;
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Type the name of the module to update"
|
||||
read -p "Insert name: " res
|
||||
else
|
||||
res="$1"
|
||||
fi
|
||||
|
||||
_tmp=$PWD
|
||||
|
||||
if [ -d "$J_PATH_MODULES/$res/" ]; then
|
||||
read v b < <(inst_getVersionBranch "https://raw.githubusercontent.com/azerothcore/$res/master/acore-module.json")
|
||||
|
||||
cd "$J_PATH_MODULES/$res/"
|
||||
|
||||
# use current branch if something wrong with json
|
||||
if [[ "$v" == "none" || "$v" == "not-defined" ]]; then
|
||||
b=`git rev-parse --abbrev-ref HEAD`
|
||||
fi
|
||||
|
||||
Joiner:upd_repo "https://github.com/azerothcore/$res" "$res" "$b" && echo "Done, please re-run compiling and db assembly" || echo "Cannot update"
|
||||
cd $_tmp
|
||||
else
|
||||
echo "Cannot update! Path doesn't exist"
|
||||
fi;
|
||||
|
||||
echo "";
|
||||
echo "";
|
||||
}
|
||||
|
||||
function inst_module_remove {
|
||||
if [ -z "$1" ]; then
|
||||
echo "Type the name of the module to remove"
|
||||
read -p "Insert name: " res
|
||||
else
|
||||
res="$1"
|
||||
fi
|
||||
|
||||
Joiner:remove "$res" && echo "Done, please re-run compiling" || echo "Cannot remove"
|
||||
|
||||
echo "";
|
||||
echo "";
|
||||
}
|
||||
|
||||
|
||||
function inst_simple_restarter {
|
||||
echo "Running $1 ..."
|
||||
bash "$AC_PATH_APPS/startup-scripts/simple-restarter" "$AC_BINPATH_FULL" "$1"
|
||||
echo
|
||||
#disown -a
|
||||
#jobs -l
|
||||
}
|
||||
|
||||
function inst_download_client_data {
|
||||
# change the following version when needed
|
||||
local VERSION=v16
|
||||
|
||||
echo "#######################"
|
||||
echo "Client data downloader"
|
||||
echo "#######################"
|
||||
|
||||
# first check if it's defined in env, otherwise use the default
|
||||
local path="${DATAPATH:-$AC_BINPATH_FULL}"
|
||||
local zipPath="${DATAPATH_ZIP:-"$path/data.zip"}"
|
||||
|
||||
dataVersionFile="$path/data-version"
|
||||
|
||||
[ -f "$dataVersionFile" ] && source "$dataVersionFile"
|
||||
|
||||
# create the path if doesn't exists
|
||||
mkdir -p "$path"
|
||||
|
||||
if [ "$VERSION" == "$INSTALLED_VERSION" ]; then
|
||||
echo "Data $VERSION already installed. If you want to force the download remove the following file: $dataVersionFile"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "Downloading client data in: $zipPath ..."
|
||||
curl -L https://github.com/wowgaming/client-data/releases/download/$VERSION/data.zip > "$zipPath" \
|
||||
&& echo "unzip downloaded file in $path..." && unzip -q -o "$zipPath" -d "$path/" \
|
||||
&& echo "Remove downloaded file" && rm "$zipPath" \
|
||||
&& echo "INSTALLED_VERSION=$VERSION" > "$dataVersionFile"
|
||||
}
|
||||
22
apps/installer/includes/includes.sh
Normal file
22
apps/installer/includes/includes.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
[[ ${INSTALLER_GUARDYVAR:-} -eq 1 ]] && return || readonly INSTALLER_GUARDYVAR=1 # include it once
|
||||
|
||||
CURRENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd )
|
||||
|
||||
source "$CURRENT_PATH/../../bash_shared/includes.sh"
|
||||
|
||||
AC_PATH_INSTALLER="$AC_PATH_APPS/installer"
|
||||
|
||||
J_PATH="$AC_PATH_DEPS/acore/joiner"
|
||||
J_PATH_MODULES="$AC_PATH_MODULES"
|
||||
|
||||
source "$J_PATH/joiner.sh"
|
||||
|
||||
if [ -f "$AC_PATH_INSTALLER/config.sh" ]; then
|
||||
source "$AC_PATH_INSTALLER/config.sh" # should overwrite previous
|
||||
fi
|
||||
|
||||
source "$AC_PATH_APPS/compiler/includes/includes.sh"
|
||||
|
||||
source "$AC_PATH_DEPS/semver_bash/semver.sh"
|
||||
|
||||
source "$AC_PATH_INSTALLER/includes/functions.sh"
|
||||
29
apps/installer/includes/os_configs/debian.sh
Normal file
29
apps/installer/includes/os_configs/debian.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
if ! command -v lsb_release &>/dev/null ; then
|
||||
sudo apt-get install -y lsb-release
|
||||
fi
|
||||
|
||||
DEBIAN_VERSION=$(lsb_release -sr)
|
||||
DEBIAN_VERSION_MIN="12"
|
||||
|
||||
if [[ $DEBIAN_VERSION -lt $DEBIAN_VERSION_MIN ]]; then
|
||||
echo "########## ########## ##########"
|
||||
echo ""
|
||||
echo " using unsupported Debian version" $DEBIAN_VERSION
|
||||
echo " please update to Debian" $DEBIAN_VERSION_MIN "or later"
|
||||
echo ""
|
||||
echo "########## ########## ##########"
|
||||
fi
|
||||
|
||||
sudo apt-get update -y
|
||||
|
||||
sudo apt-get install -y gdbserver gdb unzip curl \
|
||||
libncurses-dev libreadline-dev clang g++ \
|
||||
gcc git cmake make ccache \
|
||||
libssl-dev libbz2-dev \
|
||||
libboost-all-dev gnupg wget
|
||||
|
||||
# run noninteractive install for MYSQL 8.4 LTS
|
||||
wget https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb
|
||||
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i ./mysql-apt-config_0.8.32-1_all.deb
|
||||
sudo apt-get update
|
||||
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server libmysqlclient-dev
|
||||
34
apps/installer/includes/os_configs/osx.sh
Normal file
34
apps/installer/includes/os_configs/osx.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
##########################################
|
||||
## workaround for python upgrade issue https://github.com/actions/runner-images/issues/6817
|
||||
rm /usr/local/bin/2to3 || true
|
||||
rm /usr/local/bin/2to3-3.10 || true
|
||||
rm /usr/local/bin/2to3-3.11 || true
|
||||
rm /usr/local/bin/2to3-3.12 || true
|
||||
rm /usr/local/bin/idle3 || true
|
||||
rm /usr/local/bin/idle3.10 || true
|
||||
rm /usr/local/bin/idle3.11 || true
|
||||
rm /usr/local/bin/idle3.12 || true
|
||||
rm /usr/local/bin/pydoc3 || true
|
||||
rm /usr/local/bin/pydoc3.10 || true
|
||||
rm /usr/local/bin/pydoc3.11 || true
|
||||
rm /usr/local/bin/pydoc3.12 || true
|
||||
rm /usr/local/bin/python3 || true
|
||||
rm /usr/local/bin/python3.10 || true
|
||||
rm /usr/local/bin/python3.11 || true
|
||||
rm /usr/local/bin/python3.12 || true
|
||||
rm /usr/local/bin/python3-config || true
|
||||
rm /usr/local/bin/python3.10-config || true
|
||||
rm /usr/local/bin/python3.11-config || true
|
||||
rm /usr/local/bin/python3.12-config || true
|
||||
##########################################
|
||||
|
||||
brew update
|
||||
|
||||
##########################################
|
||||
## workaround for cmake already being installed in the github runners
|
||||
if ! command -v cmake &>/dev/null ; then
|
||||
brew install cmake
|
||||
fi
|
||||
##########################################
|
||||
|
||||
brew install openssl@3 readline boost bash-completion curl unzip mysql ccache
|
||||
44
apps/installer/includes/os_configs/ubuntu.sh
Normal file
44
apps/installer/includes/os_configs/ubuntu.sh
Normal file
@@ -0,0 +1,44 @@
|
||||
if ! command -v lsb_release &>/dev/null ; then
|
||||
sudo apt-get install -y lsb-release
|
||||
fi
|
||||
|
||||
UBUNTU_VERSION=$(lsb_release -sr);
|
||||
|
||||
case $UBUNTU_VERSION in
|
||||
"22.04")
|
||||
;;
|
||||
"24.04")
|
||||
;;
|
||||
*)
|
||||
echo "########## ########## ##########"
|
||||
echo ""
|
||||
echo " using unsupported Ubuntu version " $UBUNTU_VERSION
|
||||
echo " please update to Ubuntu 22.04 or later"
|
||||
echo ""
|
||||
echo "########## ########## ##########"
|
||||
;;
|
||||
esac
|
||||
|
||||
sudo apt update
|
||||
|
||||
# shared deps
|
||||
sudo DEBIAN_FRONTEND="noninteractive" \
|
||||
apt-get -y install ccache clang cmake curl google-perftools libmysqlclient-dev make unzip
|
||||
|
||||
if [[ $CONTINUOUS_INTEGRATION || $DOCKER ]]; then
|
||||
# TODO: update CI / Docker section for Ubuntu 22.04+
|
||||
sudo add-apt-repository -y ppa:mhier/libboost-latest && sudo apt update && sudo apt-get -y install build-essential cmake-data \
|
||||
libboost1.74-dev libbz2-dev libncurses5-dev libmysql++-dev libgoogle-perftools-dev libreadline6-dev libssl-dev libtool \
|
||||
openssl zlib1g-dev
|
||||
else
|
||||
sudo DEBIAN_FRONTEND="noninteractive" \
|
||||
apt-get install -y g++ gdb gdbserver gcc git \
|
||||
libboost-all-dev libbz2-dev libncurses-dev libreadline-dev \
|
||||
libssl-dev
|
||||
|
||||
# run noninteractive install for MYSQL 8.4 LTS
|
||||
wget https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb
|
||||
sudo DEBIAN_FRONTEND="noninteractive" dpkg -i ./mysql-apt-config_0.8.32-1_all.deb
|
||||
sudo apt-get update
|
||||
sudo DEBIAN_FRONTEND="noninteractive" apt-get install -y mysql-server
|
||||
fi
|
||||
30
apps/installer/includes/os_configs/windows.sh
Normal file
30
apps/installer/includes/os_configs/windows.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
# install chocolatey before
|
||||
|
||||
# powershell.exe -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
|
||||
|
||||
# install automatically following packages:
|
||||
# cmake
|
||||
# git
|
||||
# microsoft-build-tools
|
||||
# mysql
|
||||
|
||||
INSTALL_ARGS=""
|
||||
|
||||
if [[ $CONTINUOUS_INTEGRATION ]]; then
|
||||
INSTALL_ARGS=" --no-progress "
|
||||
else
|
||||
{ # try
|
||||
choco uninstall -y -n cmake.install cmake # needed to make sure that following install set the env properly
|
||||
} || { # catch
|
||||
echo "nothing to do"
|
||||
}
|
||||
|
||||
choco install -y --skip-checksums $INSTALL_ARGS git visualstudio2022community
|
||||
fi
|
||||
|
||||
choco install -y --skip-checksums $INSTALL_ARGS cmake.install -y --installargs 'ADD_CMAKE_TO_PATH=System'
|
||||
choco install -y --skip-checksums $INSTALL_ARGS visualstudio2022-workload-nativedesktop
|
||||
choco install -y --skip-checksums $INSTALL_ARGS openssl --force --version=3.4.1
|
||||
choco install -y --skip-checksums $INSTALL_ARGS boost-msvc-14.3 --force --version=1.87.0
|
||||
choco install -y --skip-checksums $INSTALL_ARGS mysql --force --version=8.4.4
|
||||
|
||||
99
apps/installer/main.sh
Normal file
99
apps/installer/main.sh
Normal file
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
source "$CURRENT_PATH/includes/includes.sh"
|
||||
|
||||
PS3='[Please enter your choice]: '
|
||||
options=(
|
||||
"init (i): First Installation" # 1
|
||||
"install-deps (d): Configure OS dep" # 2
|
||||
"pull (u): Update Repository" # 3
|
||||
"reset (r): Reset & Clean Repository" # 4
|
||||
"compiler (c): Run compiler tool" # 5
|
||||
"module-search (ms): Module Search by keyword" # 6
|
||||
"module-install (mi): Module Install by name" # 7
|
||||
"module-update (mu): Module Update by name" # 8
|
||||
"module-remove: (mr): Module Remove by name" # 9
|
||||
"client-data: (gd): download client data from github repository (beta)" # 10
|
||||
"run-worldserver (rw): execute a simple restarter for worldserver" # 11
|
||||
"run-authserver (ra): execute a simple restarter for authserver" # 12
|
||||
"docker (dr): Run docker tools" # 13
|
||||
"quit: Exit from this menu" # 14
|
||||
)
|
||||
|
||||
function _switch() {
|
||||
_reply="$1"
|
||||
_opt="$2"
|
||||
|
||||
case $_reply in
|
||||
""|"i"|"init"|"1")
|
||||
inst_allInOne
|
||||
;;
|
||||
""|"d"|"install-deps"|"2")
|
||||
inst_configureOS
|
||||
;;
|
||||
""|"u"|"pull"|"3")
|
||||
inst_updateRepo
|
||||
;;
|
||||
""|"r"|"reset"|"4")
|
||||
inst_resetRepo
|
||||
;;
|
||||
""|"c"|"compiler"|"5")
|
||||
bash "$AC_PATH_APPS/compiler/compiler.sh" $_opt
|
||||
;;
|
||||
""|"ms"|"module-search"|"6")
|
||||
inst_module_search "$_opt"
|
||||
;;
|
||||
""|"mi"|"module-install"|"7")
|
||||
inst_module_install "$_opt"
|
||||
;;
|
||||
""|"mu"|"module-update"|"8")
|
||||
inst_module_update "$_opt"
|
||||
;;
|
||||
""|"mr"|"module-remove"|"9")
|
||||
inst_module_remove "$_opt"
|
||||
;;
|
||||
""|"gd"|"client-data"|"10")
|
||||
inst_download_client_data
|
||||
;;
|
||||
""|"rw"|"run-worldserver"|"11")
|
||||
inst_simple_restarter worldserver
|
||||
;;
|
||||
""|"ra"|"run-authserver"|"12")
|
||||
inst_simple_restarter authserver
|
||||
;;
|
||||
""|"dr"|"docker"|"13")
|
||||
DOCKER=1 bash "$AC_PATH_ROOT/apps/docker/docker-cmd.sh" "${@:2}"
|
||||
exit
|
||||
;;
|
||||
""|"v"|"version"|"14")
|
||||
# denoRunFile "$AC_PATH_APPS/installer/main.ts" "version"
|
||||
printf "AzerothCore Rev. %s\n" "$ACORE_VERSION"
|
||||
exit
|
||||
;;
|
||||
""|"quit"|"15")
|
||||
echo "Goodbye!"
|
||||
exit
|
||||
;;
|
||||
""|"--help")
|
||||
echo "Available commands:"
|
||||
printf '%s\n' "${options[@]}"
|
||||
;;
|
||||
*) echo "invalid option, use --help option for the commands list";;
|
||||
esac
|
||||
}
|
||||
|
||||
while true
|
||||
do
|
||||
# run option directly if specified in argument
|
||||
[ ! -z $1 ] && _switch $@ # old method: "${options[$cmdopt-1]}"
|
||||
[ ! -z $1 ] && exit 0
|
||||
|
||||
echo "==== ACORE DASHBOARD ===="
|
||||
select opt in "${options[@]}"
|
||||
do
|
||||
_switch $REPLY
|
||||
break
|
||||
done
|
||||
done
|
||||
50
apps/startup-scripts/conf.sh.dist
Normal file
50
apps/startup-scripts/conf.sh.dist
Normal file
@@ -0,0 +1,50 @@
|
||||
# enable/disable GDB execution
|
||||
export GDB_ENABLED=0
|
||||
|
||||
# [optional] gdb file
|
||||
# default: gdb.conf
|
||||
export GDB=""
|
||||
|
||||
# directory where binary are stored
|
||||
export BINPATH=""
|
||||
|
||||
# Put here the pid you configured on your worldserver.conf file
|
||||
# needed when GDB_ENABLED=1
|
||||
export SERVERPID=""
|
||||
|
||||
# path to configuration file (including the file name)
|
||||
# ex: /home/user/azerothcore/etc/worldserver.conf
|
||||
export CONFIG=""
|
||||
|
||||
# path of log files
|
||||
# needed by restarter to store its logs
|
||||
export LOGS_PATH="";
|
||||
|
||||
# exec name
|
||||
# ex: worldserver
|
||||
export SERVERBIN=""
|
||||
|
||||
# prefix name for log files
|
||||
# to avoid collision with other restarters
|
||||
export LOG_PREFIX_NAME=""
|
||||
|
||||
# [optional] name of screen service
|
||||
# if no specified, screen util won't be used
|
||||
export SCREEN_NAME=""
|
||||
|
||||
# [optional] overwrite default screen options: -A -m -d -S
|
||||
# WARNING: if you are running it under a systemd service
|
||||
# please do not remove -m -d arguments from screen if are you using it,
|
||||
# or keep WITH_CONSOLE=0 .
|
||||
# otherwise the journald-logging system will take 100% of CPU slowing
|
||||
# down the whole machine. It's because a systemd service should have
|
||||
# low console output.
|
||||
export SCREEN_OPTIONS=""
|
||||
|
||||
# enable/disable it to show the output
|
||||
# within console, if disable the output will be redirect to
|
||||
# logging files
|
||||
#
|
||||
export WITH_CONSOLE=0
|
||||
|
||||
|
||||
14
apps/startup-scripts/examples/restarter-auth.sh
Normal file
14
apps/startup-scripts/examples/restarter-auth.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PATH_RUNENGINE="./"
|
||||
|
||||
source "$PATH_RUNENGINE/run-engine"
|
||||
|
||||
# you must create your conf
|
||||
# copying conf.sh.dist
|
||||
# and renaming as below
|
||||
source "./conf-auth.sh"
|
||||
|
||||
restarter
|
||||
|
||||
|
||||
14
apps/startup-scripts/examples/restarter-world.sh
Normal file
14
apps/startup-scripts/examples/restarter-world.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PATH_RUNENGINE="./"
|
||||
|
||||
source "$PATH_RUNENGINE/run-engine"
|
||||
|
||||
# you must create your conf
|
||||
# copying conf.sh.dist
|
||||
# and renaming as below
|
||||
source "./conf-world.sh"
|
||||
|
||||
restarter
|
||||
|
||||
|
||||
13
apps/startup-scripts/examples/starter-auth.sh
Normal file
13
apps/startup-scripts/examples/starter-auth.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PATH_RUNENGINE="./"
|
||||
|
||||
source "$PATH_RUNENGINE/run-engine"
|
||||
|
||||
# you must create your conf
|
||||
# copying conf.sh.dist
|
||||
# and renaming as below
|
||||
source "./conf-auth.sh"
|
||||
|
||||
starter
|
||||
|
||||
14
apps/startup-scripts/examples/starter-world.sh
Normal file
14
apps/startup-scripts/examples/starter-world.sh
Normal file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PATH_RUNENGINE="./"
|
||||
|
||||
source "$PATH_RUNENGINE/run-engine"
|
||||
|
||||
# you must create your conf
|
||||
# copying conf.sh.dist
|
||||
# and renaming as below
|
||||
source "./conf-world.sh"
|
||||
|
||||
starter
|
||||
|
||||
|
||||
7
apps/startup-scripts/gdb.conf
Normal file
7
apps/startup-scripts/gdb.conf
Normal file
@@ -0,0 +1,7 @@
|
||||
set logging enabled on
|
||||
set debug timestamp
|
||||
run
|
||||
bt
|
||||
bt full
|
||||
info thread
|
||||
thread apply all backtrace full
|
||||
115
apps/startup-scripts/run-engine
Normal file
115
apps/startup-scripts/run-engine
Normal file
@@ -0,0 +1,115 @@
|
||||
export RUN_ENGINE_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# load default conf
|
||||
if [ -e "$RUN_ENGINE_PATH/conf.dist" ]; then
|
||||
source "$RUN_ENGINE_PATH/conf.sh.dist"
|
||||
fi
|
||||
|
||||
function finish {
|
||||
if [ ! -z "$SCREEN_NAME" ]; then
|
||||
screen -X -S "$SCREEN_NAME" quit
|
||||
fi
|
||||
}
|
||||
|
||||
# disabled for now, but could be useful if we want
|
||||
# shutdown the process if restarter crashes for some reason
|
||||
# trap finish EXIT
|
||||
|
||||
function configureFiles() {
|
||||
TRACE_BEGIN_STRING="SIGSEGV"
|
||||
TRACE_FILE="$LOGS_PATH/"$LOG_PREFIX_NAME"_trace.log"
|
||||
ERR_FILE="$LOGS_PATH/"$LOG_PREFIX_NAME"_error.log"
|
||||
SYSLOG="$LOGS_PATH/"$LOG_PREFIX_NAME"_system.log"
|
||||
SYSERR="$LOGS_PATH/"$LOG_PREFIX_NAME"_system.err"
|
||||
LINKS_FILE="$LOGS_PATH/"$LOG_PREFIX_NAME"_crash_links.link"
|
||||
}
|
||||
|
||||
function checkStatus() {
|
||||
local ret=1
|
||||
# wipe do : destroy old screens + ls
|
||||
#screen -wipe
|
||||
#if screen -ls $1 | grep -q "No Sockets found"
|
||||
#then
|
||||
# return 0
|
||||
#fi
|
||||
|
||||
local gdbres=$(pgrep -f "gdb -x $GDB --batch $SERVERBIN")
|
||||
if [[ $GDB_ENABLED -eq 1 && ! -z $gdbres ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
#
|
||||
# This is a specific check for Azeroth Core in case of screen failure
|
||||
# It is possible since same binary file cannot be launched with same configuration file
|
||||
# This is an extra check
|
||||
#
|
||||
local binres=$(pgrep -f "$SERVERBIN -c $CONFIG")
|
||||
if [ ! -z $binres ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
function run() {
|
||||
echo $1
|
||||
if [ ! -z $1 ]; then
|
||||
local OPTIONS="-A -m -d -S"
|
||||
if [ ! -z "$SCREEN_OPTIONS" ]; then
|
||||
OPTIONS=$SCREEN_OPTIONS
|
||||
fi
|
||||
|
||||
echo "> Starting with screen ( screen $OPTIONS )"
|
||||
|
||||
screen $OPTIONS $1 "$RUN_ENGINE_PATH/starter" $2 $3 "$4" "$5" "$6" $7 "$BINPATH/crashes"
|
||||
else
|
||||
$RUN_ENGINE_PATH/starter $2 $3 "$4" "$5" "$6" $7 "$BINPATH/crashes"
|
||||
fi
|
||||
}
|
||||
|
||||
function starter() {
|
||||
cd $BINPATH
|
||||
|
||||
mkdir -p "$LOGS_PATH"
|
||||
mkdir -p "$BINPATH"/crashes
|
||||
|
||||
configureFiles
|
||||
|
||||
run "$SCREEN_NAME" "$SERVERBIN" "$GDB" "$CONFIG" "$SYSLOG" "$SYSERR" "$GDB_ENABLED"
|
||||
}
|
||||
|
||||
|
||||
function restarter() {
|
||||
cd $BINPATH
|
||||
|
||||
mkdir -p "$LOGS_PATH"
|
||||
mkdir -p "$BINPATH"/crashes
|
||||
|
||||
configureFiles
|
||||
|
||||
if [ ! -f $TRACE_FILE ]; then
|
||||
touch $TRACE_FILE
|
||||
fi
|
||||
|
||||
while :
|
||||
do
|
||||
if checkStatus $SCREEN_NAME; then
|
||||
DATE=$(date)
|
||||
echo "Restarting $SCREEN_NAME Core blizz($DATE)"
|
||||
if [ $GDB_ENABLED -eq 1 ]; then
|
||||
echo "GDB enabled"
|
||||
grep -B 10 -A 1800 "$TRACE_BEGIN_STRING" "$SYSLOG" >> "$TRACE_FILE"
|
||||
cat "$SYSERR" > "$ERR_FILE"
|
||||
run "$SCREEN_NAME" "$SERVERBIN" "$GDB" "$CONFIG" "$SYSLOG" "$SYSERR" 1
|
||||
fi
|
||||
|
||||
if [ $GDB_ENABLED -eq 0 ]; then
|
||||
echo "GDB disabled"
|
||||
run "$SCREEN_NAME" "$SERVERBIN" null "$CONFIG" null null 0
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
done
|
||||
}
|
||||
|
||||
70
apps/startup-scripts/simple-restarter
Normal file
70
apps/startup-scripts/simple-restarter
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#PARAMETER 1: directory
|
||||
#PARAMETER 2: binary file
|
||||
#PARAMETER 3: gdb on/off
|
||||
|
||||
bin_path="${1:-$AC_RESTARTER_BINPATH}"
|
||||
bin_file="${2:-$AC_RESTARTER_BINFILE}"
|
||||
with_gdb="${3:-$AC_RESTARTER_WITHGDB}"
|
||||
|
||||
CURRENT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd )
|
||||
|
||||
_instant_crash_count=0
|
||||
_restart_count=0
|
||||
|
||||
if [ "$#" -ne 2 ]; then
|
||||
echo "Usage: $0 path filename"
|
||||
echo "Example: $0 $HOME/azerothcore/bin worldserver"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while true
|
||||
do
|
||||
if [ ! -f "$bin_path/$bin_file" ]; then
|
||||
echo "$bin_path/$bin_file doesn't exists!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STARTING_TIME=$(date +%s)
|
||||
|
||||
cd "$bin_path";
|
||||
|
||||
if [ "$with_gdb" = true ]; then
|
||||
echo "Running with GDB enabled"
|
||||
gdb -x "$CURRENT_PATH/gdb.conf" --batch "./$bin_file"
|
||||
else
|
||||
echo "Running without GDB"
|
||||
"./$bin_file"
|
||||
fi
|
||||
|
||||
_exit_code=$?
|
||||
|
||||
echo "exit code: $_exit_code"
|
||||
# stop restarter on SIGKILL (disabled for now)
|
||||
# 128 + 9 (SIGKILL)
|
||||
#if [ $_exit_code -eq 137 ]; then
|
||||
# echo "$bin_file has been killed"
|
||||
# exit 0
|
||||
#fi
|
||||
|
||||
echo "$bin_file terminated, restarting..."
|
||||
|
||||
ENDING_TIME=$(date +%s)
|
||||
DIFFERENCE=$(( $ENDING_TIME - $STARTING_TIME ))
|
||||
|
||||
((_restart_count++))
|
||||
echo "$bin_file Terminated after $DIFFERENCE seconds, termination count: : $_restart_count"
|
||||
|
||||
if [ $DIFFERENCE -lt 10 ]; then
|
||||
# increment instant crash if runtime is lower than 10 seconds
|
||||
((_instant_crash_count++))
|
||||
else
|
||||
_instant_crash_count=0 # reset count
|
||||
fi
|
||||
|
||||
if [ $_instant_crash_count -gt 5 ]; then
|
||||
echo "$bin_file Restarter exited. Infinite crash loop prevented. Please check your system"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
32
apps/startup-scripts/starter
Normal file
32
apps/startup-scripts/starter
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
GDB_FILE="$2"
|
||||
CONFIG="$3"
|
||||
SYSLOG="$4"
|
||||
SYSERR="$5"
|
||||
GDB_ENABLED="$6"
|
||||
CRASHES_PATH="$7"
|
||||
|
||||
if [ $GDB_ENABLED -eq 1 ]; then
|
||||
echo "set logging file "$CRASHES_PATH"/gdb-$(date +%Y-%m-%d-%H-%M-%S).txt" > "$GDB_FILE"
|
||||
echo "set logging enabled on" >> "$GDB_FILE"
|
||||
echo "set debug timestamp" >> "$GDB_FILE"
|
||||
echo "run -c $3" >> "$GDB_FILE"
|
||||
echo "bt" >> "$GDB_FILE"
|
||||
echo "bt full" >> "$GDB_FILE"
|
||||
echo "info thread" >> "$GDB_FILE"
|
||||
echo "thread apply all backtrace full" >> "$GDB_FILE"
|
||||
|
||||
[ ! -f "$SYSLOG" ] && touch "$SYSLOG"
|
||||
[ ! -f "$SYSERR" ] && touch "$SYSERR"
|
||||
|
||||
if [ $WITH_CONSOLE -eq 0 ]; then
|
||||
gdb -x $GDB_FILE --batch $1 >> "$SYSLOG" 2>> "$SYSERR"
|
||||
else
|
||||
echo "> Console enabled"
|
||||
gdb -x $GDB_FILE --batch $1 > >(tee ${SYSLOG}) 2> >(tee ${SYSERR} >&2)
|
||||
fi
|
||||
|
||||
elif [ $GDB_ENABLED -eq 0 ]; then
|
||||
"./$1" -c "$CONFIG"
|
||||
fi
|
||||
116
apps/valgrind/helgrind.supp
Normal file
116
apps/valgrind/helgrind.supp
Normal file
@@ -0,0 +1,116 @@
|
||||
{
|
||||
[1] ACE_Future::ready() race in WorldSession::ProcessQueryCallbacks(), a lock is used anyway in ACE_Future::get()/set()
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZN14ACE_Future_RepIN7Trinity7AutoPtrI17PreparedResultSet16ACE_Thread_MutexEEE3setERKS4_R10ACE_FutureIS4_E
|
||||
fun:_ZN10ACE_FutureIN7Trinity7AutoPtrI17PreparedResultSet16ACE_Thread_MutexEEE3setERKS4_
|
||||
fun:_ZN21PreparedStatementTask7ExecuteEv
|
||||
}
|
||||
{
|
||||
[1] ACE_Future::ready() race in WorldSession::ProcessQueryCallbacks(), a lock is used anyway in ACE_Future::get()/set()
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZN14ACE_Future_RepIP14SQLQueryHolderE3setERKS1_R10ACE_FutureIS1_E
|
||||
fun:_ZN10ACE_FutureIP14SQLQueryHolderE3setERKS1_
|
||||
fun:_ZN18SQLQueryHolderTask7ExecuteEv
|
||||
}
|
||||
{
|
||||
[2] ACE_Future::ready() race in WorldSession::ProcessQueryCallbacks(), a lock is used anyway in ACE_Future::get()/set()
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZNK14ACE_Future_RepIP14SQLQueryHolderE5readyEv
|
||||
fun:_ZNK10ACE_FutureIP14SQLQueryHolderE5readyEv
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[3] ACE_Future::attach()/detach() false positive in WorldSession::HandleCharEnumOpcode()
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZN14ACE_Future_RepIN7Trinity7AutoPtrI17PreparedResultSet16ACE_Thread_MutexEEE6attachERPS5_
|
||||
}
|
||||
{
|
||||
[4] ACE_Future::get() race in WorldSession::ProcessQueryCallbacks() , a lock is used anyway in ACE_Future::get()/set(), the only case when this is a race is if the same ACE_Future is reused by another thread
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZNK14ACE_Future_RepIP14SQLQueryHolderE3getERS1_P14ACE_Time_Value
|
||||
fun:_ZNK10ACE_FutureIP14SQLQueryHolderE3getERS1_P14ACE_Time_Value
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[4] ACE_Future::get() race in WorldSession::ProcessQueryCallbacks() , a lock is used anyway in ACE_Future::get()/set(), the only case when this is a race is if the same ACE_Future is reused by another thread
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZNK10ACE_FutureIN7Trinity7AutoPtrI17PreparedResultSet16ACE_Thread_MutexEEE5readyEv
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[5] Race in WorldSession::ProcessQueryCallbacks(), added ASSERT(!m_result.ready())
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZN6Player10LoadFromDBEjP14SQLQueryHolder
|
||||
fun:_ZN12WorldSession17HandlePlayerLoginEP16LoginQueryHolder
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[5] Race in WorldSession::ProcessQueryCallbacks(), added ASSERT(!m_result.ready())
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZN14SQLQueryHolder17GetPreparedResultEm
|
||||
fun:_ZN12WorldSession17HandlePlayerLoginEP16LoginQueryHolder
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[5] Race in WorldSession::ProcessQueryCallbacks(), added ASSERT(!m_result.ready())
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZN12WorldSession15LoadAccountDataEN7Trinity7AutoPtrI17PreparedResultSet16ACE_Thread_MutexEEj
|
||||
fun:_ZN12WorldSession17HandlePlayerLoginEP16LoginQueryHolder
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[5] Race in WorldSession::ProcessQueryCallbacks(), added ASSERT(!m_result.ready())
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZNK17PreparedResultSet5FetchEv
|
||||
fun:_ZN12WorldSession17HandlePlayerLoginEP16LoginQueryHolder
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[5] Race in WorldSession::ProcessQueryCallbacks(), added ASSERT(!m_result.ready())
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZNK5Field9GetUInt32Ev
|
||||
fun:_ZN12WorldSession17HandlePlayerLoginEP16LoginQueryHolder
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[5] Race in WorldSession::ProcessQueryCallbacks(), added ASSERT(!m_result.ready())
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZNK5Field8GetUInt8Ev
|
||||
fun:_ZN12WorldSession17HandlePlayerLoginEP16LoginQueryHolder
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[6] False positive of possible race about ACE_Strong_Bound_Ptr
|
||||
Helgrind:Race
|
||||
...
|
||||
fun:_ZN17PreparedResultSetD1Ev
|
||||
fun:_ZN20ACE_Strong_Bound_PtrI17PreparedResultSet16ACE_Thread_MutexED1Ev
|
||||
fun:_ZN7Trinity7AutoPtrI17PreparedResultSet16ACE_Thread_MutexED1Ev
|
||||
fun:_ZN12WorldSession17HandlePlayerLoginEP16LoginQueryHolder
|
||||
fun:_ZN12WorldSession21ProcessQueryCallbacksEv
|
||||
}
|
||||
{
|
||||
[7] Race condition on bool in ACE, ignore
|
||||
Helgrind:Race
|
||||
fun:_ZN11WorldSocket12handle_closeEim
|
||||
fun:_ZN20ACE_Dev_Poll_Reactor16remove_handler_iEimP17ACE_Event_Handler
|
||||
}
|
||||
{
|
||||
[7] Race condition on bool in ACE, ignore
|
||||
Helgrind:Race
|
||||
fun:_ZNK11WorldSocket8IsClosedEv
|
||||
fun:_ZN12WorldSession6UpdateEjR12PacketFilter
|
||||
fun:_ZN5World14UpdateSessionsEj
|
||||
}
|
||||
3
apps/whitespace_remover/whitespace_remover.sh
Normal file
3
apps/whitespace_remover/whitespace_remover.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
# Change '*.cpp' and '*.h' to the extension you want to remove whitespaces in.
|
||||
find -name '*.cpp' -print0 | xargs -r0 sed -e 's/[[:blank:]]\+$//' -i
|
||||
find -name '*.h' -print0 | xargs -r0 sed -e 's/[[:blank:]]\+$//' -i
|
||||
Reference in New Issue
Block a user