Skip to content

Commit

Permalink
Merge pull request #30 from fabulous-dev/preview-net8.0
Browse files Browse the repository at this point in the history
Support for net8.0 and F# 8
  • Loading branch information
edgarfgp authored Dec 14, 2023
2 parents 81de90f + a90e662 commit 0d41f58
Show file tree
Hide file tree
Showing 62 changed files with 100 additions and 700 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release
on:
push:
tags: ['[0-9]+.[0-9]+.[0-9]+', '[0-9]+.[0-9]+.[0-9]+-pre[0-9]+']
paths-ignore: [ 'docs/**' ]

permissions: write-all

env:
CONFIG: Release
TEMPLATE_PROJ: templates/FSharp.Mobile.Templates.proj

jobs:
release:
runs-on: macos-13
environment: nuget
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Extract version from tag
uses: damienaicheh/[email protected]
- name: Set release version
run: |
if [ "${PRE_RELEASE}" == "" ]; then
RELEASE_VERSION=${MAJOR}.${MINOR}.${PATCH}
else
RELEASE_VERSION=${MAJOR}.${MINOR}.${PATCH}-${PRE_RELEASE}
fi
echo "Release version is $RELEASE_VERSION"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> "$GITHUB_ENV"
- name: Get FSharp.Mobile.Templates Changelog Entry
id: templates_changelog
uses: mindsers/changelog-reader-action@v2
with:
validation_level: warn
version: '${{ env.RELEASE_VERSION }}'
path: templates/CHANGELOG.md
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Install dotnet workload
run: dotnet workload restore
- name: Restore
run: dotnet restore ${SLN_FILE}
- name: Build
run: dotnet build ${SLN_FILE} -p:Version=${RELEASE_VERSION} -c ${CONFIG} --no-restore
- name: Pack
run: |
find templates -type f -name template.json | xargs sed -i bak "s/PKG_VERSION/${RELEASE_VERSION}/g"
dotnet pack ${TEMPLATE_PROJ} -p:Version=${RELEASE_VERSION} -p:PackageReleaseNotes="${{ steps.templates_changelog.outputs.changes }}" -c ${CONFIG} --property PackageOutputPath=${PWD}/nupkgs
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Packages
path: nupkgs/
- name: Push
run: dotnet nuget push "nupkgs/*" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_TOKEN }} --skip-duplicate
6 changes: 3 additions & 3 deletions .github/workflows/templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Pack
run: dotnet pack FSharp.Mobile.Templates.proj --configuration Release --version-suffix "nightly-${GITHUB_RUN_ID}" --property PackageOutputPath=${PWD}/nupkgs
- name: Push
Expand All @@ -29,8 +29,8 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Pack
run: dotnet pack FSharp.Mobile.Templates.proj --configuration Release--property PackageOutputPath=${PWD}/nupkgs
run: dotnet pack FSharp.Mobile.Templates.proj --configuration Release --property PackageOutputPath=${PWD}/nupkgs
- name: Push
run: dotnet nuget push "nupkgs/*" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_TOKEN }} --skip-duplicate
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
_No unreleased changes_

## [8.0.0] - 2023-12-14

### Added
- Update NET8.0 and F# 8.0

[unreleased]: https://github.com/fabulous-dev/FSharp.Mobile.Templates/compare/8.0.0...HEAD
[8.0.0]: https://github.com/fabulous-dev/FSharp.Mobile.Templates/releases/tag/8.0.0

2 changes: 1 addition & 1 deletion FSharp.Mobile.Templates.proj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<NoBuild>true</NoBuild>
<IncludeBuildOutput>false</IncludeBuildOutput>
<NoDefaultExcludes>true</NoDefaultExcludes>
<VersionPrefix>1.1.2</VersionPrefix>
<VersionPrefix>8.0.0</VersionPrefix>
<TargetFramework>netstandard2.0</TargetFramework>
<NoWarn>$(NoWarn);NU5128</NoWarn>
<IncludeContentInPack>true</IncludeContentInPack>
Expand Down
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
# FSharp.Mobile.Templates

In this repository, you can find all the templates for creating mobile and desktop apps using .NET 7.0 and F# 7.0.
In this repository, you can find all the templates for creating mobile and desktop apps using .NET 8.0 and F# 8.0.

Please note that those templates are "plain" F# templates, no additional dependencies. If you are interested in the Fabulous templates you can use:

- [Fabulous.XamarinForms templates](https://github.com/fabulous-dev/Fabulous.XamarinForms)
- [Fabulous.MauiControls templates](https://github.com/fabulous-dev/Fabulous.MauiControls)
- [Fabulous.Avalonia templates](https://github.com/fabulous-dev/Fabulous.Avalonia)

NB. The Xamarin.Forms template will stay on .NET 6.0.
Microsoft never intended to migrate Xamarin.Forms from Mono to .NET 6.0/7.0, making it hard to upgrade to .NET 7.0.

### Prerequisites
In order to build and run the Android and iOS projects, you need to install the corresponding workloads
```
Expand All @@ -20,22 +17,12 @@ dotnet workload install maccatalyst
dotnet workload install maui
```

For the Xamarin.Forms template, you'll also need to go into the file `nuget.config` and replace `USERNAME` with your GitHub username and `TOKEN` with your personal access token.
See https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry#authenticating-with-a-personal-access-token

### Available templates
- Android
- iOS
- Mac Catalyst
- Xamarin.Forms (Android, iOS)
- Maui (Android, iOS, Mac Catalyst, Windows, Tizen)

### Known issues

- First build fails on Android (native, XF and MAUI)
- You need to compile 2 times to get it working. It's a current limitation of FSharp.Android.Resource used to expose the resources.
- You might also need to unload/reopen either the Android project or the solution for Intellisense to find the resources

### Install

```
Expand All @@ -54,7 +41,6 @@ Template Name Short Name Language Tags
---------------------------- ------------------- -------- -------------
F# Android Application android-fsharp F# FSharp.Mobile
F# iOS Application ios-fsharp F# FSharp.Mobile
F# Xamarin.Forms Application xf-fsharp F# FSharp.Mobile
F# Maui Application maui-fsharp F# FSharp.Mobile
F# Mac Catalyst Application maccatalyst-fsharp F# FSharp.Mobile
```
Expand All @@ -79,7 +65,7 @@ To build and test the templates locally:

```
$ dotnet pack -c Release
$ dotnet new -i .\bin\Release\FSharp.Mobile.Templates.1.1.0.nupkg
$ dotnet new -i .\bin\Release\FSharp.Mobile.Templates.8.0.0.nupkg
```

### Acknowledgements
Expand Down
5 changes: 2 additions & 3 deletions templates/Android/App.Android.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-android</TargetFramework>
<TargetFramework>net8.0-android</TargetFramework>
<OutputType>Exe</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
</PropertyGroup>
Expand All @@ -10,7 +10,6 @@
<Compile Include="MainActivity.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="7.0.0" />
<PackageReference Include="FSharp.Android.Resource" Version="1.0.0" />
<PackageReference Include="FSharp.Core" Version="8.0.100" />
</ItemGroup>
</Project>
6 changes: 5 additions & 1 deletion templates/MacCatalyst/App.MacCatalyst.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-maccatalyst</TargetFramework>
<TargetFramework>net8.0-maccatalyst</TargetFramework>
<OutputType>Exe</OutputType>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
</PropertyGroup>
<ItemGroup>
<ImageAsset Include="Assets.xcassets\AppIcon.appiconset\Contents.json" />
Expand Down Expand Up @@ -32,4 +33,7 @@
<Compile Include="SceneDelegate.fs" />
<Compile Include="Main.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="8.0.100" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion templates/MacCatalyst/AppDelegate.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type AppDelegate() =
UIColor.White

label.TextAlignment <- UITextAlignment.Center
label.Text <- "Hello, .NET 7 and F# 7!"
label.Text <- "Hello, .NET 8 and F# 8!"
vc.View.AddSubview(label)

this.Window.RootViewController <- vc
Expand Down
10 changes: 4 additions & 6 deletions templates/Maui/MauiAppFSharp.fsproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net7.0-windows10.0.19041.0</TargetFrameworks>
<TargetFrameworks>net8.0-android;net8.0-ios;net8.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net7.0-tizen</TargetFrameworks> -->
<!-- <TargetFrameworks>$(TargetFrameworks);net8.0-tizen</TargetFrameworks> -->
<OutputType>Exe</OutputType>
<RootNamespace>MauiAppFSharp</RootNamespace>
<UseMaui>true</UseMaui>
Expand Down Expand Up @@ -72,7 +72,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FSharp.Core" Version="7.0.0" />
<PackageReference Include="FSharp.Core" Version="8.0.100" />
</ItemGroup>

<ItemGroup Condition="$(TargetPlatformIdentifier) == 'android'">
Expand All @@ -83,8 +83,6 @@
<AndroidManifest Include="$(AndroidProjectFolder)AndroidManifest.xml" />
<Compile Include="$(AndroidProjectFolder)MainActivity.fs" />
<Compile Include="$(AndroidProjectFolder)MainApplication.fs" />

<PackageReference Include="FSharp.Android.Resource" Version="1.0.4" />
</ItemGroup>

<ItemGroup Condition="$(TargetPlatformIdentifier) == 'ios'">
Expand Down
2 changes: 0 additions & 2 deletions templates/Maui/Platforms/Android/MainApplication.fs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ open Microsoft.Maui
[<Application>]
type MainApplication(handle, ownership) =
inherit MauiApplication(handle, ownership)

do MauiAppFSharp.Resource.UpdateIdValues()

override _.CreateMauiApp() = MauiProgram.CreateMauiApp()
25 changes: 0 additions & 25 deletions templates/Xamarin.Forms/.template.config/template.json

This file was deleted.

5 changes: 0 additions & 5 deletions templates/Xamarin.Forms/Android/AndroidManifest.xml

This file was deleted.

20 changes: 0 additions & 20 deletions templates/Xamarin.Forms/Android/Assets/AboutAssets.txt

This file was deleted.

20 changes: 0 additions & 20 deletions templates/Xamarin.Forms/Android/MainActivity.fs

This file was deleted.

51 changes: 0 additions & 51 deletions templates/Xamarin.Forms/Android/Resources/AboutResources.txt

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 0d41f58

Please sign in to comment.