Merge pull request #178 from diamante0018/cleanup-project-folder
README + Cleanup project folder
This commit is contained in:
commit
2274d1dfee
317
Jenkinsfile
vendored
317
Jenkinsfile
vendored
@ -1,317 +0,0 @@
|
||||
#!groovy
|
||||
|
||||
/*
|
||||
This is our new pipeline script to do all of the building in, of and around IW4x.
|
||||
|
||||
Here's what it is supposed to do:
|
||||
|
||||
- Make sure Modern Warfare 2 is installed (CI should provide the folder like a custom tool)
|
||||
- Check out code from iw4x-data
|
||||
- Build the IW4x client library (this code repository)
|
||||
- Use iw4x.exe from the iw4x-data repository in order to build the zone files in iw4x-data
|
||||
- Package the IW4x client with the newly built data files
|
||||
|
||||
At this point it is done building everything, however afterwards we want the build server to
|
||||
also push the newly built files to an update repository, depending on the branch we're on.
|
||||
|
||||
- For "develop", release to the "iw4x-dev" branch on the repository server.
|
||||
- For "master", release to the "iw4x" branch on the repository server.
|
||||
|
||||
I'm looking into how the logic of pipelining works in detail before deciding on whether to
|
||||
throw in the IW4x Updater and the IW4x Node binaries in as well or not.
|
||||
*/
|
||||
|
||||
/*
|
||||
Note that this is just a rewrite of the jobs as they are currently set up on the production
|
||||
Jenkins server. This will allow every developer to tinker around with how the build process
|
||||
is set up. For those who want to play around with this, here's a bit of information:
|
||||
|
||||
- This is a Groovy script. Essentially Java but with less bullshit (like brackets and verbose writing).
|
||||
- This gets directly translated into a Jenkins pipeline.
|
||||
- If you have no idea how to handle scripts, get your hands off this file.
|
||||
- If you do not use Jenkins, get your hands off this file.
|
||||
- If you fuck this script up, I will kill you.
|
||||
*/
|
||||
|
||||
import groovy.transform.Field
|
||||
|
||||
@Field def configurations = [
|
||||
"Debug": [
|
||||
WorkspaceID: "build@debug",
|
||||
StashName: "iw4x-debug",
|
||||
MSBuildConfiguration: "Debug",
|
||||
PremakeArgs: "",
|
||||
Archive: true,
|
||||
],
|
||||
"Release": [
|
||||
WorkspaceID: "build@release",
|
||||
StashName: "iw4x-release",
|
||||
MSBuildConfiguration: "Release",
|
||||
PremakeArgs: "",
|
||||
Archive: true,
|
||||
],
|
||||
"Release with unit tests": [
|
||||
WorkspaceID: "build@release+unittests",
|
||||
StashName: "iw4x-release-unittests",
|
||||
MSBuildConfiguration: "Release",
|
||||
PremakeArgs: "--force-unit-tests",
|
||||
Archive: false,
|
||||
],
|
||||
].collect {k, v -> [k, v]}
|
||||
|
||||
@Field def testing = [
|
||||
"Debug": [
|
||||
WorkspaceID: "testing@debug",
|
||||
StashName: "iw4x-debug",
|
||||
],
|
||||
"Release": [
|
||||
WorkspaceID: "testing@release",
|
||||
StashName: "iw4x-release-unittests",
|
||||
],
|
||||
].collect {k, v -> [k, v]}
|
||||
|
||||
def jobWorkspace(id, f) {
|
||||
ws("workspace/${env.JOB_NAME.replaceAll(/[%$]/, "_")}@$id", f)
|
||||
}
|
||||
|
||||
def useShippedPremake(f) {
|
||||
def premakeHome = "${pwd()}\\tools"
|
||||
|
||||
withEnv(["PATH+=${premakeHome}"], f)
|
||||
}
|
||||
|
||||
def getIW4xExecutable() {
|
||||
step([
|
||||
$class: 'CopyArtifact',
|
||||
filter: '*',
|
||||
fingerprintArtifacts: true,
|
||||
projectName: 'iw4x/iw4x-executable/' + iw4xExecutableBranch(),
|
||||
selector: [
|
||||
$class: 'TriggeredBuildSelector',
|
||||
allowUpstreamDependencies: false,
|
||||
fallbackToLastSuccessful: true,
|
||||
upstreamFilterStrategy: 'UseGlobalSetting'
|
||||
]
|
||||
])
|
||||
}
|
||||
|
||||
// This will build the IW4x client.
|
||||
// We need a Windows Server with Visual Studio 2015, Premake5 and Git on it.
|
||||
def doBuild(cfg) {
|
||||
retry(5) {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
useShippedPremake {
|
||||
def outputDir = pwd()
|
||||
def msbuild = tool "Microsoft.NET MSBuild 15.0"
|
||||
bat "premake5 vs2017 ${cfg.PremakeArgs}"
|
||||
bat "\"${msbuild}\" build\\iw4x.sln \"/p:OutDir=$outputDir\\\\\" \"/p:Configuration=${cfg.MSBuildConfiguration}\""
|
||||
}
|
||||
|
||||
stash name: "${cfg.StashName}", includes: "*.dll,*.pdb"
|
||||
}
|
||||
|
||||
// This will run the unit tests for IW4x.
|
||||
// We need a Windows Server with MW2 on it.
|
||||
def doUnitTests(name) {
|
||||
mw2dir = tool "Modern Warfare 2"
|
||||
|
||||
unstash "$name"
|
||||
|
||||
// Get installed localization for correct zonefiles directory junction
|
||||
def localization = readFile("${tool "Modern Warfare 2"}/localization.txt").split("\r?\n")[0]
|
||||
|
||||
try {
|
||||
timeout(time: 10, unit: "MINUTES") {
|
||||
// Set up environment
|
||||
if (isUnix()) {
|
||||
def mw2dir = tool "Modern Warfare 2"
|
||||
sh """
|
||||
mkdir -p zone
|
||||
for f in main zone/dlc \"zone/$localization\"; do
|
||||
ln -sfv \"$mw2dir/\$f\" \"\$f\"
|
||||
done
|
||||
for f in \"$mw2dir\"/*.dll \"$mw2dir\"/*.txt \"$mw2dir\"/*.bmp; do
|
||||
ln -sfv \"\$f\" \"\$(basename \"\$f\")\"
|
||||
done
|
||||
"""
|
||||
} else {
|
||||
def mw2dir = tool "Modern Warfare 2"
|
||||
bat """
|
||||
mklink /J \"main\" \"$mw2dir\\main\"
|
||||
mkdir \"zone\"
|
||||
mklink /J \"zone\\dlc\" \"$mw2dir\\zone\\dlc\"
|
||||
mklink /J \"zone\\$localization\" \"$mw2dir\\zone\\$localization\"
|
||||
copy /y \"$mw2dir\\*.dll\"
|
||||
copy /y \"$mw2dir\\*.txt\"
|
||||
copy /y \"$mw2dir\\*.bmp\"
|
||||
"""
|
||||
}
|
||||
|
||||
// Run tests
|
||||
getIW4xExecutable()
|
||||
retry(2) {
|
||||
if (isUnix()) {
|
||||
sh "WINEDEBUG=warn+all wine iw4x.exe -tests; wineserver -w"
|
||||
} else {
|
||||
bat "iw4x.exe -tests"
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
println("${name} unit test interrupted (ran too long?)")
|
||||
} catch (Exception e) {
|
||||
println("${name} unit test failed.")
|
||||
if (isUnix()) {
|
||||
currentBuild.result = 'UNSTABLE'
|
||||
} else {
|
||||
throw e
|
||||
}
|
||||
} finally {
|
||||
// In all cases make sure to at least remove the directory junctions!
|
||||
if (!isUnix()) {
|
||||
bat """
|
||||
rmdir \"main\"
|
||||
rmdir \"zone\\dlc\"
|
||||
rmdir \"zone\\$localization\"
|
||||
"""
|
||||
}
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the IW4x executable branch to use
|
||||
def iw4xExecutableBranch() {
|
||||
try {
|
||||
return IW4X_EXECUTABLE_BRANCH;
|
||||
} catch(MissingPropertyException) {
|
||||
return "master";
|
||||
}
|
||||
}
|
||||
|
||||
// Job properties
|
||||
properties([
|
||||
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '30')),
|
||||
disableConcurrentBuilds(),
|
||||
gitLabConnection('iw4x'),
|
||||
[$class: 'LeastLoadDisabledProperty', leastLoadDisabled: false]
|
||||
])
|
||||
|
||||
gitlabBuilds(builds: ["Checkout & Versioning", "Build", "Testing", "Archiving"]) {
|
||||
// First though let's give this build a proper name
|
||||
stage("Checkout & Versioning") {
|
||||
gitlabCommitStatus(name: "Checkout & Versioning") {
|
||||
node("windows") {
|
||||
jobWorkspace("versioning") {
|
||||
if (env.BRANCH_NAME == 'master')
|
||||
{
|
||||
echo 'Reset build environment'
|
||||
deleteDir()
|
||||
}
|
||||
|
||||
retry(5) {
|
||||
checkout scm
|
||||
}
|
||||
|
||||
useShippedPremake {
|
||||
def version = bat(returnStdout: true, script: '@premake5 version').split("\r?\n")[2]
|
||||
|
||||
currentBuild.setDisplayName "$version (#${env.BUILD_NUMBER})"
|
||||
}
|
||||
|
||||
stash name: "jenkins-files", includes: "jenkins/**"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// For each available configuration generate a normal build and a unit test build.
|
||||
stage("Build") {
|
||||
gitlabCommitStatus(name: "Build") {
|
||||
def executions = [:]
|
||||
for (int i = 0; i < configurations.size(); i++) {
|
||||
def entry = configurations[i]
|
||||
|
||||
def configName = entry[0]
|
||||
def config = entry[1]
|
||||
|
||||
executions[configName] = {
|
||||
node("windows") {
|
||||
jobWorkspace(config.WorkspaceID) {
|
||||
doBuild(config)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
parallel executions
|
||||
}
|
||||
}
|
||||
|
||||
// Run unit tests on each configuration.
|
||||
stage("Testing") {
|
||||
gitlabCommitStatus(name: "Testing") {
|
||||
executions = [:]
|
||||
for (int i = 0; i < testing.size(); i++) {
|
||||
def entry = testing.get(i)
|
||||
|
||||
def testName = entry[0]
|
||||
def test = entry[1]
|
||||
|
||||
executions["$testName on Windows"] = {
|
||||
node("windows") {
|
||||
jobWorkspace(test.WorkspaceID) {
|
||||
doUnitTests(test.StashName)
|
||||
}
|
||||
}
|
||||
}
|
||||
executions["$testName on Linux"] = {
|
||||
node("docker && linux && amd64") {
|
||||
timeout(time: 10, unit: "MINUTES") {
|
||||
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'XTerm']) {
|
||||
def image = null
|
||||
dir("src") {
|
||||
unstash "jenkins-files"
|
||||
image = docker.build("github.com/IW4x/iw4x-client-testing-wine32", "--rm --force-rm -f jenkins/wine32.Dockerfile jenkins")
|
||||
deleteDir()
|
||||
}
|
||||
image.inside {
|
||||
doUnitTests(test.StashName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
parallel executions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Collect all the binaries and give each configuration its own subfolder
|
||||
stage("Archiving") {
|
||||
gitlabCommitStatus(name: "Archiving") {
|
||||
node("windows") { // any node will do
|
||||
jobWorkspace("archiving") {
|
||||
try {
|
||||
for (int i = 0; i < configurations.size(); i++) {
|
||||
def entry = configurations[i]
|
||||
|
||||
def configName = entry[0]
|
||||
def config = entry[1]
|
||||
|
||||
if (config.Archive) {
|
||||
dir(configName) {
|
||||
unstash config.StashName
|
||||
}
|
||||
}
|
||||
}
|
||||
archiveArtifacts artifacts: "**/*.dll,**/*.pdb", fingerprint: true
|
||||
} finally {
|
||||
deleteDir()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
32
README.md
32
README.md
@ -12,7 +12,7 @@
|
||||
## How to compile
|
||||
|
||||
- Run `premake5 vs2022` or use the delivered `generate.bat`.
|
||||
- Build via solution file in `build\iw4x.sln`. (You can use the `build.bat` script to do it quick and easy.)
|
||||
- Build via solution file in `build\iw4x.sln`.
|
||||
|
||||
## Premake arguments
|
||||
|
||||
@ -34,23 +34,21 @@
|
||||
## Command line arguments
|
||||
|
||||
| Argument | Description |
|
||||
|:----------------------------|:-----------------------------------------------|
|
||||
|:------------------------|:-----------------------------------------------|
|
||||
| `-tests` | Perform unit tests. |
|
||||
| `-entries` | Prints fast file info to the console. |
|
||||
| `-stdout` | Redirect stdout to the external console. |
|
||||
| `-console` | Enables external console. |
|
||||
| `-dedicated` | Dedicated server. |
|
||||
| `-scriptablehttp` | Adds HTTP console commands. |
|
||||
| `-bigdumps` | Enables dumps. |
|
||||
| `-reallybigdumps` | Unused. |
|
||||
| `-bigminidumps` | Mini dumps. |
|
||||
| `-reallybigminidumps` | Big mini dumps. |
|
||||
| `-dump` | Prints asset info to a .ents file. |
|
||||
| `-monitor` | Enables monitor. |
|
||||
| `-nointro` | Skips game's intro. |
|
||||
| `-version` | Prints IW4X version. |
|
||||
| `-zonebuilder` | Enables zone builder. |
|
||||
| `-nosteam` | Disables Steam features. |
|
||||
| `-entries` | Print to the console a list of every asset as they are loaded from zonefiles. |
|
||||
| `-stdout` | Redirect all logging output to the terminal iw4x is started from, or if there is none, creates a new terminal window to write log information in. |
|
||||
| `-console` | Allow the game to display its own separate interactive console window. |
|
||||
| `-dedicated` | Starts the game as a headless dedicated server. |
|
||||
| `-scriptablehttp` | Enable HTTP related gsc functions. |
|
||||
| `-bigminidumps` | Include all code sections from loaded modules in the dump. |
|
||||
| `-reallybigminidumps` | Include data sections from all loaded modules in the dump. |
|
||||
| `-dump` | Write info of loaded assets to the raw folder as they are being loaded. |
|
||||
| `-monitor` | This flag is for internal use and it is used to indicate if an external console is present. |
|
||||
| `-nointro` | Skip game's cinematic intro. |
|
||||
| `-version` | Print IW4x build info on startup. |
|
||||
| `-zonebuilder` | Start the interactive zonebuilder tool console instead of starting the game. |
|
||||
| `-nosteam` | Disable friends feature and do not update Steam about the game's current status just like an invisible mode. |
|
||||
|
||||
|
||||
## Disclaimer
|
||||
|
24
build.bat
24
build.bat
@ -1,24 +0,0 @@
|
||||
@echo off & setlocal
|
||||
|
||||
cd %~dp0
|
||||
|
||||
if exist "%PROGRAMFILES(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsMSBuildCmd.bat" call "%PROGRAMFILES(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsMSBuildCmd.bat"
|
||||
call msbuild /version >NUL 2>NUL
|
||||
if errorlevel 0 goto:build
|
||||
|
||||
if exist "%PROGRAMFILES(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\msbuild.exe" path %PROGRAMFILES(x86)%\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin;%PATH%
|
||||
call msbuild /version >NUL 2>NUL
|
||||
if errorlevel 0 goto:build
|
||||
|
||||
echo Couldn't find any MSBuild to build this project.
|
||||
echo Make sure you have Visual C++ Build Tools 2019 or Visual Studio 2019 installed.
|
||||
endlocal
|
||||
exit /B 1
|
||||
|
||||
:build
|
||||
call generate.bat
|
||||
set PLATFORM=Win32
|
||||
set CONFIGURATION=Release
|
||||
call msbuild /nologo /m /v:m %* build\iw4x.sln
|
||||
endlocal
|
||||
exit /B %ERRORLEVEL%
|
@ -1,46 +0,0 @@
|
||||
# Requires a decent modern Docker version (v1.10.x at least ideally)
|
||||
|
||||
# Use semi-official Arch Linux image with fixed versioning
|
||||
FROM archlinux/base
|
||||
|
||||
# Environment variables
|
||||
ENV WINEPREFIX /wine32
|
||||
ENV WINEARCH win32
|
||||
ENV WINEDEBUG -all
|
||||
|
||||
# Install Wine (32-bit)
|
||||
RUN \
|
||||
echo -e "#!/bin/sh\nwine \$@\nretval=\$?\nwineserver -w\nexit \$retval" > /usr/local/bin/wine-wrapper &&\
|
||||
chmod +x /usr/local/bin/wine-wrapper &&\
|
||||
\
|
||||
(\
|
||||
echo '' &&\
|
||||
echo '[multilib]' &&\
|
||||
echo 'Include = /etc/pacman.d/mirrorlist'\
|
||||
) >> /etc/pacman.conf &&\
|
||||
pacman -Sy --noconfirm \
|
||||
awk \
|
||||
lib32-gnutls \
|
||||
wine \
|
||||
wget \
|
||||
xorg-server-xvfb \
|
||||
pacman-contrib \
|
||||
awk \
|
||||
&&\
|
||||
\
|
||||
wine-wrapper wineboot.exe -i &&\
|
||||
wget -Ovcredist_x86.exe https://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03/vcredist_x86.exe &&\
|
||||
WINEDEBUG=+all-trace xvfb-run sh -c 'wine-wrapper vcredist_x86.exe /q' &&\
|
||||
rm vcredist_x86.exe &&\
|
||||
\
|
||||
pacman -Rs --noconfirm \
|
||||
xorg-server-xvfb \
|
||||
wget \
|
||||
&&\
|
||||
\
|
||||
find /. -name "*~" -type f -delete &&\
|
||||
rm -rf /tmp/* /var/tmp/* /usr/share/man/* /usr/share/info/* /usr/share/doc/* &&\
|
||||
pacman -Scc --noconfirm &&\
|
||||
rm -rf /var/lib/pacman/sync/*
|
||||
|
||||
USER 0
|
@ -78,21 +78,9 @@ namespace Components
|
||||
|
||||
//Exception::SuspendProcess();
|
||||
|
||||
bool doFullDump = Flags::HasFlag("bigdumps") || Flags::HasFlag("reallybigdumps");
|
||||
/*if (!doFullDump)
|
||||
{
|
||||
if (MessageBoxA(nullptr,
|
||||
Utils::String::VA("%s\n\n" // errorStr
|
||||
"Would you like to create a full crash dump for the developers (this can be 100mb or more)?\nNo will create small dumps that are automatically uploaded.", errorStr),
|
||||
"IW4x Error!", MB_YESNO | MB_ICONERROR) == IDYES)
|
||||
{
|
||||
doFullDump = true;
|
||||
}
|
||||
}*/
|
||||
|
||||
MessageBoxA(nullptr, errorStr.data(), "ERROR", MB_ICONERROR);
|
||||
|
||||
if (doFullDump)
|
||||
if ( Flags::HasFlag("bigminidumps"))
|
||||
{
|
||||
Exception::SetMiniDumpType(true, false);
|
||||
}
|
||||
|
@ -111,8 +111,8 @@ namespace Components
|
||||
|
||||
Friends::SortList();
|
||||
|
||||
int notify = Dvar::Var("cl_notifyFriendState").get<int>();
|
||||
if (gotOnline && (notify == -1 || (notify == 1 && !Game::CL_IsCgameInitialized())) && !Dvar::Var("ui_streamFriendly").get<bool>())
|
||||
const auto notify = Dvar::Var("cl_notifyFriendState").get<bool>();
|
||||
if (gotOnline && (!notify || (notify && !Game::CL_IsCgameInitialized())) && !Dvar::Var("ui_streamFriendly").get<bool>())
|
||||
{
|
||||
Game::Material* material = Friends::CreateAvatar(user);
|
||||
Toast::Show(material, entry->name, "is playing IW4x", 3000, [material]()
|
||||
@ -578,14 +578,19 @@ namespace Components
|
||||
|
||||
if (Dedicated::IsEnabled() || ZoneBuilder::IsEnabled() || Monitor::IsEnabled()) return;
|
||||
|
||||
Dvar::Register<bool>("cl_anonymous", false, Game::DVAR_FLAG_SAVED, "");
|
||||
Dvar::Register<int>("cl_notifyFriendState", 1, -1, 1, Game::DVAR_FLAG_SAVED, "");
|
||||
Dvar::Register<bool>("cl_anonymous", false, Game::DVAR_FLAG_SAVED, "Enable invisible mode for Steam");
|
||||
Dvar::Register<bool>("cl_notifyFriendState", true, Game::DVAR_FLAG_SAVED, "Update friends about current game status");
|
||||
|
||||
Command::Add("addFriend", [](Command::Params* params)
|
||||
{
|
||||
if (params->length() <= 1) return;
|
||||
if (params->length() < 2u)
|
||||
{
|
||||
Logger::Print("Usage: %s <Steam ID in hexadecimal format>\n", params->get(0));
|
||||
return;
|
||||
}
|
||||
|
||||
SteamID id;
|
||||
id.bits = atoll(params->get(1));
|
||||
id.bits = std::strtoull(params->get(1), nullptr, 16);
|
||||
|
||||
Friends::AddFriend(id);
|
||||
});
|
||||
|
@ -241,14 +241,13 @@ namespace Components
|
||||
{
|
||||
if (Flags::HasFlag("dump"))
|
||||
{
|
||||
Utils::IO::WriteFile(Utils::String::VA("raw/%s.ents", name.data()), asset.mapEnts->entityString);
|
||||
Utils::IO::WriteFile(Utils::String::VA("raw/%s.ents", name.data()), asset.mapEnts->entityString, true);
|
||||
}
|
||||
|
||||
static std::string mapEntities;
|
||||
FileSystem::File ents(name + ".ents");
|
||||
if (ents.exists())
|
||||
{
|
||||
mapEntities = ents.getBuffer();
|
||||
const auto& mapEntities = ents.getBuffer();
|
||||
asset.mapEnts->entityString = const_cast<char*>(mapEntities.data());
|
||||
asset.mapEnts->numEntityChars = mapEntities.size() + 1;
|
||||
}
|
||||
|
@ -156,8 +156,8 @@ namespace Steam
|
||||
gameID.type = 1; // k_EGameIDTypeGameMod
|
||||
gameID.appID = Proxy::AppId & 0xFFFFFF;
|
||||
|
||||
char* modId = const_cast<char*>("IW4x");
|
||||
gameID.modID = *reinterpret_cast<unsigned int*>(modId) | 0x80000000;
|
||||
const char* modId = "IW4x";
|
||||
gameID.modID = *reinterpret_cast<const unsigned int*>(modId) | 0x80000000;
|
||||
|
||||
Interface clientUtils(Proxy::ClientEngine->GetIClientUtils(Proxy::SteamPipe));
|
||||
clientUtils.invoke<void>("SetAppIDForCurrentPipe", Proxy::AppId, false);
|
||||
|
Loading…
Reference in New Issue
Block a user