From 80d2ec6d3d5af51c1478d88e8bdd588ce52c6d7d Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Tue, 13 Nov 2018 17:55:12 +0000 Subject: [PATCH 01/11] Work in progress --- .../Droid/AllControls.Droid.fsproj | 5 +- .../Droid/Properties/AndroidManifest.xml | 4 +- src/Fabulous.Core/ViewConverters.fs | 15 +++- tools/Generator/Xamarin.Forms.Core.json | 72 ++++++++++--------- 4 files changed, 58 insertions(+), 38 deletions(-) diff --git a/samples/AllControls/Droid/AllControls.Droid.fsproj b/samples/AllControls/Droid/AllControls.Droid.fsproj index 7999c244c..82853a9c8 100644 --- a/samples/AllControls/Droid/AllControls.Droid.fsproj +++ b/samples/AllControls/Droid/AllControls.Droid.fsproj @@ -17,9 +17,8 @@ Properties\AndroidManifest.xml Resources Assets - true - Google Pixel 2 - Android_Accelerated_x86_Nougat + twitchdeck + twitchdeck AllControls.Droid true diff --git a/samples/TicTacToe/Droid/Properties/AndroidManifest.xml b/samples/TicTacToe/Droid/Properties/AndroidManifest.xml index 844e40502..7e67b17ff 100644 --- a/samples/TicTacToe/Droid/Properties/AndroidManifest.xml +++ b/samples/TicTacToe/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@ - + - + \ No newline at end of file diff --git a/src/Fabulous.Core/ViewConverters.fs b/src/Fabulous.Core/ViewConverters.fs index ae0740e0f..6c7a64721 100644 --- a/src/Fabulous.Core/ViewConverters.fs +++ b/src/Fabulous.Core/ViewConverters.fs @@ -54,7 +54,6 @@ type ListGroupData<'T>(shortName: string, key:'T, coll: 'T[]) = member x.ShortName = shortName member x.Items = coll - type ViewElementCell() = inherit ViewCell() @@ -110,6 +109,20 @@ type CustomListView() = type CustomGroupListView() = inherit ListView(ItemTemplate=DataTemplate(typeof), GroupHeaderTemplate=DataTemplate(typeof), IsGroupingEnabled=true) + + +type CustomEntryCell() = + inherit EntryCell() + let textChanged: Event = Event<_>() + + member this.Text + with get () = base.Text + and set (value) = + base.Text <- value + textChanged.Trigger value + + member __.EntryTextChanged = textChanged.Publish + type CustomContentPage() as self = inherit ContentPage() diff --git a/tools/Generator/Xamarin.Forms.Core.json b/tools/Generator/Xamarin.Forms.Core.json index bd397a26a..fcf90ee5f 100644 --- a/tools/Generator/Xamarin.Forms.Core.json +++ b/tools/Generator/Xamarin.Forms.Core.json @@ -1053,38 +1053,46 @@ } ] }, - { - "name": "Xamarin.Forms.EntryCell", - "members": [ - { - "name": "Label", - "defaultValue": "null" - }, - { - "name": "Text", - "defaultValue": "null" - }, - { - "name": "Keyboard", - "defaultValue": "Xamarin.Forms.Keyboard.Default" - }, - { - "name": "Placeholder", - "defaultValue": "null" - }, - { - "name": "HorizontalTextAlignment", - "defaultValue": "Xamarin.Forms.TextAlignment.Start" - }, - { - "name": "Completed", - "uniqueName": "EntryCompleted", - "defaultValue": "null", - "inputType": "string -> unit", - "convToModel": "(fun f -> System.EventHandler(fun sender args -> f (sender :?> Xamarin.Forms.EntryCell).Text))" - } - ] - }, + { + "name": "Xamarin.Forms.EntryCell", + "customType": "Fabulous.DynamicViews.CustomEntryCell", + "members": [ + { + "name": "Label", + "defaultValue": "null" + }, + { + "name": "Text", + "defaultValue": "null" + }, + { + "name": "Keyboard", + "defaultValue": "Xamarin.Forms.Keyboard.Default" + }, + { + "name": "Placeholder", + "defaultValue": "null" + }, + { + "name": "HorizontalTextAlignment", + "defaultValue": "Xamarin.Forms.TextAlignment.Start" + }, + { + "name": "Completed", + "uniqueName": "EntryCompleted", + "defaultValue": "null", + "inputType": "string -> unit", + "convToModel": "(fun f -> System.EventHandler(fun sender args -> f (sender :?> Xamarin.Forms.EntryCell).Text))" + }, + { + "name": "EntryTextChanged", + "uniqueName": "EntryCellTextChanged", + "defaultValue": "null", + "inputType": "string -> unit", + "convToModel": "(fun f -> System.EventHandler(fun sender args -> f (sender :?> Xamarin.Forms.EntryCell).Text))" + } + ] + }, { "name": "Xamarin.Forms.Label", "members": [ From 880b6153df2d6e5bc43ef953927ea73438856e98 Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Tue, 13 Nov 2018 18:06:45 +0000 Subject: [PATCH 02/11] Load of a different assembly --- tools/Generator/Xamarin.Forms.Core.json | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tools/Generator/Xamarin.Forms.Core.json b/tools/Generator/Xamarin.Forms.Core.json index fcf90ee5f..0b8a13fbf 100644 --- a/tools/Generator/Xamarin.Forms.Core.json +++ b/tools/Generator/Xamarin.Forms.Core.json @@ -1,7 +1,8 @@ { - "assemblies": [ - "packages/neutral/Xamarin.Forms/lib/netstandard1.0/Xamarin.Forms.Core.dll" - ], + "assemblies": [ + "packages/neutral/Xamarin.Forms/lib/netstandard1.0/Xamarin.Forms.Core.dll", + "src/Fabulous.Core/bin/Release/netstandard2.0/Fabulous.Core.dll" + ], "outputNamespace": "Fabulous.DynamicViews", "types": [ { @@ -1054,8 +1055,8 @@ ] }, { - "name": "Xamarin.Forms.EntryCell", - "customType": "Fabulous.DynamicViews.CustomEntryCell", + "name": "Fabulous.DynamicViews.CustomEntryCell", + "modelName": "EntryCell", "members": [ { "name": "Label", From a7ec5c763c03afcbc6ea5cd01053d2743f4c1c93 Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Tue, 13 Nov 2018 20:57:24 +0000 Subject: [PATCH 03/11] This works in WPF - not in Android/iOS however. --- Fabulous.sln | 52 +++++++++++++------ build.fsx | 6 +++ .../Fabulous.CustomControls.fsproj | 15 ++++++ .../Fabulous.CustomControls/ViewConverters.fs | 18 +++++++ tools/Generator/Xamarin.Forms.Core.json | 8 +-- 5 files changed, 78 insertions(+), 21 deletions(-) create mode 100644 customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj create mode 100644 customControls/Fabulous.CustomControls/ViewConverters.fs diff --git a/Fabulous.sln b/Fabulous.sln index 7ba0a5646..e6ae22b0d 100644 --- a/Fabulous.sln +++ b/Fabulous.sln @@ -63,6 +63,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1199BA9F EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "extensions", "extensions", "{13C0EB5D-E38E-4714-9421-77CD9C53A067}" EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Fabulous.CustomControls", "customControls\Fabulous.CustomControls\Fabulous.CustomControls.fsproj", "{7FF328BB-9318-4C11-8A9A-37DD98EAB35B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -307,6 +309,22 @@ Global {9031246B-4B08-47C9-A500-30334A245272}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator {9031246B-4B08-47C9-A500-30334A245272}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator {9031246B-4B08-47C9-A500-30334A245272}.Release|x86.ActiveCfg = Release|iPhone + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|iPhone.Build.0 = Debug|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|x86.ActiveCfg = Debug|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|x86.Build.0 = Debug|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|Any CPU.Build.0 = Release|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|iPhone.ActiveCfg = Release|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|iPhone.Build.0 = Release|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|x86.ActiveCfg = Release|Any CPU + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|x86.Build.0 = Release|Any CPU {AC36B11A-383D-45A3-8999-4F6475E9DD13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC36B11A-383D-45A3-8999-4F6475E9DD13}.Debug|Any CPU.Build.0 = Debug|Any CPU {AC36B11A-383D-45A3-8999-4F6475E9DD13}.Debug|iPhone.ActiveCfg = Debug|Any CPU @@ -407,22 +425,22 @@ Global {810EEB40-5042-4946-B695-5B13E9957807}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {810EEB40-5042-4946-B695-5B13E9957807}.Release|x86.ActiveCfg = Release|Any CPU {810EEB40-5042-4946-B695-5B13E9957807}.Release|x86.Build.0 = Release|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|iPhone.ActiveCfg = Debug|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|iPhone.Build.0 = Debug|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|x86.ActiveCfg = Debug|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Debug|x86.Build.0 = Debug|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|Any CPU.Build.0 = Release|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|iPhone.ActiveCfg = Release|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|iPhone.Build.0 = Release|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|iPhoneSimulator.Build.0 = Release|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|x86.ActiveCfg = Release|Any CPU - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379}.Release|x86.Build.0 = Release|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Debug|iPhone.ActiveCfg = Debug|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Debug|iPhone.Build.0 = Debug|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Debug|x86.ActiveCfg = Debug|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Debug|x86.Build.0 = Debug|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Release|Any CPU.Build.0 = Release|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Release|iPhone.ActiveCfg = Release|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Release|iPhone.Build.0 = Release|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Release|iPhoneSimulator.Build.0 = Release|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Release|x86.ActiveCfg = Release|Any CPU + {7FF328BB-9318-4C11-8A9A-37DD98EAB35B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -444,11 +462,11 @@ Global {13F140D6-2D21-41BE-AC90-4B14D8C16A47} = {12D18417-809C-4CA9-AD3E-474333B181BC} {5CCD3C0C-3434-434C-B8C2-7FFDEDCC2437} = {12D18417-809C-4CA9-AD3E-474333B181BC} {9031246B-4B08-47C9-A500-30334A245272} = {12D18417-809C-4CA9-AD3E-474333B181BC} + {D83017F5-0B21-4D0C-8C7F-0EBA37E16379} = {12D18417-809C-4CA9-AD3E-474333B181BC} {A61655CB-26DF-47E7-BCC0-91FD9A7D83AA} = {FB194A8D-00A6-4416-AA8D-A89C1541935B} {AC36B11A-383D-45A3-8999-4F6475E9DD13} = {A61655CB-26DF-47E7-BCC0-91FD9A7D83AA} {13181907-1C53-47C1-BDF0-DBECCC2ED92E} = {A61655CB-26DF-47E7-BCC0-91FD9A7D83AA} {F557905B-B099-44AB-939C-AB169499A36E} = {A61655CB-26DF-47E7-BCC0-91FD9A7D83AA} - {D83017F5-0B21-4D0C-8C7F-0EBA37E16379} = {12D18417-809C-4CA9-AD3E-474333B181BC} {10DF5D2F-17FA-43DE-9549-B84E6CF26602} = {E75EAD35-1041-42CC-8AA4-01DB58FA467C} {23640E46-E830-4AB7-9289-E527F6429435} = {E75EAD35-1041-42CC-8AA4-01DB58FA467C} {810EEB40-5042-4946-B695-5B13E9957807} = {1199BA9F-BF79-477F-8E25-FD0E0CBC962A} diff --git a/build.fsx b/build.fsx index 05ee72b97..8d51736fc 100644 --- a/build.fsx +++ b/build.fsx @@ -56,6 +56,7 @@ let projects = [ { Name = "Templates"; Path = !! "templates/**/*.nuspec"; Action = NuGetPack; OutputPath = buildDir } ] let tools = { Name = "Tools"; Path = !! "tools/**/*.fsproj"; Action = MSBuild Release; OutputPath = buildDir + "/tools" } +let customControls = { Name = "CustomControls"; Path = !! "customControls/**/*.fsproj"; Action = DotNetPack; OutputPath = buildDir } let samples = { Name = "Samples"; Path = (!! "samples/**/*.fsproj" |> removeIncompatiblePlatformProjects); Action = MSBuild Debug; OutputPath = buildDir + "/samples" } @@ -128,6 +129,10 @@ Target.create "Restore" (fun _ -> DotNet.restore id "Fabulous.sln" ) +Target.create "BuildCustomControls" (fun _ -> + customControls |> buildProject +) + Target.create "BuildTools" (fun _ -> tools |> buildProject ) @@ -200,6 +205,7 @@ open Fake.Core.TargetOperators ==> "Restore" ==> "UpdateVersion" ==> "BuildTools" + ==> "BuildCustomControls" ==> "RunGenerator" ==> "Build" diff --git a/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj b/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj new file mode 100644 index 000000000..3db56d39b --- /dev/null +++ b/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj @@ -0,0 +1,15 @@ + + + + netstandard2.0 + + + + + + + + + + + diff --git a/customControls/Fabulous.CustomControls/ViewConverters.fs b/customControls/Fabulous.CustomControls/ViewConverters.fs new file mode 100644 index 000000000..ae9888ade --- /dev/null +++ b/customControls/Fabulous.CustomControls/ViewConverters.fs @@ -0,0 +1,18 @@ +namespace Fabulous.DynamicViews + +open Xamarin.Forms +open System + +type CustomEntryCell() = + inherit EntryCell() + + let textChanged = Event, TextChangedEventArgs>() + + member x.Text + with get () = base.Text + and set (value) = + let oldValue = base.Text + base.Text <- value + textChanged.Trigger(x, TextChangedEventArgs(oldValue, value)) + + [] member __.TextChanged = textChanged.Publish \ No newline at end of file diff --git a/tools/Generator/Xamarin.Forms.Core.json b/tools/Generator/Xamarin.Forms.Core.json index eaf864388..e1e1345dd 100644 --- a/tools/Generator/Xamarin.Forms.Core.json +++ b/tools/Generator/Xamarin.Forms.Core.json @@ -1,7 +1,7 @@ { "assemblies": [ "packages/neutral/Xamarin.Forms/lib/netstandard1.0/Xamarin.Forms.Core.dll", - "src/Fabulous.Core/bin/Release/netstandard2.0/Fabulous.Core.dll" + "customControls/Fabulous.CustomControls/bin/Release/netstandard2.0/Fabulous.CustomControls.dll" ], "outputNamespace": "Fabulous.DynamicViews", "types": [ @@ -1086,11 +1086,11 @@ "convToModel": "(fun f -> System.EventHandler(fun sender args -> f (sender :?> Xamarin.Forms.EntryCell).Text))" }, { - "name": "EntryTextChanged", + "name": "TextChanged", "uniqueName": "EntryCellTextChanged", "defaultValue": "null", - "inputType": "string -> unit", - "convToModel": "(fun f -> System.EventHandler(fun sender args -> f (sender :?> Xamarin.Forms.EntryCell).Text))" + "inputType": "Xamarin.Forms.TextChangedEventArgs -> unit", + "convToModel": "(fun f -> System.EventHandler(fun _sender args -> f args))" } ] }, From a646dfa539d0b669e1e31fb6f595a39364ac0809 Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Tue, 13 Nov 2018 21:12:46 +0000 Subject: [PATCH 04/11] I should commit the changes that I made in Core too. --- src/Fabulous.Core/Fabulous.Core.fsproj | 3 +++ src/Fabulous.Core/ViewConverters.fs | 14 -------------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/Fabulous.Core/Fabulous.Core.fsproj b/src/Fabulous.Core/Fabulous.Core.fsproj index 5d679b7ec..1454e11d4 100644 --- a/src/Fabulous.Core/Fabulous.Core.fsproj +++ b/src/Fabulous.Core/Fabulous.Core.fsproj @@ -23,5 +23,8 @@ + + + diff --git a/src/Fabulous.Core/ViewConverters.fs b/src/Fabulous.Core/ViewConverters.fs index 6b8a47cce..c95764591 100644 --- a/src/Fabulous.Core/ViewConverters.fs +++ b/src/Fabulous.Core/ViewConverters.fs @@ -110,20 +110,6 @@ type CustomListView() = type CustomGroupListView() = inherit ListView(ItemTemplate=DataTemplate(typeof), GroupHeaderTemplate=DataTemplate(typeof), IsGroupingEnabled=true) - - -type CustomEntryCell() = - inherit EntryCell() - let textChanged: Event = Event<_>() - - member this.Text - with get () = base.Text - and set (value) = - base.Text <- value - textChanged.Trigger value - - member __.EntryTextChanged = textChanged.Publish - type CustomContentPage() as self = inherit ContentPage() From 3abbbe6c672e5a5e4de080918e5501a6771ab5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9=20Larivi=C3=A8re?= Date: Thu, 15 Nov 2018 18:47:23 +0000 Subject: [PATCH 05/11] Apply suggestions from code review Co-Authored-By: garethhubball --- .../Fabulous.CustomControls/Fabulous.CustomControls.fsproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj b/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj index 3db56d39b..4a9366c92 100644 --- a/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj +++ b/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj @@ -1,5 +1,5 @@  - + netstandard2.0 @@ -9,7 +9,7 @@ - + - + From 4f708e3cf7413f150b2509b4a9bbacf0c37c263b Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Thu, 15 Nov 2018 18:52:46 +0000 Subject: [PATCH 06/11] EntryCell now uses PropertyChanged to fire TextChanged event. --- .../Fabulous.CustomControls/Controls.fs | 22 +++++++++++++++++++ .../Fabulous.CustomControls.fsproj | 2 +- .../Fabulous.CustomControls/ViewConverters.fs | 18 --------------- tools/Generator/Xamarin.Forms.Core.json | 2 +- 4 files changed, 24 insertions(+), 20 deletions(-) create mode 100644 customControls/Fabulous.CustomControls/Controls.fs delete mode 100644 customControls/Fabulous.CustomControls/ViewConverters.fs diff --git a/customControls/Fabulous.CustomControls/Controls.fs b/customControls/Fabulous.CustomControls/Controls.fs new file mode 100644 index 000000000..2becf850a --- /dev/null +++ b/customControls/Fabulous.CustomControls/Controls.fs @@ -0,0 +1,22 @@ +namespace Fabulous.CustomControls + +open Xamarin.Forms +open System + +type CustomEntryCell() as self = + inherit EntryCell() + + let mutable oldValue = "" + let textChanged = Event, TextChangedEventArgs>() + + do self.PropertyChanging.Add( + fun args -> + if args.PropertyName = "Text" then + oldValue <- self.Text) + + do self.PropertyChanged.Add( + fun args -> + if args.PropertyName = "Text" then + textChanged.Trigger(self, TextChangedEventArgs(oldValue, self.Text))) + + [] member __.TextChanged = textChanged.Publish \ No newline at end of file diff --git a/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj b/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj index 3db56d39b..392d43429 100644 --- a/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj +++ b/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj @@ -5,7 +5,7 @@ - + diff --git a/customControls/Fabulous.CustomControls/ViewConverters.fs b/customControls/Fabulous.CustomControls/ViewConverters.fs deleted file mode 100644 index ae9888ade..000000000 --- a/customControls/Fabulous.CustomControls/ViewConverters.fs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Fabulous.DynamicViews - -open Xamarin.Forms -open System - -type CustomEntryCell() = - inherit EntryCell() - - let textChanged = Event, TextChangedEventArgs>() - - member x.Text - with get () = base.Text - and set (value) = - let oldValue = base.Text - base.Text <- value - textChanged.Trigger(x, TextChangedEventArgs(oldValue, value)) - - [] member __.TextChanged = textChanged.Publish \ No newline at end of file diff --git a/tools/Generator/Xamarin.Forms.Core.json b/tools/Generator/Xamarin.Forms.Core.json index e1e1345dd..d629f7778 100644 --- a/tools/Generator/Xamarin.Forms.Core.json +++ b/tools/Generator/Xamarin.Forms.Core.json @@ -1055,7 +1055,7 @@ ] }, { - "name": "Fabulous.DynamicViews.CustomEntryCell", + "name": "Fabulous.CustomControls.CustomEntryCell", "modelName": "EntryCell", "members": [ { From 9657269cc7087f4ef86e098c1168f2c4b33f7b2e Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Thu, 15 Nov 2018 19:02:02 +0000 Subject: [PATCH 07/11] Added the required reference to the sample projects. --- samples/AllControls/AllControls/AllControls.fsproj | 1 + samples/CounterApp/CounterApp/CounterApp.fsproj | 1 + .../StaticViewCounterApp/StaticViewCounterApp.fsproj | 1 + samples/TicTacToe/TicTacToe/TicTacToe.fsproj | 1 + 4 files changed, 4 insertions(+) diff --git a/samples/AllControls/AllControls/AllControls.fsproj b/samples/AllControls/AllControls/AllControls.fsproj index f31e66a59..c7ee6b7e2 100644 --- a/samples/AllControls/AllControls/AllControls.fsproj +++ b/samples/AllControls/AllControls/AllControls.fsproj @@ -9,6 +9,7 @@ + diff --git a/samples/CounterApp/CounterApp/CounterApp.fsproj b/samples/CounterApp/CounterApp/CounterApp.fsproj index a4d6b96f8..8e5c4cc99 100644 --- a/samples/CounterApp/CounterApp/CounterApp.fsproj +++ b/samples/CounterApp/CounterApp/CounterApp.fsproj @@ -12,6 +12,7 @@ + diff --git a/samples/StaticView/StaticViewCounterApp/StaticViewCounterApp/StaticViewCounterApp.fsproj b/samples/StaticView/StaticViewCounterApp/StaticViewCounterApp/StaticViewCounterApp.fsproj index 2fadc05f6..0a000071a 100644 --- a/samples/StaticView/StaticViewCounterApp/StaticViewCounterApp/StaticViewCounterApp.fsproj +++ b/samples/StaticView/StaticViewCounterApp/StaticViewCounterApp/StaticViewCounterApp.fsproj @@ -17,6 +17,7 @@ + diff --git a/samples/TicTacToe/TicTacToe/TicTacToe.fsproj b/samples/TicTacToe/TicTacToe/TicTacToe.fsproj index 0f8471b0f..74489eb82 100644 --- a/samples/TicTacToe/TicTacToe/TicTacToe.fsproj +++ b/samples/TicTacToe/TicTacToe/TicTacToe.fsproj @@ -12,6 +12,7 @@ + From f8de4069d2637f2d4c36cc60bad1a3c3229e20c3 Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Thu, 15 Nov 2018 19:04:12 +0000 Subject: [PATCH 08/11] Cleanup for PR --- .../Droid/AllControls.Droid.fsproj | 5 ++- .../Droid/Properties/AndroidManifest.xml | 2 +- src/Fabulous.Core/Xamarin.Forms.Core.fs | 45 ++++++++++++++----- 3 files changed, 39 insertions(+), 13 deletions(-) diff --git a/samples/AllControls/Droid/AllControls.Droid.fsproj b/samples/AllControls/Droid/AllControls.Droid.fsproj index 82853a9c8..7999c244c 100644 --- a/samples/AllControls/Droid/AllControls.Droid.fsproj +++ b/samples/AllControls/Droid/AllControls.Droid.fsproj @@ -17,8 +17,9 @@ Properties\AndroidManifest.xml Resources Assets - twitchdeck - twitchdeck + true + Google Pixel 2 + Android_Accelerated_x86_Nougat AllControls.Droid true diff --git a/samples/AllControls/Droid/Properties/AndroidManifest.xml b/samples/AllControls/Droid/Properties/AndroidManifest.xml index 8a967a582..c0aaf9719 100644 --- a/samples/AllControls/Droid/Properties/AndroidManifest.xml +++ b/samples/AllControls/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/Fabulous.Core/Xamarin.Forms.Core.fs b/src/Fabulous.Core/Xamarin.Forms.Core.fs index b4edce875..7a427095f 100644 --- a/src/Fabulous.Core/Xamarin.Forms.Core.fs +++ b/src/Fabulous.Core/Xamarin.Forms.Core.fs @@ -279,6 +279,8 @@ type View() = [] static member val _LabelAttribKey : AttributeKey<_> = AttributeKey<_>("Label") [] + static member val _EntryCellTextChangedAttribKey : AttributeKey<_> = AttributeKey<_>("EntryCellTextChanged") + [] static member val _VerticalTextAlignmentAttribKey : AttributeKey<_> = AttributeKey<_>("VerticalTextAlignment") [] static member val _FormattedTextAttribKey : AttributeKey<_> = AttributeKey<_>("FormattedText") @@ -6811,6 +6813,7 @@ type View() = ?placeholder: string, ?horizontalTextAlignment: Xamarin.Forms.TextAlignment, ?completed: string -> unit, + ?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit, ?height: double, ?isEnabled: bool, ?classId: string, @@ -6825,6 +6828,7 @@ type View() = let attribCount = match placeholder with Some _ -> attribCount + 1 | None -> attribCount let attribCount = match horizontalTextAlignment with Some _ -> attribCount + 1 | None -> attribCount let attribCount = match completed with Some _ -> attribCount + 1 | None -> attribCount + let attribCount = match textChanged with Some _ -> attribCount + 1 | None -> attribCount let attribBuilder = View.BuildCell(attribCount, ?height=height, ?isEnabled=isEnabled, ?classId=classId, ?styleId=styleId, ?automationId=automationId, ?created=created, ?ref=ref) match label with None -> () | Some v -> attribBuilder.Add(View._LabelAttribKey, (v)) @@ -6833,20 +6837,21 @@ type View() = match placeholder with None -> () | Some v -> attribBuilder.Add(View._PlaceholderAttribKey, (v)) match horizontalTextAlignment with None -> () | Some v -> attribBuilder.Add(View._HorizontalTextAlignmentAttribKey, (v)) match completed with None -> () | Some v -> attribBuilder.Add(View._EntryCompletedAttribKey, (fun f -> System.EventHandler(fun sender args -> f (sender :?> Xamarin.Forms.EntryCell).Text))(v)) + match textChanged with None -> () | Some v -> attribBuilder.Add(View._EntryCellTextChangedAttribKey, (fun f -> System.EventHandler(fun _sender args -> f args))(v)) attribBuilder [] - static member val CreateFuncEntryCell : (unit -> Xamarin.Forms.EntryCell) = (fun () -> View.CreateEntryCell()) + static member val CreateFuncEntryCell : (unit -> Fabulous.CustomControls.CustomEntryCell) = (fun () -> View.CreateEntryCell()) [] - static member CreateEntryCell () : Xamarin.Forms.EntryCell = - upcast (new Xamarin.Forms.EntryCell()) + static member CreateEntryCell () : Fabulous.CustomControls.CustomEntryCell = + upcast (new Fabulous.CustomControls.CustomEntryCell()) [] - static member val UpdateFuncEntryCell = (fun (prevOpt: ViewElement voption) (curr: ViewElement) (target: Xamarin.Forms.EntryCell) -> View.UpdateEntryCell (prevOpt, curr, target)) + static member val UpdateFuncEntryCell = (fun (prevOpt: ViewElement voption) (curr: ViewElement) (target: Fabulous.CustomControls.CustomEntryCell) -> View.UpdateEntryCell (prevOpt, curr, target)) [] - static member UpdateEntryCell (prevOpt: ViewElement voption, curr: ViewElement, target: Xamarin.Forms.EntryCell) = + static member UpdateEntryCell (prevOpt: ViewElement voption, curr: ViewElement, target: Fabulous.CustomControls.CustomEntryCell) = // update the inherited Cell element let baseElement = (if View.ProtoCell.IsNone then View.ProtoCell <- Some (View.Cell())); View.ProtoCell.Value baseElement.UpdateInherited (prevOpt, curr, target) @@ -6862,6 +6867,8 @@ type View() = let mutable currHorizontalTextAlignmentOpt = ValueNone let mutable prevEntryCompletedOpt = ValueNone let mutable currEntryCompletedOpt = ValueNone + let mutable prevEntryCellTextChangedOpt = ValueNone + let mutable currEntryCellTextChangedOpt = ValueNone for kvp in curr.AttributesKeyed do if kvp.Key = View._LabelAttribKey.KeyValue then currLabelOpt <- ValueSome (kvp.Value :?> string) @@ -6875,6 +6882,8 @@ type View() = currHorizontalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment) if kvp.Key = View._EntryCompletedAttribKey.KeyValue then currEntryCompletedOpt <- ValueSome (kvp.Value :?> System.EventHandler) + if kvp.Key = View._EntryCellTextChangedAttribKey.KeyValue then + currEntryCellTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler) match prevOpt with | ValueNone -> () | ValueSome prev -> @@ -6891,6 +6900,8 @@ type View() = prevHorizontalTextAlignmentOpt <- ValueSome (kvp.Value :?> Xamarin.Forms.TextAlignment) if kvp.Key = View._EntryCompletedAttribKey.KeyValue then prevEntryCompletedOpt <- ValueSome (kvp.Value :?> System.EventHandler) + if kvp.Key = View._EntryCellTextChangedAttribKey.KeyValue then + prevEntryCellTextChangedOpt <- ValueSome (kvp.Value :?> System.EventHandler) match prevLabelOpt, currLabelOpt with | ValueSome prevValue, ValueSome currValue when prevValue = currValue -> () | _, ValueSome currValue -> target.Label <- currValue @@ -6922,6 +6933,12 @@ type View() = | ValueNone, ValueSome currValue -> target.Completed.AddHandler(currValue) | ValueSome prevValue, ValueNone -> target.Completed.RemoveHandler(prevValue) | ValueNone, ValueNone -> () + match prevEntryCellTextChangedOpt, currEntryCellTextChangedOpt with + | ValueSome prevValue, ValueSome currValue when identical prevValue currValue -> () + | ValueSome prevValue, ValueSome currValue -> target.TextChanged.RemoveHandler(prevValue); target.TextChanged.AddHandler(currValue) + | ValueNone, ValueSome currValue -> target.TextChanged.AddHandler(currValue) + | ValueSome prevValue, ValueNone -> target.TextChanged.RemoveHandler(prevValue) + | ValueNone, ValueNone -> () /// Describes a EntryCell in the view static member inline EntryCell(?label: string, @@ -6930,13 +6947,14 @@ type View() = ?placeholder: string, ?horizontalTextAlignment: Xamarin.Forms.TextAlignment, ?completed: string -> unit, + ?textChanged: Xamarin.Forms.TextChangedEventArgs -> unit, ?height: double, ?isEnabled: bool, ?classId: string, ?styleId: string, ?automationId: string, - ?created: (Xamarin.Forms.EntryCell -> unit), - ?ref: ViewRef) = + ?created: (Fabulous.CustomControls.CustomEntryCell -> unit), + ?ref: ViewRef) = let attribBuilder = View.BuildEntryCell(0, ?label=label, @@ -6945,15 +6963,16 @@ type View() = ?placeholder=placeholder, ?horizontalTextAlignment=horizontalTextAlignment, ?completed=completed, + ?textChanged=textChanged, ?height=height, ?isEnabled=isEnabled, ?classId=classId, ?styleId=styleId, ?automationId=automationId, - ?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox target))), - ?ref=(match ref with None -> None | Some (ref: ViewRef) -> Some ref.Unbox)) + ?created=(match created with None -> None | Some createdFunc -> Some (fun (target: obj) -> createdFunc (unbox target))), + ?ref=(match ref with None -> None | Some (ref: ViewRef) -> Some ref.Unbox)) - ViewElement.Create(View.CreateFuncEntryCell, View.UpdateFuncEntryCell, attribBuilder) + ViewElement.Create(View.CreateFuncEntryCell, View.UpdateFuncEntryCell, attribBuilder) [] static member val ProtoEntryCell : ViewElement option = None with get, set @@ -11244,6 +11263,9 @@ module ViewElementExtensions = /// Adjusts the Label property in the visual element member x.Label(value: string) = x.WithAttribute(View._LabelAttribKey, (value)) + /// Adjusts the EntryCellTextChanged property in the visual element + member x.EntryCellTextChanged(value: Xamarin.Forms.TextChangedEventArgs -> unit) = x.WithAttribute(View._EntryCellTextChangedAttribKey, (fun f -> System.EventHandler(fun _sender args -> f args))(value)) + /// Adjusts the VerticalTextAlignment property in the visual element member x.VerticalTextAlignment(value: Xamarin.Forms.TextAlignment) = x.WithAttribute(View._VerticalTextAlignmentAttribKey, (value)) @@ -11872,6 +11894,9 @@ module ViewElementExtensions = /// Adjusts the Label property in the visual element let label (value: string) (x: ViewElement) = x.Label(value) + /// Adjusts the EntryCellTextChanged property in the visual element + let entryCellTextChanged (value: Xamarin.Forms.TextChangedEventArgs -> unit) (x: ViewElement) = x.EntryCellTextChanged(value) + /// Adjusts the VerticalTextAlignment property in the visual element let verticalTextAlignment (value: Xamarin.Forms.TextAlignment) (x: ViewElement) = x.VerticalTextAlignment(value) From b61a43f149842157c8120c1f5686dcd7ba7e181a Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Sun, 18 Nov 2018 18:56:35 +0000 Subject: [PATCH 09/11] Added the CustomControls NuGet package to the template projects. --- samples/AllControls/Droid/Properties/AndroidManifest.xml | 2 +- templates/content/blank/NewApp.Android/NewApp.Android.fsproj | 3 +++ templates/content/blank/NewApp.Android/packages.config | 1 + templates/content/blank/NewApp.WPF/NewApp.WPF.fsproj | 1 + templates/content/blank/NewApp.iOS/NewApp.iOS.fsproj | 3 +++ templates/content/blank/NewApp.iOS/packages.config | 1 + templates/content/blank/NewApp.macOS/packages.config | 1 + templates/content/blank/NewApp/NewApp.fsproj | 1 + 8 files changed, 12 insertions(+), 1 deletion(-) diff --git a/samples/AllControls/Droid/Properties/AndroidManifest.xml b/samples/AllControls/Droid/Properties/AndroidManifest.xml index c0aaf9719..8a967a582 100644 --- a/samples/AllControls/Droid/Properties/AndroidManifest.xml +++ b/samples/AllControls/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/templates/content/blank/NewApp.Android/NewApp.Android.fsproj b/templates/content/blank/NewApp.Android/NewApp.Android.fsproj index 5a9b373e8..f9e7616be 100644 --- a/templates/content/blank/NewApp.Android/NewApp.Android.fsproj +++ b/templates/content/blank/NewApp.Android/NewApp.Android.fsproj @@ -180,6 +180,9 @@ ..\packages/Fabulous.LiveUpdate.FabulousPkgsVersion/lib/netstandard2.0/Fabulous.LiveUpdate.dll + + ..\packages/Fabulous.CustomControls.FabulousPkgsVersion/lib/netstandard2.0/Fabulous.CustomControls.dll + ..\packages/Newtonsoft.Json.NewtonsoftJsonPkg/lib/netstandard2.0/Newtonsoft.Json.dll diff --git a/templates/content/blank/NewApp.Android/packages.config b/templates/content/blank/NewApp.Android/packages.config index 920b04923..826d94628 100644 --- a/templates/content/blank/NewApp.Android/packages.config +++ b/templates/content/blank/NewApp.Android/packages.config @@ -30,5 +30,6 @@ + \ No newline at end of file diff --git a/templates/content/blank/NewApp.WPF/NewApp.WPF.fsproj b/templates/content/blank/NewApp.WPF/NewApp.WPF.fsproj index eab17de69..7d1f38f90 100644 --- a/templates/content/blank/NewApp.WPF/NewApp.WPF.fsproj +++ b/templates/content/blank/NewApp.WPF/NewApp.WPF.fsproj @@ -25,6 +25,7 @@ + diff --git a/templates/content/blank/NewApp.iOS/NewApp.iOS.fsproj b/templates/content/blank/NewApp.iOS/NewApp.iOS.fsproj index dee91d19d..c6fafaaee 100644 --- a/templates/content/blank/NewApp.iOS/NewApp.iOS.fsproj +++ b/templates/content/blank/NewApp.iOS/NewApp.iOS.fsproj @@ -172,6 +172,9 @@ ..\packages\Fabulous.LiveUpdate.FabulousPkgsVersion\lib\netstandard2.0\Fabulous.LiveUpdate.dll + + ..\packages\Fabulous.CustomControls.FabulousPkgsVersion\lib\netstandard2.0\Fabulous.CustomControls.dll + ..\packages\Newtonsoft.Json.NewtonsoftJsonPkg\lib\netstandard2.0\Newtonsoft.Json.dll diff --git a/templates/content/blank/NewApp.iOS/packages.config b/templates/content/blank/NewApp.iOS/packages.config index 07b557843..5879fb1a2 100644 --- a/templates/content/blank/NewApp.iOS/packages.config +++ b/templates/content/blank/NewApp.iOS/packages.config @@ -6,5 +6,6 @@ + \ No newline at end of file diff --git a/templates/content/blank/NewApp.macOS/packages.config b/templates/content/blank/NewApp.macOS/packages.config index 186c645fb..339b9f5ad 100644 --- a/templates/content/blank/NewApp.macOS/packages.config +++ b/templates/content/blank/NewApp.macOS/packages.config @@ -5,5 +5,6 @@ + \ No newline at end of file diff --git a/templates/content/blank/NewApp/NewApp.fsproj b/templates/content/blank/NewApp/NewApp.fsproj index 964c706aa..09eb7222f 100644 --- a/templates/content/blank/NewApp/NewApp.fsproj +++ b/templates/content/blank/NewApp/NewApp.fsproj @@ -12,6 +12,7 @@ + From ed9c78e5cde3f23c17a009123f59c990a5f6ddd7 Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Sun, 18 Nov 2018 19:53:18 +0000 Subject: [PATCH 10/11] Moved the custom controls project into the `src` folder. --- Fabulous.sln | 2 +- build.fsx | 30 +++++++++++-------- src/Fabulous.Core/Fabulous.Core.fsproj | 2 +- .../Fabulous.CustomControls/Controls.fs | 0 .../Fabulous.CustomControls.fsproj | 0 tools/Generator/Xamarin.Forms.Core.json | 2 +- 6 files changed, 20 insertions(+), 16 deletions(-) rename {customControls => src}/Fabulous.CustomControls/Controls.fs (100%) rename {customControls => src}/Fabulous.CustomControls/Fabulous.CustomControls.fsproj (100%) diff --git a/Fabulous.sln b/Fabulous.sln index e6ae22b0d..e00b32c16 100644 --- a/Fabulous.sln +++ b/Fabulous.sln @@ -63,7 +63,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{1199BA9F EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "extensions", "extensions", "{13C0EB5D-E38E-4714-9421-77CD9C53A067}" EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Fabulous.CustomControls", "customControls\Fabulous.CustomControls\Fabulous.CustomControls.fsproj", "{7FF328BB-9318-4C11-8A9A-37DD98EAB35B}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Fabulous.CustomControls", "src\Fabulous.CustomControls\Fabulous.CustomControls.fsproj", "{7FF328BB-9318-4C11-8A9A-37DD98EAB35B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/build.fsx b/build.fsx index 8d51736fc..37a7f7d40 100644 --- a/build.fsx +++ b/build.fsx @@ -36,7 +36,7 @@ type ProjectDefinition = Name: string Path: IGlobbingPattern Action: BuildAction - OutputPath: string + OutputPath: string option } let release = ReleaseNotes.load "RELEASE_NOTES.MD" @@ -50,19 +50,23 @@ let removeIncompatiblePlatformProjects pattern = pattern let projects = [ - { Name = "Src"; Path = !! "src/**/*.fsproj"; Action = DotNetPack; OutputPath = buildDir } - { Name = "Extensions"; Path = !! "extensions/**/*.fsproj"; Action = DotNetPack; OutputPath = buildDir } - { Name = "Tests"; Path = !! "tests/**/*.fsproj"; Action = MSBuild Release; OutputPath = buildDir + "/tests" } - { Name = "Templates"; Path = !! "templates/**/*.nuspec"; Action = NuGetPack; OutputPath = buildDir } + { Name = "Src"; Path = !! "src/**/*.fsproj"; Action = DotNetPack; OutputPath = Some buildDir } + { Name = "Extensions"; Path = !! "extensions/**/*.fsproj"; Action = DotNetPack; OutputPath = Some buildDir } + { Name = "Tests"; Path = !! "tests/**/*.fsproj"; Action = MSBuild Release; OutputPath = Some (buildDir + "/tests") } + { Name = "Templates"; Path = !! "templates/**/*.nuspec"; Action = NuGetPack; OutputPath = Some buildDir } ] -let tools = { Name = "Tools"; Path = !! "tools/**/*.fsproj"; Action = MSBuild Release; OutputPath = buildDir + "/tools" } -let customControls = { Name = "CustomControls"; Path = !! "customControls/**/*.fsproj"; Action = DotNetPack; OutputPath = buildDir } -let samples = { Name = "Samples"; Path = (!! "samples/**/*.fsproj" |> removeIncompatiblePlatformProjects); Action = MSBuild Debug; OutputPath = buildDir + "/samples" } + +let tools = { Name = "Tools"; Path = !! "tools/**/*.fsproj"; Action = MSBuild Release; OutputPath = Some (buildDir + "/tools") } +let samples = { Name = "Samples"; Path = (!! "samples/**/*.fsproj" |> removeIncompatiblePlatformProjects); Action = MSBuild Debug; OutputPath = Some (buildDir + "/samples") } +let customControls = { Name = "CustomControls"; Path = !! "src/Fabulous.CustomControls/*.fsproj"; Action = MSBuild Release; OutputPath = None } let getOutputDir basePath proj = - let folderName = Path.GetFileNameWithoutExtension(proj) - sprintf "%s/%s/" basePath folderName + match basePath with + | Some path -> + let folderName = Path.GetFileNameWithoutExtension(proj) + sprintf "%s/%s/" path folderName + | None -> "" let msbuild (buildType: BuildType) (definition: ProjectDefinition) = let configuration = match buildType with Debug -> "Debug" | Release -> "Release" @@ -79,14 +83,14 @@ let dotnetPack (definition: ProjectDefinition) = { opt with Common = { opt.Common with CustomParams = Some "-p:IncludeSourceLink=True" } Configuration = DotNet.BuildConfiguration.Release - OutputPath = Some definition.OutputPath }) project + OutputPath = definition.OutputPath }) project let nugetPack (definition: ProjectDefinition) = for nuspec in definition.Path do NuGet.NuGetPack (fun opt -> { opt with WorkingDir = "templates" - OutputPath = definition.OutputPath + OutputPath = definition.OutputPath.Value Version = release.NugetVersion ReleaseNotes = (String.toLines release.Notes) }) nuspec @@ -138,7 +142,7 @@ Target.create "BuildTools" (fun _ -> ) Target.create "RunGenerator" (fun _ -> - DotNet.exec id (tools.OutputPath + "/Generator/Generator.dll") "tools/Generator/Xamarin.Forms.Core.json src/Fabulous.Core/Xamarin.Forms.Core.fs" |> ignore + DotNet.exec id (tools.OutputPath.Value + "/Generator/Generator.dll") "tools/Generator/Xamarin.Forms.Core.json src/Fabulous.Core/Xamarin.Forms.Core.fs" |> ignore ) Target.create "Build" (fun _ -> diff --git a/src/Fabulous.Core/Fabulous.Core.fsproj b/src/Fabulous.Core/Fabulous.Core.fsproj index 1454e11d4..250d95bbb 100644 --- a/src/Fabulous.Core/Fabulous.Core.fsproj +++ b/src/Fabulous.Core/Fabulous.Core.fsproj @@ -24,7 +24,7 @@ - + diff --git a/customControls/Fabulous.CustomControls/Controls.fs b/src/Fabulous.CustomControls/Controls.fs similarity index 100% rename from customControls/Fabulous.CustomControls/Controls.fs rename to src/Fabulous.CustomControls/Controls.fs diff --git a/customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj b/src/Fabulous.CustomControls/Fabulous.CustomControls.fsproj similarity index 100% rename from customControls/Fabulous.CustomControls/Fabulous.CustomControls.fsproj rename to src/Fabulous.CustomControls/Fabulous.CustomControls.fsproj diff --git a/tools/Generator/Xamarin.Forms.Core.json b/tools/Generator/Xamarin.Forms.Core.json index d629f7778..5f146fcd4 100644 --- a/tools/Generator/Xamarin.Forms.Core.json +++ b/tools/Generator/Xamarin.Forms.Core.json @@ -1,7 +1,7 @@ { "assemblies": [ "packages/neutral/Xamarin.Forms/lib/netstandard1.0/Xamarin.Forms.Core.dll", - "customControls/Fabulous.CustomControls/bin/Release/netstandard2.0/Fabulous.CustomControls.dll" + "src/Fabulous.CustomControls/bin/Release/netstandard2.0/Fabulous.CustomControls.dll" ], "outputNamespace": "Fabulous.DynamicViews", "types": [ From 095aa0f6a07ac2fe4cc41eb13d2a533a086aac02 Mon Sep 17 00:00:00 2001 From: Gareth Hubball Date: Sun, 18 Nov 2018 19:57:34 +0000 Subject: [PATCH 11/11] Removed TargetSDKVersion again. --- samples/TicTacToe/Droid/Properties/AndroidManifest.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/TicTacToe/Droid/Properties/AndroidManifest.xml b/samples/TicTacToe/Droid/Properties/AndroidManifest.xml index 7e67b17ff..1a43f26bb 100644 --- a/samples/TicTacToe/Droid/Properties/AndroidManifest.xml +++ b/samples/TicTacToe/Droid/Properties/AndroidManifest.xml @@ -1,5 +1,5 @@  - + \ No newline at end of file