Skip to content

Commit

Permalink
Merge pull request #26 from picoe/curtis/nuget-and-ci
Browse files Browse the repository at this point in the history
Add nuget and CI
  • Loading branch information
cwensley authored Oct 17, 2019
2 parents bd0c5d3 + 5d14475 commit 02adddc
Show file tree
Hide file tree
Showing 25 changed files with 406 additions and 219 deletions.
7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The following authors have all licensed their contributions to Eto.Toolkit
under the licensing terms detailed in LICENSE.

(Authors keep copyright of their contributions, of course; they just grant
a license to everyone to use it as detailed in LICENSE.)

* Curtis Wensley
56 changes: 56 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
variables:
solution: 'src/Eto.Toolkit.sln'
build.version: '0.1.0-ci-$(Build.BuildNumber)'
build.configuration: 'Release'
build.arguments: /restore /t:Build;Pack /p:BuildVersion=$(build.version) /p:BuildBranch=$(Build.SourceBranch)

trigger:
- master
- refs/tags/*

jobs:
- job: Mac
pool:
vmImage: 'macOS-10.14'
variables:
build.platform: 'Mac'
steps:
- checkout: self
submodules: true
- script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_18_1
displayName: 'Select Xamarin SDK version'
- task: MSBuild@1
displayName: Restore, Build and Package
inputs:
solution: '$(solution)'
platform: '$(build.platform)'
configuration: '$(build.configuration)'
msbuildArguments: '$(build.arguments)'
- task: PublishBuildArtifacts@1
displayName: Publish nupkg
inputs:
pathtoPublish: artifacts/nuget/$(build.configuration)
artifactName: nuget
publishLocation: container

- job: Windows
pool:
vmImage: 'windows-2019'
variables:
build.platform: 'Windows'
steps:
- checkout: self
submodules: true
- task: MSBuild@1
displayName: Restore, Build and Package
inputs:
solution: '$(solution)'
platform: '$(build.platform)'
configuration: '$(build.configuration)'
msbuildArguments: '$(build.arguments)'
- task: PublishBuildArtifacts@1
displayName: Publish nupkg
inputs:
pathtoPublish: artifacts/nuget/$(build.configuration)
artifactName: nuget
publishLocation: container
20 changes: 18 additions & 2 deletions build/Common.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,25 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BasePath>$(MSBuildThisFileDirectory)..\</BasePath>
<BaseIntermediateOutputPath Condition="$(BaseIntermediateOutputPath) == ''">$(BasePath)artifacts\obj\$(OS)\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<BaseOutputPath Condition="$(BaseOutputPath) == ''">$(BasePath)\artifacts\$(OutputArtifactName)\</BaseOutputPath>
<ArtifactsDir>$(BasePath)artifacts\</ArtifactsDir>
<BaseIntermediateOutputPath Condition="$(BaseIntermediateOutputPath) == ''">$(ArtifactsDir)obj\$(OS)\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<BaseOutputPath Condition="$(BaseOutputPath) == ''">$(ArtifactsDir)$(OutputArtifactName)\</BaseOutputPath>
<PackageOutputPath Condition="$(PackageOutputPath) == ''">$(ArtifactsDir)nuget\$(Configuration)\</PackageOutputPath>
<RestoreProjectStyle Condition="'$(RestoreProjectStyle)' == ''">PackageReference</RestoreProjectStyle>
</PropertyGroup>

<PropertyGroup>
<!-- set version from tag -->
<Version Condition="$(BuildBranch.StartsWith('refs/tags/'))">$(BuildBranch.Substring(10))</Version>
<!-- set version for CI build -->
<Version Condition="$(Version) == '' AND $(BuildVersion) != ''">$(BuildVersion)</Version>

<Version Condition="$(Version) == ''">0.1.0-dev</Version>
<Authors>Eto.Toolkit Authors</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/picoe/Eto.Toolkit</RepositoryUrl>
<Copyright>Copyright (c) 2016-2019 Eto.Toolkit authors, see AUTHORS file.</Copyright>
</PropertyGroup>

<Import Condition="Exists('$(BasePath)..\Eto.Toolkit.props')" Project="$(BasePath)..\Eto.Toolkit.props" />
</Project>
6 changes: 5 additions & 1 deletion src/Eto.CodeEditor.Wpf/Eto.CodeEditor.Wpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<TargetFrameworkProfile />
<BaseIntermediateOutputPath>..\..\artifacts\obj\Eto.CodeEditor.Wpf</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -92,6 +91,11 @@
<PackageReference Include="jacobslusser.ScintillaNET.Signed">
<Version>3.6.3</Version>
</PackageReference>
<PackageReference Include="NuGet.Build.Tasks.Pack">
<Version>5.3.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
17 changes: 5 additions & 12 deletions src/Eto.CodeEditor.XamMac/Eto.CodeEditor.XamMac2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,12 @@
<PackageReference Include="Eto.Platform.XamMac2">
<Version>2.4.1</Version>
</PackageReference>
<PackageReference Include="NuGet.Build.Packaging">
<Version>0.2.0</Version>
<PackageReference Include="NuGet.Build.Tasks.Pack">
<Version>5.3.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<TextStylePolicy TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" FileWidth="80" TabsToSpaces="True" scope="text/x-csharp" />
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceAfterControlFlowStatementKeyword="True" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" scope="text/x-csharp" />
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>

</Project>
19 changes: 0 additions & 19 deletions src/Eto.CodeEditor/Eto.CodeEditor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,8 @@

<PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageVersion>1.0.0</PackageVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\..\artifacts\core\Debug</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\..\artifacts\core\Release</OutputPath>
</PropertyGroup>
<ProjectExtensions>
<MonoDevelop>
<Properties>
<Policies>
<TextStylePolicy TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" FileWidth="80" TabsToSpaces="True" scope="text/x-csharp" />
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceAfterControlFlowStatementKeyword="True" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" scope="text/x-csharp" />
</Policies>
</Properties>
</MonoDevelop>
</ProjectExtensions>
<ItemGroup>
<PackageReference Include="Eto.Forms" Version="2.4.1" />
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.0" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions src/Eto.HtmlRenderer.ImageSharp/Eto.HtmlRenderer.ImageSharp.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Eto.HtmlRenderer\Eto.HtmlRenderer.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0007" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
//
// - Sun Tsu,
// "The Art of War"
#if USE_IMAGESHARP
using Eto.Drawing;
using TheArtOfDev.HtmlRenderer.Adapters;
using System.Collections.Generic;
Expand All @@ -19,6 +18,11 @@
using System.IO;
using SixLabors.ImageSharp.Formats.Png;
using System.Diagnostics;
using TheArtOfDev.HtmlRenderer.Eto.Adapters;
using SixLabors.ImageSharp.Metadata;
using SixLabors.ImageSharp.Formats.Gif;

[assembly: Eto.ExportHandler(typeof(IImageAdapter), typeof(ImageSharpImageAdapter))]

namespace TheArtOfDev.HtmlRenderer.Eto.Adapters
{
Expand All @@ -29,32 +33,10 @@ class ImageSharpImageAdapter : RImage, IImageAdapter
Dictionary<int, Bitmap> _images = new Dictionary<int, Bitmap>();


public static ImageSharpImageAdapter TryGet(Stream stream)
{
var img = SixLabors.ImageSharp.Image.Load(stream, out var format);
if (img.Frames.Count > 1 && img.Frames.Any(r => r.MetaData.FrameDelay > 0))
{
return new ImageSharpImageAdapter(img);
}
img.Dispose();
return null;
}

public ImageSharpImageAdapter(SixLabors.ImageSharp.Image<Rgba32> image, bool preloadFrames = true)
{
Image = image;
if (preloadFrames)
{
for (int i = 0; i < Frames.Count; i++)
{
GetFrame(i);
}
}
}

public bool Preload { get; set; }

public SixLabors.ImageSharp.Image<Rgba32> Image { get; }
public SixLabors.ImageSharp.Image Image { get; private set; }

private Bitmap GetFrame(int currentFrame)
{
Expand Down Expand Up @@ -85,7 +67,7 @@ private IList<RImageFrame> GetFrames()
{
return Image
.Frames
.Select(r => (RImageFrame)new ImageFrameAdapter(TimeSpan.FromMilliseconds(r.MetaData.FrameDelay * 10)))
.Select(r => (RImageFrame)new ImageFrameAdapter(TimeSpan.FromMilliseconds(GetDelay(r) * 10)))
.ToList();
}

Expand All @@ -94,9 +76,31 @@ public override void SetActiveFrame(int frame)
_currentFrame = frame;
}

int GetDelay(SixLabors.ImageSharp.ImageFrame frame)
{
var gifMetaData = frame.Metadata.GetFormatMetadata(GifFormat.Instance);
return gifMetaData?.FrameDelay ?? 0;
}

Image IImageAdapter.Image => GetFrame(_currentFrame);

public override void Dispose() => Image.Dispose();

public bool Load(Stream stream)
{
var img = SixLabors.ImageSharp.Image.Load(stream, out var format);
if (img.Frames.Count > 1 && img.Frames.Any(r => GetDelay(r) > 0))
{
Image = img;
for (int i = 0; i < Frames.Count; i++)
{
GetFrame(i);
}
return true;
}
img.Dispose();
return false;

}
}
}
#endif
}
15 changes: 15 additions & 0 deletions src/Eto.HtmlRenderer.Mac/Eto.HtmlRenderer.Mac64.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net45</TargetFramework>
<MacBuildBundle>False</MacBuildBundle>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Eto.Platform.Mac64" Version="2.4.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Eto.HtmlRenderer\Eto.HtmlRenderer.csproj" AdditionalProperties="TargetFramework=net45" />
</ItemGroup>
</Project>
75 changes: 75 additions & 0 deletions src/Eto.HtmlRenderer.Mac/Eto.HtmlRenderer.XamMac2.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B5D415B5-22D9-44C9-888A-26301E76AE99}</ProjectGuid>
<ProjectTypeGuids>{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>Eto.HtmlRenderer.Mac</RootNamespace>
<AssemblyName>Eto.HtmlRenderer.XamMac2</AssemblyName>
<MonoMacResourcePrefix>Resources</MonoMacResourcePrefix>
<UseXamMacFullFramework>true</UseXamMacFullFramework>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<TargetFrameworkIdentifier>Xamarin.Mac</TargetFrameworkIdentifier>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\artifacts\core\Debug\net45</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<UseSGen>false</UseSGen>
<HttpClientHandler></HttpClientHandler>
<LinkMode></LinkMode>
<XamMacArch></XamMacArch>
<AOTMode>None</AOTMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>..\..\artifacts\core\Release\net45</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<EnableCodeSigning>false</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
<EnablePackageSigning>false</EnablePackageSigning>
<IncludeMonoRuntime>false</IncludeMonoRuntime>
<UseSGen>false</UseSGen>
<HttpClientHandler></HttpClientHandler>
<LinkMode></LinkMode>
<XamMacArch></XamMacArch>
<AOTMode>None</AOTMode>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.Mac" />
</ItemGroup>
<ItemGroup>
<Compile Include="MacImageAdapter.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Eto.HtmlRenderer\Eto.HtmlRenderer.csproj">
<Project>{D9C153E4-6D38-4B4F-8BEE-6C9938D99CE2}</Project>
<Name>Eto.HtmlRenderer</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Eto.Platform.XamMac2">
<Version>2.5.0-rc.4</Version>
</PackageReference>
<PackageReference Include="NuGet.Build.Tasks.Pack">
<Version>5.3.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Mac\Xamarin.Mac.CSharp.targets" />
</Project>
Loading

0 comments on commit 02adddc

Please sign in to comment.