Skip to content

Commit 5e1de71

Browse files
committed
Update scripts to work with the new engine toolchain.
1 parent a216dee commit 5e1de71

17 files changed

+319
-340
lines changed

.travis.yml

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
# Travis-CI Build for OpenRAModSDK
22
# see travis-ci.org for details
33

4+
dist: xenial
45
language: csharp
5-
mono: 4.6.1
6-
sudo: false
6+
mono: 5.20.1
77

88
addons:
99
apt:
1010
packages:
11+
- dpkg
1112
- liblua5.1-0
12-
- nsis
13-
- nsis-common
1413

1514
script:
1615
- make
@@ -20,18 +19,23 @@ script:
2019
if [ "${TRAVIS_TEST_PACKAGING}" == "True" ]; then make check-packaging-scripts && ./packaging/package-all.sh test-0 || travis_terminate 1; fi
2120

2221
before_deploy:
22+
- wget http://mirrors.kernel.org/ubuntu/pool/universe/n/nsis/nsis-common_3.03-2_all.deb
23+
- wget http://mirrors.kernel.org/ubuntu/pool/universe/n/nsis/nsis_3.03-2_amd64.deb
24+
- sudo dpkg -i nsis-common_3.03-2_all.deb
25+
- sudo dpkg -i nsis_3.03-2_amd64.deb
2326
- mkdir build
2427
- make check-packaging-scripts && cd build && ../packaging/package-all.sh ${TRAVIS_TAG} ${PWD} && cd ..
25-
- . mod.config
2628

2729
deploy:
2830
provider: releases
2931
api_key: ${GH_DEPLOY_API_KEY}
3032
file:
31-
- build/${PACKAGING_INSTALLER_NAME}-${TRAVIS_TAG}.exe
33+
- build/${PACKAGING_INSTALLER_NAME}-${TRAVIS_TAG}-x86.exe
34+
- build/${PACKAGING_INSTALLER_NAME}-${TRAVIS_TAG}-x64.exe
35+
- build/${PACKAGING_INSTALLER_NAME}-${TRAVIS_TAG}-x86-winportable.zip
36+
- build/${PACKAGING_INSTALLER_NAME}-${TRAVIS_TAG}-x64-winportable.zip
3237
- build/${PACKAGING_INSTALLER_NAME}-${TRAVIS_TAG}-macOS.zip
33-
- build/${PACKAGING_INSTALLER_NAME}-${TRAVIS_TAG}-winportable.zip
34-
- build/${PACKAGING_INSTALLER_NAME}-${TRAVIS_TAG}.AppImage
38+
- build/${PACKAGING_INSTALLER_NAME}-${TRAVIS_TAG}-x86_64.AppImage
3539
skip_cleanup: true
3640
on:
3741
tags: true

ExampleMod.sln

+21-14
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,28 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenRA.Mods.Common", "engin
99
EndProject
1010
Global
1111
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12-
Debug|x86 = Debug|x86
13-
Release|x86 = Release|x86
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
Release-x86|Any CPU = Release-x86|Any CPU
1415
EndGlobalSection
1516
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16-
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|x86.ActiveCfg = Debug|x86
17-
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|x86.Build.0 = Debug|x86
18-
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|x86.ActiveCfg = Release|x86
19-
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|x86.Build.0 = Release|x86
20-
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|x86.ActiveCfg = Debug|x86
21-
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|x86.Build.0 = Debug|x86
22-
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|x86.ActiveCfg = Release|x86
23-
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|x86.Build.0 = Release|x86
24-
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|x86.ActiveCfg = Debug|x86
25-
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|x86.Build.0 = Debug|x86
26-
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|x86.ActiveCfg = Release|x86
27-
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|x86.Build.0 = Release|x86
17+
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release|Any CPU.Build.0 = Release|Any CPU
21+
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release-x86|Any CPU.ActiveCfg = Release|Any CPU
22+
{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}.Release-x86|Any CPU.Build.0 = Release|Any CPU
23+
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24+
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Debug|Any CPU.Build.0 = Debug|Any CPU
25+
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.ActiveCfg = Release|Any CPU
26+
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release|Any CPU.Build.0 = Release|Any CPU
27+
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release-x86|Any CPU.ActiveCfg = Release-x86|Any CPU
28+
{0DFB103F-2962-400F-8C6D-E2C28CCBA633}.Release-x86|Any CPU.Build.0 = Release-x86|Any CPU
29+
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30+
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
31+
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
32+
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release|Any CPU.Build.0 = Release|Any CPU
33+
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release-x86|Any CPU.ActiveCfg = Release|Any CPU
34+
{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}.Release-x86|Any CPU.Build.0 = Release|Any CPU
2835
EndGlobalSection
2936
EndGlobal

Makefile

+36-24
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,26 @@
2121
# make check-packaging-scripts
2222

2323
.PHONY: utility stylecheck build clean engine version check check-scripts check-sdk-scripts check-packaging-scripts check-variables
24-
.DEFAULT_GOAL := build
24+
.DEFAULT_GOAL := all
2525

2626
VERSION = $(shell git name-rev --name-only --tags --no-undefined HEAD 2>/dev/null || echo git-`git rev-parse --short HEAD`)
2727
MOD_ID = $(shell cat user.config mod.config 2> /dev/null | awk -F= '/MOD_ID/ { print $$2; exit }')
2828
ENGINE_DIRECTORY = $(shell cat user.config mod.config 2> /dev/null | awk -F= '/ENGINE_DIRECTORY/ { print $$2; exit }')
2929
MOD_SEARCH_PATHS = "$(shell python -c "import os; print(os.path.realpath('.'))")/mods,./mods"
3030

31-
MANIFEST_PATH = "mods/$(MOD_ID)/mod.yaml"
31+
WHITELISTED_OPENRA_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_OPENRA_ASSEMBLIES/ { print $$2; exit }')"
32+
WHITELISTED_THIRDPARTY_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_THIRDPARTY_ASSEMBLIES/ { print $$2; exit }')"
33+
WHITELISTED_CORE_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_CORE_ASSEMBLIES/ { print $$2; exit }')"
34+
WHITELISTED_MOD_ASSEMBLIES = "$(shell cat user.config mod.config 2> /dev/null | awk -F= '/WHITELISTED_MOD_ASSEMBLIES/ { print $$2; exit }')"
3235

33-
HAS_MSBUILD = $(shell command -v msbuild 2> /dev/null)
36+
MANIFEST_PATH = "mods/$(MOD_ID)/mod.yaml"
3437
HAS_LUAC = $(shell command -v luac 2> /dev/null)
35-
LUA_FILES = $(shell find mods/*/maps/* -iname '*.lua')
36-
PROJECT_DIRS = $(shell dirname $$(find . -iname "*.csproj" -not -path "$(ENGINE_DIRECTORY)/*"))
38+
LUA_FILES = $(shell find mods/*/maps/* -iname '*.lua' 2> /dev/null)
39+
40+
MSBUILD = msbuild -verbosity:m -nologo
41+
42+
# Enable 32 bit builds while generating the windows installer
43+
WIN32 = false
3744

3845
check-sdk-scripts:
3946
@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)
@@ -94,29 +101,32 @@ check-variables:
94101
exit 1; \
95102
fi
96103

104+
engine-dependencies: check-variables check-sdk-scripts
105+
@./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1)
106+
@cd $(ENGINE_DIRECTORY) && make dependencies WIN32=$(WIN32)
107+
97108
engine: check-variables check-sdk-scripts
98109
@./fetch-engine.sh || (printf "Unable to continue without engine files\n"; exit 1)
99-
@cd $(ENGINE_DIRECTORY) && make core
110+
@cd $(ENGINE_DIRECTORY) && make core WIN32=$(WIN32)
100111

101-
utility: engine
112+
utility: engine-dependencies engine
102113
@test -f "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" || (printf "OpenRA.Utility.exe not found!\n"; exit 1)
103114

104-
stylecheck: engine
105-
@test -f "$(ENGINE_DIRECTORY)/OpenRA.StyleCheck.exe" || (cd $(ENGINE_DIRECTORY) && make stylecheck)
106-
107-
build: engine
108-
ifeq ("$(HAS_MSBUILD)","")
109-
@find . -maxdepth 1 -name '*.sln' -exec xbuild /nologo /verbosity:quiet /p:TreatWarningsAsErrors=true \;
115+
core:
116+
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.4."; exit 1)
117+
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:restore \;
118+
ifeq ($(WIN32), $(filter $(WIN32),true yes y on 1))
119+
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:build -p:Configuration="Release-x86" \;
110120
else
111-
@find . -maxdepth 1 -name '*.sln' -exec msbuild /t:Rebuild /nr:false \;
121+
@$(MSBUILD) -t:build -p:Configuration=Release
122+
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:build -p:Configuration=Release \;
112123
endif
113124

125+
all: engine-dependencies engine core
126+
114127
clean: engine
115-
ifeq ("$(HAS_MSBUILD)","")
116-
@find . -maxdepth 1 -name '*.sln' -exec xbuild /nologo /verbosity:quiet /p:TreatWarningsAsErrors=true /t:Clean \;
117-
else
118-
@find . -maxdepth 1 -name '*.sln' -exec msbuild /t:Clean /nr:false \;
119-
endif
128+
@command -v $(MSBUILD) >/dev/null || (echo "OpenRA requires the '$(MSBUILD)' tool provided by Mono >= 5.4."; exit 1)
129+
@find . -maxdepth 1 -name '*.sln' -exec $(MSBUILD) -t:clean \;
120130
@cd $(ENGINE_DIRECTORY) && make clean
121131
@printf "The engine has been cleaned.\n"
122132

@@ -136,13 +146,15 @@ ifneq ("$(LUA_FILES)","")
136146
@luac -p $(LUA_FILES)
137147
endif
138148

139-
check: utility stylecheck
149+
check: utility
150+
@echo "Compiling in debug mode..."
151+
@$(MSBUILD) -t:build -p:Configuration=Debug
152+
@echo "Checking runtime assemblies..."
153+
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-runtime-assemblies $(WHITELISTED_OPENRA_ASSEMBLIES) $(WHITELISTED_THIRDPARTY_ASSEMBLIES) $(WHITELISTED_CORE_ASSEMBLIES) $(WHITELISTED_MOD_ASSEMBLIES)
140154
@echo "Checking for explicit interface violations..."
141155
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-explicit-interfaces
142-
@for i in $(PROJECT_DIRS) ; do \
143-
echo "Checking for code style violations in $${i}...";\
144-
mono --debug "$(ENGINE_DIRECTORY)/OpenRA.StyleCheck.exe" $${i};\
145-
done
156+
@echo "Checking for incorrect conditional trait interface overrides..."
157+
@MOD_SEARCH_PATHS="$(MOD_SEARCH_PATHS)" mono --debug "$(ENGINE_DIRECTORY)/OpenRA.Utility.exe" $(MOD_ID) --check-conditional-trait-interface-overrides
146158

147159
test: utility
148160
@echo "Testing $(MOD_ID) mod MiniYAML..."
+29-63
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,43 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
1+
<Project Sdk="Microsoft.NET.Sdk">
32
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6-
<ProjectGuid>{4E5B38F7-4E99-4C92-BB39-9100CC7F3829}</ProjectGuid>
7-
<OutputType>Library</OutputType>
8-
<RootNamespace>OpenRA.Mods.Example</RootNamespace>
9-
<AssemblyName>OpenRA.Mods.Example</AssemblyName>
10-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11-
</PropertyGroup>
12-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
13-
<DebugSymbols>true</DebugSymbols>
14-
<DebugType>full</DebugType>
15-
<DefineConstants>DEBUG;TRACE</DefineConstants>
16-
<PlatformTarget>x86</PlatformTarget>
17-
<ErrorReport>prompt</ErrorReport>
18-
<OutputPath>bin\Debug\</OutputPath>
3+
<TargetFramework>net461</TargetFramework>
194
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
20-
</PropertyGroup>
21-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
22-
<DebugSymbols>true</DebugSymbols>
23-
<OutputPath>bin\Release\</OutputPath>
24-
<DefineConstants>TRACE</DefineConstants>
25-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
26-
<DebugType>pdbonly</DebugType>
27-
<PlatformTarget>x86</PlatformTarget>
28-
<ErrorReport>prompt</ErrorReport>
295
<Optimize>true</Optimize>
6+
<LangVersion>5</LangVersion>
7+
<DebugSymbols>true</DebugSymbols>
8+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
9+
<OutputPath>../mods/example</OutputPath>
10+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
11+
<PlatformTarget>AnyCPU</PlatformTarget>
12+
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
13+
<CodeAnalysisRuleSet>../engine/OpenRA.ruleset</CodeAnalysisRuleSet>
3014
</PropertyGroup>
3115
<ItemGroup>
32-
<Reference Include="System" />
33-
<Reference Include="System.Core" />
34-
<Reference Include="System.Drawing" />
35-
<Reference Include="Eluant">
36-
<HintPath>..\engine\thirdparty\download\Eluant.dll</HintPath>
37-
<Private>False</Private>
38-
</Reference>
39-
</ItemGroup>
40-
<ItemGroup>
41-
<Compile Include="Widgets\Logic\TemplateMenuLogic.cs" />
42-
</ItemGroup>
43-
<ItemGroup>
44-
<Folder Include="Widgets\" />
45-
<Folder Include="Widgets\Logic\" />
16+
<!-- Work around an issue where Rider does not detect files in the project root using the default glob -->
17+
<Compile Include="**/*.cs" Exclude="$(DefaultItemExcludes)" />
4618
</ItemGroup>
19+
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<Optimize>false</Optimize>
22+
</PropertyGroup>
4723
<ItemGroup>
48-
<ProjectReference Include="..\engine\OpenRA.Mods.Common\OpenRA.Mods.Common.csproj">
49-
<Project>{FE6C8CC0-2F07-442A-B29F-17617B3B7FC6}</Project>
50-
<Name>OpenRA.Mods.Common</Name>
24+
<Reference Include="Eluant">
25+
<HintPath>../engine/thirdparty/download/Eluant.dll</HintPath>
26+
<Private>False</Private>
27+
</Reference>
28+
<ProjectReference Include="../engine/OpenRA.Game/OpenRA.Game.csproj">
5129
<Private>False</Private>
5230
</ProjectReference>
53-
<ProjectReference Include="..\engine\OpenRA.Game\OpenRA.Game.csproj">
54-
<Project>{0DFB103F-2962-400F-8C6D-E2C28CCBA633}</Project>
55-
<Name>OpenRA.Game</Name>
31+
<ProjectReference Include="../engine/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj">
5632
<Private>False</Private>
5733
</ProjectReference>
34+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" />
35+
<AdditionalFiles Include="../engine/stylecop.json" />
5836
</ItemGroup>
59-
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
60-
<Target Name="AfterBuild">
61-
<MakeDir Directories="$(SolutionDir)mods/example/" />
62-
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(SolutionDir)mods/example/" />
63-
<!--
64-
We need to copy OpenRA.Mods.Cnc.pdb (not `.dll.pdb`). This is only necessary on Windows.
65-
Mono outputs a `.dll.mdb` so we can just append `.mdb` directly.
66-
-->
67-
<Copy SourceFiles="$(TargetDir)$(TargetName).pdb" DestinationFolder="$(SolutionDir)mods/example/" Condition="Exists('$(TargetDir)$(TargetName).pdb')" />
68-
<Copy SourceFiles="$(TargetPath).mdb" DestinationFolder="$(SolutionDir)mods/example/" Condition="Exists('$(TargetPath).mdb')" />
69-
<!-- Uncomment these lines when debugging or adding to this target
70-
<Message Text="DEBUG OS: $(OS)"/>
71-
<Message Text="DEBUG SolutionDir: $(SolutionDir)"/>
72-
<Message Text="DEBUG TargetPath: $(TargetPath)"/>
73-
<Message Text="DEBUG TargetDir: $(TargetDir)"/>
74-
<Message Text="DEBUG TargetName: $(TargetName)"/>
75-
-->
37+
<Target Name="DisableAnalyzers" BeforeTargets="CoreCompile" Condition="'$(Configuration)'=='Release'">
38+
<!-- Disable code style analysis on Release builds to improve compile-time performance -->
39+
<ItemGroup Condition="'$(Configuration)'=='Release'">
40+
<Analyzer Remove="@(Analyzer)" />
41+
</ItemGroup>
7642
</Target>
7743
</Project>

0 commit comments

Comments
 (0)