add MegaLinter, .editorconfig and style fixes
This commit is contained in:
parent
e8ec59a852
commit
01497d35ca
31
.editorconfig
Normal file
31
.editorconfig
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
# Global
|
||||||
|
[*]
|
||||||
|
indent_style = unset
|
||||||
|
indent_size = 4
|
||||||
|
tab_width = 4
|
||||||
|
end_of_line = lf
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = unset
|
||||||
|
|
||||||
|
# Source
|
||||||
|
[*.{sh,bash,dash,ksh}]
|
||||||
|
indent_style = tab
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[builder]
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
# Other
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
[*.{txt,cfg,conf}]
|
||||||
|
indent_style = tab
|
88
.github/workflows/docs-autoupdate.yml
vendored
88
.github/workflows/docs-autoupdate.yml
vendored
@ -1,41 +1,47 @@
|
|||||||
name: docs-autoupdate
|
---
|
||||||
|
name: docs-autoupdate
|
||||||
on:
|
|
||||||
push:
|
# checkov:skip=CKV2_GHA_1:Write permission is needed to push changes to the repository
|
||||||
branches:
|
permissions: write-all
|
||||||
- '*'
|
|
||||||
|
on:
|
||||||
jobs:
|
push:
|
||||||
update-docs:
|
branches:
|
||||||
runs-on: ubuntu-latest
|
- '*'
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
jobs:
|
||||||
with:
|
update-docs:
|
||||||
fetch-depth: 0
|
runs-on: ubuntu-latest
|
||||||
- name: Update docs
|
steps:
|
||||||
run: |
|
- uses: actions/checkout@v3
|
||||||
if ! [[ -e USAGE.md ]]; then touch USAGE.md; fi
|
with:
|
||||||
mv USAGE.md USAGE.md.old
|
fetch-depth: 0
|
||||||
mkdir tools
|
- name: Update docs
|
||||||
cp ./builder ./tools/
|
run: |
|
||||||
chmod +x ./tools/builder
|
if ! [[ -e USAGE.md ]]; then touch USAGE.md; fi
|
||||||
echo '# KF2-BuildTools' >> USAGE.md
|
mv USAGE.md USAGE.md.old
|
||||||
echo '[![title](https://img.shields.io/badge/Help-Page-w)](https://github.com/GenZmeY/KF2-BuildTools)' >> USAGE.md
|
mkdir tools
|
||||||
echo '[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags)' >> USAGE.md
|
cp ./builder ./tools/
|
||||||
echo '[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml)' >> USAGE.md
|
chmod +x ./tools/builder
|
||||||
echo '```' >> USAGE.md
|
{
|
||||||
./tools/builder -nch >> USAGE.md
|
echo '# KF2-BuildTools'
|
||||||
echo '```' >> USAGE.md
|
echo '[![title](https://img.shields.io/badge/Help-Page-w)](https://github.com/GenZmeY/KF2-BuildTools)'
|
||||||
if ! cmp -s USAGE.md USAGE.md.old; then
|
echo '[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags)'
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
echo '[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml)'
|
||||||
git config --local user.name "github-actions"
|
echo '```text'
|
||||||
git add USAGE.md
|
./tools/builder -nch
|
||||||
git commit -m "Update USAGE.md to version $(git describe 2> /dev/null)"
|
echo '```'
|
||||||
else
|
} >> USAGE.md
|
||||||
echo "No change, skip updating USAGE.md"
|
if ! cmp -s USAGE.md USAGE.md.old; then
|
||||||
fi
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
- name: Push changes
|
git config --local user.name "github-actions"
|
||||||
uses: ad-m/github-push-action@master
|
git add USAGE.md
|
||||||
with:
|
git commit -m "Update USAGE.md to version $(git describe 2> /dev/null)"
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
else
|
||||||
branch: ${{ github.ref }}
|
echo "No change, skip updating USAGE.md"
|
||||||
|
fi
|
||||||
|
- name: Push changes
|
||||||
|
uses: ad-m/github-push-action@master
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
branch: ${{ github.ref }}
|
||||||
|
73
.github/workflows/mega-linter.yml
vendored
Normal file
73
.github/workflows/mega-linter.yml
vendored
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
---
|
||||||
|
name: MegaLinter
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
env:
|
||||||
|
APPLY_FIXES: none
|
||||||
|
APPLY_FIXES_EVENT: pull_request
|
||||||
|
APPLY_FIXES_MODE: commit
|
||||||
|
DISABLE: SPELL
|
||||||
|
DISABLE_ERRORS_LINTERS: REPOSITORY_CHECKOV # Barks at write-permission on docs-autoupdate.yml which I need
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.ref }}-${{ github.workflow }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: MegaLinter
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: MegaLinter
|
||||||
|
id: ml
|
||||||
|
uses: oxsecurity/megalinter@v6
|
||||||
|
env:
|
||||||
|
VALIDATE_ALL_CODEBASE: true
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Archive production artifacts
|
||||||
|
if: ${{ success() }} || ${{ failure() }}
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: MegaLinter reports
|
||||||
|
path: |
|
||||||
|
megalinter-reports
|
||||||
|
mega-linter.log
|
||||||
|
|
||||||
|
- name: Create Pull Request with applied fixes
|
||||||
|
id: cpr
|
||||||
|
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
|
||||||
|
uses: peter-evans/create-pull-request@v5
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
||||||
|
commit-message: "[MegaLinter] Apply linters automatic fixes"
|
||||||
|
title: "[MegaLinter] Apply linters automatic fixes"
|
||||||
|
labels: bot
|
||||||
|
- name: Create PR output
|
||||||
|
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
|
||||||
|
run: |
|
||||||
|
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
||||||
|
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
||||||
|
|
||||||
|
- name: Prepare commit
|
||||||
|
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
|
||||||
|
run: sudo chown -Rc $UID .git/
|
||||||
|
- name: Commit and push applied linter fixes
|
||||||
|
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository)
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v4
|
||||||
|
with:
|
||||||
|
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
|
||||||
|
commit_message: "[MegaLinter] Apply linters fixes"
|
||||||
|
commit_user_name: megalinter-bot
|
||||||
|
commit_user_email: nicolas.vuillamy@ox.security
|
20
.github/workflows/shellcheck-dev.yml
vendored
20
.github/workflows/shellcheck-dev.yml
vendored
@ -1,20 +0,0 @@
|
|||||||
name: shellcheck-dev
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- '*'
|
|
||||||
- '!master'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
shellcheck:
|
|
||||||
name: shellcheck
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Run ShellCheck
|
|
||||||
uses: ludeeus/action-shellcheck@master
|
|
||||||
env:
|
|
||||||
SHELLCHECK_OPTS: -x
|
|
||||||
with:
|
|
||||||
additional_files: 'builder'
|
|
19
.github/workflows/shellcheck-master.yml
vendored
19
.github/workflows/shellcheck-master.yml
vendored
@ -1,19 +0,0 @@
|
|||||||
name: shellcheck
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
shellcheck:
|
|
||||||
name: shellcheck
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Run ShellCheck
|
|
||||||
uses: ludeeus/action-shellcheck@master
|
|
||||||
env:
|
|
||||||
SHELLCHECK_OPTS: -x
|
|
||||||
with:
|
|
||||||
additional_files: 'builder'
|
|
22
.github/workflows/shellcheck.yml
vendored
Normal file
22
.github/workflows/shellcheck.yml
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
---
|
||||||
|
name: shellcheck
|
||||||
|
|
||||||
|
permissions: read-all
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
shellcheck:
|
||||||
|
name: shellcheck
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Run ShellCheck
|
||||||
|
uses: ludeeus/action-shellcheck@master
|
||||||
|
env:
|
||||||
|
SHELLCHECK_OPTS: -x
|
||||||
|
with:
|
||||||
|
additional_files: 'builder'
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
3rd-party-bin
|
3rd-party-bin
|
||||||
shellcheck.exe
|
shellcheck.exe
|
||||||
|
@ -7,7 +7,7 @@ StripSource="True"
|
|||||||
|
|
||||||
# Mutators to be compiled
|
# Mutators to be compiled
|
||||||
# Specify them with a space as a separator,
|
# Specify them with a space as a separator,
|
||||||
# Mutators will be compiled in the specified order
|
# Mutators will be compiled in the specified order
|
||||||
PackageBuildOrder="SomePackageName SomePackageNameMut"
|
PackageBuildOrder="SomePackageName SomePackageNameMut"
|
||||||
|
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ PackageBuildOrder="SomePackageName SomePackageNameMut"
|
|||||||
|
|
||||||
# Mutators that will be uploaded to the workshop
|
# Mutators that will be uploaded to the workshop
|
||||||
# Specify them with a space as a separator,
|
# Specify them with a space as a separator,
|
||||||
# The order doesn't matter
|
# The order doesn't matter
|
||||||
PackageUpload="SomePackageName SomePackageNameMut"
|
PackageUpload="SomePackageName SomePackageNameMut"
|
||||||
|
|
||||||
|
|
||||||
|
31
README.md
31
README.md
@ -1,26 +1,27 @@
|
|||||||
# KF2-BuildTools
|
# KF2-BuildTools
|
||||||
[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags)
|
[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags)
|
||||||
[![shellcheck](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/shellcheck-master.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/shellcheck-master.yml)
|
[![shellcheck](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/shellcheck-master.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/shellcheck-master.yml)
|
||||||
|
[![MegaLinter](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/mega-linter.yml/badge.svg?branch=master)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/mega-linter.yml)
|
||||||
[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml)
|
[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml)
|
||||||
[![license](https://img.shields.io/github/license/GenZmeY/KF2-Server-Extension)](LICENSE)
|
[![license](https://img.shields.io/github/license/GenZmeY/KF2-Server-Extension)](LICENSE)
|
||||||
|
|
||||||
# Features:
|
## Features
|
||||||
- Build, brew, test and upload to Steam Workshop;
|
- Build, brew, test and upload to Steam Workshop;
|
||||||
- No need to edit KFEditor.ini at all;
|
- No need to edit KFEditor.ini at all;
|
||||||
- Sources can be stored in any path;
|
- Sources can be stored in any path;
|
||||||
- Easily switch between different projects.
|
- Easily switch between different projects.
|
||||||
|
|
||||||
# Requirements
|
## Requirements
|
||||||
- [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/);
|
- [Killing Floor 2](https://store.steampowered.com/app/232090/Killing_Floor_2/);
|
||||||
- Killing Floor 2 - SDK;
|
- Killing Floor 2 - SDK;
|
||||||
- [git-bash](https://git-scm.com/download/win).
|
- [git-bash](https://git-scm.com/download/win).
|
||||||
|
|
||||||
# Add to your project
|
## Add to your project
|
||||||
Make sure that the location of folders and files in your project as follows (Correct it if it's not):
|
Make sure that the location of folders and files in your project as follows (Correct it if it's not):
|
||||||
`/<PackageName>/Classes/*.uc`
|
`/<PackageName>/Classes/*.uc`
|
||||||
|
|
||||||
**There are two ways to add KF2-BuildTools to your project:**
|
**There are two ways to add KF2-BuildTools to your project:**
|
||||||
## 1. As [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
|
### 1. As [git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
|
||||||
Open git-bash and go to your project: `cd <your_project_path>`
|
Open git-bash and go to your project: `cd <your_project_path>`
|
||||||
Add submodule: `git submodule add https://github.com/GenZmeY/KF2-BuildTools tools`
|
Add submodule: `git submodule add https://github.com/GenZmeY/KF2-BuildTools tools`
|
||||||
|
|
||||||
@ -28,18 +29,18 @@ Add submodule: `git submodule add https://github.com/GenZmeY/KF2-BuildTools tool
|
|||||||
Get updates: `pushd tools && git pull && popd`
|
Get updates: `pushd tools && git pull && popd`
|
||||||
Commit the changes: `git add tools && git commit -m 'update tools'`
|
Commit the changes: `git add tools && git commit -m 'update tools'`
|
||||||
|
|
||||||
## 2. As standalone script
|
### 2. As standalone script
|
||||||
Just create a `tools` folder and put [builder](builder) there.
|
Just create a `tools` folder and put [builder](builder) there.
|
||||||
Now you can use the script in the same way as in the first case, but you will have to update it yourself.
|
Now you can use the script in the same way as in the first case, but you will have to update it yourself.
|
||||||
|
|
||||||
# Usage
|
## Usage
|
||||||
Available commands can be found here: [USAGE.md](USAGE.md)
|
Available commands can be found here: [USAGE.md](USAGE.md)
|
||||||
|
|
||||||
If you have a simple mutator or game mode, then the usage is also simple: just use [the commands](USAGE.md) to compile, test and upload to the steam workshop.
|
If you have a simple mutator or game mode, then the usage is also simple: just use [the commands](USAGE.md) to compile, test and upload to the steam workshop.
|
||||||
|
|
||||||
![demo](example.gif)
|
![demo](example.gif)
|
||||||
|
|
||||||
## The result can be found here:
|
### The result can be found here
|
||||||
**Compiled packages:**
|
**Compiled packages:**
|
||||||
`C:\Users\<username>\Documents\My Games\KillingFloor2\KFGame\Unpublished\`
|
`C:\Users\<username>\Documents\My Games\KillingFloor2\KFGame\Unpublished\`
|
||||||
|
|
||||||
@ -49,20 +50,20 @@ If you have a simple mutator or game mode, then the usage is also simple: just u
|
|||||||
**Uploaded packages:**
|
**Uploaded packages:**
|
||||||
your steam workshop 🙃
|
your steam workshop 🙃
|
||||||
|
|
||||||
# Usage (Advanced)
|
## Usage (Advanced)
|
||||||
If your project contains several mutators, *.upk files, external dependencies, or you want to customize the whole process in more details, then this section is for you.
|
If your project contains several mutators, *.upk files, external dependencies, or you want to customize the whole process in more details, then this section is for you.
|
||||||
|
|
||||||
## Setup
|
### Setup
|
||||||
When you run compilation for the first time or do `./tools/builder --init` `builder.cfg` appears in your project folder.
|
When you run compilation for the first time or do `./tools/builder --init` `builder.cfg` appears in your project folder.
|
||||||
Edit it to set build/test/upload options. The config contains the necessary comments inside.
|
Edit it to set build/test/upload options. The config contains the necessary comments inside.
|
||||||
|
|
||||||
Edit the files in the `PublicationContent` folder - they are responsible for the description in the Steam Workshop.
|
Edit the files in the `PublicationContent` folder - they are responsible for the description in the Steam Workshop.
|
||||||
|
|
||||||
## Project filesystem
|
### Project filesystem
|
||||||
If you have *.upk or localization files, they must be in a specific location.
|
If you have *.upk or localization files, they must be in a specific location.
|
||||||
|
|
||||||
Change the filesystem of the project to such a form that everything works correctly:
|
Change the filesystem of the project to such a form that everything works correctly:
|
||||||
```
|
```text
|
||||||
/SomePackageName1
|
/SomePackageName1
|
||||||
*.upk
|
*.upk
|
||||||
/Classes
|
/Classes
|
||||||
@ -84,7 +85,7 @@ Change the filesystem of the project to such a form that everything works correc
|
|||||||
/Config
|
/Config
|
||||||
*.ini
|
*.ini
|
||||||
/BrewedPC
|
/BrewedPC
|
||||||
*.*
|
*.*
|
||||||
/tools
|
/tools
|
||||||
builder
|
builder
|
||||||
builder.cfg
|
builder.cfg
|
||||||
@ -93,7 +94,7 @@ builder.cfg
|
|||||||
**Note:** Use the `BrewedPC` folder for additional content such as sound files for your weapons or other stuff. This will be copied to the final BrewedPC before being uploaded to the workshop.
|
**Note:** Use the `BrewedPC` folder for additional content such as sound files for your weapons or other stuff. This will be copied to the final BrewedPC before being uploaded to the workshop.
|
||||||
By the way, this allows you to use a script to upload maps (although this was not its original purpose). Just put the map(s) in `BrewedPC` (don't forget to edit the `PublicationContent`) and run `./tools/builder -u`.
|
By the way, this allows you to use a script to upload maps (although this was not its original purpose). Just put the map(s) in `BrewedPC` (don't forget to edit the `PublicationContent`) and run `./tools/builder -u`.
|
||||||
|
|
||||||
## Examples (Projects that use KF2-BuildTools)
|
### Examples (Projects that use KF2-BuildTools)
|
||||||
**Simplest case (one mutator):**
|
**Simplest case (one mutator):**
|
||||||
- [AdminAutoLogin](https://github.com/GenZmeY/KF2-AdminAutoLogin)
|
- [AdminAutoLogin](https://github.com/GenZmeY/KF2-AdminAutoLogin)
|
||||||
- [StartWave](https://github.com/GenZmeY/KF2-StartWave)
|
- [StartWave](https://github.com/GenZmeY/KF2-StartWave)
|
||||||
@ -112,5 +113,5 @@ By the way, this allows you to use a script to upload maps (although this was no
|
|||||||
**two mutators are uploaded to the steam workshop:**
|
**two mutators are uploaded to the steam workshop:**
|
||||||
- [UnofficialMod](https://github.com/GenZmeY/UnofficialMod)
|
- [UnofficialMod](https://github.com/GenZmeY/UnofficialMod)
|
||||||
|
|
||||||
# License
|
## License
|
||||||
[GNU GPLv3](LICENSE)
|
[GNU GPLv3](LICENSE)
|
||||||
|
2
TODO.md
2
TODO.md
@ -1,2 +1,2 @@
|
|||||||
# TODO:
|
# TODO
|
||||||
- [ ] improve error parser (class vs name mismatch, etc...)
|
- [ ] improve error parser (class vs name mismatch, etc...)
|
||||||
|
2
USAGE.md
2
USAGE.md
@ -2,7 +2,7 @@
|
|||||||
[![title](https://img.shields.io/badge/Help-Page-w)](https://github.com/GenZmeY/KF2-BuildTools)
|
[![title](https://img.shields.io/badge/Help-Page-w)](https://github.com/GenZmeY/KF2-BuildTools)
|
||||||
[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags)
|
[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags)
|
||||||
[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml)
|
[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml)
|
||||||
```
|
```text
|
||||||
Usage: ./tools/builder OPTIONS
|
Usage: ./tools/builder OPTIONS
|
||||||
|
|
||||||
Compile, brew, test and upload your kf2 packages to the Steam Workshop.
|
Compile, brew, test and upload your kf2 packages to the Steam Workshop.
|
||||||
|
192
builder
192
builder
@ -37,11 +37,11 @@ function reg_readkey () # $1: path, $2: key
|
|||||||
function steamlib_by_steamid () # $1: SteamID
|
function steamlib_by_steamid () # $1: SteamID
|
||||||
{
|
{
|
||||||
local Path
|
local Path
|
||||||
|
|
||||||
if ! [[ -f "$SteamLibFoldersVdf" ]]; then
|
if ! [[ -f "$SteamLibFoldersVdf" ]]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while read -r Line
|
while read -r Line
|
||||||
do
|
do
|
||||||
if echo "$Line" | grep -Foq '"path"'; then
|
if echo "$Line" | grep -Foq '"path"'; then
|
||||||
@ -154,7 +154,7 @@ function get_latest () # $1: Reponame, $2: filename, $3: output filename
|
|||||||
local LatestTag=""
|
local LatestTag=""
|
||||||
LatestTag="$(curl --silent "$ApiUrl" | grep -Po '"tag_name": "\K.*?(?=")')"
|
LatestTag="$(curl --silent "$ApiUrl" | grep -Po '"tag_name": "\K.*?(?=")')"
|
||||||
local DownloadUrl="https://github.com/$1/releases/download/$LatestTag/$2"
|
local DownloadUrl="https://github.com/$1/releases/download/$LatestTag/$2"
|
||||||
|
|
||||||
msg "download $2 ($LatestTag)"
|
msg "download $2 ($LatestTag)"
|
||||||
mkdir -p "$(dirname "$3")/"
|
mkdir -p "$(dirname "$3")/"
|
||||||
curl -LJs "$DownloadUrl" -o "$3"
|
curl -LJs "$DownloadUrl" -o "$3"
|
||||||
@ -176,7 +176,7 @@ function repo_url () # $1: remote.origin.url
|
|||||||
if echo "$1" | grep -qoP '^https?://'; then
|
if echo "$1" | grep -qoP '^https?://'; then
|
||||||
echo "$1" | sed -r 's|\.git||'
|
echo "$1" | sed -r 's|\.git||'
|
||||||
else
|
else
|
||||||
echo "$1" | sed -r 's|^.+:(.+)\.git$|https://github.com/\1|'
|
echo "$1" | sed -r 's|^.+:(.+)\.git$|https://github.com/\1|'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ function warn () # $1: String
|
|||||||
function usage ()
|
function usage ()
|
||||||
{
|
{
|
||||||
local HelpMessage=""
|
local HelpMessage=""
|
||||||
|
|
||||||
HelpMessage="$(cat <<EOF
|
HelpMessage="$(cat <<EOF
|
||||||
${BLD}Usage:${DEF} $0 OPTIONS
|
${BLD}Usage:${DEF} $0 OPTIONS
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ EOF
|
|||||||
function version ()
|
function version ()
|
||||||
{
|
{
|
||||||
local Version=""
|
local Version=""
|
||||||
|
|
||||||
Version="$(git describe 2> /dev/null)"
|
Version="$(git describe 2> /dev/null)"
|
||||||
if [[ -z "$Version" ]]; then
|
if [[ -z "$Version" ]]; then
|
||||||
Version="(standalone)"
|
Version="(standalone)"
|
||||||
@ -309,7 +309,7 @@ function init ()
|
|||||||
local DefMap=""
|
local DefMap=""
|
||||||
local BaseList=""
|
local BaseList=""
|
||||||
local BaseListNext=""
|
local BaseListNext=""
|
||||||
|
|
||||||
if [[ -e "$MutBuilderConfig" ]]; then
|
if [[ -e "$MutBuilderConfig" ]]; then
|
||||||
if is_true "$ArgForce"; then
|
if is_true "$ArgForce"; then
|
||||||
msg "rewriting $(basename "$MutBuilderConfig")"
|
msg "rewriting $(basename "$MutBuilderConfig")"
|
||||||
@ -317,7 +317,7 @@ function init ()
|
|||||||
else
|
else
|
||||||
msg "creating new $(basename "$MutBuilderConfig")"
|
msg "creating new $(basename "$MutBuilderConfig")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d "$MutBrewedPCAddon" ]]; then
|
if [[ -d "$MutBrewedPCAddon" ]]; then
|
||||||
while read -r Map
|
while read -r Map
|
||||||
do
|
do
|
||||||
@ -338,14 +338,14 @@ function init ()
|
|||||||
PackageList="$PackageList $Package"
|
PackageList="$PackageList $Package"
|
||||||
fi
|
fi
|
||||||
done < <(find "$MutSource" -mindepth 2 -maxdepth 2 -type d -ipath '*/Classes' | sed -r 's|.+/([^/]+)/[^/]+|\1|' | sort)
|
done < <(find "$MutSource" -mindepth 2 -maxdepth 2 -type d -ipath '*/Classes' | sed -r 's|.+/([^/]+)/[^/]+|\1|' | sort)
|
||||||
|
|
||||||
if [[ -n "$PackageList" ]]; then
|
if [[ -n "$PackageList" ]]; then
|
||||||
msg "packages found: $(print_list "$PackageList" ", ")"
|
msg "packages found: $(print_list "$PackageList" ", ")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# DISCLAMER: BigO nightmare (*)
|
# DISCLAMER: BigO nightmare (*)
|
||||||
# Remove seniors with a weak psyche from the screen
|
# Remove seniors with a weak psyche from the screen
|
||||||
#
|
#
|
||||||
# (*) As planned though:
|
# (*) As planned though:
|
||||||
# Initialized once and quickly even on large projects,
|
# Initialized once and quickly even on large projects,
|
||||||
# There is no point in optimizing this
|
# There is no point in optimizing this
|
||||||
@ -377,7 +377,7 @@ function init ()
|
|||||||
BaseList="$BaseListNext"
|
BaseList="$BaseListNext"
|
||||||
BaseListNext=""
|
BaseListNext=""
|
||||||
done
|
done
|
||||||
|
|
||||||
# find available gamemodes
|
# find available gamemodes
|
||||||
BaseList='KFGameInfo_'
|
BaseList='KFGameInfo_'
|
||||||
BaseListNext=''
|
BaseListNext=''
|
||||||
@ -409,23 +409,23 @@ function init ()
|
|||||||
BaseListNext=""
|
BaseListNext=""
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$AviableMutators" ]]; then
|
if [[ -n "$AviableMutators" ]]; then
|
||||||
msg "mutators found: $(print_list "$AviableMutators" ", ")"
|
msg "mutators found: $(print_list "$AviableMutators" ", ")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$AviableGamemodes" ]]; then
|
if [[ -z "$AviableGamemodes" ]]; then
|
||||||
DefGamemode="KFGameContent.KFGameInfo_Survival"
|
DefGamemode="KFGameContent.KFGameInfo_Survival"
|
||||||
else
|
else
|
||||||
msg "custom gamemodes found: $(print_list "$AviableGamemodes" ", ")"
|
msg "custom gamemodes found: $(print_list "$AviableGamemodes" ", ")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$AviableMaps" ]]; then
|
if [[ -z "$AviableMaps" ]]; then
|
||||||
DefMap="KF-Nuked"
|
DefMap="KF-Nuked"
|
||||||
else
|
else
|
||||||
msg "maps found: $(print_list "$AviableMaps" ", ")"
|
msg "maps found: $(print_list "$AviableMaps" ", ")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_true "$ArgForce" || ! [[ -e "$MutBuilderConfig" ]]; then
|
if is_true "$ArgForce" || ! [[ -e "$MutBuilderConfig" ]]; then
|
||||||
cat > "$MutBuilderConfig" <<EOF
|
cat > "$MutBuilderConfig" <<EOF
|
||||||
### Build parameters ###
|
### Build parameters ###
|
||||||
@ -437,7 +437,7 @@ StripSource="True"
|
|||||||
|
|
||||||
# Mutators to be compiled
|
# Mutators to be compiled
|
||||||
# Specify them with a space as a separator,
|
# Specify them with a space as a separator,
|
||||||
# Mutators will be compiled in the specified order
|
# Mutators will be compiled in the specified order
|
||||||
PackageBuildOrder="$PackageList"
|
PackageBuildOrder="$PackageList"
|
||||||
|
|
||||||
|
|
||||||
@ -446,7 +446,7 @@ PackageBuildOrder="$PackageList"
|
|||||||
# Packages you want to brew using @peelz's patched KFEditor.
|
# Packages you want to brew using @peelz's patched KFEditor.
|
||||||
# Useful for cases where regular brew doesn't put *.upk inside the package.
|
# Useful for cases where regular brew doesn't put *.upk inside the package.
|
||||||
# Specify them with a space as a separator,
|
# Specify them with a space as a separator,
|
||||||
# The order doesn't matter
|
# The order doesn't matter
|
||||||
PackagePeelzBrew=""
|
PackagePeelzBrew=""
|
||||||
|
|
||||||
|
|
||||||
@ -454,7 +454,7 @@ PackagePeelzBrew=""
|
|||||||
|
|
||||||
# Mutators that will be uploaded to the workshop
|
# Mutators that will be uploaded to the workshop
|
||||||
# Specify them with a space as a separator,
|
# Specify them with a space as a separator,
|
||||||
# The order doesn't matter
|
# The order doesn't matter
|
||||||
PackageUpload="$PackageList"
|
PackageUpload="$PackageList"
|
||||||
|
|
||||||
|
|
||||||
@ -492,16 +492,16 @@ Args=""
|
|||||||
EOF
|
EOF
|
||||||
msg "$(basename "$MutBuilderConfig") created" "${GRN}"
|
msg "$(basename "$MutBuilderConfig") created" "${GRN}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [[ -d "$MutPubContent" ]]; then mkdir -p "$MutPubContent"; fi
|
if ! [[ -d "$MutPubContent" ]]; then mkdir -p "$MutPubContent"; fi
|
||||||
|
|
||||||
ProjectName="$(basename "$(readlink -e "$MutSource")")"
|
ProjectName="$(basename "$(readlink -e "$MutSource")")"
|
||||||
|
|
||||||
if is_true "$ArgForce" || ! [[ -e "$MutPubContentTitle" ]]; then
|
if is_true "$ArgForce" || ! [[ -e "$MutPubContentTitle" ]]; then
|
||||||
echo "$ProjectName" > "$MutPubContentTitle"
|
echo "$ProjectName" > "$MutPubContentTitle"
|
||||||
msg "$(basename "$MutPubContentTitle") created" "${GRN}"
|
msg "$(basename "$MutPubContentTitle") created" "${GRN}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_true "$ArgForce" || ! [[ -e "$MutPubContentDescription" ]]; then
|
if is_true "$ArgForce" || ! [[ -e "$MutPubContentDescription" ]]; then
|
||||||
:> "$MutPubContentDescription"
|
:> "$MutPubContentDescription"
|
||||||
if [[ -n "$AviableGamemodes" ]] || [[ -n "$AviableMutators" ]] || [[ -n "$AviableMaps" ]]; then
|
if [[ -n "$AviableGamemodes" ]] || [[ -n "$AviableMutators" ]] || [[ -n "$AviableMaps" ]]; then
|
||||||
@ -517,7 +517,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
echo "" >> "$MutPubContentDescription"
|
echo "" >> "$MutPubContentDescription"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GitRemoteUrl="$(repo_url "$(git config --get remote.origin.url)")"
|
GitRemoteUrl="$(repo_url "$(git config --get remote.origin.url)")"
|
||||||
if [[ -n "$GitRemoteUrl" ]]; then
|
if [[ -n "$GitRemoteUrl" ]]; then
|
||||||
{
|
{
|
||||||
@ -526,7 +526,7 @@ EOF
|
|||||||
echo ""
|
echo ""
|
||||||
} >> "$MutPubContentDescription"
|
} >> "$MutPubContentDescription"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GitUsername="$(git config --get user.name)"
|
GitUsername="$(git config --get user.name)"
|
||||||
if [[ -n "$GitUsername" ]]; then
|
if [[ -n "$GitUsername" ]]; then
|
||||||
{
|
{
|
||||||
@ -535,10 +535,10 @@ EOF
|
|||||||
echo ""
|
echo ""
|
||||||
} >> "$MutPubContentDescription"
|
} >> "$MutPubContentDescription"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "$(basename "$MutPubContentDescription") created" "${GRN}"
|
msg "$(basename "$MutPubContentDescription") created" "${GRN}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_true "$ArgForce" || [[ "$(preview_extension)" == "None" ]]; then
|
if is_true "$ArgForce" || [[ "$(preview_extension)" == "None" ]]; then
|
||||||
if [[ -e "$DummyPreview" ]]; then
|
if [[ -e "$DummyPreview" ]]; then
|
||||||
cp -f "$DummyPreview" "${MutPubContentPreview}.png"
|
cp -f "$DummyPreview" "${MutPubContentPreview}.png"
|
||||||
@ -547,7 +547,7 @@ EOF
|
|||||||
fi
|
fi
|
||||||
msg "$(basename "${MutPubContentPreview}.png") created" "${GRN}"
|
msg "$(basename "${MutPubContentPreview}.png") created" "${GRN}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_true "$ArgForce" || ! [[ -e "$MutPubContentTags" ]]; then
|
if is_true "$ArgForce" || ! [[ -e "$MutPubContentTags" ]]; then
|
||||||
:> "$MutPubContentTags"
|
:> "$MutPubContentTags"
|
||||||
if [[ -n "$AviableGamemodes" ]]; then
|
if [[ -n "$AviableGamemodes" ]]; then
|
||||||
@ -574,14 +574,14 @@ function preview_extension ()
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "None"
|
echo "None"
|
||||||
}
|
}
|
||||||
|
|
||||||
function read_settings ()
|
function read_settings ()
|
||||||
{
|
{
|
||||||
if ! [[ -f "$MutBuilderConfig" ]]; then init; fi
|
if ! [[ -f "$MutBuilderConfig" ]]; then init; fi
|
||||||
|
|
||||||
if bash -n "$MutBuilderConfig"; then
|
if bash -n "$MutBuilderConfig"; then
|
||||||
# shellcheck source=./.shellcheck/builder.cfg
|
# shellcheck source=./.shellcheck/builder.cfg
|
||||||
source "$MutBuilderConfig"
|
source "$MutBuilderConfig"
|
||||||
@ -595,9 +595,9 @@ function merge_package () # $1: What, $2: Where
|
|||||||
local ModificationTime=""
|
local ModificationTime=""
|
||||||
local ModificationTimeNew=""
|
local ModificationTimeNew=""
|
||||||
local PID=""
|
local PID=""
|
||||||
|
|
||||||
msg "merge $1 into $2"
|
msg "merge $1 into $2"
|
||||||
|
|
||||||
if is_true "$ArgHoldEditor"; then
|
if is_true "$ArgHoldEditor"; then
|
||||||
pushd "$KFWin64" &> /dev/null
|
pushd "$KFWin64" &> /dev/null
|
||||||
CMD //C "$(basename "$KFEditorMergePackages")" make "$1" "$2"
|
CMD //C "$(basename "$KFEditorMergePackages")" make "$1" "$2"
|
||||||
@ -627,16 +627,16 @@ function merge_package () # $1: What, $2: Where
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$KFWin64/$1" # cleanup (manual)
|
rm -f "$KFWin64/$1" # cleanup (manual)
|
||||||
}
|
}
|
||||||
|
|
||||||
function merge_packages () # $1: Mutator name
|
function merge_packages () # $1: Mutator name
|
||||||
{
|
{
|
||||||
msg "merge packages for $1.u"
|
msg "merge packages for $1.u"
|
||||||
|
|
||||||
cp -f "$KFUnpublishScript/$1.u" "$KFWin64"
|
cp -f "$KFUnpublishScript/$1.u" "$KFWin64"
|
||||||
|
|
||||||
while read -r Upk
|
while read -r Upk
|
||||||
do
|
do
|
||||||
cp -f "$Upk" "$KFWin64"
|
cp -f "$Upk" "$KFWin64"
|
||||||
@ -653,7 +653,7 @@ function parse_log () # $1: Logfile
|
|||||||
local Message=''
|
local Message=''
|
||||||
|
|
||||||
local I=1
|
local I=1
|
||||||
if grep -qP ' Error:(.+:)? Error, ' "$1"; then # check to prevent a very strange crash
|
if grep -qP ' Error:(.+:)? Error, ' "$1"; then # check to prevent a very strange crash
|
||||||
while read -r Error
|
while read -r Error
|
||||||
do
|
do
|
||||||
if [[ -z "$Error" ]]; then break; fi
|
if [[ -z "$Error" ]]; then break; fi
|
||||||
@ -670,7 +670,7 @@ function parse_log () # $1: Logfile
|
|||||||
((I+=1))
|
((I+=1))
|
||||||
done < <(grep -P ' Error:(.+:)? Error, ' "$1")
|
done < <(grep -P ' Error:(.+:)? Error, ' "$1")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -qP ' Warning:(.+:)? Warning, ' "$1"; then # and here too
|
if grep -qP ' Warning:(.+:)? Warning, ' "$1"; then # and here too
|
||||||
while read -r Warning
|
while read -r Warning
|
||||||
do
|
do
|
||||||
@ -711,49 +711,49 @@ function compile ()
|
|||||||
local StripSourceArg=""
|
local StripSourceArg=""
|
||||||
local PID=""
|
local PID=""
|
||||||
local Logfile=""
|
local Logfile=""
|
||||||
|
|
||||||
read_settings
|
read_settings
|
||||||
|
|
||||||
if ! command -v multini &> /dev/null; then
|
if ! command -v multini &> /dev/null; then
|
||||||
get_latest_multini "$ThirdPartyBin/multini.exe"
|
get_latest_multini "$ThirdPartyBin/multini.exe"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$PackageBuildOrder" ]]; then
|
if [[ -z "$PackageBuildOrder" ]]; then
|
||||||
die "No packages found! Check project filesystem, fix config and try again"
|
die "No packages found! Check project filesystem, fix config and try again"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
multini --del "$KFEditorConf" 'ModPackages' 'ModPackages'
|
multini --del "$KFEditorConf" 'ModPackages' 'ModPackages'
|
||||||
for Package in $PackageBuildOrder
|
for Package in $PackageBuildOrder
|
||||||
do
|
do
|
||||||
multini --add "$KFEditorConf" 'ModPackages' 'ModPackages' "$Package"
|
multini --add "$KFEditorConf" 'ModPackages' 'ModPackages' "$Package"
|
||||||
done
|
done
|
||||||
multini --set "$KFEditorConf" 'ModPackages' 'ModPackagesInPath' "$(cygpath -w "$MutSource")"
|
multini --set "$KFEditorConf" 'ModPackages' 'ModPackagesInPath' "$(cygpath -w "$MutSource")"
|
||||||
|
|
||||||
rm -rf "$KFUnpublish" "$KFPublish"
|
rm -rf "$KFUnpublish" "$KFPublish"
|
||||||
|
|
||||||
mkdir -p "$KFUnpublishPackages" "$KFUnpublishScript"
|
mkdir -p "$KFUnpublishPackages" "$KFUnpublishScript"
|
||||||
|
|
||||||
for Package in $PackageBuildOrder
|
for Package in $PackageBuildOrder
|
||||||
do
|
do
|
||||||
find "$MutSource/$Package" -type f -iname '*.upk' -not -ipath "*/Weapons/*" -exec cp -f {} "$KFUnpublishPackages" \;
|
find "$MutSource/$Package" -type f -iname '*.upk' -not -ipath "*/Weapons/*" -exec cp -f {} "$KFUnpublishPackages" \;
|
||||||
find "$MutSource/$Package" -type d -iname 'WwiseAudio' -exec cp -rf {} "$KFUnpublishBrewedPC" \;
|
find "$MutSource/$Package" -type d -iname 'WwiseAudio' -exec cp -rf {} "$KFUnpublishBrewedPC" \;
|
||||||
find "$MutSource/$Package" -type d -iname 'Weapons' -exec cp -rf {} "$KFUnpublishPackages" \;
|
find "$MutSource/$Package" -type d -iname 'Weapons' -exec cp -rf {} "$KFUnpublishPackages" \;
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -d "$MutLocalization" ]]; then
|
if [[ -d "$MutLocalization" ]]; then
|
||||||
mkdir -p "$KFUnpublishLocalization"
|
mkdir -p "$KFUnpublishLocalization"
|
||||||
cp -rf "$MutLocalization"/* "$KFUnpublishLocalization"
|
cp -rf "$MutLocalization"/* "$KFUnpublishLocalization"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d "$MutConfig" ]]; then
|
if [[ -d "$MutConfig" ]]; then
|
||||||
mkdir -p "$KFUnpublishConfig"
|
mkdir -p "$KFUnpublishConfig"
|
||||||
cp -rf "$MutConfig"/* "$KFUnpublishConfig"
|
cp -rf "$MutConfig"/* "$KFUnpublishConfig"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_true "$StripSource"; then StripSourceArg="-stripsource"; fi
|
if is_true "$StripSource"; then StripSourceArg="-stripsource"; fi
|
||||||
|
|
||||||
msg "compilation"
|
msg "compilation"
|
||||||
|
|
||||||
if is_true "$ArgHoldEditor"; then
|
if is_true "$ArgHoldEditor"; then
|
||||||
CMD //C "$(cygpath -w "$KFEditor")" make $StripSourceArg -useunpublished
|
CMD //C "$(cygpath -w "$KFEditor")" make $StripSourceArg -useunpublished
|
||||||
parse_log "$(find_log)"
|
parse_log "$(find_log)"
|
||||||
@ -770,7 +770,7 @@ function compile ()
|
|||||||
Logfile="$(find_log)"
|
Logfile="$(find_log)"
|
||||||
if compiled; then
|
if compiled; then
|
||||||
msg "successfully compiled" "${GRN}"
|
msg "successfully compiled" "${GRN}"
|
||||||
|
|
||||||
msg "wait for the log"
|
msg "wait for the log"
|
||||||
while ! grep -qF 'Log file closed' "$Logfile"
|
while ! grep -qF 'Log file closed' "$Logfile"
|
||||||
do
|
do
|
||||||
@ -786,7 +786,7 @@ function compile ()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find "$KFUnpublish" -type d -empty -delete
|
find "$KFUnpublish" -type d -empty -delete
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -796,12 +796,12 @@ function publish_common ()
|
|||||||
mkdir -p "$KFPublishLocalization"
|
mkdir -p "$KFPublishLocalization"
|
||||||
cp -rf "$MutLocalization"/* "$KFPublishLocalization"
|
cp -rf "$MutLocalization"/* "$KFPublishLocalization"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d "$MutConfig" ]]; then
|
if [[ -d "$MutConfig" ]]; then
|
||||||
mkdir -p "$KFPublishConfig"
|
mkdir -p "$KFPublishConfig"
|
||||||
cp -rf "$MutConfig"/* "$KFPublishConfig"
|
cp -rf "$MutConfig"/* "$KFPublishConfig"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d "$MutBrewedPCAddon" ]]; then
|
if [[ -d "$MutBrewedPCAddon" ]]; then
|
||||||
mkdir -p "$KFPublishBrewedPC"
|
mkdir -p "$KFPublishBrewedPC"
|
||||||
cp -rf "$MutBrewedPCAddon"/* "$KFPublishBrewedPC"
|
cp -rf "$MutBrewedPCAddon"/* "$KFPublishBrewedPC"
|
||||||
@ -833,15 +833,15 @@ function brew ()
|
|||||||
{
|
{
|
||||||
local PackageBrew=""
|
local PackageBrew=""
|
||||||
local PID=""
|
local PID=""
|
||||||
|
|
||||||
msg "brewing"
|
msg "brewing"
|
||||||
|
|
||||||
read_settings
|
read_settings
|
||||||
|
|
||||||
if ! compiled; then
|
if ! compiled; then
|
||||||
die "You must compile packages before brewing. Use --compile option for this." 2
|
die "You must compile packages before brewing. Use --compile option for this." 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$PackagePeelzBrew" ]]; then
|
if [[ -z "$PackagePeelzBrew" ]]; then
|
||||||
PackageBrew="$PackageBuildOrder"
|
PackageBrew="$PackageBuildOrder"
|
||||||
else
|
else
|
||||||
@ -852,17 +852,17 @@ function brew ()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -rf "$KFPublish"
|
rm -rf "$KFPublish"
|
||||||
|
|
||||||
mkdir -p "$KFPublishBrewedPC" "$KFPublishPackages"
|
mkdir -p "$KFPublishBrewedPC" "$KFPublishPackages"
|
||||||
|
|
||||||
for Package in $PackageBuildOrder
|
for Package in $PackageBuildOrder
|
||||||
do
|
do
|
||||||
find "$MutSource/$Package" -type d -iname 'WwiseAudio' -exec cp -rf {} "$KFPublishBrewedPC" \;
|
find "$MutSource/$Package" -type d -iname 'WwiseAudio' -exec cp -rf {} "$KFPublishBrewedPC" \;
|
||||||
find "$MutSource/$Package" -type d -iname 'Weapons' -exec cp -rf {} "$KFPublishPackages" \;
|
find "$MutSource/$Package" -type d -iname 'Weapons' -exec cp -rf {} "$KFPublishPackages" \;
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n "$PackageBrew" ]]; then
|
if [[ -n "$PackageBrew" ]]; then
|
||||||
if is_true "$ArgHoldEditor"; then
|
if is_true "$ArgHoldEditor"; then
|
||||||
pushd "$KFWin64" &> /dev/null
|
pushd "$KFWin64" &> /dev/null
|
||||||
@ -887,20 +887,20 @@ function brew ()
|
|||||||
die "brewing failed"
|
die "brewing failed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$PackagePeelzBrew" ]]; then
|
if [[ -n "$PackagePeelzBrew" ]]; then
|
||||||
msg "peelz brewing"
|
msg "peelz brewing"
|
||||||
|
|
||||||
if ! [[ -x "$KFEditorPatcher" ]]; then
|
if ! [[ -x "$KFEditorPatcher" ]]; then
|
||||||
get_latest_kfeditor_patcher "$KFEditorPatcher"
|
get_latest_kfeditor_patcher "$KFEditorPatcher"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "patching $(basename "$KFEditor")"
|
msg "patching $(basename "$KFEditor")"
|
||||||
pushd "$KFWin64" &> /dev/null
|
pushd "$KFWin64" &> /dev/null
|
||||||
CMD //C "$(basename "$KFEditorPatcher")"
|
CMD //C "$(basename "$KFEditorPatcher")"
|
||||||
popd &> /dev/null
|
popd &> /dev/null
|
||||||
msg "successfully patched" "${GRN}"
|
msg "successfully patched" "${GRN}"
|
||||||
|
|
||||||
for Package in $PackagePeelzBrew
|
for Package in $PackagePeelzBrew
|
||||||
do
|
do
|
||||||
merge_packages "$Package"
|
merge_packages "$Package"
|
||||||
@ -908,20 +908,20 @@ function brew ()
|
|||||||
find "$MutSource/$Package" -type f -iname '*.upk' -not -ipath '*/Weapons/*' -printf "%f\n" | xargs -I{} find "$KFPublishBrewedPC" -type f -iname {} -delete
|
find "$MutSource/$Package" -type f -iname '*.upk' -not -ipath '*/Weapons/*' -printf "%f\n" | xargs -I{} find "$KFPublishBrewedPC" -type f -iname {} -delete
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "successfully brewed" "${GRN}"
|
msg "successfully brewed" "${GRN}"
|
||||||
|
|
||||||
rm -f "$KFPublishBrewedPC"/*.tmp
|
rm -f "$KFPublishBrewedPC"/*.tmp
|
||||||
|
|
||||||
find "$KFPublish" -type d -empty -delete
|
find "$KFPublish" -type d -empty -delete
|
||||||
}
|
}
|
||||||
|
|
||||||
function publish_unpublished ()
|
function publish_unpublished ()
|
||||||
{
|
{
|
||||||
warn "uploading without brewing${DEF}"
|
warn "uploading without brewing${DEF}"
|
||||||
|
|
||||||
mkdir -p "$KFPublishBrewedPC" "$KFPublishScript" "$KFPublishPackages"
|
mkdir -p "$KFPublishBrewedPC" "$KFPublishScript" "$KFPublishPackages"
|
||||||
|
|
||||||
for Package in $PackageUpload
|
for Package in $PackageUpload
|
||||||
do
|
do
|
||||||
cp -f "$KFUnpublishScript/$Package.u" "$KFPublishScript"
|
cp -f "$KFUnpublishScript/$Package.u" "$KFPublishScript"
|
||||||
@ -929,7 +929,7 @@ function publish_unpublished ()
|
|||||||
find "$MutSource/$Package" -type d -iname 'WwiseAudio' -exec cp -rf {} "$KFPublishBrewedPC" \;
|
find "$MutSource/$Package" -type d -iname 'WwiseAudio' -exec cp -rf {} "$KFPublishBrewedPC" \;
|
||||||
find "$MutSource/$Package" -type d -iname 'Weapons' -exec cp -rf {} "$KFPublishPackages" \;
|
find "$MutSource/$Package" -type d -iname 'Weapons' -exec cp -rf {} "$KFPublishPackages" \;
|
||||||
done
|
done
|
||||||
|
|
||||||
find "$KFPublish" -type d -empty -delete
|
find "$KFPublish" -type d -empty -delete
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,36 +938,36 @@ function upload ()
|
|||||||
local PreparedWsDir=""
|
local PreparedWsDir=""
|
||||||
local Preview=""
|
local Preview=""
|
||||||
local Success="False"
|
local Success="False"
|
||||||
|
|
||||||
read_settings
|
read_settings
|
||||||
|
|
||||||
if ! compiled && ! test -d "$MutBrewedPCAddon"; then
|
if ! compiled && ! test -d "$MutBrewedPCAddon"; then
|
||||||
die "You must compile packages before uploading. Use --compile option for this." 2
|
die "You must compile packages before uploading. Use --compile option for this." 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -d "$KFPublish" ]]; then
|
if [[ -d "$KFPublish" ]]; then
|
||||||
brew_cleanup
|
brew_cleanup
|
||||||
elif [[ -d "$KFUnpublish" ]]; then
|
elif [[ -d "$KFUnpublish" ]]; then
|
||||||
publish_unpublished
|
publish_unpublished
|
||||||
fi
|
fi
|
||||||
|
|
||||||
publish_common
|
publish_common
|
||||||
|
|
||||||
Preview="${MutPubContentPreview}.$(preview_extension)"
|
Preview="${MutPubContentPreview}.$(preview_extension)"
|
||||||
|
|
||||||
if ! [[ -e "$Preview" ]]; then
|
if ! [[ -e "$Preview" ]]; then
|
||||||
die "No preview image in PublicationContent" 2
|
die "No preview image in PublicationContent" 2
|
||||||
elif [[ $(stat --printf="%s" "$Preview") -ge 1048576 ]]; then
|
elif [[ $(stat --printf="%s" "$Preview") -ge 1048576 ]]; then
|
||||||
warn "The size of $(basename "$Preview") is greater than 1mb. Steam may prevent you from loading content with this image. if you get an error while loading - try using a smaller preview."
|
warn "The size of $(basename "$Preview") is greater than 1mb. Steam may prevent you from loading content with this image. if you get an error while loading - try using a smaller preview."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if grep -Fq '"' "$MutPubContentDescription"; then
|
if grep -Fq '"' "$MutPubContentDescription"; then
|
||||||
warn "Double quotes (\") found in $(basename "$MutPubContentDescription"), this may prevent the item from being uploaded to the workshop"
|
warn "Double quotes (\") found in $(basename "$MutPubContentDescription"), this may prevent the item from being uploaded to the workshop"
|
||||||
warn "Remove double quotes if there are problems uploading to the workshop"
|
warn "Remove double quotes if there are problems uploading to the workshop"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find "$KFPublish" -type d -empty -delete
|
find "$KFPublish" -type d -empty -delete
|
||||||
|
|
||||||
# it's a bad idea to use the $KFPublish folder for upload
|
# it's a bad idea to use the $KFPublish folder for upload
|
||||||
# because in that case some files won't get uploaded to the workshop for some reason
|
# because in that case some files won't get uploaded to the workshop for some reason
|
||||||
# so create a temporary folder to get around this
|
# so create a temporary folder to get around this
|
||||||
@ -981,9 +981,9 @@ function upload ()
|
|||||||
\$MicroTxItem "false"
|
\$MicroTxItem "false"
|
||||||
\$PackageDirectory "$(cygpath -w "$PreparedWsDir")"
|
\$PackageDirectory "$(cygpath -w "$PreparedWsDir")"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
cp -rf "$KFPublish" "$PreparedWsDir"
|
cp -rf "$KFPublish" "$PreparedWsDir"
|
||||||
|
|
||||||
msg "upload to steam workshop"
|
msg "upload to steam workshop"
|
||||||
while read -r Output
|
while read -r Output
|
||||||
do
|
do
|
||||||
@ -994,10 +994,10 @@ EOF
|
|||||||
err "UploadTool: $Output"
|
err "UploadTool: $Output"
|
||||||
fi
|
fi
|
||||||
done < <("$KFWorkshop" "$(basename "$MutWsInfo")" 2>&1)
|
done < <("$KFWorkshop" "$(basename "$MutWsInfo")" 2>&1)
|
||||||
|
|
||||||
rm -rf "$PreparedWsDir"
|
rm -rf "$PreparedWsDir"
|
||||||
rm -f "$MutWsInfo"
|
rm -f "$MutWsInfo"
|
||||||
|
|
||||||
if is_true "$Success"; then
|
if is_true "$Success"; then
|
||||||
msg "successfully uploaded to steam workshop" "${GRN}"
|
msg "successfully uploaded to steam workshop" "${GRN}"
|
||||||
else
|
else
|
||||||
@ -1008,16 +1008,16 @@ EOF
|
|||||||
function run_test ()
|
function run_test ()
|
||||||
{
|
{
|
||||||
local UseUnpublished=""
|
local UseUnpublished=""
|
||||||
|
|
||||||
read_settings
|
read_settings
|
||||||
|
|
||||||
if brewed "$PackageBuildOrder"; then
|
if brewed "$PackageBuildOrder"; then
|
||||||
msg "run test (brewed)"
|
msg "run test (brewed)"
|
||||||
else
|
else
|
||||||
UseUnpublished="-useunpublished"
|
UseUnpublished="-useunpublished"
|
||||||
msg "run test (unpublished)"
|
msg "run test (unpublished)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CMD //C "$(cygpath -w "$KFGame")" "$Map?Difficulty=$Difficulty?GameLength=$GameLength?Game=$Game?Mutator=$Mutators?$Args" $UseUnpublished -log
|
CMD //C "$(cygpath -w "$KFGame")" "$Map?Difficulty=$Difficulty?GameLength=$GameLength?Game=$Game?Mutator=$Mutators?$Args" $UseUnpublished -log
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1026,7 +1026,7 @@ function parse_combined_params () # $1: Combined short parameters
|
|||||||
local Param="${1}"
|
local Param="${1}"
|
||||||
local Length="${#Param}"
|
local Length="${#Param}"
|
||||||
local Position=1
|
local Position=1
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
if [[ "$Position" -ge "$Length" ]]; then break; fi
|
if [[ "$Position" -ge "$Length" ]]; then break; fi
|
||||||
@ -1034,7 +1034,7 @@ function parse_combined_params () # $1: Combined short parameters
|
|||||||
he ) ((Position+=2)); ArgHoldEditor="true" ;;
|
he ) ((Position+=2)); ArgHoldEditor="true" ;;
|
||||||
nc ) ((Position+=2)); ArgNoColors="true" ;;
|
nc ) ((Position+=2)); ArgNoColors="true" ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$Position" -ge "$Length" ]]; then break; fi
|
if [[ "$Position" -ge "$Length" ]]; then break; fi
|
||||||
case "${Param:$Position:1}" in
|
case "${Param:$Position:1}" in
|
||||||
h ) ((Position+=1)); ArgHelp="true" ;;
|
h ) ((Position+=1)); ArgHelp="true" ;;
|
||||||
@ -1083,41 +1083,41 @@ function main ()
|
|||||||
parse_params "$@"
|
parse_params "$@"
|
||||||
setup_colors
|
setup_colors
|
||||||
export PATH="$PATH:$ThirdPartyBin"
|
export PATH="$PATH:$ThirdPartyBin"
|
||||||
|
|
||||||
# Modifiers
|
# Modifiers
|
||||||
if is_true "$ArgDebug"; then set -o xtrace; fi
|
if is_true "$ArgDebug"; then set -o xtrace; fi
|
||||||
|
|
||||||
# Help
|
# Help
|
||||||
if is_true "$ArgVersion" && is_true "$ArgHelp"; then version; usage; die "" 0; fi
|
if is_true "$ArgVersion" && is_true "$ArgHelp"; then version; usage; die "" 0; fi
|
||||||
if is_true "$ArgVersion"; then version; die "" 0; fi
|
if is_true "$ArgVersion"; then version; die "" 0; fi
|
||||||
if is_true "$ArgHelp"; then usage; die "" 0; fi
|
if is_true "$ArgHelp"; then usage; die "" 0; fi
|
||||||
|
|
||||||
# Checks
|
# Checks
|
||||||
if [[ -z "$KFSteamLibraryFolder" ]]; then
|
if [[ -z "$KFSteamLibraryFolder" ]]; then
|
||||||
err "\"Killing Floor 2\" not found"
|
err "\"Killing Floor 2\" not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$KFSDKSteamLibraryFolder" ]]; then
|
if [[ -z "$KFSDKSteamLibraryFolder" ]]; then
|
||||||
err "\"Killing Floor 2 - SDK\" not found"
|
err "\"Killing Floor 2 - SDK\" not found"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$KFSteamLibraryFolder" ]] || [[ -z "$KFSDKSteamLibraryFolder" ]]; then
|
if [[ -z "$KFSteamLibraryFolder" ]] || [[ -z "$KFSDKSteamLibraryFolder" ]]; then
|
||||||
die "" 1
|
die "" 1
|
||||||
elif [[ "$KFPath" != "$KFSDKPath" ]]; then
|
elif [[ "$KFPath" != "$KFSDKPath" ]]; then
|
||||||
warn "\"Killing Floor 2\" and \"Killing Floor 2 - SDK\" installed in different steam library folders."
|
warn "\"Killing Floor 2\" and \"Killing Floor 2 - SDK\" installed in different steam library folders."
|
||||||
warn "If you get errors, install them in the same steam library folder."
|
warn "If you get errors, install them in the same steam library folder."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Backup
|
# Backup
|
||||||
if is_true "$ArgCompile" || is_true "$ArgBrew"; then backup_kfeditorconf; fi
|
if is_true "$ArgCompile" || is_true "$ArgBrew"; then backup_kfeditorconf; fi
|
||||||
|
|
||||||
# Actions
|
# Actions
|
||||||
if is_true "$ArgInit"; then init; fi
|
if is_true "$ArgInit"; then init; fi
|
||||||
if is_true "$ArgCompile"; then compile; fi
|
if is_true "$ArgCompile"; then compile; fi
|
||||||
if is_true "$ArgBrew"; then brew; fi
|
if is_true "$ArgBrew"; then brew; fi
|
||||||
if is_true "$ArgUpload"; then upload; fi
|
if is_true "$ArgUpload"; then upload; fi
|
||||||
if is_true "$ArgTest"; then run_test; fi
|
if is_true "$ArgTest"; then run_test; fi
|
||||||
|
|
||||||
# Restore
|
# Restore
|
||||||
if is_true "$ArgCompile" || is_true "$ArgBrew"; then restore_kfeditorconf; fi
|
if is_true "$ArgCompile" || is_true "$ArgBrew"; then restore_kfeditorconf; fi
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user