This repository has been archived by the owner on Nov 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 147
/
Copy pathGooglePlayServicesTargets.cshtml
98 lines (90 loc) · 3.42 KB
/
GooglePlayServicesTargets.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
@using System.Linq
@using System.IO
@using System.Xml.Linq
<?xml version="1.0" encoding="utf-8"?>
@functions {
public static void RemoveXmlns(XElement e)
{
e.Name = e.Name.LocalName;
foreach (var node in e.DescendantNodes())
{
var n = node as XElement;
if (n != null)
RemoveXmlns(n);
}
}
}
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
</PropertyGroup>
@if (@Model.MavenArtifacts.Count > 0) {
<ItemGroup>
@foreach (var art in @Model.MavenArtifacts) {
if (art.ProguardFile != null) {
<ProguardConfiguration Condition=" '$(AndroidApplication)' == 'true' " Include="$(MSBuildThisFileDirectory)..\..\proguard\proguard.txt" />
}
}
</ItemGroup>
<PropertyGroup>
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
</PropertyGroup>
}
<PropertyGroup>
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
</PropertyGroup>
<PropertyGroup>
<AndroidFragmentType>AndroidX.Fragment.App.Fragment</AndroidFragmentType>
</PropertyGroup>
@foreach (var art in @Model.MavenArtifacts) {
if (art.MavenArtifactPackaging == "aar") {
var friendlyArtifactId = art.MavenArtifactId.Replace("-", "");
var friendlyVersion = art.MavenArtifactVersion.Replace(".", "_").Replace("-", "_");
var friendlyId = friendlyArtifactId + "_" + friendlyVersion;
var url = "https://dl.google.com/dl/android/maven2/" + art.MavenGroupId.Replace(".", "/") + "/" + art.MavenArtifactId + "/" + art.MavenArtifactVersion + "/" + art.MavenArtifactId + "-" + art.MavenArtifactVersion + ".aar";
var xbdKey = friendlyArtifactId + "-" + art.MavenArtifactVersion;
var xbdAarFile = friendlyArtifactId + "-" + art.MavenArtifactVersion + ".aar";
var xbdAarPath = xbdKey + "\\" + xbdKey + ".aar";
var xbdSha256 = art.MavenArtifactSha256;
<ItemGroup>
<XamarinBuildRestoreResources Include="_XbdRestoreItems_@(friendlyId)" />
</ItemGroup>
<Target Name="_XbdRestoreItems_@(friendlyId)">
<ItemGroup>
<XamarinBuildDownload Include="@(xbdKey)">
<Url>@(url)</Url>
<ToFile>@(xbdAarFile)</ToFile>
<Kind>Uncompressed</Kind>
<Sha256>@(xbdSha256)</Sha256>
</XamarinBuildDownload>
</ItemGroup>
<ItemGroup>
<XamarinBuildDownloadAndroidAarLibrary Include="$(XamarinBuildDownloadDir)@(xbdAarPath)" />
@*
<!--
NOTE:
Xamarin.Build.Download version set in GooglePlaySericesProjects.cshtml template is
important for attributes in GooglePlaySericesTargets.cshtml template
XamarinBuildDownloadAndroidAarLibrary v >= 0.10.0
XamarinBuildDownloadRestoreAssemblyAar v < 0.10.0
-->
*@
<XamarinBuildDownloadAndroidAarLibrary Include="$(XamarinBuildDownloadDir)@(xbdAarPath)" />
</ItemGroup>
</Target>
}
}
@{
string mergeTargets = Path.Combine(Model.Config.BasePath, "source", Model.MavenGroupId, Model.Name, "merge.targets");
if (File.Exists(mergeTargets)) {
XDocument xmlTargets = XDocument.Load(mergeTargets);
XNamespace nsChild = xmlTargets.Root.Name.Namespace;
@Raw("\r\n\r\n");
foreach (var xelem in xmlTargets.Element (nsChild + "Project").Elements ()) {
RemoveXmlns(xelem);
@Raw("\r\n" + xelem.ToString());
}
@Raw("\r\n\r\n");
}
}
</Project>