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

Commit 6f2dad5

Browse files
committed
Tokenize nuget versions for dependencies
In our template.nuspec files we had some cases where just using `$version$` wasn’t enough, since say Arch.Lifecycle.Runtime would be a different version than Arch.Core.Runtime. So, now the nuget-setup build task will go through and replace a pattern of `$package.id.artifact-id$` with the correlating version from the ARTIFACTS list in the build script. So, we can put something like: `$android.arch.lifecycle.common$` in the nuspec template and it will be replaced with `1.0.0` for example.
1 parent 1780c73 commit 6f2dad5

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

arch-core/common/nuget/template.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<iconUrl>https://raw.githubusercontent.com/xamarin/AndroidSupportComponents/master/icons/arch-core-common_128x128.png</iconUrl>
1515
<dependencies>
1616
<group targetFramework="MonoAndroid80">
17-
<dependency id="Xamarin.Android.Support.Annotations" version="26.1.0" />
17+
<dependency id="Xamarin.Android.Support.Annotations" version="$com.android.support.support-annotations$" />
1818
</group>
1919
</dependencies>
2020
</metadata>

arch-core/runtime/nuget/template.nuspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<iconUrl>https://raw.githubusercontent.com/xamarin/AndroidSupportComponents/master/icons/arch-core-runtime_128x128.png</iconUrl>
1515
<dependencies>
1616
<group targetFramework="MonoAndroid80">
17-
<dependency id="Xamarin.Android.Support.Annotations" version="26.1.0" />
18-
<dependency id="Xamarin.Android.Arch.Core.Common" version="1.0.0" />
17+
<dependency id="Xamarin.Android.Support.Annotations" version="$com.android.support.support-annotations$" />
18+
<dependency id="Xamarin.Android.Arch.Core.Common" version="$android.arch.core.common$" />
1919
</group>
2020
</dependencies>
2121
</metadata>

arch-lifecycle/common/nuget/template.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<iconUrl>https://raw.githubusercontent.com/xamarin/AndroidSupportComponents/master/icons/arch-lifecycle-common_128x128.png</iconUrl>
1515
<dependencies>
1616
<group targetFramework="MonoAndroid80">
17-
<dependency id="Xamarin.Android.Support.Annotations" version="26.1.0" />
17+
<dependency id="Xamarin.Android.Support.Annotations" version="$com.android.support.support-annotations$" />
1818
</group>
1919
</dependencies>
2020
</metadata>

arch-lifecycle/extensions/nuget/template.nuspec

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
<iconUrl>https://raw.githubusercontent.com/xamarin/AndroidSupportComponents/master/icons/arch-lifecycle-extensions_128x128.png</iconUrl>
1515
<dependencies>
1616
<group targetFramework="MonoAndroid80">
17-
<dependency id="Xamarin.Android.Support.Annotations" version="26.1.0" />
18-
<dependency id="Xamarin.Android.Support.Fragment" version="26.1.0" />
19-
<dependency id="Xamarin.Android.Arch.Lifecycle.Runtime" version="1.0.3" />
20-
<dependency id="Xamarin.Android.Arch.Lifecycle.Common" version="1.0.3" />
21-
<dependency id="Xamarin.Android.Arch.Core.Common" version="1.0.0" />
22-
<dependency id="Xamarin.Android.Arch.Core.Runtime" version="1.0.0" />
17+
<dependency id="Xamarin.Android.Support.Annotations" version="$com.android.support.support-annotations$" />
18+
<dependency id="Xamarin.Android.Support.Fragment" version="$com.android.support.support-fragment$" />
19+
<dependency id="Xamarin.Android.Arch.Lifecycle.Runtime" version="$android.arch.lifecycle.runtime$" />
20+
<dependency id="Xamarin.Android.Arch.Lifecycle.Common" version="$android.arch.lifecycle.common$" />
21+
<dependency id="Xamarin.Android.Arch.Core.Common" version="$android.arch.core.common$" />
22+
<dependency id="Xamarin.Android.Arch.Core.Runtime" version="$android.arch.core.runtime$" />
2323
</group>
2424
</dependencies>
2525
</metadata>

arch-lifecycle/runtime/nuget/template.nuspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
<iconUrl>https://raw.githubusercontent.com/xamarin/AndroidSupportComponents/master/icons/arch-lifecycle-runtime_128x128.png</iconUrl>
1515
<dependencies>
1616
<group targetFramework="MonoAndroid80">
17-
<dependency id="Xamarin.Android.Support.Annotations" version="26.1.0" />
18-
<dependency id="Xamarin.Android.Arch.Lifecycle.Common" version="1.0.1" />
19-
<dependency id="Xamarin.Android.Arch.Core.Common" version="1.0.0" />
17+
<dependency id="Xamarin.Android.Support.Annotations" version="$com.android.support.support-annotations$" />
18+
<dependency id="Xamarin.Android.Arch.Lifecycle.Common" version="$android.arch.lifecycle.common$" />
19+
<dependency id="Xamarin.Android.Arch.Core.Common" version="$android.arch.core.common$" />
2020
</group>
2121
</dependencies>
2222
</metadata>

build.cake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,15 @@ Task ("nuget-setup")
392392

393393
// Transform all template.nuspec files
394394
var nuspecText = FileReadText(art.PathPrefix + art.ArtifactId + "/nuget/template.nuspec");
395+
396+
// We use a pattern of $package.id.artifact.id$ as a placeholder in nuspec templates
397+
// which we want to substitute the actual nuget version into
398+
// So for example $com.android.support.support-compat$ would get replaced with the nuget version for Xamarin.Android.Support.Compat
399+
foreach (var artifactInfo in ARTIFACTS) {
400+
var placeholder = "$" + artifactInfo.Package + "." + artifactInfo.ArtifactId + "$";
401+
nuspecText = nuspecText.Replace(placeholder, artifactInfo.NuGetVersion);
402+
}
403+
395404
//nuspecText = nuspecText.Replace ("$xbdversion$", XBD_VERSION);
396405
var nuspecFile = new FilePath(art.PathPrefix + art.ArtifactId + "/nuget/" + art.NugetId + ".nuspec");
397406
FileWriteText(nuspecFile, nuspecText);

0 commit comments

Comments
 (0)