Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Update Kotlin to v1.2.71 #643

Merged
merged 9 commits into from
Sep 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Android/Kotlin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
generated/
245 changes: 59 additions & 186 deletions Android/Kotlin/build.cake
Original file line number Diff line number Diff line change
@@ -1,206 +1,79 @@
/*
Error: Could not resolve type with token 01000016 from typeref (expected class
'Cake.Core.CakeTaskBuilder`1' in assembly
'Cake.Core, Version=0.26.1.0, Culture=neutral, PublicKeyToken=null')
*/
//#load "../../common.cake" //

var TARGET = Argument ("t", Argument ("target", "Default"));
var TARGET = Argument("t", Argument("target", "Default"));

var JAR_VERSION = "1.3.31";

var JAR_STDLIB_URL = string.Format ("https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib/{0}/kotlin-stdlib-{0}.jar", JAR_VERSION);
var JAR_STDLIB_JDK7_URL = string.Format ("https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk7/{0}/kotlin-stdlib-jdk7-{0}.jar", JAR_VERSION);
var JAR_STDLIB_JDK8_URL = string.Format ("https://repo1.maven.org/maven2/org/jetbrains/kotlin/kotlin-stdlib-jdk8/{0}/kotlin-stdlib-jdk8-{0}.jar", JAR_VERSION);

var JAR_STDLIB_DEST = "./externals/kotlin-stdlib.jar";
var JAR_STDLIB_JDK7_DEST = "./externals/kotlin-stdlib-jdk7.jar";
var JAR_STDLIB_JDK8_DEST = "./externals/kotlin-stdlib-jdk8.jar";

string[] configs = new string[]
Task("binderate")
.Does(() =>
{
"Debug",
"Release"
};

Task ("externals")
.Does
(
() =>
{
EnsureDirectoryExists ("./externals/");

if (!FileExists (JAR_STDLIB_DEST))
{
DownloadFile (JAR_STDLIB_URL, JAR_STDLIB_DEST);
}
if (!FileExists (JAR_STDLIB_JDK7_DEST))
{
DownloadFile (JAR_STDLIB_JDK7_URL, JAR_STDLIB_JDK7_DEST);
}
if (!FileExists (JAR_STDLIB_JDK8_DEST))
{
DownloadFile (JAR_STDLIB_JDK8_URL, JAR_STDLIB_JDK8_DEST);
}


string dir = "./native/KotlinSample/";
var gradlew = MakeAbsolute((FilePath)"./native/KotlinSample/gradlew");
var configFile = MakeAbsolute(new FilePath("./config.json")).FullPath;
var basePath = MakeAbsolute(new DirectoryPath("./")).FullPath;

int exitCodeWithArgument = StartProcess (gradlew, new ProcessSettings {
Arguments = "build",
WorkingDirectory = dir
});

}
);
var exit = StartProcess("xamarin-android-binderator",
$"--config=\"{configFile}\" --basepath=\"{basePath}\"");
if (exit != 0) throw new Exception($"xamarin-android-binderator exited with code {exit}.");
});

Task("native")
.Does(() =>
{
var gradlew = MakeAbsolute((FilePath)"./native/KotlinSample/gradlew");
var exit = StartProcess(gradlew, new ProcessSettings {
Arguments = "assemble",
WorkingDirectory = "./native/KotlinSample/"
});
if (exit != 0) throw new Exception($"Gradle exited with exit code {exit}.");
});

Task("externals")
.IsDependentOn("binderate")
.IsDependentOn("native");

Task("libs")
.IsDependentOn("externals")
.Does
(
() =>
{
RestorePackages("./source/**/*.sln");
Build("./source/**/*.sln");
Build("./source/**/*.csproj");

string[] assemblies = new string[]
{
"./source/Xamarin.Kotlin.StdLib/bin/Release/Xamarin.Kotlin.StdLib.dll",
"./source/Xamarin.Kotlin.StdLib.Jdk7/bin/Release/Xamarin.Kotlin.StdLib.Jdk7.dll",
"./source/Xamarin.Kotlin.StdLib.Jdk8/bin/Release/Xamarin.Kotlin.StdLib.Jdk8.dll",
};
.Does(() =>
{
var settings = new MSBuildSettings()
.SetConfiguration("Release")
.SetVerbosity(Verbosity.Minimal)
.WithRestore()
.WithProperty("DesignTimeBuild", "false")
.WithProperty("PackageOutputPath", MakeAbsolute((DirectoryPath)"./output/").FullPath)
.WithTarget("Pack");

EnsureDirectoryExists("./output/");
foreach(string asm in assemblies)
{
CopyFileToDirectory(asm, "./output/");
}
MSBuild("./generated/Xamarin.Kotlin.sln", settings);
});

}
);
Task("nuget")
.IsDependentOn("libs");

Task("samples")
.Does
(
() =>
{
RestorePackages("./samples/**/*.sln");
Build("./samples/**/*.sln");
Build("./samples/**/*.csproj");

}
);

public void RestorePackages(string pattern)
.IsDependentOn("libs")
.Does(() =>
{
FilePathCollection files = GetFiles(pattern);
var settings = new MSBuildSettings()
.SetConfiguration("Release")
.SetVerbosity(Verbosity.Minimal)
.WithRestore()
.WithProperty("DesignTimeBuild", "false");

foreach(FilePath file in files)
{
NuGetRestore(file, new NuGetRestoreSettings { } );
}
MSBuild("./samples/KotlinSample.sln", settings);
});

return;
}
public void Build(string pattern)
Task("clean")
.Does(() =>
{
FilePathCollection files = GetFiles(pattern);

foreach(FilePath file in files)
{
foreach (string config in configs)
{
MSBuild
(
file.ToString(),
new MSBuildSettings
{
Configuration = config,
}
//.WithProperty("DefineConstants", "TRACE;DEBUG;NETCOREAPP2_0;NUNIT")
.WithProperty("AndroidClassParser", "jar2xml")

);
}
}

return;
}

public void Package(string pattern)
{
NuGetPackSettings settings = new NuGetPackSettings
{
BasePath = "./",
OutputDirectory = "./output/"
/*
Id = "TestNuGet",
Version = "0.0.0.1",
Title = "The tile of the package",
Authors = new string[] {"John Doe"},
Owners = new string[] {"Contoso"},
Description = "The description of the package",
Summary = "Excellent summary of what the package does",
ProjectUrl = new Uri("https://github.com/SomeUser/TestNuGet/"),
IconUrl = new Uri("http://cdn.rawgit.com/SomeUser/TestNuGet/master/icons/testNuGet.png"),
LicenseUrl = new Uri("https://github.com/SomeUser/TestNuGet/blob/master/LICENSE.md"),
Copyright = "Some company 2015",
ReleaseNotes = new string[] {"Bug fixes", "Issue fixes", "Typos"},
Tags = new string[] {"Cake", "Script", "Build"},
RequireLicenseAcceptance= false,
Symbols = false,
NoPackageAnalysis = true,
Files = new string[]
{
new NuSpecContent {Source = "bin/TestNuGet.dll", Target = "bin"},
},
BasePath = "./src/TestNuGet/bin/release",
*/
};

FilePathCollection files = GetFiles(pattern);
CleanDirectories("./generated/*/bin");
CleanDirectories("./generated/*/obj");

foreach(FilePath file in files)
{
foreach (string config in configs)
{
NuGetPack(file.ToString(), settings);
}
}

return;
}
Task ("nuget")
.IsDependentOn("libs")
.Does
(
() =>
{
Package("./nuget/*.nuspec");

return;
}
);

Task ("clean")
.Does
(
() =>
{
DeleteFiles ("./externals/*.jar");
}
);
CleanDirectories("./externals/");
CleanDirectories("./generated/");
CleanDirectories("./native/.gradle");
CleanDirectories("./native/**/build");
});

Task("Default")
.Does
(
() =>
{
RunTarget("nuget");
}
);
.IsDependentOn("externals")
.IsDependentOn("libs")
.IsDependentOn("nuget")
.IsDependentOn("samples");

RunTarget (TARGET);
RunTarget(TARGET);
70 changes: 70 additions & 0 deletions Android/Kotlin/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
[{
"mavenRepositoryType" : "MavenCentral",
"slnFile" : "generated/Xamarin.Kotlin.sln",
"templates" : [
{
"templateFile": "source/Project.cshtml",
"outputFileRule" : "generated/{groupid}.{artifactid}/{groupid}.{artifactid}.csproj"
},
{
"templateFile": "source/Targets.cshtml",
"outputFileRule" : "generated/{groupid}.{artifactid}/{nugetid}.targets"
}
],
"artifacts" : [
{
"groupId" : "org.jetbrains.kotlin",
"artifactId" : "kotlin-stdlib",
"version" : "1.2.71",
"nugetId" : "Xamarin.Kotlin.StdLib"
},
{
"groupId" : "org.jetbrains.kotlin",
"artifactId" : "kotlin-stdlib-common",
"version" : "1.2.71",
"nugetId" : "Xamarin.Kotlin.StdLib.Common",
"metadata" :
{
"friendlyName" : "Common"
}
},
{
"groupId" : "org.jetbrains.kotlin",
"artifactId" : "kotlin-stdlib-jdk7",
"version" : "1.2.71",
"nugetId" : "Xamarin.Kotlin.StdLib.Jdk7",
"metadata" :
{
"friendlyName" : "JDK 7 extension"
}
},
{
"groupId" : "org.jetbrains.kotlin",
"artifactId" : "kotlin-stdlib-jdk8",
"version" : "1.2.71",
"nugetId" : "Xamarin.Kotlin.StdLib.Jdk8",
"metadata" :
{
"friendlyName" : "JDK 8 extension"
}
},
{
"groupId" : "org.jetbrains.kotlin",
"artifactId" : "kotlin-stdlib-jre7",
"version" : "1.2.71",
"nugetId" : "Xamarin.Kotlin.StdLib.Jre7"
},
{
"groupId" : "org.jetbrains.kotlin",
"artifactId" : "kotlin-stdlib-jre8",
"version" : "1.2.71",
"nugetId" : "Xamarin.Kotlin.StdLib.Jre8"
},
{
"groupId" : "org.jetbrains",
"artifactId" : "annotations",
"version" : "13.0",
"nugetId" : "Xamarin.Jetbrains.Annotations"
}
]
}]
2 changes: 1 addition & 1 deletion Android/Kotlin/native/KotlinSample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.21'
ext.kotlin_version = '1.2.51'
repositories {
google()
jcenter()
Expand Down
22 changes: 0 additions & 22 deletions Android/Kotlin/nuget/Xamarin.Kotlin.StdLib.Jdk7.nuspec

This file was deleted.

22 changes: 0 additions & 22 deletions Android/Kotlin/nuget/Xamarin.Kotlin.StdLib.Jdk8.nuspec

This file was deleted.

Loading