Skip to content

Commit

Permalink
Add github issue and pull request templates (The-Legion-Preservation-…
Browse files Browse the repository at this point in the history
…Project#132)

* Add issue and pull request templates

* fix build
  • Loading branch information
jasongdove authored Nov 2, 2024
1 parent 892423d commit 8710a6c
Show file tree
Hide file tree
Showing 15 changed files with 350 additions and 90 deletions.
111 changes: 81 additions & 30 deletions cmake/genrev.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,59 +20,110 @@ if(WITHOUT_GIT)
set(rev_date "1970-01-01 00:00:00 +0000")
set(rev_hash "unknown")
set(rev_branch "Archived")
# No valid git commit date, use today
string(TIMESTAMP rev_date_fallback "%Y-%m-%d %H:%M:%S" UTC)
else()
if(GIT_EXECUTABLE)
# Create a revision-string that we can use
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --long --match init --dirty=+ --abbrev=12
COMMAND "${GIT_EXECUTABLE}" rev-parse --short=12 HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_info
OUTPUT_VARIABLE rev_hash
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

# And grab the commits timestamp
execute_process(
COMMAND "${GIT_EXECUTABLE}" show -s --format=%ci
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_date
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(rev_hash)
# Retrieve repository dirty status
execute_process(
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE is_dirty
ERROR_QUIET
)

# Also retrieve branch name
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
# Append dirty marker to commit hash
if(is_dirty)
set(rev_hash "${rev_hash}+")
endif()

# And grab the commits timestamp
execute_process(
COMMAND "${GIT_EXECUTABLE}" show -s --format=%ci
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_date
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

# Also retrieve branch name
execute_process(
COMMAND "${GIT_EXECUTABLE}" symbolic-ref -q --short HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)

# when ran on CI, repository is put in detached HEAD state, attempt to scan for known local branches
if(NOT rev_branch)
execute_process(
COMMAND "${GIT_EXECUTABLE}" for-each-ref --points-at=HEAD refs/heads "--format=%(refname:short)"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()

# if local branch scan didn't find anything, try remote branches
if(NOT rev_branch)
execute_process(
COMMAND "${GIT_EXECUTABLE}" for-each-ref --points-at=HEAD refs/remotes "--format=%(refname:short)"
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE rev_branch
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()

# give up finding a name for branch, use commit hash
if(NOT rev_branch)
set(rev_branch ${rev_hash})
endif()

# normalize branch to single line (for-each-ref can output multiple lines if there are multiple branches on the same commit)
string(REGEX MATCH "^[^ \t\r\n]+" rev_branch ${rev_branch})
endif()
endif()

# Last minute check - ensure that we have a proper revision
# If everything above fails (means the user has erased the git revision control directory or removed the origin/HEAD tag)
if(NOT rev_info)
if(NOT rev_hash)
# No valid ways available to find/set the revision/hash, so let's force some defaults
message(STATUS "
Could not find a proper repository signature (hash) - you may need to pull tags with git fetch -t
Continuing anyway - note that the versionstring will be set to \"unknown 1970-01-01 00:00:00 (Archived)\"")
set(rev_date "1970-01-01 00:00:00 +0000")
set(rev_hash "unknown")
set(rev_branch "Archived")
# No valid git commit date, use today
string(TIMESTAMP rev_date_fallback "%Y-%m-%d %H:%M:%S" UTC)
else()
# Extract information required to build a proper versionstring
string(REGEX REPLACE init-|[0-9]+-g "" rev_hash ${rev_info})
# We have valid date from git commit, use that
set(rev_date_fallback ${rev_date})
endif()
endif()

# For package/copyright information we always need a proper date - keep "Archived/1970" for displaying git info but a valid year elsewhere
string(REGEX MATCH "([0-9]+)-([0-9]+)-([0-9]+)" rev_date_fallback_match ${rev_date_fallback})
set(rev_year ${CMAKE_MATCH_1})
set(rev_month ${CMAKE_MATCH_2})
set(rev_day ${CMAKE_MATCH_3})

# Create the actual revision_data.h file from the above params
if(NOT "${rev_hash_cached}" MATCHES "${rev_hash}" OR NOT "${rev_branch_cached}" MATCHES "${rev_branch}" OR NOT EXISTS "${BUILDDIR}/revision_data.h")
configure_file(
"${CMAKE_SOURCE_DIR}/revision_data.h.in.cmake"
"${BUILDDIR}/revision_data.h"
@ONLY
)
set(rev_hash_cached "${rev_hash}" CACHE INTERNAL "Cached commit-hash")
set(rev_branch_cached "${rev_branch}" CACHE INTERNAL "Cached branch name")
endif()
configure_file(
"${CMAKE_SOURCE_DIR}/revision_data.h.in.cmake"
"${BUILDDIR}/revision_data.h"
@ONLY
)
38 changes: 0 additions & 38 deletions cmake/macros/FindGit.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ option(WITH_COREDEBUG "Include additional debug-code in core"

set(WITH_SOURCE_TREE "hierarchical" CACHE STRING "Build the source tree for IDE's.")
set_property(CACHE WITH_SOURCE_TREE PROPERTY STRINGS no flat hierarchical hierarchical-folders)
option(WITHOUT_GIT "Disable the GIT testing routines" 1)
option(WITHOUT_GIT "Disable the GIT testing routines" 0)
15 changes: 15 additions & 0 deletions cmake/showoptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,19 @@ else()
message("* Show source tree : No")
endif()

if(WITHOUT_GIT)
message("* Use GIT revision hash : No")
message("")
message(" *** WITHOUT_GIT - WARNING!")
message(" *** By choosing the WITHOUT_GIT option you have waived all rights for support,")
message(" *** and accept that or all requests for support or assistance sent to the core")
message(" *** developers will be rejected. This due to that we will be unable to detect")
message(" *** what revision of the codebase you are using in a proper way.")
message(" *** We remind you that you need to use the repository codebase and a supported")
message(" *** version of git for the revision-hash to work, and be allowed to ask for")
message(" *** support if needed.")
else()
message("* Use GIT revision hash : Yes (default)")
endif()

message("")
45 changes: 45 additions & 0 deletions issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!--- (**********************************)
(** Fill in the following fields **)
(**********************************)
(you can delete all rows before description and after operating system when creating issue)
For SQL fixes:
search for existing issues, if a bug report exist for the issue you are trying to fix and it's opened post there.
don't modify WDB fields without supply one sniff of those fields (censure guids, character names, anything blizzard can use to identify source)
don't hardcode guids.
don't DELETE + INSERT to update only few fields of one row.
don't use database names.
don't put ' around numbers.
don't put ( ) if they aren't needed.
use only 1 DELETE + INSERT when we add multiple items to one table, unless you are scripting multiple creatures.
start fix by -- in case some previous sql misses proper ending.
DELETE by guid AND entry to be sure we don't delete existing spawns.
start sql code with 3 ` sql --->

**Description:**

CHANGEME Description of the problem or issue here.
If this is a crash, post the crashlog (upload to https://gist.github.com/).

**Expected behaviour:**

CHANGEME Tell us what should happen instead.

**Steps to reproduce the problem:**

1. CHANGEME Step 1 include entries of affected creatures / items / quests with a link to the relevant wowhead page.
2. Step 2
3. Step 3

**LC rev. hash/commit:**

CHANGEME Copy the result of server debug command (if you need to run it from client get prat addon)

**Operating system:**

CHANGEME OS


<!--- Notes
- This template is for problem reports. For other types of report, edit it accordingly.
- For fixes containing C++ changes, create a Pull Request.
--->
29 changes: 29 additions & 0 deletions pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!--- (**********************************)
(** Fill in the following fields **)
(**********************************) --->

**Changes proposed:**

-
-
-

**Issues addressed:**

Closes # (insert issue tracker number)


**Tests performed:**

(Does it build, tested in-game, etc.)


**Known issues and TODO list:** (add/remove lines as needed)

- [ ]
- [ ]


<!--- Notes
- Enable the setting "[√] Allow edits from maintainers." when creating your pull request.
--->
12 changes: 6 additions & 6 deletions revision_data.h.in.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
#define _MYSQL_EXECUTABLE R"(@MYSQL_EXECUTABLE@)"
#define _FULL_DATABASE "LegionCore_world_735.26972_2024_10_23.sql"
#define _HOTFIXES_DATABASE "LegionCore_hotfixes_735.26972_2024_10_23.sql"
#define VER_COMPANYNAME_STR "LegionCore"
#define VER_LEGALCOPYRIGHT_STR "(c)2024 LegionCore"
#define VER_FILEVERSION 0,0,0
#define VER_FILEVERSION_STR "LegionCore 2024-09-22"
#define VER_PRODUCTVERSION VER_FILEVERSION
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
#define VER_COMPANYNAME_STR "LegionCore"
#define VER_LEGALCOPYRIGHT_STR "(c)@rev_year@ LegionCore"
#define VER_FILEVERSION 0,0,0
#define VER_FILEVERSION_STR "@rev_hash@ @rev_date@ (@rev_branch@ branch)"
#define VER_PRODUCTVERSION VER_FILEVERSION
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR
#endif // __REVISION_DATA_H__
10 changes: 10 additions & 0 deletions src/common/GitRevision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ char const* GitRevision::GetCMakeCommand()
return _CMAKE_COMMAND;
}

char const* GitRevision::GetCMakeVersion()
{
return _CMAKE_VERSION;
}

char const* GitRevision::GetHostOSVersion()
{
return _CMAKE_HOST_SYSTEM;
}

char const* GitRevision::GetBuildDirectory()
{
return _BUILD_DIRECTORY;
Expand Down
2 changes: 2 additions & 0 deletions src/common/GitRevision.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ namespace GitRevision
char const* GetDate();
char const* GetBranch();
char const* GetCMakeCommand();
char const* GetCMakeVersion();
char const* GetHostOSVersion();
char const* GetBuildDirectory();
char const* GetSourceDirectory();
char const* GetMySQLExecutable();
Expand Down
4 changes: 3 additions & 1 deletion src/server/game/DataStores/DB2Stores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ DB2Manager& DB2Manager::Instance()
return instance;
}

void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
uint32 DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
{
uint32 oldMSTime = getMSTime();

Expand Down Expand Up @@ -1591,6 +1591,8 @@ void DB2Manager::LoadStores(std::string const& dataPath, uint32 defaultLocale)
InitDB2CustomStores();

TC_LOG_INFO("server.loading", ">> Initialized " SZFMTD " DB2 data stores in %u ms", _stores.size(), GetMSTimeDiffToNow(oldMSTime));

return availableDb2Locales;
}

void DB2Manager::InitDB2CustomStores()
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/DataStores/DB2Stores.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class DB2Manager

static DB2Manager& Instance();

void LoadStores(std::string const& dataPath, uint32 defaultLocale);
uint32 LoadStores(std::string const& dataPath, uint32 defaultLocale);
void InitDB2CustomStores();
static DB2StorageBase const* GetStorage(uint32 type);
void LoadingExtraHotfixData();
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Maps/TransportMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ typedef std::map<uint32, TransportAnimation> TransportAnimationContainer;

class TransportMgr
{
friend void DB2Manager::LoadStores(std::string const&, uint32);
friend uint32 DB2Manager::LoadStores(std::string const&, uint32);

public:
static TransportMgr* instance();
Expand Down
3 changes: 2 additions & 1 deletion src/server/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ rate_values{}, m_int_configs{}, m_bool_configs{}, m_float_configs{}, m_NextRando
m_pvpMysticCount = 0;

m_defaultDbcLocale = LOCALE_enUS;
m_availableDbcLocaleMask = 0;

m_isClosed = false;

Expand Down Expand Up @@ -1616,7 +1617,7 @@ void World::SetInitialWorldSettings()
CharacterDatabase.Execute(stmt);

TC_LOG_INFO("server.loading", "Loading db2 info...");
sDB2Manager.LoadStores(m_dataPath, m_defaultDbcLocale);
m_availableDbcLocaleMask = sDB2Manager.LoadStores(m_dataPath, m_defaultDbcLocale);

TC_LOG_INFO("server.loading", "Loading hotfix info...");
sDB2Manager.LoadHotfixData();
Expand Down
3 changes: 3 additions & 0 deletions src/server/game/World/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ class World

void UpdateRealmCharCount(uint32 accid);

LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if (m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; }

// used World DB version
void LoadDBVersion();
char const* GetDBVersion() const { return m_DBVersion.c_str(); }
Expand Down Expand Up @@ -963,6 +965,7 @@ class World
uint32 m_playerLimit;
AccountTypes m_allowedSecurityLevel;
LocaleConstant m_defaultDbcLocale; // from config for one from loaded DBC locales
uint32 m_availableDbcLocaleMask; // by loaded DBC
bool m_allowMovement;
std::vector<std::string> _motd;
std::string m_dataPath;
Expand Down
Loading

0 comments on commit 8710a6c

Please sign in to comment.