Skip to content

Commit

Permalink
Merge pull request #222 from penev92/updateModTo20230225
Browse files Browse the repository at this point in the history
Update mod to release-20230225
  • Loading branch information
evgeniysergeev authored Jul 4, 2023
2 parents e0b95ce + 48a0b10 commit 87f3bd5
Show file tree
Hide file tree
Showing 119 changed files with 6,207 additions and 4,783 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Continuous Integration

on:
push:
pull_request:

jobs:
linux:
name: Linux (.NET 6.0)
runs-on: ubuntu-22.04

steps:
- name: Clone Repository
uses: actions/checkout@v3

- name: Install .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Prepare Environment
run: |
. mod.config;
awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format. File must be saved using unix-style (LF, not CRLF or CR) line endings.\n"; exit 1);
- name: Check Code
run: |
make check
make check-packaging-scripts
- name: Check Mod
run: |
sudo apt-get install lua5.1
make check-scripts
make test
linux-mono:
name: Linux (mono)
runs-on: ubuntu-22.04

steps:
- name: Clone Repository
uses: actions/checkout@v3

- name: Prepare Environment
run: |
. mod.config;
awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format. File must be saved using unix-style (LF, not CRLF or CR) line endings.\n"; exit 1);
- name: Check Code
run: |
# check-packaging-scripts does not depend on .net/mono, so is not needed here
mono --version
make RUNTIME=mono check
- name: Check Mod
run: |
# check-scripts does not depend on .net/mono, so is not needed here
make RUNTIME=mono test
windows:
name: Windows (.NET 6.0)
runs-on: windows-2019

steps:
- name: Clone Repository
uses: actions/checkout@v3

- name: Install .NET 6.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'

- name: Check Code
shell: powershell
run: |
# Work around runtime failures on the GH Actions runner
dotnet nuget add source https://api.nuget.org/v3/index.json -n nuget.org
.\make.ps1 check
- name: Check Mods
run: |
chocolatey install lua --version 5.1.5.52
$ENV:Path = $ENV:Path + ";C:\Program Files (x86)\Lua\5.1\"
.\make.ps1 check-scripts
.\make.ps1 test
13 changes: 7 additions & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"recommendations": [
"EditorConfig.EditorConfig",
"ms-dotnettools.csharp",
"openra.vscode-openra-lua",
"openra.oraide-vscode",
]
"recommendations": [
"EditorConfig.EditorConfig",
"ms-dotnettools.csharp",
"openra.oraide-vscode",
"openra.vscode-openra-lua",
"macabeus.vscode-fluent",
]
}
27 changes: 18 additions & 9 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@
"name": "d2",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}/engine/bin/OpenRA.dll",
"windows": {
"program": "${workspaceRoot}/engine/bin/OpenRA.exe",
},
"args": [
"Engine.EngineDir=${workspaceRoot}/engine",
"Engine.ModSearchPaths=${workspaceRoot}/mods",
"Game.Mod=d2",
"Debug.DisplayDeveloperSettings=true",
]
"Engine.EngineDir=${workspaceRoot}/engine",
"Engine.ModSearchPaths=${workspaceRoot}/mods, ${workspaceRoot}/engine/mods",
"Debug.DisplayDeveloperSettings=true",
],
"preLaunchTask": "build",
},
]
{
"name": "Launch Utility",
"type": "coreclr",
"request": "launch",
"program": "${workspaceRoot}/engine/bin/OpenRA.Utility.dll",
"args": ["d2", "--check-yaml"],
"env": {
"ENGINE_DIR": "${workspaceRoot}/engine",
"MOD_SEARCH_PATHS": "${workspaceRoot}/mods, ${workspaceRoot}/engine/mods"
},
"preLaunchTask": "build",
},
],
}
46 changes: 35 additions & 11 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "make",
"args": ["all"],
"windows": {
"command": "make.cmd"
}
}
]
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "make",
"args": ["all", "CONFIGURATION=Debug"],
"windows": {
"command": "make.cmd"
}
},
{
"label": "Run Utility",
"command": "dotnet ${workspaceRoot}/engine/bin/OpenRA.Utility.dll ${input:modId} ${input:command}",
"type": "shell",
"options": {
"env": {
"ENGINE_DIR": "${workspaceRoot}/engine",
"MOD_SEARCH_PATHS": "${workspaceRoot}/mods,${workspaceRoot}/engine/mods"
}
}
}
],
"inputs": [
{
"id": "modId",
"description": "ID of the mod to run",
"default": "d2",
"type": "promptString"
}, {
"id": "command",
"description": "Name of the command + parameters",
"default": "",
"type": "promptString"
},
]
}
76 changes: 76 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by private-messaging a project team member (users with a + in front
of their name) via our IRC channel (#openra on Libera –
[webchat](https://web.libera.chat/#openra)). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
57 changes: 43 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
# to compile, run:
# make
#
# to compile using Mono (version 6.4 or greater) instead of .NET 6, run:
# make RUNTIME=mono
#
# to compile using system libraries for native dependencies, run:
# make [RUNTIME=net6] TARGETPLATFORM=unix-generic
#
# to remove the files created by compiling, run:
# make clean
#
Expand All @@ -13,7 +19,10 @@
# make check-scripts
#
# to check the engine and your mod dlls for StyleCop violations, run:
# make check
# make [RUNTIME=net6] check
#
# to check your mod yaml for errors, run:
# make [RUNTIME=net6] test
#
# the following are internal sdk helpers that are not intended to be run directly:
# make check-variables
Expand All @@ -36,31 +45,40 @@ MOD_ID = $(shell cat user.config mod.config 2> /dev/null | awk -F= '/MOD_ID/ { p
ENGINE_DIRECTORY = $(shell cat user.config mod.config 2> /dev/null | awk -F= '/ENGINE_DIRECTORY/ { print $$2; exit }')
MOD_SEARCH_PATHS = "$(shell $(PYTHON) -c "import os; print(os.path.realpath('.'))")/mods,./mods"

WHITELISTED_OPENRA_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_OPENRA_ASSEMBLIES/ { print $$2; exit }')"
WHITELISTED_THIRDPARTY_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_THIRDPARTY_ASSEMBLIES/ { print $$2; exit }')"
WHITELISTED_CORE_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_CORE_ASSEMBLIES/ { print $$2; exit }')"
WHITELISTED_MOD_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_MOD_ASSEMBLIES/ { print $$2; exit }')"

MANIFEST_PATH = "mods/$(MOD_ID)/mod.yaml"
HAS_LUAC = $(shell command -v luac 2> /dev/null)
LUA_FILES = $(shell find mods/*/maps/* -iname '*.lua' 2> /dev/null)
MOD_SOLUTION_FILES = $(shell find . -maxdepth 1 -iname '*.sln' 2> /dev/null)

MSBUILD = msbuild -verbosity:m -nologo
DOTNET = dotnet

RUNTIME ?= net6
CONFIGURATION ?= Release
DOTNET_RID = $(shell ${DOTNET} --info | grep RID: | cut -w -f3)
ARCH_X64 = $(shell echo ${DOTNET_RID} | grep x64)

ifndef TARGETPLATFORM
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
ifeq ($(UNAME_S),Darwin)
ifeq ($(ARCH_X64),)
TARGETPLATFORM = osx-arm64
else
TARGETPLATFORM = osx-x64
endif
else
ifeq ($(UNAME_M),x86_64)
TARGETPLATFORM = linux-x64
else
ifeq ($(UNAME_M),aarch64)
TARGETPLATFORM = linux-arm64
else
TARGETPLATFORM = unix-generic
endif
endif
endif
endif

check-sdk-scripts:
@awk '/\r$$/ { exit(1); }' mod.config || (printf "Invalid mod.config format: file must be saved using unix-style (CR, not CRLF) line endings.\n"; exit 1)
Expand Down Expand Up @@ -123,18 +141,25 @@ check-variables:

engine: check-variables check-sdk-scripts
@./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1)
@cd $(ENGINE_DIRECTORY) && make TARGETPLATFORM=$(TARGETPLATFORM) all
@cd $(ENGINE_DIRECTORY) && make RUNTIME=$(RUNTIME) TARGETPLATFORM=$(TARGETPLATFORM) all

all: engine
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.18."; exit 1)
ifeq ($(RUNTIME), mono)
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 6.4."; exit 1)
ifneq ("$(MOD_SOLUTION_FILES)","")
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:Build -restore -p:Configuration=Release -p:TargetPlatform=$(TARGETPLATFORM) \;
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:Build -restore -p:Configuration=${CONFIGURATION} -p:TargetPlatform=$(TARGETPLATFORM) -p:Mono=true \;
endif
else
@find . -maxdepth 1 -name '*.sln' -exec $(DOTNET) build -c ${CONFIGURATION} -p:TargetPlatform=$(TARGETPLATFORM) \;
endif

clean: engine
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.18."; exit 1)
ifneq ("$(MOD_SOLUTION_FILES)","")
ifeq ($(RUNTIME), mono)
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:clean \;
else
@find . -maxdepth 1 -name '*.sln' -exec $(DOTNET) clean \;
endif
endif
@cd $(ENGINE_DIRECTORY) && make clean

Expand All @@ -154,11 +179,15 @@ endif

check: engine
ifneq ("$(MOD_SOLUTION_FILES)","")
@echo "Compiling in debug mode..."
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:Build -restore -p:Configuration=Debug -p:TargetPlatform=$(TARGETPLATFORM) \;
@echo "Compiling in Debug mode..."
ifeq ($(RUNTIME), mono)
# Enabling EnforceCodeStyleInBuild and GenerateDocumentationFile as a workaround for some code style rules (in particular IDE0005) being bugged and not reporting warnings/errors otherwise.
@$(MSBUILD) -t:build -restore -p:Configuration=Debug -warnaserror -p:TargetPlatform=$(TARGETPLATFORM) -p:Mono=true -p:EnforceCodeStyleInBuild=true -p:GenerateDocumentationFile=true
else
# Enabling EnforceCodeStyleInBuild and GenerateDocumentationFile as a workaround for some code style rules (in particular IDE0005) being bugged and not reporting warnings/errors otherwise.
@$(DOTNET) build -c Debug -nologo -warnaserror -p:TargetPlatform=$(TARGETPLATFORM) -p:EnforceCodeStyleInBuild=true -p:GenerateDocumentationFile=true
endif
endif
@echo "Checking runtime assemblies..."
@./utility.sh --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES) $(WHITELISTED_MOD_ASSEMBLIES)
@echo "Checking for explicit interface violations..."
@./utility.sh --check-explicit-interfaces
@echo "Checking for incorrect conditional trait interface overrides..."
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Mods.D2/AudioLoaders/VocLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ int Read(byte[] buffer, int offset, int count)

public class VocStream : Stream
{
VocFormat format;
readonly VocFormat format;
public VocStream(VocFormat format)
{
this.format = format;
Expand Down
Loading

0 comments on commit 87f3bd5

Please sign in to comment.