Skip to content

Commit

Permalink
binderator-verification Cake task added + mismatched errors fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
moljac committed Dec 11, 2019
1 parent b7169db commit 052d908
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 4 deletions.
58 changes: 58 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ Task("javadocs")
});

Task ("binderate")
.IsDependentOn("binderate-config-verify")
.Does (() =>
{
var configFile = MakeAbsolute(new FilePath("./config.json")).FullPath;
Expand All @@ -221,6 +222,63 @@ Task ("binderate")
}
});

string nuget_version_template = "x.y.z-preview06";
JArray binderator_json_array = null;

Task("binderate-config-verify")
.Does
(
() =>
{
using (StreamReader reader = System.IO.File.OpenText(@"./config.json"))
{
JsonTextReader jtr = new JsonTextReader(reader);
binderator_json_array = (JArray)JToken.ReadFrom(jtr);
}

Information("config.json verification...");
foreach(JObject jo in binderator_json_array[0]["artifacts"])
{
bool? dependency_only = (bool?) jo["dependencyOnly"];
if ( dependency_only == true)
{
continue;
}
string version = (string) jo["version"];
string nuget_version = (string) jo["nugetVersion"];

Information($"groupId = {jo["groupId"]}");
Information($"artifactId = {jo["artifactId"]}");
Information($"version = {version}");
Information($"nuget_version = {nuget_version}");
Information($"nugetId = {jo["nugetId"]}");

string[] version_parts = version.Split(new string[]{ "." }, StringSplitOptions.RemoveEmptyEntries);
string x = version_parts[0];
string y = version_parts[1];
string z = version_parts[2];
version = version.Replace("x", x);
version = version.Replace("y", y);
version = version.Replace("z", z);
if( string.Equals(version, nuget_version))
{
Error("check config.json for nuget id");
Error ($" groupId = {jo["groupId"]}");
Error ($" artifactId = {jo["artifactId"]}");
Error ($" version = {version}");
Error ($" nuget_version = {nuget_version}");
Error ($" nugetId = {jo["nugetId"]}");

Warning($" expected : ");
Warning($" nuget_version = {nuget_version}");
throw new Exception("check config.json for nuget id");
}
}

return;
}
);

Task("libs")
.Does(() =>
{
Expand Down
8 changes: 4 additions & 4 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
"artifactId" : "browser",
"version" : "1.0.0",
"nugetId" : "Xamarin.AndroidX.Browser",
"nugetVersion" : "1.1.0-preview06",
"nugetVersion" : "1.0.0-preview06",
"dependencyOnly" : false
}
,{
Expand Down Expand Up @@ -226,7 +226,7 @@
,{
"groupId" : "androidx.exifinterface",
"artifactId" : "exifinterface",
"version" : "1.0.0",
"version" : "1.1.0",
"nugetId" : "Xamarin.AndroidX.ExifInterface",
"nugetVersion" : "1.1.0-preview06",
"dependencyOnly" : false
Expand Down Expand Up @@ -612,7 +612,7 @@
"artifactId" : "slidingpanelayout",
"version" : "1.0.0",
"nugetId" : "Xamarin.AndroidX.SlidingPaneLayout",
"nugetVersion" : "1.1.0-preview06",
"nugetVersion" : "1.0.0-preview06",
"dependencyOnly" : false
}
,{
Expand Down Expand Up @@ -716,7 +716,7 @@
"artifactId" : "material",
"version" : "1.0.0",
"nugetId" : "Xamarin.Google.Android.Material",
"nugetVersion" : "1.1.0-preview06",
"nugetVersion" : "1.0.0-preview06",
"dependencyOnly" : false
},

Expand Down

0 comments on commit 052d908

Please sign in to comment.