Skip to content

Commit

Permalink
Add switches to build Control Gallery using the nuget produced by the…
Browse files Browse the repository at this point in the history
… build (xamarin#8937)

* Build Control Gallery with nugets

* - sync pipelines

* - add team project check

* - fix output dir to match for ui tests

* - preserve dual screen
  • Loading branch information
PureWeen authored Mar 11, 2020
1 parent 112a203 commit 1532d46
Show file tree
Hide file tree
Showing 34 changed files with 329 additions and 156 deletions.
12 changes: 12 additions & 0 deletions DevopsNuget.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear/>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
<add key="nightly" value="https://aka.ms/xf-ci/index.json" />
<add key="nuget" value="../s/Nuget" />
</packageSources>
<activePackageSource>
<add key="All" value="(Aggregate source)" />
</activePackageSource>
</configuration>
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@
<Target Name="GitVersion" />

<Import Condition="'$(EnvironmentBuildPropsImported)' != 'True'" Project="Environment.Build.props" />
</Project>
</Project>
1 change: 0 additions & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
<PackageReference Include="GitInfo" Version="2.0.20" PrivateAssets="All" />
<PackageReference Include="MSBuilder.GenerateAssemblyInfo" Version="0.2.1" PrivateAssets="All" />
</ItemGroup>

<Import Project="Version.targets" />
</Project>
15 changes: 14 additions & 1 deletion Environment.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@




<PropertyGroup Condition="'$(CI)' == ''">
<CI>false</CI>
<CI Condition="'$(TF_BUILD)' == 'true'">true</CI>
Expand All @@ -19,6 +20,18 @@
-->
</PropertyGroup>

<PropertyGroup Condition="'$(CI)' == 'true'">
<_XamarinFormsVersion>$(BUILD_BUILDNUMBER.Split(`+`)[0])</_XamarinFormsVersion>
<XamarinFormsVersion Condition="Exists('$(BUILD_SOURCESDIRECTORY)/Nuget/Xamarin.Forms.$(_XamarinFormsVersion).nupkg')" >$(_XamarinFormsVersion)</XamarinFormsVersion>
</PropertyGroup>

<!-- Build from source or nugets-->
<PropertyGroup>
<XamarinFormsVersion Condition="'$(XamarinFormsVersion)' == ''"></XamarinFormsVersion>
<FromSource Condition="'$(XamarinFormsVersion)' != ''">false</FromSource>
<FromSource Condition="'$(FromSource)' == ''">true</FromSource>
</PropertyGroup>

<PropertyGroup>
<Use2017 Condition="'$(Use2017)' == '' AND '$(MSBuildRuntimeType)' == 'Mono'">$(FrameworkSDKRoot.Contains('/Versions/5'))</Use2017>
<Use2017 Condition="'$(Use2017)' == '' AND '$(MSBuildAssemblyVersion)' &lt; '16.0'">true</Use2017>
Expand All @@ -30,4 +43,4 @@
<AndroidTargetFrameworks Condition="'$(Use2017)' == 'true'">MonoAndroid90;</AndroidTargetFrameworks>
<AndroidTargetFrameworks Condition="'$(Use2017)' == 'false'">MonoAndroid90;MonoAndroid10.0;</AndroidTargetFrameworks>
</PropertyGroup>
</Project>
</Project>
16 changes: 16 additions & 0 deletions Nuget.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="$(XamarinFormsVersion)">
</PackageReference>
<PackageReference Include="Xamarin.Forms.Maps" Version="$(XamarinFormsVersion)">
</PackageReference>
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="$(XamarinFormsVersion)">
</PackageReference>
<PackageReference Include="Xamarin.Forms.DualScreen" Version="$(XamarinFormsVersion)">
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" $(TargetFrameworkIdentifier.StartsWith('MonoAndroid')) ">
<PackageReference Include="Xamarin.Forms.AppLinks" Version="$(XamarinFormsVersion)">
</PackageReference>
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions Nuget/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{39B3457F-01D8-43D0-8E84-D8C4F73CF48D}</ProjectGuid>
Expand Down
18 changes: 9 additions & 9 deletions Xamarin.Forms.ControlGallery.Android/Android10.Build.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>
<ItemGroup Condition="'$(TargetFrameworkVersion)' == 'v10.0'">
<PackageReference Include="Xamarin.AndroidX.Migration">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.1.0" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.0.0" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.Migration">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.1.0" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.0.0" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0" />
</ItemGroup>
</Project>
</Project>
5 changes: 4 additions & 1 deletion Xamarin.Forms.ControlGallery.Android/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<Project>
<Import Project="Android10.Build.targets" Condition="'$(TargetFrameworkVersion)' == 'v10.0'" />
</Project>
<Import Condition="'$(Use2017)' == 'true'" Project="Nuget2017.Build.targets" />
<Import Condition="'$(Use2017)' != 'true'" Project="Nuget2019.Build.targets" />
<Import Project="..\Nuget.targets" Condition="'$(FromSource)' == 'false'" />
</Project>
7 changes: 7 additions & 0 deletions Xamarin.Forms.ControlGallery.Android/Nuget2017.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<ItemGroup>
<PackageReference Include="Xamarin.Build.Download">
<Version>0.4.11</Version>
</PackageReference>
</ItemGroup>
</Project>
17 changes: 17 additions & 0 deletions Xamarin.Forms.ControlGallery.Android/Nuget2019.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>
<ItemGroup>
<PackageReference Include="Xamarin.Build.Download">
<Version>0.7.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkVersion)' == 'v10.0'">
<PackageReference Include="Xamarin.AndroidX.Migration">
<Version>1.0.0</Version>
</PackageReference>
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.1.0" />
<PackageReference Include="Xamarin.AndroidX.Browser" Version="1.0.0" />
<PackageReference Include="Xamarin.Google.Android.Material" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0" />
<PackageReference Include="Xamarin.AndroidX.Palette" Version="1.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
using Xamarin.Forms;
using Xamarin.Forms.ControlGallery.Android;
using Xamarin.Forms.Controls;
using Xamarin.Forms.Internals;

[assembly: Dependency(typeof(PlatformSpecificCoreGalleryFactory))]

namespace Xamarin.Forms.ControlGallery.Android
{
[Preserve(AllMembers = true)]
public class PlatformSpecificCoreGalleryFactory : IPlatformSpecificCoreGalleryFactory
{
public string Title => "Android Core Gallery";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
</PropertyGroup>

<PropertyGroup>
<!-- default locally to using fast renderers but if we're running on CI don't set a value for ANDROID_RENDERERS.
This will let the old and new yaml configurations coexist -->
Expand All @@ -37,7 +36,6 @@
<DefineConstants Condition="'$(ANDROID_RENDERERS)' == 'PREAPPCOMPAT'">$(DefineConstants);FORMS_APPLICATION_ACTIVITY</DefineConstants>
<DefineConstants Condition="'$(ANDROID_RENDERERS)' == 'LEGACY'">$(DefineConstants)</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DefineConstants>$(DefineConstants);HAVE_OPENTK</DefineConstants>
<AndroidKeyStore>True</AndroidKeyStore>
Expand Down Expand Up @@ -194,11 +192,7 @@
<AndroidResource Include="Resources\drawable\Icon.png" />
<AndroidResource Include="Resources\drawable\cover1.jpg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Stubs\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android (Forwarders).csproj">
<Project>{6e53feb1-1100-46ae-8013-17bba35cc197}</Project>
<Name>Xamarin.Forms.Platform.Android (Forwarders)</Name>
</ProjectReference>
<ItemGroup>
<ProjectReference Include="..\Xamarin.Forms.Controls\Xamarin.Forms.Controls.csproj">
<Project>{cb9c96ce-125c-4a68-b6a1-c3ff1fbf93e1}</Project>
<Name>Xamarin.Forms.Controls</Name>
Expand All @@ -207,6 +201,15 @@
<Project>{4dcd0420-1168-4b77-86db-6196ee4bd491}</Project>
<Name>Xamarin.Forms.CustomAttributes</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition="$(FromSource) == 'true'">
<ProguardConfiguration Include="..\.nuspec\proguard.cfg">
<Link>proguard.cfg</Link>
</ProguardConfiguration>
<ProjectReference Include="..\Stubs\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android (Forwarders).csproj">
<Project>{6e53feb1-1100-46ae-8013-17bba35cc197}</Project>
<Name>Xamarin.Forms.Platform.Android (Forwarders)</Name>
</ProjectReference>
<ProjectReference Include="..\Xamarin.Forms.DualScreen\Xamarin.Forms.DualScreen.csproj">
<Project>{fb4a866a-5721-4545-9e5d-b7f7d59875a4}</Project>
<Name>Xamarin.Forms.DualScreen</Name>
Expand Down Expand Up @@ -358,9 +361,6 @@
<PackageReference Include="Xam.Plugin.DeviceInfo">
<Version>3.0.2</Version>
</PackageReference>
<PackageReference Include="Xamarin.Build.Download">
<Version>0.7.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Android.Support.Animated.Vector.Drawable" Version="28.0.0.3" />
Expand Down Expand Up @@ -394,11 +394,6 @@
<AndroidResource Include="Resources\drawable\GifOne.gif" />
<AndroidEnvironment Include="Environment.txt" />
</ItemGroup>
<ItemGroup>
<ProguardConfiguration Include="..\.nuspec\proguard.cfg">
<Link>proguard.cfg</Link>
</ProguardConfiguration>
</ItemGroup>
<ItemGroup>
<AndroidResource Include="Resources\drawable\GifTwo.gif" />
</ItemGroup>
Expand All @@ -424,11 +419,11 @@
</AndroidResource>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="$(FromSource) == 'true' AND Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="BeforeBuild">
<CreateItem Include="Properties\MapsKey.cs.blank">
<Output TaskParameter="Include" ItemName="MapsKey" />
</CreateItem>
<Copy SourceFiles="@(MapsKey)" DestinationFiles="Properties\MapsKey.cs" Condition="!Exists('Properties\MapsKey.cs')" />
</Target>
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="..\Nuget.targets" Condition="$(FromSource) == 'false'" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@
<Project>{cb9c96ce-125c-4a68-b6a1-c3ff1fbf93e1}</Project>
<Name>Xamarin.Forms.Controls</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition="$(FromSource) == 'false'">
<ProjectReference Include="..\Xamarin.Forms.CustomAttributes\Xamarin.Forms.CustomAttributes.csproj">
<Project>{4dcd0420-1168-4b77-86db-6196ee4bd491}</Project>
<Name>Xamarin.Forms.CustomAttributes</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition="$(FromSource) == 'true'">
<ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj">
<Project>{57b8b73d-c3b5-4c42-869e-7b2f17d354ac}</Project>
<Name>Xamarin.Forms.Core</Name>
Expand Down
3 changes: 3 additions & 0 deletions Xamarin.Forms.ControlGallery.iOS/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project>
<Import Project="..\Nuget.targets" Condition="$(FromSource) == 'false'" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Condition="'$(EnvironmentBuildPropsImported)' != 'True'" Project="..\Environment.Build.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' And '$(BuildIpa)' == 'True' ">iPhone</Platform>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProjectGuid>{C7131F14-274F-4B55-ACA9-E81731AD012F}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
Expand Down Expand Up @@ -159,6 +161,14 @@
<Project>{cb9c96ce-125c-4a68-b6a1-c3ff1fbf93e1}</Project>
<Name>Xamarin.Forms.Controls</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition="$(FromSource) == 'false'">
<ProjectReference Include="..\Xamarin.Forms.CustomAttributes\Xamarin.Forms.CustomAttributes.csproj">
<Project>{4dcd0420-1168-4b77-86db-6196ee4bd491}</Project>
<Name>Xamarin.Forms.CustomAttributes</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup Condition="$(FromSource) == 'true'">
<ProjectReference Include="..\Xamarin.Forms.DualScreen\Xamarin.Forms.DualScreen.csproj">
<Project>{fb4a866a-5721-4545-9e5d-b7f7d59875a4}</Project>
<Name>Xamarin.Forms.DualScreen</Name>
Expand Down Expand Up @@ -439,4 +449,4 @@
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
</Project>
</Project>
2 changes: 1 addition & 1 deletion Xamarin.Forms.Controls/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Import Project="..\.nuspec\Xamarin.Forms.props" />
<Import Project="..\Directory.Build.props" />
<Import Project="..\.nuspec\Xamarin.Forms.props" Condition="$(FromSource) == 'true'" />
</Project>
5 changes: 3 additions & 2 deletions Xamarin.Forms.Controls/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project>
<Import Project="..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />
<Import Project="..\.nuspec\Xamarin.Forms.targets" Condition="$(FromSource) == 'true' AND '$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\.nuspec\Xamarin.Forms.targets" Condition="$(FromSource) == 'true' AND '$(BuildingInsideVisualStudio)' != 'true'" />
<Import Project="..\Nuget.targets" Condition="'$(FromSource)' == 'false'" />
</Project>
11 changes: 11 additions & 0 deletions Xamarin.Forms.Controls/Nuget.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="$(XamarinFormsVersion)">
</PackageReference>
<PackageReference Include="Xamarin.Forms.Maps" Version="$(XamarinFormsVersion)">
</PackageReference>
<PackageReference Include="Xamarin.Forms.Visual.Material" Version="$(XamarinFormsVersion)">
</PackageReference>
<ProjectReference Include="..\Xamarin.Forms.CustomAttributes\Xamarin.Forms.CustomAttributes.csproj" />
</ItemGroup>
</Project>
11 changes: 11 additions & 0 deletions Xamarin.Forms.Controls/Source.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<Project>
<Import Project="..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' == 'true' AND Exists('$(__XFBuildTasksLocation)Xamarin.Forms.Build.Tasks.dll')" />
<Import Project="..\.nuspec\Xamarin.Forms.targets" Condition="'$(BuildingInsideVisualStudio)' != 'true'" />
<ItemGroup>
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj" />
<ProjectReference Include="..\Xamarin.Forms.CustomAttributes\Xamarin.Forms.CustomAttributes.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj" />
</ItemGroup>
</Project>
7 changes: 5 additions & 2 deletions Xamarin.Forms.Controls/Xamarin.Forms.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@
<None Remove="Fonts\fa-regular-400.ttf" />
<None Remove="Fonts\PTM55FT.ttf" />
</ItemGroup>
<ItemGroup>
<ItemGroup Condition="$(FromSource) == 'true'">
<!-- A reference to the entire .NET Framework is automatically included -->
<ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj" />
<ProjectReference Include="..\Xamarin.Forms.CustomAttributes\Xamarin.Forms.CustomAttributes.csproj" />
<ProjectReference Include="..\Xamarin.Forms.DualScreen\Xamarin.Forms.DualScreen.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj" />
</ItemGroup>
<ItemGroup Condition="$(FromSource) == 'false'">
<ProjectReference Include="..\Xamarin.Forms.CustomAttributes\Xamarin.Forms.CustomAttributes.csproj" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="BuildNumber.txt" />
<EmbeddedResource Include="GalleryPages\crimson.jpg" />
Expand Down Expand Up @@ -91,4 +94,4 @@

<Import Project="..\Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems" Label="Shared" />

</Project>
</Project>
7 changes: 7 additions & 0 deletions Xamarin.Forms.DualScreen/DualScreenService.android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ namespace Xamarin.Forms.DualScreen
{
public class DualScreenService
{
[Internals.Preserve(Conditional = true)]
public DualScreenService()
{

}

public static void Init(Activity activity)
{
DependencyService.Register<DualScreenServiceImpl>();
Expand All @@ -34,6 +40,7 @@ internal class DualScreenServiceImpl : IDualScreenService, Platform.Android.Dual
object _hingeAngleLock = new object();
TaskCompletionSource<int> _gettingHingeAngle;

[Internals.Preserve(Conditional = true)]
public DualScreenServiceImpl()
{
_HingeService = this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
<ItemGroup>
<PackageReference Condition="'$(CI)' == 'true'" Include="Xamarin.Build.TypeRedirector" Version="0.1.2-preview" PrivateAssets="all" />
</ItemGroup>
</Project>
</Project>
Loading

0 comments on commit 1532d46

Please sign in to comment.