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

Commit a694ff1

Browse files
committed
Added bindings for support-annotations
1 parent 964d2ef commit a694ff1

File tree

9 files changed

+182
-12
lines changed

9 files changed

+182
-12
lines changed

AndroidSupport.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Transition", "transition\so
5353
EndProject
5454
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exif", "exifinterface\source\Exif.csproj", "{EBD7CBA0-E16C-460D-908C-89D453DDC556}"
5555
EndProject
56+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Annotations", "support-annotations\source\Annotations.csproj", "{EFC85AD8-90A7-4C98-8CEA-A875213DA5DC}"
57+
EndProject
5658
Global
5759
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5860
Debug|Any CPU = Debug|Any CPU
@@ -163,5 +165,9 @@ Global
163165
{EBD7CBA0-E16C-460D-908C-89D453DDC556}.Debug|Any CPU.Build.0 = Debug|Any CPU
164166
{EBD7CBA0-E16C-460D-908C-89D453DDC556}.Release|Any CPU.ActiveCfg = Release|Any CPU
165167
{EBD7CBA0-E16C-460D-908C-89D453DDC556}.Release|Any CPU.Build.0 = Release|Any CPU
168+
{EFC85AD8-90A7-4C98-8CEA-A875213DA5DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
169+
{EFC85AD8-90A7-4C98-8CEA-A875213DA5DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
170+
{EFC85AD8-90A7-4C98-8CEA-A875213DA5DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
171+
{EFC85AD8-90A7-4C98-8CEA-A875213DA5DC}.Release|Any CPU.Build.0 = Release|Any CPU
166172
EndGlobalSection
167173
EndGlobal

build.cake

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ Task ("externals")
244244
MoveFile (implFile, path + aarDir + "/libs/internal_impl.jar");
245245
}
246246

247+
CopyFile (string.Format (path + "m2repository/com/android/support/support-annotations/{0}/support-annotations-{0}.jar", AAR_VERSION), path + "support-annotations.jar");
247248
// We get docs a different way now
248249
// // Get android docs
249250
// if (!FileExists (path + "docs.zip")) {
@@ -327,7 +328,23 @@ Task ("component-setup").Does (() =>
327328
});
328329

329330
Task ("nuget-setup").IsDependentOn ("buildtasks").IsDependentOn ("externals")
330-
.WithCriteria (!FileExists ("./generated.targets")).Does (() => {
331+
.WithCriteria (!FileExists ("./generated.targets")).Does (() =>
332+
{
333+
334+
Action<FilePath, FilePath> mergeTargetsFiles = (FilePath fromFile, FilePath intoFile) =>
335+
{
336+
// Load the doc to append to, and the doc to append
337+
var xOrig = System.Xml.Linq.XDocument.Load (MakeAbsolute(intoFile).FullPath);
338+
System.Xml.Linq.XNamespace nsOrig = xOrig.Root.Name.Namespace;
339+
var xMerge = System.Xml.Linq.XDocument.Load (MakeAbsolute(fromFile).FullPath);
340+
System.Xml.Linq.XNamespace nsMerge = xMerge.Root.Name.Namespace;
341+
// Add all the elements under <Project> into the existing file's <Project> node
342+
foreach (var xItemToAdd in xMerge.Element (nsMerge + "Project").Elements ())
343+
xOrig.Element (nsOrig + "Project").Add (xItemToAdd);
344+
345+
xOrig.Save (MakeAbsolute (intoFile).FullPath);
346+
};
347+
331348
var templateText = FileReadText ("./template.targets");
332349

333350
if (FileExists ("./generated.targets"))
@@ -417,19 +434,20 @@ Task ("nuget-setup").IsDependentOn ("buildtasks").IsDependentOn ("externals")
417434

418435
if (FileExists (mergeFile)) {
419436
Information ("merge.targets found, merging into generated file...");
420-
421-
// Load the doc to append to, and the doc to append
422-
var xOrig = System.Xml.Linq.XDocument.Load (MakeAbsolute(targetsFile).FullPath);
423-
System.Xml.Linq.XNamespace nsOrig = xOrig.Root.Name.Namespace;
424-
var xMerge = System.Xml.Linq.XDocument.Load (MakeAbsolute(mergeFile).FullPath);
425-
System.Xml.Linq.XNamespace nsMerge = xMerge.Root.Name.Namespace;
426-
// Add all the elements under <Project> into the existing file's <Project> node
427-
foreach (var xItemToAdd in xMerge.Element (nsMerge + "Project").Elements ())
428-
xOrig.Element (nsOrig + "Project").Add (xItemToAdd);
429-
430-
xOrig.Save (MakeAbsolute (targetsFile).FullPath);
437+
mergeTargetsFiles (mergeFile, targetsFile);
431438
}
432439
}
440+
441+
// Support annotations needs merging tool
442+
var annotationsPart = downloadParts.FirstOrDefault (p => p.LocalPath.EndsWith ("/support-annotations-" + AAR_VERSION + ".jar"));
443+
var annotationsTemplateText = FileReadText ("./support-annotations/nuget/template.targets");
444+
annotationsTemplateText = annotationsTemplateText.Replace ("$AarVersion$", AAR_VERSION)
445+
.Replace ("$XbdRangeStart$", annotationsPart.RangeStart.ToString())
446+
.Replace ("$XbdRangeEnd$", annotationsPart.RangeEnd.ToString())
447+
.Replace ("$XbdMd5$", annotationsPart.Md5);
448+
449+
FileWriteText ("./support-annotations/nuget/Xamarin.Android.Support.Annotations.targets", annotationsTemplateText);
450+
mergeTargetsFiles ("./support-annotations/nuget/Xamarin.Android.Support.Annotations.targets", "./generated.targets");
433451
});
434452

435453
Task ("nuget").IsDependentOn ("nuget-setup").IsDependentOn ("nuget-base").IsDependentOn ("libs");
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0"?>
2+
<package>
3+
<metadata>
4+
<id>Xamarin.Android.Support.Annotations</id>
5+
<title>Xamarin Android Support Library - Annotations</title>
6+
<version>$version$</version>
7+
<authors>Xamarin Inc.</authors>
8+
<owners>Xamarin Inc.</owners>
9+
<requireLicenseAcceptance>true</requireLicenseAcceptance>
10+
<description>Annotations Android Support Library C# bindings for Xamarin</description>
11+
<copyright>Copyright © Microsoft Corporation</copyright>
12+
<projectUrl>https://github.com/xamarin/AndroidSupportComponents/</projectUrl>
13+
<licenseUrl>https://github.com/xamarin/AndroidSupportComponents/blob/master/LICENSE.md</licenseUrl>
14+
<iconUrl>https://raw.githubusercontent.com/xamarin/GooglePlayServicesComponents/master/icons/support-annotations_128x128.png</iconUrl>
15+
<dependencies>
16+
<group targetFramework="MonoAndroid70">
17+
<dependency id="Xamarin.Build.Download" version="0.4.2" />
18+
</group>
19+
</dependencies>
20+
</metadata>
21+
<files>
22+
<file src="support-annotations/nuget/Xamarin.Android.Support.Annotations.targets" target="build/MonoAndroid70" />
23+
24+
<file src="output/Xamarin.Android.Support.Annotations.dll" target="lib/MonoAndroid70" />
25+
</files>
26+
</package>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\..\packages\Xamarin.Build.Download.0.4.2\build\Xamarin.Build.Download.props" Condition="Exists('..\..\packages\Xamarin.Build.Download.0.4.2\build\Xamarin.Build.Download.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{EFC85AD8-90A7-4C98-8CEA-A875213DA5DC}</ProjectGuid>
8+
<ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>Android.Support.Annotations</RootNamespace>
11+
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
12+
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
13+
<AssemblyName>Xamarin.Android.Support.Annotations</AssemblyName>
14+
<TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
15+
<!-- <SignAssembly>true</SignAssembly>
16+
<DelaySign>true</DelaySign>
17+
<AssemblyOriginatorKeyFile>publickey.snk</AssemblyOriginatorKeyFile> -->
18+
<AndroidClassParser>class-parse</AndroidClassParser>
19+
<ProductVersion>8.0.30703</ProductVersion>
20+
<SchemaVersion>2.0</SchemaVersion>
21+
</PropertyGroup>
22+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
23+
<DebugSymbols>true</DebugSymbols>
24+
<DebugType>full</DebugType>
25+
<Optimize>false</Optimize>
26+
<OutputPath>bin\Debug</OutputPath>
27+
<DefineConstants>DEBUG;</DefineConstants>
28+
<ErrorReport>prompt</ErrorReport>
29+
<WarningLevel>4</WarningLevel>
30+
<AndroidLinkMode>None</AndroidLinkMode>
31+
<ConsolePause>false</ConsolePause>
32+
</PropertyGroup>
33+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
34+
<DebugType>full</DebugType>
35+
<Optimize>true</Optimize>
36+
<OutputPath>bin\Release</OutputPath>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
40+
<ConsolePause>false</ConsolePause>
41+
</PropertyGroup>
42+
<PropertyGroup>
43+
<!--Docs URL Can be found here: http://dl-ssl.google.com/android/repository/repository-8.xml -->
44+
<DroidDocPaths>..\..\externals\docs\reference</DroidDocPaths>
45+
</PropertyGroup>
46+
<ItemGroup>
47+
<Reference Include="System" />
48+
<Reference Include="System.Xml" />
49+
<Reference Include="System.Core" />
50+
<Reference Include="Mono.Android" />
51+
</ItemGroup>
52+
<ItemGroup>
53+
<Compile Include="Properties\AssemblyInfo.cs" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<TransformFile Include="Transforms\EnumFields.xml" />
57+
<TransformFile Include="Transforms\EnumMethods.xml" />
58+
<TransformFile Include="Transforms\Metadata.xml" />
59+
</ItemGroup>
60+
<ItemGroup>
61+
<Folder Include="Additions\" />
62+
</ItemGroup>
63+
<ItemGroup>
64+
<None Include="packages.config" />
65+
</ItemGroup>
66+
<ItemGroup>
67+
<InputJar Include="..\..\externals\support-annotations.jar">
68+
<Link>Jars\support-annotations.jar</Link>
69+
</InputJar>
70+
</ItemGroup>
71+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
72+
<Import Project="..\..\generated.targets" />
73+
<Import Project="..\..\packages\Xamarin.Build.Download.0.4.2\build\Xamarin.Build.Download.targets" Condition="Exists('..\..\packages\Xamarin.Build.Download.0.4.2\build\Xamarin.Build.Download.targets')" />
74+
</Project>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using Android.App;
4+
5+
// Information about this assembly is defined by the following attributes.
6+
// Change them to the values specific to your project.
7+
8+
[assembly: AssemblyTitle("Xamarin.Android.Support.Annotations")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany ("Microsoft Corporation")]
12+
[assembly: AssemblyProduct("")]
13+
[assembly: AssemblyCopyright ("Copyright © Microsoft Corporation")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
18+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
19+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
20+
21+
[assembly: AssemblyVersion("1.0.0")]
22+
23+
// The following attributes are used to specify the signing key for the assembly,
24+
// if desired. See the Mono documentation for more information about signing.
25+
26+
//[assembly: AssemblyDelaySign(false)]
27+
//[assembly: AssemblyKeyFile("")]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<enum-field-mappings>
2+
<!-- <mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType">
3+
<field jni-name="Fragment_id" clr-name="Id" value="1" />
4+
<field jni-name="Fragment_name" clr-name="Name" value="0" />
5+
<field jni-name="Fragment_tag" clr-name="Tag" value="2" />
6+
</mapping>-->
7+
</enum-field-mappings>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<enum-method-mappings>
2+
3+
</enum-method-mappings>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<metadata>
2+
3+
<attr path="/api/package[@name='android.support.annotations']" name="managedName">Android.Support.Annotations</attr>
4+
5+
</metadata>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Xamarin.Build.Download" version="0.4.2" targetFramework="monoandroid70" />
4+
</packages>

0 commit comments

Comments
 (0)