Skip to content

Commit

Permalink
Merge pull request #163 from nventive/dev/jela/tasks-ambiguity
Browse files Browse the repository at this point in the history
Include SHA1 in Uno.UI.Tasks msbuild tasks
  • Loading branch information
jeromelaban authored Aug 31, 2018
2 parents 5f429dc + 272b638 commit 6482adf
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 174 deletions.
253 changes: 134 additions & 119 deletions build/Uno.UI.proj
Original file line number Diff line number Diff line change
@@ -1,135 +1,150 @@
<?xml version="1.0" encoding="utf-8"?>

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\PreEmptive.Dotfuscator.Targets" Condition="Exists('$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\PreEmptive.Dotfuscator.Targets')"/>
<Import Project="$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\PreEmptive.Dotfuscator.Targets" Condition="Exists('$(MSBuildExtensionsPath)\PreEmptive\Dotfuscator\4\PreEmptive.Dotfuscator.Targets')"/>

<PropertyGroup>
<AppVersion>$(GITVERSION_FullSemVer)</AppVersion>
<NuGetBin>.\nuget\NuGet.exe</NuGetBin>
<OutputDir>$(BUILD_ARTIFACTSTAGINGDIRECTORY)</OutputDir>
<Configuration>$(CombinedConfiguration.Split('|')[0])</Configuration>
<Platform>$(CombinedConfiguration.Split('|')[1])</Platform>
<AppEnvironment Condition="'$(CombinedConfiguration)' != '' and $(CombinedConfiguration.Split('|').Length) > 2">$(CombinedConfiguration.Split('|')[2])</AppEnvironment>

<UpdateAssemblyInfo>false</UpdateAssemblyInfo>
</PropertyGroup>
<PropertyGroup>
<AppVersion>$(GITVERSION_FullSemVer)</AppVersion>

<NuGetBin>.\nuget\NuGet.exe</NuGetBin>
<OutputDir>$(BUILD_ARTIFACTSTAGINGDIRECTORY)</OutputDir>
<Configuration>$(CombinedConfiguration.Split('|')[0])</Configuration>
<Platform>$(CombinedConfiguration.Split('|')[1])</Platform>
<AppEnvironment Condition="'$(CombinedConfiguration)' != '' and $(CombinedConfiguration.Split('|').Length) > 2">$(CombinedConfiguration.Split('|')[2])</AppEnvironment>

<UpdateAssemblyInfo>false</UpdateAssemblyInfo>
</PropertyGroup>

<Import Project=".\obj\Uno.UI.Build.csproj.nuget.g.props"/>
<Import Project=".\obj\Uno.UI.Build.csproj.nuget.g.targets"/>

<Target Name="Build" DependsOnTargets="GetVersion;UpdateFileVersions">
<Message Text="Buidling for $(Configuration) and $(Platform) BuildReason:$(BUILD_REASON) Version:$(GitVersion_FullSemVer) Obfuscation:$(RunObfuscation)" />
<Target Name="Build" DependsOnTargets="GetVersion;UpdateFileVersions;UpdateTasksSHA">
<Message Text="Buidling for $(Configuration) and $(Platform) BuildReason:$(BUILD_REASON) Version:$(GitVersion_FullSemVer) Obfuscation:$(RunObfuscation)" />

<!--
<!--
Use NuGet 4.3.0 or later for the restore
CI_Build environment is required for the restore to pickup the TargetFrameworksCI property in projects.
-->
<Exec Command="set NUGET_RESTORE_MSBUILD_ARGS=/p:CI_Build=true &amp; nuget\nuget.exe restore ..\src\Uno.UI.sln" Condition="'$(AppEnvironment)'=='' " />

<CallTarget Targets="BuildCI" Condition="'$(Configuration)'=='Release'" />

<CallTarget Targets="BuildNuGetPackage" Condition="'$(Configuration)'=='Release'" />
<CallTarget Targets="PublishVisx" Condition="'$(Configuration)'=='Release'" />
<CallTarget Targets="GenerateAPIDiff" Condition="'$(Configuration)'=='Release'" />
</Target>

<Target Name="UpdateFileVersions">

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoSolutionTemplate.VISX\source.extension.vsixmanifest"
XPath="/x:PackageManifest/x:Metadata/x:Identity/@Version"
Value="$(GITVERSION_MajorMinorPatch)"
Namespace="http://schemas.microsoft.com/developer/vsx-schema/2011"
Prefix="x"/>

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoSolutionTemplate\UnoQuickStart.Droid\UnoQuickStart.Droid.csproj"
XPath="//x:PackageReference[@Include='Uno.UI']/@Version"
Value="$(GitVersion_FullSemVer)"
Namespace="http://schemas.microsoft.com/developer/msbuild/2003"
Prefix="x"/>

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoSolutionTemplate\UnoQuickStart.iOS\UnoQuickStart.iOS.csproj"
XPath="//x:PackageReference[@Include='Uno.UI']/@Version"
Value="$(GitVersion_FullSemVer)"
Namespace="http://schemas.microsoft.com/developer/msbuild/2003"
Prefix="x"/>

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoSolutionTemplate\UnoQuickStart.Wasm\UnoQuickStart.Wasm.csproj"
XPath="//PackageReference[@Include='Uno.UI']/@Version"
Value="$(GitVersion_FullSemVer)" />

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoLibraryTemplate\CrossTargetedLibrary.csproj"
XPath="//PackageReference[@Include='Uno.UI']/@Version"
Value="$(GitVersion_FullSemVer)" />

</Target>

<Target Name="BuildCI">

<MSBuild Properties="Configuration=Release;VisualStudioVersion=15.0;CopyDSYM=False;InformationalVersion=$(GITVERSION_InformationalVersion);CI_Build=true;_IsCIBuild=true"
Projects="..\src\Uno.UI.sln"
Targets="Build"
RebaseOutputs="false"
BuildInParallel="true" />

</Target>

<Target Name="GenerateDoc">
<Exec Command="$(NuGetPackageRoot)\docfx.console\2.36.0\tools\docfx.exe ..\doc\docfx.json -o $(OutputDir)\doc" />
</Target>

<Target Name="GenerateAPIDiff">
<PropertyGroup>
<WindowsDefinition>C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\2.0.0.0\Windows.Foundation.UniversalApiContract.winmd</WindowsDefinition>
<iOS_UnoUIDefinition>..\src\Uno.UI\bin\release\xamarinios10\Uno.UI.dll</iOS_UnoUIDefinition>
<Android_UnoUIDefinition>..\src\Uno.UI\bin\release\Monoandroid80\Uno.UI.dll</Android_UnoUIDefinition>
<Wasm_UnoUIDefinition>..\src\Uno.UI\bin\release\netstandard2.0\Uno.UI.dll</Wasm_UnoUIDefinition>
</PropertyGroup>

<Exec Command="..\src\Uno.UI.AssemblyComparer\Bin\Release\Uno.UI.AssemblyComparer.exe &quot;$(iOS_UnoUIDefinition)&quot; &quot;$(WindowsDefinition)&quot; &quot;output.txt&quot;" />
<Exec Command="copy .\output.txt &quot;$(OutputDir)\iOS_API_Diff.txt&quot;" />

<Exec Command="..\src\Uno.UI.AssemblyComparer\Bin\Release\Uno.UI.AssemblyComparer.exe &quot;$(Android_UnoUIDefinition)&quot; &quot;$(WindowsDefinition)&quot; &quot;output.txt&quot;" />
<Exec Command="copy .\output.txt &quot;$(OutputDir)\Android_API_Diff.txt&quot;" />

<Exec Command="..\src\Uno.UI.AssemblyComparer\Bin\Release\Uno.UI.AssemblyComparer.exe &quot;$(Wasm_UnoUIDefinition)&quot; &quot;$(WindowsDefinition)&quot; &quot;output.txt&quot;" />
<Exec Command="copy .\output.txt &quot;$(OutputDir)\Wasm_API_Diff.txt&quot;" />
</Target>
<Exec Command="set NUGET_RESTORE_MSBUILD_ARGS=/p:CI_Build=true &amp; nuget\nuget.exe restore ..\src\Uno.UI.sln" Condition="'$(AppEnvironment)'=='' " />

<CallTarget Targets="BuildCI" Condition="'$(Configuration)'=='Release'" />

<CallTarget Targets="BuildNuGetPackage" Condition="'$(Configuration)'=='Release'" />
<CallTarget Targets="PublishVisx" Condition="'$(Configuration)'=='Release'" />
<CallTarget Targets="GenerateAPIDiff" Condition="'$(Configuration)'=='Release'" />
</Target>

<Target Name="UpdateFileVersions">

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoSolutionTemplate.VISX\source.extension.vsixmanifest"
XPath="/x:PackageManifest/x:Metadata/x:Identity/@Version"
Value="$(GITVERSION_MajorMinorPatch)"
Namespace="http://schemas.microsoft.com/developer/vsx-schema/2011"
Prefix="x"/>

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoSolutionTemplate\UnoQuickStart.Droid\UnoQuickStart.Droid.csproj"
XPath="//x:PackageReference[@Include='Uno.UI']/@Version"
Value="$(GitVersion_FullSemVer)"
Namespace="http://schemas.microsoft.com/developer/msbuild/2003"
Prefix="x"/>

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoSolutionTemplate\UnoQuickStart.iOS\UnoQuickStart.iOS.csproj"
XPath="//x:PackageReference[@Include='Uno.UI']/@Version"
Value="$(GitVersion_FullSemVer)"
Namespace="http://schemas.microsoft.com/developer/msbuild/2003"
Prefix="x"/>

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoSolutionTemplate\UnoQuickStart.Wasm\UnoQuickStart.Wasm.csproj"
XPath="//PackageReference[@Include='Uno.UI']/@Version"
Value="$(GitVersion_FullSemVer)" />

<XmlUpdate
XmlFileName="..\src\SolutionTemplate\UnoLibraryTemplate\CrossTargetedLibrary.csproj"
XPath="//PackageReference[@Include='Uno.UI']/@Version"
Value="$(GitVersion_FullSemVer)" />

</Target>

<Target Name="UpdateTasksSHA">

<ItemGroup>
<_Sha1Replace Include="..\src\SourceGenerators\Uno.UI.Tasks\Uno.UI.Tasks.csproj" />
<_Sha1Replace Include="..\src\SourceGenerators\Uno.UI.Tasks\Assets\RetargetAssets.cs" />
<_Sha1Replace Include="..\src\SourceGenerators\Uno.UI.Tasks\Content\Uno.UI.Tasks.targets" />
<_Sha1Replace Include="..\src\SourceGenerators\Uno.UI.Tasks\ResourcesGenerator\ResourcesGenerationTask.cs" />
</ItemGroup>

<FileUpdate Files="@(_Sha1Replace)"
Regex="v0"
ReplacementText="v$(GitVersion_Sha)" />

</Target>

<Target Name="BuildCI">

<MSBuild Properties="Configuration=Release;VisualStudioVersion=15.0;CopyDSYM=False;InformationalVersion=$(GITVERSION_InformationalVersion);CI_Build=true;_IsCIBuild=true"
Projects="..\src\Uno.UI.sln"
Targets="Build"
RebaseOutputs="false"
BuildInParallel="true" />

</Target>

<Target Name="GenerateDoc">
<Exec Command="$(NuGetPackageRoot)\docfx.console\2.36.0\tools\docfx.exe ..\doc\docfx.json -o $(OutputDir)\doc" />
</Target>

<Target Name="GenerateAPIDiff">
<PropertyGroup>
<WindowsDefinition>C:\Program Files (x86)\Windows Kits\10\References\Windows.Foundation.UniversalApiContract\2.0.0.0\Windows.Foundation.UniversalApiContract.winmd</WindowsDefinition>
<iOS_UnoUIDefinition>..\src\Uno.UI\bin\release\xamarinios10\Uno.UI.dll</iOS_UnoUIDefinition>
<Android_UnoUIDefinition>..\src\Uno.UI\bin\release\Monoandroid80\Uno.UI.dll</Android_UnoUIDefinition>
<Wasm_UnoUIDefinition>..\src\Uno.UI\bin\release\netstandard2.0\Uno.UI.dll</Wasm_UnoUIDefinition>
</PropertyGroup>

<Exec Command="..\src\Uno.UI.AssemblyComparer\Bin\Release\Uno.UI.AssemblyComparer.exe &quot;$(iOS_UnoUIDefinition)&quot; &quot;$(WindowsDefinition)&quot; &quot;output.txt&quot;" />
<Exec Command="copy .\output.txt &quot;$(OutputDir)\iOS_API_Diff.txt&quot;" />

<Exec Command="..\src\Uno.UI.AssemblyComparer\Bin\Release\Uno.UI.AssemblyComparer.exe &quot;$(Android_UnoUIDefinition)&quot; &quot;$(WindowsDefinition)&quot; &quot;output.txt&quot;" />
<Exec Command="copy .\output.txt &quot;$(OutputDir)\Android_API_Diff.txt&quot;" />

<Exec Command="..\src\Uno.UI.AssemblyComparer\Bin\Release\Uno.UI.AssemblyComparer.exe &quot;$(Wasm_UnoUIDefinition)&quot; &quot;$(WindowsDefinition)&quot; &quot;output.txt&quot;" />
<Exec Command="copy .\output.txt &quot;$(OutputDir)\Wasm_API_Diff.txt&quot;" />
</Target>

<Target Name="PublishVisx">
<Copy SourceFiles="..\src\SolutionTemplate\UnoSolutionTemplate.VISX\bin\Release\UnoSolutionTemplate.vsix"
DestinationFiles="$(OutputDir)\UnoPlatform-$(GITVERSION_FullSemVer).vsix" />
</Target>

<Target Name="BuildNuGetPackage" DependsOnTargets="_FillMsBuildVersion">

<PropertyGroup>
<NugetNamespace>http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd</NugetNamespace>
</PropertyGroup>

<XmlUpdate
XmlFileName=".\Uno.UI.nuspec"
XPath="/x:package/x:metadata/x:version"
Value="$(GITVERSION_FullSemVer)"
Namespace="$(NugetNamespace)"
Prefix="x"/>

<XmlUpdate
XmlFileName=".\Uno.UI.nuspec"
XPath="/x:package/x:metadata/x:dependencies/x:dependency/@version"
Value="$(GITVERSION_FullSemVer)"
Namespace="$(NugetNamespace)"
Prefix="x"/>

<!-- Create the packages -->
<Exec Command="$(NuGetBin) pack Uno.UI.nuspec -Verbosity Detailed" />
</Target>

<Import Project="GetMsBuildVersion.targets" />
<Copy SourceFiles="..\src\SolutionTemplate\UnoSolutionTemplate.VISX\bin\Release\UnoSolutionTemplate.vsix"
DestinationFiles="$(OutputDir)\UnoPlatform-$(GITVERSION_FullSemVer).vsix" />
</Target>

<Target Name="BuildNuGetPackage" DependsOnTargets="_FillMsBuildVersion">

<PropertyGroup>
<NugetNamespace>http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd</NugetNamespace>
</PropertyGroup>

<XmlUpdate
XmlFileName=".\Uno.UI.nuspec"
XPath="/x:package/x:metadata/x:version"
Value="$(GITVERSION_FullSemVer)"
Namespace="$(NugetNamespace)"
Prefix="x"/>

<XmlUpdate
XmlFileName=".\Uno.UI.nuspec"
XPath="/x:package/x:metadata/x:dependencies/x:dependency/@version"
Value="$(GITVERSION_FullSemVer)"
Namespace="$(NugetNamespace)"
Prefix="x"/>

<!-- Create the packages -->
<Exec Command="$(NuGetBin) pack Uno.UI.nuspec -Verbosity Detailed" />
</Target>

<Import Project="GetMsBuildVersion.targets" />

</Project>
7 changes: 4 additions & 3 deletions src/SourceGenerators/Uno.UI.Tasks/Assets/RetargetAssets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Uno.UI.Tasks.Assets
/// <remarks>
/// Currently supports .png, .jpg, .jpeg and .gif.
/// </remarks>
public class RetargetAssets : Task
public class RetargetAssets_v0 : Task
{
private const int HighDPIThresholdScale = 150;

Expand Down Expand Up @@ -56,7 +56,8 @@ public override bool Execute()
resourceToTargetPath = resource => AndroidResourceConverter.Convert(resource, DefaultLanguage);
break;
default:
throw new NotSupportedException($"{nameof(TargetPlatform)} must be either 'ios' or 'android'.");
this.Log().Info($"Skipping unknown platform {TargetPlatform}");
return true;
}

Assets = ContentItems.Where(content => IsAsset(content.ItemSpec)).ToArray();
Expand Down Expand Up @@ -106,4 +107,4 @@ private static bool IsAsset(string path)
|| extension == ".gif";
}
}
}
}
Loading

0 comments on commit 6482adf

Please sign in to comment.