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

Template updates and sdk support #1923

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@ root = true
[*.cs]
indent_style = tab
indent_size = 4
tab_size = 4
charset=utf-8
csharp_new_line_before_open_brace = all

# packages.config uses spaces
[**\packages.config]
indent_style = space
indent_size = 2

[*.{csproj,vbproj,proj,targets,props}]
[*.{csproj,vbproj,fsproj,proj,targets,props}]
indent_style = space
indent_size = 2
tab_size = 2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: microsoft/setup-msbuild@v1

- name: Build
run: dotnet build ${{ env.BuildParameters }} /p:Platform=Windows /t:Package /bl:artifacts/log/Build.Windows.binlog
run: dotnet build ${{ env.BuildParameters }} /p:Platform=Windows /t:Build /bl:artifacts/log/Build.Windows.binlog

- name: Build VS/Win Extension
run: msbuild ${{ env.BuildParameters }} /t:BuildAddins /bl:artifacts/log/Addin.Windows.binlog
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
echo "BuildParameters=${{ env.BuildParameters }} /p:EnableNotarizationBuild=True" >> $GITHUB_ENV

- name: Build
run: dotnet build ${{ env.BuildParameters }} /p:Platform=Mac /t:Package /bl:artifacts/log/Build.Mac.binlog
run: dotnet build ${{ env.BuildParameters }} /p:Platform=Mac /t:Build /bl:artifacts/log/Build.Mac.binlog

- name: Build VS/Mac extension
run: msbuild ${{ env.BuildParameters }} /t:BuildAddins /bl:artifacts/log/Addin.Mac.binlog
Expand Down
5 changes: 1 addition & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"editor.detectIndentation": false,
"files.exclude": {
"**/.vs": true,
"**/obj": true,
"**/bin": true,
"**/*.user": true,
"**/packages": true
"**/*.user": true
},
"var": {
"configuration" : "Debug",
Expand Down
46 changes: 45 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,50 @@
"clear": true
}
},
{
"label": "build-templates",
"command": "dotnet build ${config:var.buildProperties} /p:Configuration=${config:var.configuration} ${workspaceFolder}/src/Addins/Eto.Forms.Templates/Eto.Forms.Templates.csproj ; dotnet new -i ${workspaceFolder}/",
"type": "shell",
"problemMatcher": "$msCompile",
"group": "build",
"presentation": {
"clear": true
}
},
{
"label": "generate-templates",
"command": "dotnet msbuild ${workspaceFolder}/build/Build.proj /t:GenerateTemplates",
"type": "shell",
"dependsOn": [ "build-templates" ],
"problemMatcher": "$msCompile",
"group": "build",
"presentation": {
"clear": true
}
},
{
"label": "test-mac-publishing",
"command": "dotnet msbuild ${workspaceFolder}/build/Build.proj /t:TestMacPublishing",
"type": "shell",
"problemMatcher": "$msCompile",
"group": "build",
"presentation": {
"clear": true
}
},
{
"label": "build-packages",
"command": "dotnet msbuild /t:Package ${config:var.buildProperties} /p:Configuration=${config:var.configuration} ${workspaceFolder}/build/Build.proj",
"type": "shell",
"problemMatcher": "$msCompile",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"clear": true
}
},
{
"label": "build-gtk",
"command": "dotnet build ${config:var.buildProperties} /p:Configuration=${config:var.configuration} ${workspaceFolder}/test/Eto.Test.Gtk/Eto.Test.Gtk.csproj",
Expand Down Expand Up @@ -139,7 +183,7 @@
"type": "promptString",
"id": "version",
"description": "Enter the version to update to",
"default": "2.5.x"
"default": "2.5.x-dev"
}
]
}
138 changes: 112 additions & 26 deletions build/Build.proj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Package" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)Common.props" />

<PropertyGroup>
Expand All @@ -8,6 +8,8 @@
<BuildVersion Condition="$(BuildVersion) == ''"></BuildVersion>
<HasVSWin Condition="$(HasVSWin) == '' and $(OSPlatform) == 'Windows'">True</HasVSWin>
<HasVSMac Condition="$(HasVSMac) == '' and $(OSPlatform) != 'Windows'">True</HasVSMac>

<BuildProperties>Configuration=$(Configuration);Platform=$(OSPlatform)</BuildProperties>
</PropertyGroup>

<Target Name="PrintInfo" Condition="$(PrintInfo) != 'False'">
Expand Down Expand Up @@ -51,14 +53,15 @@

<FileUpdate Files="$(AddinDir)Eto.Addin.VisualStudio.Windows\source.extension.vsixmanifest"
WarnOnNoUpdate="true"
Pattern='(?&lt;=^\s*&lt;Identity\s+Id=&quot;Eto.Addin.VisualStudio.Windows&quot;.+?Version=&quot;)(.+?)(?=&quot;\s+)'
Pattern='(?&lt;=^\s*&lt;Identity\s+Id=&quot;Eto.Addin.VisualStudio&quot;.+?Version=&quot;)(.+?)(?=&quot;\s+)'
Replacement='$(AssemblyVersionBeforeRelease)' />

<PropertyGroup>
<PackageFiles>$(AddinDir)Eto.Forms.Templates\Eto.Forms.Templates.csproj</PackageFiles>
<ProjFiles>$(BasePath)src\Eto\sdk\Sdk.targets</ProjFiles>
</PropertyGroup>

<MSBuild Targets="UpdateReference" Properties="ReferenceName=(Eto([.][\\w]+)+);ReferenceVersion=$(AssemblyInformationalVersion);PackageFiles=$(PackageFiles);PrintInfo=False" Projects="$(MSBuildProjectFile)"/>
<MSBuild Targets="UpdateReference" Properties='ReferenceName=(Eto[.][^"]+);ReferenceVersion=$(AssemblyInformationalVersion);PackageFiles=$(PackageFiles);ProjFiles=$(ProjFiles);PrintInfo=False' Projects="$(MSBuildProjectFile)"/>

</Target>

Expand Down Expand Up @@ -87,6 +90,7 @@
<ProjFiles Include="$(ProjFiles)" Condition="$(ProjFiles) != ''" />
<ProjFiles Include="$(BasePath)**\*.csproj" />
<ProjFiles Include="$(BasePath)**\*.fsproj" />
<ProjFiles Include="$(BasePath)**\*.vbproj" />

<PackageFiles Include="$(PackageFiles)" Condition="$(PackageFiles) != ''" />
</ItemGroup>
Expand All @@ -109,6 +113,12 @@
Pattern="(?&lt;=&lt;PackageReference.+?Include\s*[=]\s*&quot;$(ReferenceName)&quot;.*&gt;\s*&lt;Version&gt;)$(ReplaceVersionPattern)(?=&lt;)"
Replacement='$(ReferenceVersion)' />

<!-- Sdk version -->
<FileUpdate Files="@(ProjFiles)"
WarnOnNoUpdate="false"
Pattern='(?&lt;=&lt;Project Sdk\s*[=]\s*&quot;$(ReferenceName)[/])$(ReplaceVersionPattern)(?="&gt;)'
Replacement='$(ReferenceVersion)' />

<!-- PackageVersion tag in sdk-style projects -->
<FileUpdate Files="@(PackageFiles)"
WarnOnNoUpdate="false"
Expand All @@ -126,7 +136,7 @@
Replacement='$(ReferenceVersion)' />
</Target>

<Target Name="BuildHelpShfb" DependsOnTargets="Build">
<Target Name="BuildHelpShfb" DependsOnTargets="BuildCore">
<PropertyGroup>
<SHFBVersion>2017.12.30.2</SHFBVersion>
<SHFBPath>$(MSBuildThisFileDirectory)..\artifacts\packages\EWSoftware.SHFB.$(SHFBVersion)\tools\</SHFBPath>
Expand All @@ -142,67 +152,113 @@
<StandalonePackage Include="$(AddinDir)Eto.Forms.Templates\Eto.Forms.Templates.csproj" />
</ItemGroup>

<!-- Build all source code -->
<Target Name="Build" DependsOnTargets="UpdateVersion;PrintInfo">

<PropertyGroup>
<BuildProperties>Configuration=$(Configuration);Platform=$(OSPlatform)</BuildProperties>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="BuildCore;Package;BuildSamples">
</Target>

<!-- Build all source code -->
<Target Name="BuildCore" DependsOnTargets="UpdateVersion;PrintInfo">
<MSBuild Projects="$(SourceDir)Eto.sln" Targets="Restore" Properties="$(BuildProperties);_RestoreEnforceEvaluate=True" />
<MSBuild Projects="$(SourceDir)Eto.sln" Targets="$(PackageTargets)" Properties="$(BuildProperties)" />
</Target>

<Target Name="BuildSamples" DependsOnTargets="BuildCore">
<MSBuild Projects="$(BasePath)samples\Samples.sln" Targets="Restore" Properties="$(BuildProperties);_RestoreEnforceEvaluate=True"/>
<MSBuild Projects="$(BasePath)samples\Samples.sln" Targets="$(PackageTargets)" Properties="$(BuildProperties)"/>
</Target>

<!-- Package everything up into nuget packages -->
<Target Name="Package" DependsOnTargets="Build">
<Target Name="Package">
<MSBuild Projects="$(SourceDir)Eto.sln" Targets="Restore" Properties="$(BuildProperties);IsPacking=True;_RestoreEnforceEvaluate=True" />
<MSBuild Projects="$(SourceDir)Eto.sln" Targets="Pack" Properties="$(BuildProperties);IsPacking=True" />

<!-- build dotnet template -->
<MSBuild Projects="%(StandalonePackage.Identity)" Targets="Restore" Properties="Configuration=$(Configuration);_RestoreEnforceEvaluate=True" />
<MSBuild Projects="%(StandalonePackage.Identity)" Targets="Pack" Properties="Configuration=$(Configuration);IsPacking=True" />

<ItemGroup>
<EtoFormsPackages Include="$([System.IO.Directory]::GetDirectories('$(ArtifactsDir)packages', 'eto.*'))" Condition="Exists('$(ArtifactsDir)packages')"/>
</ItemGroup>

<RemoveDir Directories="@(EtoFormsPackages)" />
</Target>

<Target Name="SetupNugetConfig">
<PropertyGroup>
<NugetConfigPath>$(ArtifactsDir)nuget.config</NugetConfigPath>
<NugetPackagesPath>$(ArtifactsDir)packages</NugetPackagesPath>
</PropertyGroup>

<!-- <RemoveDir Directories="$(NugetPackagesPath)"/> -->

<Exec Command='dotnet new nuget -o $(ArtifactsDir) &amp;&amp; dotnet nuget add source "./nuget/$(Configuration)" --name eto-local --configfile "$(NugetConfigPath)"'
Condition="!Exists('$(NugetConfigPath)')" />
</Target>

<!-- Generate all permutations of the templates for testing -->
<Target Name="GenerateTemplates">
<Target Name="GenerateTemplates" DependsOnTargets="Package;SetupNugetConfig">

<RemoveDir Directories="$(ArtifactsDir)templates"/>

<!-- install the current version of the templates -->
<Exec Command="dotnet new -i $(PackageOutputPath)Eto.Forms.Templates.$(InformationalVersion).nupkg" />

<!-- generate project templates -->
<ItemGroup>
<Language Include="fs" Value="F#" />
<Language Include="cs" Value="C#" />
<Language Include="fs" Value="F#" />
<Language Include="vb" Value="VB" />

<Mode Include="code" />
<Mode Include="json" />
<Mode Include="preview" />
<Mode Include="xaml" />
<Mode Include="json" />

<Combined Include="combined" Value="-c" />
<Combined Include="separate" Value="" />

<Framework Include="net50" Value="net5.0" />
<Framework Include="net48" Value="net48" />

<OtherOptions Include="none" Value="" />
<OtherOptions Include="wf" Value="-wf" />
<OtherOptions Include="xm" Value="-xm" />
<OtherOptions Include="wf_xm" Value="-wf -xm" />

<Combined Include="separate" Value="" />
<Combined Include="combined" Value="-c" />

<Framework Include="full" />
<Framework Include="core" />
<Framework Include="both" />
<OtherOptions Include="xm" Value="-xm" />

<CombinedProject1 Include="*" LanguageId="%(Language.Identity)" Language="%(Language.Value)" />
<CombinedProject2 Include="@(CombinedProject1)" ModeId="%(Mode.Identity)" Mode="%(Mode.Identity)" />
<CombinedProject3 Include="@(CombinedProject2)" CombinedId="%(Combined.Identity)" Combined="%(Combined.Value)" />
<CombinedProject4 Include="@(CombinedProject3)" FrameworkId="%(Framework.Identity)" Framework="%(Framework.Identity)" />
<CombinedProject4 Include="@(CombinedProject3)" FrameworkId="%(Framework.Identity)" Framework="%(Framework.Value)" />
<CombinedProject Include="@(CombinedProject4)" OtherId="%(OtherOptions.Identity)" Other="%(OtherOptions.Value)" />
<CombinedProject Update="@(CombinedProject)"
OutputPath="$(ArtifactsDir)templates\App.%(LanguageId)-%(CombinedId)-%(OtherId)-%(ModeId)-%(FrameworkId)"
BuildCommand="&amp;&amp; dotnet build" />

<!-- Xamarin.Mac doesn't support VB -->
<CombinedProject Remove="@(CombinedProject)" Condition="%(CombinedId) == 'combined' and %(LanguageId) == 'vb' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm')" />
<!-- Wpf doesn't support F# -->
<CombinedProject Remove="@(CombinedProject)" Condition="%(LanguageId) == 'fs' and (%(OtherId) == 'none' or %(OtherId) == 'xm')" />


<!-- Can only build wpf/winforms .NET 5 projects on windows.. :( -->
<CombinedProject Update="@(CombinedProject)"
Condition="%(CombinedId) == 'separate' and !$([MSBuild]::IsOSPlatform(Windows))"
BuildCommand="&amp;&amp; dotnet build **/*.Mac.*proj &amp;&amp;dotnet build **/*.Gtk.*proj" />

<!-- Xamarin.Mac separate projects require msbuild -->
<CombinedProject Update="@(CombinedProject)" Condition="%(CombinedId) == 'separate' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm')"
BuildCommand='%(BuildCommand) &amp;&amp;env -i HOME="$HOME" bash -l -c "msbuild /restore /v:Minimal **/*.XamMac.*proj"' />

<!-- Xamarin.Mac combined doesn't support building with dotnet other than csharp :( -->
<CombinedProject Update="@(CombinedProject)" Condition="%(CombinedId) == 'combined' and (%(LanguageId) != 'cs' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm'))"
BuildCommand='&amp;&amp; env -i HOME="$HOME" bash -l -c "msbuild /restore /v:Minimal"' />

<!-- Only build Xamarin.Mac on Mac -->
<CombinedProject Update="@(CombinedProject)" Condition="!$([MSBuild]::IsOSPlatform(OSX)) and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm')"
BuildCommand="" />

</ItemGroup>

<Exec Command="export DOTNET_NEW_LOCAL_SEARCH_FILE_ONLY=TRUE &amp;&amp; dotnet new etoapp -m %(CombinedProject.Mode) -sln -lang %(Language) %(Other) %(Combined) -f %(Framework) -o $(ArtifactsDir)templates\App.%(LanguageId)-%(CombinedId)-%(OtherId)-%(ModeId)-%(FrameworkId)" />
<Exec Command="dotnet new etoapp -m %(CombinedProject.Mode) -sln -lang %(Language) %(Other) %(Combined) -f %(Framework) -o %(OutputPath) &amp;&amp; cd %(OutputPath) %(BuildCommand)" EnvironmentVariables="NUGET_PACKAGES=$(NugetPackagesPath);DOTNET_NEW_LOCAL_SEARCH_FILE_ONLY=1" />

<!-- generate file templates -->
<ItemGroup>
Expand All @@ -215,8 +271,38 @@
<CombinedFile Include="@(CombinedFile2)" BaseId="%(Base.Identity)" Base="%(Base.Value)" />
</ItemGroup>

<Exec Command="dotnet new etofile -m %(CombinedFile.Mode) -b %(Base) -o $(ArtifactsDir)templates\File_%(LanguageId)-%(ModeId)-%(Base)" />
<Exec Command="dotnet new etofile -m %(CombinedFile.Mode) -b %(Base) -lang %(Language) -o $(ArtifactsDir)templates/File_%(LanguageId)-%(ModeId)-%(Base)" />

</Target>

<Target Name="TestMacPublishing" DependsOnTargets="Package;SetupNugetConfig">

<RemoveDir Directories="$(ArtifactsDir)mac-publish"/>

<!-- install the current version of the templates -->
<Exec Command="dotnet new -i $(PackageOutputPath)Eto.Forms.Templates.$(InformationalVersion).nupkg" />

<!-- generate project templates -->
<ItemGroup>
<Config Include="release" Value="-c Release" />
<Config Include="debug" Value="-c Debug" />

<Build Include="build-net4" Create="-f net48" Build="build" />
<Build Include="build-net5" Create="-f net5.0" Build="build" />
<Build Include="build-rid-net5" Create="-f net5.0" Build="build -r osx-x64" />
<Build Include="publish-net5" Create="-f net5.0" Build="publish" />
<Build Include="publish-rid-net5" Create="-f net5.0" Build="publish -r osx-x64" />

<Combined Include="combined" Value="-c" />
<Combined Include="separate" Value="" Build="**/*.Mac.csproj" />

<CombinedPublish2 Include="*" CombinedId="%(Combined.Identity)" Combined="%(Combined.Value)" CombinedBuild="%(Combined.Build)" />
<CombinedPublish1 Include="@(CombinedPublish2)" ConfigId="%(Config.Identity)" Config="%(Config.Value)" />
<CombinedPublish Include="@(CombinedPublish1)" BuildId="%(Build.Identity)" BuildCreate="%(Build.Create)" Build="%(Build.Build)" />
<CombinedPublish Update="@(CombinedPublish)" OutputPath="$(ArtifactsDir)mac-publish/App-%(BuildId)-%(ConfigId)-%(CombinedId)/" />
</ItemGroup>

<Exec Command="dotnet new etoapp %(CombinedPublish.Combined) %(BuildCreate) -o %(OutputPath) &amp;&amp; cd %(OutputPath) &amp;&amp; dotnet %(Build) %(Config) %(CombinedBuild)" EnvironmentVariables="NUGET_PACKAGES=$(ArtifactsDir)packages/" />
</Target>

<!-- build the MD/VS for Mac and/or the VS addin, depending on your platform -->
Expand Down
3 changes: 2 additions & 1 deletion build/Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>

<BasePath>$(MSBuildThisFileDirectory)..\</BasePath>
<BasePath>$([System.IO.Path]::GetFullPath($(BasePath)))</BasePath>
<OSPlatform Condition="$(OSPlatform) == '' and '$(OS)' == 'Unix' and !Exists('/Library/Frameworks')">Linux</OSPlatform>
<OSPlatform Condition="$(OSPlatform) == '' and '$(OS)' == 'Unix' and Exists('/Library/Frameworks')">Mac</OSPlatform>
<OSPlatform Condition="$(OSPlatform) == '' and '$(OS)' != 'Unix'">Windows</OSPlatform>
Expand Down Expand Up @@ -40,7 +41,7 @@
<InformationalVersion Condition="$(InformationalVersion) == ''">$(DevVersion)-dev</InformationalVersion>

<Company>Picoe Software Solutions</Company>
<Copyright>(c) 2010-2020 by Curtis Wensley, 2012-2014 by Vivek Jhaveri and contributors</Copyright>
<Copyright>(c) 2010-2021 by Curtis Wensley, 2012-2014 by Vivek Jhaveri and contributors</Copyright>

<PackageVersion>$(InformationalVersion)</PackageVersion>
<PackageLicenseFile>Eto-LICENSE.txt</PackageLicenseFile>
Expand Down
2 changes: 2 additions & 0 deletions build/Utilities.targets
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,8 @@ public class IncrementVersion : Task
Version beforeVersion;
if (!hasSuffix)
beforeVersion = version;
else if (version.Build > 0)
beforeVersion = new Version(version.Major, version.Minor, version.Build - 1, 9999);
else if (version.Minor > 0)
beforeVersion = new Version(version.Major, version.Minor - 1, 9999, 0);
else {
Expand Down
Loading