Skip to content

Commit

Permalink
Update to enable building Net8.0 projects
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisPulman committed Nov 20, 2023
1 parent 7aa9c9e commit 2ecdb7d
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 27 deletions.
22 changes: 17 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,26 @@ jobs:
build:
runs-on: windows-latest
steps:
- name: Setup dotnet
- name: 'Setup dotnet 6 / 7 / 8'
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Install DotNet workloads
- name: 'Setup Java JDK 11'
uses: actions/[email protected]
with:
distribution: 'microsoft'
java-version: '11'

- name: 'Add MSBuild to PATH'
uses: microsoft/[email protected]
with:
vs-prerelease: true

- name: 'Install DotNet workloads'
shell: bash
run: |
dotnet workload install android ios tvos macos maui maccatalyst
Expand All @@ -38,11 +50,11 @@ jobs:
- name: 'Restore and Compile ReactiveUI Projects'
run: ./build.cmd Compile

- name: Build Website
- name: 'Build Website'
run: ./build.cmd BuildWebsite

- name: Deploy netlify
if: ${{ github.event_name != 'pull_request' }}
- name: 'Deploy netlify'
if: ${{ github.event_name != 'pull_request' }}
run: |
npm install -g netlify-cli
netlify deploy --auth=${{ secrets.NETLIFY_DEPLOY_KEY }} --site=${{ secrets.NETLIFY_SITE_ID }} --prod --dir=reactiveui/_site
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Build website](https://github.com/reactiveui/website/workflows/Build%20website/badge.svg)

This is the ReactiveUI website. It's a static site generated by [DocFx](https://dotnet.github.io/docfx/index.html).
This is the source code for the [ReactiveUI](https://www.reactiveui.net/) website. It's a static site generated by [DocFx](https://dotnet.github.io/docfx/index.html).

## Contributing

Expand All @@ -11,11 +11,23 @@ This is the ReactiveUI website. It's a static site generated by [DocFx](https://
2. Create a new branch, if needed
3. Clone the project
4. In order to build and host the docs do the following:
- **Windows**
-- Open command prompt at the repository root folder and run `docfx reactiveui/docfx.json --serve`
5. Wait several minutes while it installs dependencies and initializes (approx 35 mins). It is ready when you see `Hit Ctrl-C to exit`
**Windows** -- Open command prompt and install the following tools:
- the DocFx tool `dotnet tool update -g docfx`
- the Nuke tool `dotnet tool install Nuke.GlobalTool --global`

- Open command prompt at the repository root folder, ensure that you have installed the DocFx tool and then run `docfx reactiveui/docfx.json --serve`

5. Wait several minutes while it installs dependencies and initializes (approx 5 mins). It is ready when you see `Hit Ctrl-C to exit`
6. Browse the website on `localhost:8080`
---

To build the entire Website we use `Nuke Build` you will need to install the tool so that you can run command line nuke commands using `dotnet tool install Nuke.GlobalTool --global`.

To build the entire Website we use `Nuke Build` you will need to install the tool so that you can run command line nuke commands.
Once installed from the command prompt execute `Nuke` this will download and build the sources for the API section of the website.
---
Once installed from the command prompt execute `Nuke` this will download and build the sources for the API section of the website, this takes around 35 minutes to compile and build the website with the API sections.

---
Once complete you can either execute `docfx reactiveui/docfx.json --serve` to run the site OR `Nuke BuildWebsite` to build the API only.

---
If you have generated the API section and wish to remove it on your local machine to enable the website to compile faster, run `nuke clean` and then run `docfx reactiveui/docfx.json --serve`
4 changes: 2 additions & 2 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ class Build : NukeBuild
.Executes(() =>
{
// Restore ReactiveUI Projects
RxUIAPIDirectory.GetSources(reactiveui, RxUIProjects);
RxUIAPIDirectory.GetSources(RootDirectory, reactiveui, RxUIProjects);
// Restore Reactive Marbles Projects
RxMAPIDirectory.GetSources(reactivemarbles, DynamicData);
RxMAPIDirectory.GetSources(RootDirectory, reactivemarbles, DynamicData);
});

Target Compile => _ => _
Expand Down
11 changes: 3 additions & 8 deletions build/Configuration.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
using System;
using System.ComponentModel;
using System.Linq;
using Nuke.Common.Tooling;

[TypeConverter(typeof(TypeConverter<Configuration>))]
public class Configuration : Enumeration
{
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
public static Configuration Release = new Configuration { Value = nameof(Release) };
public static Configuration Debug = new() { Value = nameof(Debug) };
public static Configuration Release = new() { Value = nameof(Release) };

public static implicit operator string(Configuration configuration)
{
return configuration.Value;
}
public static implicit operator string(Configuration configuration) => configuration.Value;
}
9 changes: 6 additions & 3 deletions build/SourceFetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Nuke.Common;
using Nuke.Common.IO;
using Polly;

Expand All @@ -16,12 +17,12 @@ internal static class SourceFetcher
private static readonly object _lockConsoleObject = new();
private static readonly object _lockWorkloadObject = new();

public static void GetSources(this AbsolutePath fileSystem, string owner, params string[] repositories)
public static void GetSources(this AbsolutePath fileSystem, AbsolutePath rootDirectory, string owner, params string[] repositories)
{
FetchGitHubZip(fileSystem, owner, repositories, "external", true, true);
FetchGitHubZip(fileSystem, rootDirectory, owner, repositories, "external", true, true);
}

private static void FetchGitHubZip(AbsolutePath fileSystem, string owner, string[] repositories, string outputFolder, bool fetchNuGet, bool useSrc)
private static void FetchGitHubZip(AbsolutePath fileSystem, AbsolutePath rootDirectory, string owner, string[] repositories, string outputFolder, bool fetchNuGet, bool useSrc)
{
var zipCache = fileSystem / "zip";
zipCache.CreateDirectory();
Expand Down Expand Up @@ -88,6 +89,8 @@ await waitAndRetry.ExecuteAsync(async () =>
if (fetchNuGet)
{
var directory = useSrc ? finalPath / $"{repository}-main" / "src" : finalPath;
File.Copy(rootDirectory / "global.json", directory / "global.json", true);
WorkflowRestore(owner, repository, finalPath, useSrc);
FetchNuGet(owner, repository, finalPath, useSrc);
}
Expand Down
4 changes: 2 additions & 2 deletions build/_build.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -17,6 +17,6 @@

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="7.0.6" />
<PackageReference Include="Polly" Version="8.1.0" />
<PackageReference Include="Polly" Version="8.2.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.400",
"version": "8.0.10",
"rollForward": "latestMinor"
},
"msbuild-sdks": {
Expand Down

0 comments on commit 2ecdb7d

Please sign in to comment.