Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 06d5e49

Browse files
committed
samples and samples target added
1 parent 09509b7 commit 06d5e49

28 files changed

+255
-0
lines changed

build.cake

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
#addin nuget:?package=Cake.FileHelpers&version=3.1.0
66

77
using System.Xml.Linq;
8+
using System.Text.RegularExpressions;
89

910
var TARGET = Argument ("t", Argument ("target", "Default"));
1011
var BUILD_CONFIG = Argument ("config", "Release");
1112
var VERBOSITY = Argument ("v", Argument ("verbosity", Verbosity.Normal));
1213
var MAX_CPU_COUNT = Argument("maxcpucount", 0);
14+
var CONFIGURATION = Argument ("c", Argument ("configuration", "Release"));
1315

1416
// Lists all the artifacts and their versions for com.android.support.*
1517
// https://dl.google.com/dl/android/maven2/com/android/support/group-index.xml
@@ -152,6 +154,50 @@ Task("nuget")
152154
});
153155
});
154156

157+
Task("samples")
158+
.IsDependentOn("nuget")
159+
.Does(() =>
160+
{
161+
// TODO: make this actually work with more than just this sample
162+
163+
// make a big .targets file that pulls in everything
164+
var xmlns = (XNamespace)"http://schemas.microsoft.com/developer/msbuild/2003";
165+
var itemGroup = new XElement(xmlns + "ItemGroup");
166+
foreach (var nupkg in GetFiles("./output/*.nupkg")) {
167+
// Skip Wear as it has special implications requiring more packages to be used properly in an app
168+
if (nupkg.FullPath.Contains(".Wear."))
169+
continue;
170+
// Skip the migration packages as that is not meant forto be used here
171+
if (nupkg.FullPath.Contains("Xamarin.AndroidX.Migration"))
172+
continue;
173+
var filename = nupkg.GetFilenameWithoutExtension();
174+
var match = Regex.Match(filename.ToString(), @"(.+?)\.(\d+[\.0-9\-a-zA-Z]+)");
175+
itemGroup.Add(new XElement(xmlns + "PackageReference",
176+
new XAttribute("Include", match.Groups[1]),
177+
new XAttribute("Version", match.Groups[2])));
178+
}
179+
var xdoc = new XDocument(new XElement(xmlns + "Project", itemGroup));
180+
xdoc.Save("./output/AllPackages.targets");
181+
182+
// clear the packages folder so we always use the latest
183+
var packagesPath = MakeAbsolute((DirectoryPath)"./samples/packages").FullPath;
184+
EnsureDirectoryExists(packagesPath);
185+
CleanDirectories(packagesPath);
186+
187+
// build the samples
188+
var settings = new MSBuildSettings()
189+
.SetConfiguration(CONFIGURATION)
190+
.SetVerbosity(VERBOSITY)
191+
.SetMaxCpuCount(0)
192+
.EnableBinaryLogger("./output/samples.binlog")
193+
.WithRestore()
194+
.WithProperty("RestorePackagesPath", packagesPath)
195+
.WithProperty("DesignTimeBuild", "false")
196+
.WithProperty("AndroidSdkBuildToolsVersion", "29.0.2");
197+
198+
MSBuild("./samples/BuildAll/BuildAll.sln", settings);
199+
});
200+
155201
Task ("merge")
156202
.IsDependentOn ("libs")
157203
.Does (() =>

samples/BuildAll/BuildAll.sln

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.28606.126
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildAll", "BuildAll\BuildAll.csproj", "{F47B1471-0F85-4690-B8A7-09F86ABBB1F6}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{F47B1471-0F85-4690-B8A7-09F86ABBB1F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{F47B1471-0F85-4690-B8A7-09F86ABBB1F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{F47B1471-0F85-4690-B8A7-09F86ABBB1F6}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
17+
{F47B1471-0F85-4690-B8A7-09F86ABBB1F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
18+
{F47B1471-0F85-4690-B8A7-09F86ABBB1F6}.Release|Any CPU.Build.0 = Release|Any CPU
19+
{F47B1471-0F85-4690-B8A7-09F86ABBB1F6}.Release|Any CPU.Deploy.0 = Release|Any CPU
20+
EndGlobalSection
21+
GlobalSection(SolutionProperties) = preSolution
22+
HideSolutionNode = FALSE
23+
EndGlobalSection
24+
GlobalSection(ExtensibilityGlobals) = postSolution
25+
SolutionGuid = {47AA0B75-DCFB-4D55-AFC5-DB072FDDCCB1}
26+
EndGlobalSection
27+
EndGlobal
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{F47B1471-0F85-4690-B8A7-09F86ABBB1F6}</ProjectGuid>
9+
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10+
<TemplateGuid>{122416d6-6b49-4ee2-a1e8-b825f31c79fe}</TemplateGuid>
11+
<OutputType>Library</OutputType>
12+
<AppDesignerFolder>Properties</AppDesignerFolder>
13+
<RootNamespace>BuildAll</RootNamespace>
14+
<AssemblyName>BuildAll</AssemblyName>
15+
<FileAlignment>512</FileAlignment>
16+
<AndroidApplication>True</AndroidApplication>
17+
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
18+
<AndroidResgenClass>Resource</AndroidResgenClass>
19+
<GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies>
20+
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
21+
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
22+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
23+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
24+
<AndroidEnableSGenConcurrent>true</AndroidEnableSGenConcurrent>
25+
<AndroidHttpClientHandlerType>Xamarin.Android.Net.AndroidClientHandler</AndroidHttpClientHandlerType>
26+
<EnableProguard>true</EnableProguard>
27+
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
30+
<DebugSymbols>True</DebugSymbols>
31+
<DebugType>portable</DebugType>
32+
<Optimize>False</Optimize>
33+
<OutputPath>bin\Debug\</OutputPath>
34+
<DefineConstants>DEBUG;TRACE</DefineConstants>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
<AndroidUseSharedRuntime>True</AndroidUseSharedRuntime>
38+
<AndroidLinkMode>None</AndroidLinkMode>
39+
<EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk>
40+
<MandroidI18n />
41+
<AndroidDexTool>d8</AndroidDexTool>
42+
</PropertyGroup>
43+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
44+
<DebugSymbols>True</DebugSymbols>
45+
<DebugType>pdbonly</DebugType>
46+
<Optimize>True</Optimize>
47+
<OutputPath>bin\Release\</OutputPath>
48+
<DefineConstants>TRACE</DefineConstants>
49+
<ErrorReport>prompt</ErrorReport>
50+
<WarningLevel>4</WarningLevel>
51+
<AndroidManagedSymbols>true</AndroidManagedSymbols>
52+
<AndroidUseSharedRuntime>False</AndroidUseSharedRuntime>
53+
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
54+
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
55+
</PropertyGroup>
56+
<ItemGroup>
57+
<Reference Include="System" />
58+
<Reference Include="System.Xml" />
59+
<Reference Include="System.Core" />
60+
<Reference Include="Mono.Android" />
61+
</ItemGroup>
62+
<ItemGroup>
63+
<Compile Include="MainActivity.cs" />
64+
<Compile Include="Resources\Resource.designer.cs" />
65+
<Compile Include="Properties\AssemblyInfo.cs" />
66+
</ItemGroup>
67+
<ItemGroup>
68+
<None Include="Properties\AndroidManifest.xml" />
69+
</ItemGroup>
70+
<ItemGroup>
71+
<AndroidResource Include="Resources\layout\activity_main.axml" />
72+
<AndroidResource Include="Resources\values\colors.xml" />
73+
<AndroidResource Include="Resources\values\ic_launcher_background.xml" />
74+
<AndroidResource Include="Resources\values\strings.xml" />
75+
<AndroidResource Include="Resources\values\styles.xml" />
76+
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher.xml" />
77+
<AndroidResource Include="Resources\mipmap-anydpi-v26\ic_launcher_round.xml" />
78+
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher.png" />
79+
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_foreground.png" />
80+
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher_round.png" />
81+
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher.png" />
82+
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_foreground.png" />
83+
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher_round.png" />
84+
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher.png" />
85+
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_foreground.png" />
86+
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher_round.png" />
87+
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher.png" />
88+
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_foreground.png" />
89+
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher_round.png" />
90+
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher.png" />
91+
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_foreground.png" />
92+
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher_round.png" />
93+
</ItemGroup>
94+
<Import Project="..\..\..\output\AllPackages.targets" />
95+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
96+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Android.App;
2+
using Android.OS;
3+
4+
namespace BuildAll
5+
{
6+
[Activity(Label = "@string/app_name", MainLauncher = true)]
7+
public class MainActivity : Activity
8+
{
9+
protected override void OnCreate(Bundle savedInstanceState)
10+
{
11+
base.OnCreate(savedInstanceState);
12+
13+
// Set our view from the "main" layout resource
14+
SetContentView(Resource.Layout.activity_main);
15+
}
16+
}
17+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
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="BuildAll.BuildAll" android:installLocation="auto">
3+
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
4+
<application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true"></application>
5+
</manifest>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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("BuildAll")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("BuildAll")]
14+
[assembly: AssemblyCopyright("Copyright © 2018")]
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")]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:app="http://schemas.android.com/apk/res-auto"
4+
xmlns:tools="http://schemas.android.com/tools"
5+
android:layout_width="match_parent"
6+
android:layout_height="match_parent">
7+
</RelativeLayout>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5+
</adaptive-icon>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background"/>
4+
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
5+
</adaptive-icon>
1.6 KB
Loading

0 commit comments

Comments
 (0)