diff --git a/Directory.Build.props b/Directory.Build.props index 3f030e4146..c8d441a78c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,6 +2,7 @@ 8.0 + true $(MSBuildThisFileDirectory)app.manifest @@ -28,6 +29,7 @@ $(NoWarn);NU1701 + false ppy Pty Ltd MIT https://github.com/ppy/osu diff --git a/build.ps1 b/InspectCode.ps1 old mode 100755 new mode 100644 similarity index 89% rename from build.ps1 rename to InspectCode.ps1 index 4b3b1f717a..6ed935fdbb --- a/build.ps1 +++ b/InspectCode.ps1 @@ -22,6 +22,6 @@ if ($Experimental) { $cakeArguments += "-experimental" } $cakeArguments += $ScriptArgs dotnet tool restore -dotnet cake ./build/build.cake --bootstrap -dotnet cake ./build/build.cake $cakeArguments +dotnet cake ./build/InspectCode.cake --bootstrap +dotnet cake ./build/InspectCode.cake $cakeArguments exit $LASTEXITCODE \ No newline at end of file diff --git a/README.md b/README.md index 65fb97eb5d..7adc8dc973 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,8 @@ Detailed changelogs are published on the [official osu! site](https://osu.ppy.sh - A desktop platform with the [.NET Core SDK 3.0](https://www.microsoft.com/net/learn/get-started) or higher installed. - When running on Linux, please have a system-wide FFmpeg installation available to support video decoding. -- When running on Windows 7 or 8.1, **[additional prerequisites](https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore2x)** may be required to correctly run .NET Core applications if your operating system is not up-to-date with the latest service packs. +- When running on Windows 7 or 8.1, **[additional prerequisites](https://docs.microsoft.com/en-us/dotnet/core/install/dependencies?tabs=netcore30&pivots=os-windows)** may be required to correctly run .NET Core applications if your operating system is not up-to-date with the latest service packs. +- When developing with mobile, [Xamarin](https://docs.microsoft.com/en-us/xamarin/) is required, which is shipped together with Visual Studio or [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/). - When working with the codebase, we recommend using an IDE with intelligent code completion and syntax highlighting, such as [Visual Studio 2019+](https://visualstudio.microsoft.com/vs/), [JetBrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/). ## Running osu! @@ -73,13 +74,19 @@ If you are not interested in debugging osu!, you can add `-c Release` to gain pe If the build fails, try to restore NuGet packages with `dotnet restore`. +_Due to historical feature gap between .NET Core and Xamarin, running `dotnet` CLI from the root directory will not work for most commands. This can be resolved by specifying a target `.csproj` or the helper project at `build/Desktop.proj`. Configurations have been provided to work around this issue for all supported IDEs mentioned above._ + ### Testing with resource/framework modifications Sometimes it may be necessary to cross-test changes in [osu-resources](https://github.com/ppy/osu-resources) or [osu-framework](https://github.com/ppy/osu-framework). This can be achieved by running some commands as documented on the [osu-resources](https://github.com/ppy/osu-resources/wiki/Testing-local-resources-checkout-with-other-projects) and [osu-framework](https://github.com/ppy/osu-framework/wiki/Testing-local-framework-checkout-with-other-projects) wiki pages. ### Code analysis -Code analysis can be run with `powershell ./build.ps1` or `build.sh`. This is currently only supported under Windows due to [ReSharper CLI shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternatively, you can install ReSharper or use Rider to get inline support in your IDE of choice. +Before committing your code, please run a code formatter. It can be achieved with `dotnet format` in command line, or `Format code` command in your IDE. + +We have adopted some cross-platform, compiler integrated analyzers. They can provide warnings when you are editing, building inside IDE or from command line, as-if they are provided by the compiler itself. + +JetBrains ReSharper InspectCode is also used for wider rule sets. You can run it from PowerShell with `.\InspectCode.ps1`, which is [only supported on Windows](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternatively, you can install ReSharper or use Rider to get inline support in your IDE of choice. ## Contributing diff --git a/appveyor.yml b/appveyor.yml index f911d67c6e..a4a0cedc66 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,27 @@ clone_depth: 1 version: '{branch}-{build}' image: Visual Studio 2019 -test: off -build_script: - - cmd: PowerShell -Version 2.0 .\build.ps1 +dotnet_csproj: + patch: true + file: 'osu.Game\osu.Game.csproj' # Use wildcard when it's able to exclude Xamarin projects + version: '0.0.{build}' +cache: + - '%LOCALAPPDATA%\NuGet\v3-cache -> appveyor.yml' +before_build: + - ps: dotnet --info # Useful when version mismatch between CI and local + - ps: nuget restore -verbosity quiet # Only nuget.exe knows both new (.NET Core) and old (Xamarin) projects +build: + project: osu.sln + parallel: true + verbosity: minimal + publish_nuget: true +after_build: + - ps: dotnet tool restore + - ps: dotnet format --dry-run --check + - ps: .\InspectCode.ps1 +test: + assemblies: + except: + - '**\*Android*' + - '**\*iOS*' + - 'build\**\*' diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml index fb7825b31d..bb4482f501 100644 --- a/appveyor_deploy.yml +++ b/appveyor_deploy.yml @@ -1,10 +1,21 @@ clone_depth: 1 version: '{build}' image: Visual Studio 2019 +dotnet_csproj: + patch: true + file: 'osu.Game\osu.Game.csproj' # Use wildcard when it's able to exclude Xamarin projects + version: $(APPVEYOR_REPO_TAG_NAME) +before_build: + - ps: dotnet --info # Useful when version mismatch between CI and local + - ps: nuget restore -verbosity quiet # Only nuget.exe knows both new (.NET Core) and old (Xamarin) projects test: off skip_non_tags: true -build_script: - - cmd: PowerShell -Version 2.0 .\build.ps1 +configuration: Release +build: + project: build\Desktop.proj # Skipping Xamarin Release that's slow and covered by fastlane + parallel: true + verbosity: minimal + publish_nuget: true deploy: - provider: Environment name: nuget diff --git a/build.sh b/build.sh deleted file mode 100755 index 2c22f08574..0000000000 --- a/build.sh +++ /dev/null @@ -1,17 +0,0 @@ -echo "Installing Cake.Tool..." -dotnet tool restore - -# Parse arguments. -CAKE_ARGUMENTS=() -for i in "$@"; do - case $1 in - -s|--script) SCRIPT="$2"; shift ;; - --) shift; CAKE_ARGUMENTS+=("$@"); break ;; - *) CAKE_ARGUMENTS+=("$1") ;; - esac - shift -done - -echo "Running build script..." -dotnet cake ./build/build.cake --bootstrap -dotnet cake ./build/build.cake "${CAKE_ARGUMENTS[@]}" \ No newline at end of file diff --git a/build/build.cake b/build/InspectCode.cake similarity index 61% rename from build/build.cake rename to build/InspectCode.cake index 274e57ef4e..bd3fdf5f93 100644 --- a/build/build.cake +++ b/build/InspectCode.cake @@ -7,45 +7,29 @@ var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); // ARGUMENTS /////////////////////////////////////////////////////////////////////////////// -var target = Argument("target", "Build"); +var target = Argument("target", "CodeAnalysis"); var configuration = Argument("configuration", "Release"); var rootDirectory = new DirectoryPath(".."); var sln = rootDirectory.CombineWithFilePath("osu.sln"); -var desktopBuilds = rootDirectory.CombineWithFilePath("build/Desktop.proj"); var desktopSlnf = rootDirectory.CombineWithFilePath("osu.Desktop.slnf"); /////////////////////////////////////////////////////////////////////////////// // TASKS /////////////////////////////////////////////////////////////////////////////// -Task("Compile") - .Does(() => { - DotNetCoreBuild(desktopBuilds.FullPath, new DotNetCoreBuildSettings { - Configuration = configuration, - }); - }); - -Task("Test") - .IsDependentOn("Compile") - .Does(() => { - var testAssemblies = GetFiles(rootDirectory + "/**/*.Tests/bin/**/*.Tests.dll"); - - DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings { - Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx", - Parallel = true, - ToolTimeout = TimeSpan.FromMinutes(10), - }); - }); - -// windows only because both inspectcore and nvika depend on net45 +// windows only because both inspectcode and nvika depend on net45 Task("InspectCode") .WithCriteria(IsRunningOnWindows()) - .IsDependentOn("Compile") .Does(() => { InspectCode(desktopSlnf, new InspectCodeSettings { CachesHome = "inspectcode", OutputFile = "inspectcodereport.xml", + ArgumentCustomization = arg => { + if (AppVeyor.IsRunningOnAppVeyor) // Don't flood CI output + arg.Append("--verbosity:WARN"); + return arg; + }, }); int returnCode = StartProcess(nVikaToolPath, $@"parsereport ""inspectcodereport.xml"" --treatwarningsaserrors"); @@ -61,13 +45,8 @@ Task("CodeFileSanity") }); }); -Task("DotnetFormat") - .Does(() => DotNetCoreTool(sln.FullPath, "format", "--dry-run --check")); - -Task("Build") +Task("CodeAnalysis") .IsDependentOn("CodeFileSanity") - .IsDependentOn("DotnetFormat") - .IsDependentOn("InspectCode") - .IsDependentOn("Test"); + .IsDependentOn("InspectCode"); RunTarget(target); \ No newline at end of file diff --git a/osu.Game.Rulesets.Catch.Tests.Android/Properties/AndroidManifest.xml b/osu.Game.Rulesets.Catch.Tests.Android/Properties/AndroidManifest.xml index 0fa3b7730d..f8c3fcd894 100644 --- a/osu.Game.Rulesets.Catch.Tests.Android/Properties/AndroidManifest.xml +++ b/osu.Game.Rulesets.Catch.Tests.Android/Properties/AndroidManifest.xml @@ -1,5 +1,6 @@  - + + \ No newline at end of file diff --git a/osu.Game.Tests.Android/osu.Game.Tests.Android.csproj b/osu.Game.Tests.Android/osu.Game.Tests.Android.csproj index c2dd194e09..c44ed69c4d 100644 --- a/osu.Game.Tests.Android/osu.Game.Tests.Android.csproj +++ b/osu.Game.Tests.Android/osu.Game.Tests.Android.csproj @@ -24,6 +24,7 @@ %(RecursiveDir)%(Filename)%(Extension) + %(RecursiveDir)%(Filename)%(Extension) @@ -68,10 +69,5 @@ osu.Game - - - 2.0.0 - - \ No newline at end of file diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2f633bdbc1..4c5d7667bf 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -7,7 +7,9 @@ osu! ppy.osu.Game + 0.0.0 icon.png + true