Skip to content

Commit 9c0f523

Browse files
Xamarin Support (#1360)
* Multi-target `BenchmarkDotNet.Samples` to include `netstandard2.0` * Don't probe for `mono` binary for `InProcess` * Detect Xamarin.Android / Xamarin.iOS * Fix for `Directory.CurrentDirectory()` as `ArtifactPath` * Default to `InProcess` for Xamarin platforms * Added documentation, sample, and a new `BenchmarkDotNet.Xamarin.sln`
1 parent 82b15ee commit 9c0f523

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+1003
-4
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,6 @@ src/BenchmarkDotNet/Disassemblers/net461/*
5656
# Cake
5757
tools/**
5858
.dotnet
59+
60+
# Xamarin
61+
Resource.designer.cs

BenchmarkDotNet.Xamarin.sln

+125
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29920.165
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet", "src\BenchmarkDotNet\BenchmarkDotNet.csproj", "{6A3481EC-78A3-4A2E-994D-ED16778D83BB}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Samples.Forms", "samples\BenchmarkDotNet.Samples.Forms\BenchmarkDotNet.Samples.Forms.csproj", "{34358E9C-7048-43F5-AA66-4F9060081178}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchmarkDotNet.Samples.Android", "samples\BenchmarkDotNet.Samples.Android\BenchmarkDotNet.Samples.Android.csproj", "{F8547E13-AE77-44CC-9F1D-1717921C4B86}"
11+
EndProject
12+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchmarkDotNet.Samples.iOS", "samples\BenchmarkDotNet.Samples.iOS\BenchmarkDotNet.Samples.iOS.csproj", "{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}"
13+
EndProject
14+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Disassembler.x64", "src\BenchmarkDotNet.Disassembler.x64\BenchmarkDotNet.Disassembler.x64.csproj", "{78BD1D11-7841-4079-8ED7-CD253A71FD33}"
15+
EndProject
16+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Disassembler.x86", "src\BenchmarkDotNet.Disassembler.x86\BenchmarkDotNet.Disassembler.x86.csproj", "{6E54F07F-5B12-465A-ADA2-39879DB704C1}"
17+
EndProject
18+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Annotations", "src\BenchmarkDotNet.Annotations\BenchmarkDotNet.Annotations.csproj", "{FA360486-97B1-4BA9-BCB2-78F86EA0F881}"
19+
EndProject
20+
Global
21+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
22+
Debug|Any CPU = Debug|Any CPU
23+
Debug|iPhone = Debug|iPhone
24+
Debug|iPhoneSimulator = Debug|iPhoneSimulator
25+
Release|Any CPU = Release|Any CPU
26+
Release|iPhone = Release|iPhone
27+
Release|iPhoneSimulator = Release|iPhoneSimulator
28+
EndGlobalSection
29+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
30+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
31+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
32+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Debug|iPhone.ActiveCfg = Debug|Any CPU
33+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Debug|iPhone.Build.0 = Debug|Any CPU
34+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
35+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
36+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
37+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Release|Any CPU.Build.0 = Release|Any CPU
38+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Release|iPhone.ActiveCfg = Release|Any CPU
39+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Release|iPhone.Build.0 = Release|Any CPU
40+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
41+
{6A3481EC-78A3-4A2E-994D-ED16778D83BB}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
42+
{34358E9C-7048-43F5-AA66-4F9060081178}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
43+
{34358E9C-7048-43F5-AA66-4F9060081178}.Debug|Any CPU.Build.0 = Debug|Any CPU
44+
{34358E9C-7048-43F5-AA66-4F9060081178}.Debug|iPhone.ActiveCfg = Debug|Any CPU
45+
{34358E9C-7048-43F5-AA66-4F9060081178}.Debug|iPhone.Build.0 = Debug|Any CPU
46+
{34358E9C-7048-43F5-AA66-4F9060081178}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
47+
{34358E9C-7048-43F5-AA66-4F9060081178}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
48+
{34358E9C-7048-43F5-AA66-4F9060081178}.Release|Any CPU.ActiveCfg = Release|Any CPU
49+
{34358E9C-7048-43F5-AA66-4F9060081178}.Release|Any CPU.Build.0 = Release|Any CPU
50+
{34358E9C-7048-43F5-AA66-4F9060081178}.Release|iPhone.ActiveCfg = Release|Any CPU
51+
{34358E9C-7048-43F5-AA66-4F9060081178}.Release|iPhone.Build.0 = Release|Any CPU
52+
{34358E9C-7048-43F5-AA66-4F9060081178}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
53+
{34358E9C-7048-43F5-AA66-4F9060081178}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
54+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
55+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Debug|Any CPU.Build.0 = Debug|Any CPU
56+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
57+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Debug|iPhone.ActiveCfg = Debug|Any CPU
58+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Debug|iPhone.Build.0 = Debug|Any CPU
59+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Debug|iPhone.Deploy.0 = Debug|Any CPU
60+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
61+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
62+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
63+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Release|Any CPU.ActiveCfg = Release|Any CPU
64+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Release|Any CPU.Build.0 = Release|Any CPU
65+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Release|Any CPU.Deploy.0 = Release|Any CPU
66+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Release|iPhone.ActiveCfg = Release|Any CPU
67+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Release|iPhone.Build.0 = Release|Any CPU
68+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Release|iPhone.Deploy.0 = Release|Any CPU
69+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
70+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
71+
{F8547E13-AE77-44CC-9F1D-1717921C4B86}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
72+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Debug|Any CPU.ActiveCfg = Debug|iPhone
73+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Debug|iPhone.ActiveCfg = Debug|iPhone
74+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Debug|iPhone.Build.0 = Debug|iPhone
75+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
76+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
77+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Release|Any CPU.ActiveCfg = Release|iPhone
78+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Release|iPhone.ActiveCfg = Release|iPhone
79+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Release|iPhone.Build.0 = Release|iPhone
80+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
81+
{0A63C8A0-F7EB-47D7-8057-0C87C77C02A4}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
82+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
83+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Debug|Any CPU.Build.0 = Debug|Any CPU
84+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Debug|iPhone.ActiveCfg = Debug|Any CPU
85+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Debug|iPhone.Build.0 = Debug|Any CPU
86+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
87+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
88+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Release|Any CPU.ActiveCfg = Release|Any CPU
89+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Release|Any CPU.Build.0 = Release|Any CPU
90+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Release|iPhone.ActiveCfg = Release|Any CPU
91+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Release|iPhone.Build.0 = Release|Any CPU
92+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
93+
{78BD1D11-7841-4079-8ED7-CD253A71FD33}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
94+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
95+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
96+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Debug|iPhone.ActiveCfg = Debug|Any CPU
97+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Debug|iPhone.Build.0 = Debug|Any CPU
98+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
99+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
100+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
101+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Release|Any CPU.Build.0 = Release|Any CPU
102+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Release|iPhone.ActiveCfg = Release|Any CPU
103+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Release|iPhone.Build.0 = Release|Any CPU
104+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
105+
{6E54F07F-5B12-465A-ADA2-39879DB704C1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
106+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
107+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Debug|Any CPU.Build.0 = Debug|Any CPU
108+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Debug|iPhone.ActiveCfg = Debug|Any CPU
109+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Debug|iPhone.Build.0 = Debug|Any CPU
110+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
111+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
112+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Release|Any CPU.ActiveCfg = Release|Any CPU
113+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Release|Any CPU.Build.0 = Release|Any CPU
114+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Release|iPhone.ActiveCfg = Release|Any CPU
115+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Release|iPhone.Build.0 = Release|Any CPU
116+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
117+
{FA360486-97B1-4BA9-BCB2-78F86EA0F881}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
118+
EndGlobalSection
119+
GlobalSection(SolutionProperties) = preSolution
120+
HideSolutionNode = FALSE
121+
EndGlobalSection
122+
GlobalSection(ExtensibilityGlobals) = postSolution
123+
SolutionGuid = {36B462DE-57CC-423E-855A-F3B19FE99549}
124+
EndGlobalSection
125+
EndGlobal

docs/articles/samples/IntroXamarin.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
uid: BenchmarkDotNet.Samples.Xamarin
3+
---
4+
5+
## Sample: IntroXamarin
6+
7+
To use BenchmarkDotNet with Xamarin, you will need to build a small UI for running Benchmarks and displaying the results so you can actually read them.
8+
Using [Xamarin.Forms](https://dotnet.microsoft.com/apps/xamarin/xamarin-forms) is a simple way to be able to run your benchmarks on iOS or Android.
9+
10+
Other notes:
11+
12+
* Use `Release` builds when running actual benchmarks.
13+
* Disable the linker via the `Don't Link` or `None`.
14+
15+
### Source code
16+
17+
[!code-csharp[MainPage.xaml.cs](../../../samples/BenchmarkDotNet.Samples.Forms/MainPage.xaml.cs)]
18+
19+
### Output
20+
21+
![Xamarin Output](../../images/xamarin-screenshot.png)
22+
23+
### Links
24+
25+
* [Xamarin.Android linker settings](https://docs.microsoft.com/xamarin/android/deploy-test/linker#linker-behavior)
26+
* [Xamarin.iOS linker settings](https://docs.microsoft.com/xamarin/ios/deploy-test/linker#dont-link)
27+
* The permanent link to this sample: @BenchmarkDotNet.Samples.Xamarin
28+
29+
---

docs/images/xamarin-screenshot.png

91.5 KB
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProjectGuid>{F8547E13-AE77-44CC-9F1D-1717921C4B86}</ProjectGuid>
7+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
8+
<TemplateGuid>{c9e5eea5-ca05-42a1-839b-61506e0a37df}</TemplateGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>BenchmarkDotNet.Samples.Forms.Droid</RootNamespace>
11+
<AssemblyName>BenchmarkDotNet.Samples.Forms.Android</AssemblyName>
12+
<AndroidApplication>True</AndroidApplication>
13+
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
14+
<AndroidResgenClass>Resource</AndroidResgenClass>
15+
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
16+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
17+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
18+
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
19+
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
20+
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
21+
<AndroidUseAapt2>true</AndroidUseAapt2>
22+
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
23+
<NuGetPackageImportStamp>
24+
</NuGetPackageImportStamp>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
27+
<DebugSymbols>true</DebugSymbols>
28+
<DebugType>portable</DebugType>
29+
<Optimize>false</Optimize>
30+
<OutputPath>bin\Debug</OutputPath>
31+
<DefineConstants>DEBUG;</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
<AndroidLinkMode>None</AndroidLinkMode>
35+
</PropertyGroup>
36+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
37+
<DebugSymbols>true</DebugSymbols>
38+
<DebugType>portable</DebugType>
39+
<Optimize>true</Optimize>
40+
<OutputPath>bin\Release</OutputPath>
41+
<ErrorReport>prompt</ErrorReport>
42+
<WarningLevel>4</WarningLevel>
43+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
44+
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
45+
<AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
46+
<AndroidLinkMode>None</AndroidLinkMode>
47+
</PropertyGroup>
48+
<ItemGroup>
49+
<Reference Include="Mono.Android" />
50+
<Reference Include="System" />
51+
<Reference Include="System.Core" />
52+
<Reference Include="System.Xml.Linq" />
53+
<Reference Include="System.Xml" />
54+
<Reference Include="System.Numerics" />
55+
<Reference Include="System.Numerics.Vectors" />
56+
</ItemGroup>
57+
<ItemGroup>
58+
<PackageReference Include="Xamarin.Forms" Version="4.5.0.530" />
59+
<PackageReference Include="Xamarin.Essentials" Version="1.5.2" />
60+
</ItemGroup>
61+
<ItemGroup>
62+
<Compile Include="MainActivity.cs" />
63+
<Compile Include="Resources\Resource.designer.cs" />
64+
<Compile Include="Properties\AssemblyInfo.cs" />
65+
</ItemGroup>
66+
<ItemGroup>
67+
<None Include="Properties\AndroidManifest.xml" />
68+
</ItemGroup>
69+
<ItemGroup>
70+
<AndroidResource Include="Resources\layout\Tabbar.xml" />
71+
<AndroidResource Include="Resources\layout\Toolbar.xml" />
72+
<AndroidResource Include="Resources\values\styles.xml" />
73+
<AndroidResource Include="Resources\values\colors.xml" />
74+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon.xml" />
75+
<AndroidResource Include="Resources\mipmap-anydpi-v26\icon_round.xml" />
76+
<AndroidResource Include="Resources\mipmap-hdpi\icon.png" />
77+
<AndroidResource Include="Resources\mipmap-hdpi\launcher_foreground.png" />
78+
<AndroidResource Include="Resources\mipmap-mdpi\icon.png" />
79+
<AndroidResource Include="Resources\mipmap-mdpi\launcher_foreground.png" />
80+
<AndroidResource Include="Resources\mipmap-xhdpi\icon.png" />
81+
<AndroidResource Include="Resources\mipmap-xhdpi\launcher_foreground.png" />
82+
<AndroidResource Include="Resources\mipmap-xxhdpi\icon.png" />
83+
<AndroidResource Include="Resources\mipmap-xxhdpi\launcher_foreground.png" />
84+
<AndroidResource Include="Resources\mipmap-xxxhdpi\icon.png" />
85+
<AndroidResource Include="Resources\mipmap-xxxhdpi\launcher_foreground.png" />
86+
</ItemGroup>
87+
<ItemGroup>
88+
<Folder Include="Resources\drawable\" />
89+
</ItemGroup>
90+
<ItemGroup>
91+
<ProjectReference Include="..\BenchmarkDotNet.Samples.Forms\BenchmarkDotNet.Samples.Forms.csproj">
92+
<Project>{EF54613D-8A3D-42DB-BF98-AD95C582FEF3}</Project>
93+
<Name>BenchmarkDotNet.Samples.Forms</Name>
94+
</ProjectReference>
95+
</ItemGroup>
96+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
97+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
3+
using Android.App;
4+
using Android.Content.PM;
5+
using Android.Runtime;
6+
using Android.Views;
7+
using Android.Widget;
8+
using Android.OS;
9+
10+
namespace BenchmarkDotNet.Samples.Forms.Droid
11+
{
12+
[Activity(Label = "BenchmarkDotNet.Samples.Forms", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
13+
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
14+
{
15+
protected override void OnCreate(Bundle savedInstanceState)
16+
{
17+
TabLayoutResource = Resource.Layout.Tabbar;
18+
ToolbarResource = Resource.Layout.Toolbar;
19+
20+
base.OnCreate(savedInstanceState);
21+
22+
Xamarin.Essentials.Platform.Init(this, savedInstanceState);
23+
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
24+
LoadApplication(new App());
25+
}
26+
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
27+
{
28+
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
29+
30+
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
31+
}
32+
}
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.benchmarkdotnet.samples">
3+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28" />
4+
<application android:label="BenchmarkDotNet.Samples.Android"></application>
5+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
6+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
using Android.App;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("BenchmarkDotNet.Samples.Forms.Android")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("BenchmarkDotNet.Samples.Forms.Android")]
14+
[assembly: AssemblyCopyright("Copyright © 2014")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
//
26+
// You can specify all the values or you can default the Build and Revision Numbers
27+
// by using the '*' as shown below:
28+
// [assembly: AssemblyVersion("1.0.*")]
29+
[assembly: AssemblyVersion("1.0.0.0")]
30+
[assembly: AssemblyFileVersion("1.0.0.0")]
31+
32+
// Add some common permissions, these can be removed if not needed
33+
[assembly: UsesPermission(Android.Manifest.Permission.Internet)]
34+
[assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
android:id="@+id/sliding_tabs"
5+
android:layout_width="match_parent"
6+
android:layout_height="wrap_content"
7+
android:background="?attr/colorPrimary"
8+
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
9+
app:tabIndicatorColor="@android:color/white"
10+
app:tabGravity="fill"
11+
app:tabMode="fixed" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<android.support.v7.widget.Toolbar
2+
xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:id="@+id/toolbar"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content"
6+
android:background="?attr/colorPrimary"
7+
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
8+
android:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
9+

0 commit comments

Comments
 (0)