Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Godot 3.3 #2215

Merged
merged 10 commits into from
May 29, 2021
Merged
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
jetbrains:
working_directory: ~/Thrive
docker:
- image: hhyyrylainen/godot-ci:v6
- image: hhyyrylainen/godot-ci:v9
environment:
GIT_LFS_SKIP_SMUDGE: 1
CIRCLE_COMPARE_URL: << pipeline.project.git_url >>/compare/<< pipeline.git.base_revision >>..<<pipeline.git.revision>>
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
- restore_cache:
keys:
- v3-nuget-{{ .Branch }}
- run: nuget restore Thrive.sln
- run: dotnet restore Thrive.sln
- save_cache:
key: v3-nuget-{{ .Branch }}
paths:
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
format_script:
working_directory: ~/Thrive
docker:
- image: hhyyrylainen/thrive-lint:v6
- image: hhyyrylainen/thrive-lint:v8
environment:
GIT_LFS_SKIP_SMUDGE: 1
steps:
Expand Down
8 changes: 4 additions & 4 deletions CIConfiguration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 1

jobs:
build:
image: thrive/godot-ci:v8
image: thrive/godot-ci:v9
cache:
loadFrom:
- v1-{Branch}-build
Expand All @@ -19,7 +19,7 @@ jobs:
name: Export to make project valid
command: godot --export "Linux/X11" "builds/a.x86_64"
- run:
command: nuget restore Thrive.sln
command: dotnet restore Thrive.sln
- run:
name: Compile with checks
command: ./check_formatting.rb -c compile
Expand All @@ -30,7 +30,7 @@ jobs:
name: Upload devbuilds
command: ./upload_devbuilds.rb
jetbrains:
image: thrive/godot-ci:v8
image: thrive/godot-ci:v9
cache:
loadFrom:
- v1-{Branch}-jetbrains
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
command: |
godot --export "Linux/X11" "builds/a.x86_64" || true
- run:
command: nuget restore Thrive.sln
command: dotnet restore Thrive.sln
# Makes sure that there aren't any changes at this point to not make the CI trip up on them
- run:
name: Make sure no changes to git tracked files at this point
Expand Down
2 changes: 1 addition & 1 deletion Thrive.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Godot.NET.Sdk/3.2.3">
<Project Sdk="Godot.NET.Sdk/3.3.0">
<PropertyGroup>
<ProjectGuid>{D38E3F51-1E8C-4F32-99B2-641320B0AC3C}</ProjectGuid>
<OutputType>Library</OutputType>
Expand Down
55 changes: 4 additions & 51 deletions check_formatting.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# This script first builds using msbuild treating warnings as errors
# This script first builds using dotnet treating warnings as errors
# and then runs some custom line length checks
require 'optparse'
require 'find'
Expand Down Expand Up @@ -37,7 +37,6 @@
EMBEDDED_FONT_SIGNATURE = 'sub_resource type="DynamicFont"'

OUTPUT_MUTEX = Mutex.new
MSBUILD_MUTEX = Mutex.new

# Bom bytes
BOM = [239, 187, 191].freeze
Expand All @@ -62,9 +61,6 @@
opts.on('-p', '--[no-]parallel', 'Run different checks in parallel (default)') do |b|
@options[:parallel] = b
end
opts.on('--msbuild MSBUILD', 'Specify msbuild dll to use with jetbrains tools') do |f|
@options[:msBuild] = f
end
end.parse!

onError "Unhandled parameters: #{ARGV}" unless ARGV.empty?
Expand All @@ -73,43 +69,6 @@

# Helper functions

def detect_ms_build_dll
msbuild = which 'msbuild'

unless msbuild
OUTPUT_MUTEX.synchronize do
puts 'Searched paths:'
pathAsArray.each do |p|
puts p
end

onError 'msbuild not found in PATH'
end
end

File.foreach(msbuild) do |line|
match = line.match(%r{/mono\s+.+\s(/.*/MSBuild.dll)\s+})

next unless match

dll = match.captures[0]

info "msbuild dll path detected: #{dll}"
return dll
end

onError 'Could not determine MSBuild.dll location, please specify --msbuild ' \
'parameter with the correct path'
end

def ms_build
MSBUILD_MUTEX.synchronize do
return @options[:msBuild] if @options[:msBuild]

@options[:msBuild] = detect_ms_build_dll
end
end

def ide_file?(path)
path =~ %r{/\.vs/} || path =~ %r{/\.idea/}
end
Expand All @@ -124,7 +83,7 @@ def cache?(path)

# Skip some files that would otherwise be processed
def skip_file?(path)
explicitly_ignored?(path) || path =~ %r{^\.\/\.\/} || cache?(path) || ide_file?(path)
explicitly_ignored?(path) || path =~ %r{^\./\./} || cache?(path) || ide_file?(path)
end

def file_type_skipped?(path)
Expand Down Expand Up @@ -485,12 +444,12 @@ def run_compile
# Make sure in analysis mode before running build
perform_analysis_mode_check true, quiet: true

status, output = runOpen3CaptureOutput('msbuild', 'Thrive.sln', '/t:Clean,Build',
status, output = runOpen3CaptureOutput('dotnet', 'build', 'Thrive.sln', '/t:Clean,Build',
'/warnaserror')

if status != 0
OUTPUT_MUTEX.synchronize do
info 'Build output from msbuild:'
info 'Build output from dotnet:'
puts output
error "\nBuild generated warnings or errors."
end
Expand Down Expand Up @@ -554,8 +513,6 @@ def run_inspect_code

params = [inspect_code_executable, 'Thrive.sln', '-o=inspect_results.xml']

params.append "--toolset-path=#{ms_build}" if OS.linux?

params.append "--include=#{@includes.join(';')}" if @includes

runOpen3Checked(*params)
Expand Down Expand Up @@ -606,8 +563,6 @@ def run_cleanup_code

params = [cleanup_code_executable, 'Thrive.sln', '--profile=full_no_xml']

params.append "--toolset-path=#{ms_build}" if OS.linux?

params.append "--include=#{@includes.join(';')}" if @includes

runOpen3Checked(*params)
Expand Down Expand Up @@ -637,8 +592,6 @@ def run_duplicate_finder
"--discard-cost=#{DUPLICATE_THRESSHOLD}", '--discard-literals=true',
'--exclude-by-comment="NO_DUPLICATE_CHECK"']

params.append "--toolset-path=#{ms_build}" if OS.linux?

if @includes
params += @includes.select { |item| item =~ /\.cs$/ }.uniq
else
Expand Down
62 changes: 35 additions & 27 deletions doc/setup_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Prerequisites
Godot mono version
------------------

The currently used Godot version is __3.2.3 mono__. The regular version
The currently used Godot version is __3.3.2 mono__. The regular version
will not work. You can download Godot here: https://godotengine.org/download/
if it is still the latest stable version. If a new version of Godot has
been released but Thrive has not been updated yet, you need to look
Expand Down Expand Up @@ -90,15 +90,22 @@ Godot currently supports the following development environments:
### MonoDevelop

On Linux MonoDevelop and Jetbrains Rider are recommended. To get an up
to date version, first enable the mono repository:
to date version of mono, first enable the mono repository:
https://www.mono-project.com/download/stable/ and then install the
following packages with your package manager: `mono-complete
monodevelop nuget`. Make sure it is a newer version of mono that comes
with msbuild. Fedora has mono in the official repo but it is too old
to work. If you are going to use Rider you don't need the monodevelop
package.

On Windows don't intall Mono or MonoDevelop, it will break things.
Next you need, dotnet sdk, for example the package might be called
`dotnet-sdk-5.0`, this will install the `dotnet` command required
later. With Rider it may be possible to skip the mono install and just
install dotnet sdk. Note that some of the used tools require the 3.1
version of the sdk, so you should install that now.

On Windows don't intall Mono or MonoDevelop, it will break
things. Dotnet may be a good tool to use on Windows.

For a better experience with Godot, you can install the following
addon for MonoDevelop:
Expand All @@ -114,8 +121,10 @@ available from: https://www.jetbrains.com/rider/
It has a Godot plugin which is easy to install. With Rider the
debugging experience is better than with MonoDevelop.

Rider requires mono to be installed similarly to MonoDevelop, so
follow those instructions on how to get mono setup.
First install dotnet according to the instructions in the previous
section. If building in Rider doesn't work or some features are
missing, then install the mono packages, also mentioned in the
previous section.

<img src="https://randomthrivefiles.b-cdn.net/setup_instructions/images/rider_godot_plugin.png" alt="rider godot plugin" width="600px">

Expand All @@ -130,7 +139,7 @@ https://docs.godotengine.org/en/stable/getting_started/scripting/c_sharp/c_sharp
### Visual Studio Code

Note: Setting up Visual Studio Code with Linux is possible,
however it is recommended to use MonoDevelop instead
however it is recommended to use MonoDevelop or Rider instead.

Visual Studio Code, not to be confused with Visual Studio, doesn't
come with build tools, so you'll need to install the build tools for
Expand All @@ -153,8 +162,8 @@ Scroll down on the left window until you find Mono. Click on Editor and set
External Editor to Visual Studio Code. Click on Builds and set Build Tool to
MSBuild (VS Build Tools).

If you want to setup live debugging with Godot follow the instructions here
https://docs.godotengine.org/en/stable/getting_started/scripting/c_sharp/c_sharp_basics.html#configuring-visual-studio-code-for-debugging
If you want to setup live debugging with Godot follow the instructions here:
https://docs.godotengine.org/en/3.3/getting_started/scripting/c_sharp/c_sharp_basics.html#visual-studio-code


Building Thrive
Expand Down Expand Up @@ -197,7 +206,7 @@ can't be opened and their file sizes are tiny, you don't have Git LFS
properly installed.

For devs working directly with the Thrive repository switch to a feature
branch or create one when working on new features. For example `git checkout godot`.
branch or create one when working on new features. For example `git checkout 123_feature`.
This keeps the main branch clean as other branches can be merged through
pull requests on github which is the recommended way to get your code into
Thrive.
Expand Down Expand Up @@ -251,14 +260,10 @@ Click on Editor. Set External Editor to your development environment.

Here selected IDE is Rider.

Click on Builds under Mono and set Build Tool to your compiler. If you have build errors,
check if this is setup properly.

On Linux it is required to use mono as the build tool as selected in
Godot editor settings. The option to build with dotnet is creates
broken releases. Like this:
Click on Builds under Mono and set Build Tool to your compiler. If you
have build errors, check if this is setup properly.

<img src="https://randomthrivefiles.b-cdn.net/setup_instructions/images/godot_build_tool_option_linux.png" alt="godot linux build tool" width="550px">
On Linux dotnet is the recommended build tool.

Even if you do not use the Godot script editor, Godot automatically opens some files and replaces the spaces with tabs.
To stop Godot from messing with you files, go to Text Editor -> Indent and set Type to spaces
Expand All @@ -271,12 +276,12 @@ Thrive uses some external C# packages which need to be restored before
compiling.

On Linux, or if you're using Visual Studio Code, open a terminal to
the thrive folder and run the following
command: `nuget restore` it should download the missing nuget
packages. You may need to rerun this command when new package
dependencies are added to Thrive. Note: if you use MonoDevelop it
*might* automatically restore missing packages using nuget when
compiling the game within MonoDevelop.
the thrive folder and run the following command: `dotnet restore` (or
use `nuget restore` command if you use mono instead of dotnet) it
should download the missing nuget packages. You may need to rerun this
command when new package dependencies are added to Thrive. Note: if
you use an IDE like MonoDevelop or Rider it may automatically restore
missing packages when compiling the game through it.


On Windows you should use Visual Studio to restore the packages. To do
Expand All @@ -290,8 +295,6 @@ If you have nuget in path or you use the Visual Studio command prompt
you should also be able to restore the packages by running `nuget
restore` in the Thrive folder.

Note: dotnet restore command should be avoided as it can break things.

Compiling
---------

Expand Down Expand Up @@ -319,7 +322,9 @@ breakpoints set in MonoDevelop work.
From Rider you can compile the game from the top right menu bar by
selecting the `Player` target (with the Godot icon). That target
should automatically appear once you install the Godot plugin
(https://plugins.jetbrains.com/plugin/13882-godot-support).
(https://plugins.jetbrains.com/plugin/13882-godot-support). If things
don't work you should check Rider settings to make sure that the used
msbuild version is from dotnet and not mono.

With that plugin you can run the game from Godot (once you have ran once
from Godot editor so that it sets up things), using these toolbar buttons
Expand Down Expand Up @@ -446,13 +451,16 @@ sudo npm install -g jsonlint
Download from:
https://www.jetbrains.com/resharper/download/#section=commandline
unzip and add to PATH. Currently used version is:
JetBrains.ReSharper.CommandLineTools.2020.2
JetBrains.ReSharper.CommandLineTools.2021.1.3

NOTE: there is more documentation on the install process here:
https://www.jetbrains.com/help/resharper/InspectCode.html

On Linux you need to install the dotnet runtime for them to work. On
Fedora this can be done with: `sudo dnf install dotnet-runtime-3.1`
Fedora this can be done with: `sudo dnf install dotnet-runtime-3.1` If
that doesn't work you may need to install a different runtime as
well. If none of the sh scripts are executable run this in the
unzipped jetbrains folder: `chmod +x *.sh`

## Localization tools

Expand Down
16 changes: 6 additions & 10 deletions docker/ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
FROM fedora:32

# mono repo
RUN rpm --import "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
RUN curl https://download.mono-project.com/repo/centos8-stable.repo | tee /etc/yum.repos.d/mono-centos8-stable.repo
FROM fedora:34

RUN dnf install -y --setopt=deltarpm=false ruby ruby-devel redhat-rpm-config git git-lfs \
p7zip tar unzip xz gcc make mono-complete nuget wget dotnet-runtime-3.1 && dnf clean all
p7zip tar unzip xz gcc make wget dotnet-sdk-5.0 dotnet-runtime-3.1 && dnf clean all
RUN git lfs install
RUN gem install os colorize rubyzip json sha3 httparty parallel nokogiri

# Jetbrains CLI tools
RUN wget https://download.jetbrains.com/resharper/dotUltimate.2020.2/JetBrains.ReSharper.CommandLineTools.2020.2.zip \
-O jetbrains.zip && unzip jetbrains.zip -d /usr/bin && rm -rf jetbrains.zip
RUN wget https://download.jetbrains.com/resharper/dotUltimate.2021.1.3/JetBrains.ReSharper.CommandLineTools.2021.1.3.zip \
-O jetbrains.zip && unzip jetbrains.zip -d /usr/bin && rm -rf jetbrains.zip && chmod +x /usr/bin/*.sh

# Godot install
ENV GODOT_VERSION "3.2.3"
ENV GODOT_VERSION "3.3.2"

RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/mono/Godot_v${GODOT_VERSION}-stable_mono_linux_headless_64.zip \
&& wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/mono/Godot_v${GODOT_VERSION}-stable_mono_export_templates.tpz \
Expand All @@ -31,7 +27,7 @@ RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/mono/Godot
&& rm -f Godot_v${GODOT_VERSION}-stable_mono_export_templates.tpz Godot_v${GODOT_VERSION}-stable_mono_linux_headless_64.zip \
&& rm -rf templates godot_dir

# Editor settings to use msbuild
# Editor settings to use the right build tool
COPY editor_settings-3.tres /root/.config/godot/editor_settings-3.tres

# Godot pck tool
Expand Down
2 changes: 1 addition & 1 deletion docker/ci/editor_settings-3.tres
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_resource type="EditorSettings" format=2]

[resource]
mono/builds/build_tool = 0
mono/builds/build_tool = 3
2 changes: 1 addition & 1 deletion docker/jsonlint/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM fedora:33
FROM fedora:34


RUN dnf install -y --setopt=deltarpm=false ruby ruby-devel redhat-rpm-config make gcc git git-lfs nodejs zlib-devel python3 python3-pip gettext && dnf clean all
Expand Down
Loading