[android] update latest 15-4 stable branch of Xamarin.Android
MSBuild tasks changed a bit: - Aapt needs to conditionally run if there are no resources - ResolveLibraryProjectImports had changes to required properties - Using shorter names for intermediate directories Other changes: - Xamarin.Android’s mono.android.Runtime.init had API changes. - URLs in cake script to download 15-4 build artifact from Jenkins - AppVeyor cache should watch for `build\Android.cake` changes After this PR, I'll look at getting API-26 support as the default.
This commit is contained in:
Родитель
7ab037a4e8
Коммит
de31e4ff88
|
@ -37,7 +37,7 @@ environment:
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
- packages -> **\packages.config
|
- packages -> **\packages.config
|
||||||
- external\Xamarin.Android -> build.cake
|
- external\Xamarin.Android -> build\Android.cake
|
||||||
|
|
||||||
#---------------------------------#
|
#---------------------------------#
|
||||||
# build scripts #
|
# build scripts #
|
||||||
|
|
|
@ -18,7 +18,8 @@ namespace Embeddinator
|
||||||
public const string IntermediateDir = "obj";
|
public const string IntermediateDir = "obj";
|
||||||
public const string ResourcePaths = "resourcepaths.cache";
|
public const string ResourcePaths = "resourcepaths.cache";
|
||||||
|
|
||||||
const string LibraryProjectDir = "library_project_imports";
|
const string LibraryProjectDir = "lp";
|
||||||
|
const string ImportsDirectory = "jl";
|
||||||
const string LinkMode = "SdkOnly";
|
const string LinkMode = "SdkOnly";
|
||||||
|
|
||||||
static ProjectRootElement CreateProject()
|
static ProjectRootElement CreateProject()
|
||||||
|
@ -102,6 +103,7 @@ namespace Embeddinator
|
||||||
|
|
||||||
//Aapt Task to generate R.txt
|
//Aapt Task to generate R.txt
|
||||||
var aapt = target.AddTask("Aapt");
|
var aapt = target.AddTask("Aapt");
|
||||||
|
aapt.Condition = $"Exists('{resourceDir}')";
|
||||||
aapt.SetParameter("ImportsDirectory", outputDirectory);
|
aapt.SetParameter("ImportsDirectory", outputDirectory);
|
||||||
aapt.SetParameter("OutputImportDirectory", outputDirectory);
|
aapt.SetParameter("OutputImportDirectory", outputDirectory);
|
||||||
aapt.SetParameter("ManifestFiles", manifestPath);
|
aapt.SetParameter("ManifestFiles", manifestPath);
|
||||||
|
@ -196,10 +198,12 @@ $@"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||||
//ResolveLibraryProjectImports Task, extracts Android resources
|
//ResolveLibraryProjectImports Task, extracts Android resources
|
||||||
var resolveLibraryProject = target.AddTask("ResolveLibraryProjectImports");
|
var resolveLibraryProject = target.AddTask("ResolveLibraryProjectImports");
|
||||||
resolveLibraryProject.SetParameter("Assemblies", "@(ResolvedUserAssemblies)");
|
resolveLibraryProject.SetParameter("Assemblies", "@(ResolvedUserAssemblies)");
|
||||||
|
resolveLibraryProject.SetParameter("AssemblyIdentityMapFile", Path.Combine(intermediateDir, LibraryProjectDir, "map.cache"));
|
||||||
|
resolveLibraryProject.SetParameter("CacheFile", Path.Combine(intermediateDir, "libraryprojectimports.cache"));
|
||||||
resolveLibraryProject.SetParameter("UseShortFileNames", "False");
|
resolveLibraryProject.SetParameter("UseShortFileNames", "False");
|
||||||
resolveLibraryProject.SetParameter("ImportsDirectory", intermediateDir);
|
resolveLibraryProject.SetParameter("ImportsDirectory", ImportsDirectory);
|
||||||
resolveLibraryProject.SetParameter("OutputDirectory", intermediateDir);
|
resolveLibraryProject.SetParameter("OutputDirectory", intermediateDir);
|
||||||
resolveLibraryProject.SetParameter("OutputImportDirectory", intermediateDir);
|
resolveLibraryProject.SetParameter("OutputImportDirectory", Path.Combine(intermediateDir, LibraryProjectDir));
|
||||||
resolveLibraryProject.AddOutputItem("ResolvedAssetDirectories", "ResolvedAssetDirectories");
|
resolveLibraryProject.AddOutputItem("ResolvedAssetDirectories", "ResolvedAssetDirectories");
|
||||||
resolveLibraryProject.AddOutputItem("ResolvedResourceDirectories", "ResolvedResourceDirectories");
|
resolveLibraryProject.AddOutputItem("ResolvedResourceDirectories", "ResolvedResourceDirectories");
|
||||||
|
|
||||||
|
@ -209,15 +213,16 @@ $@"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||||
getAdditionalResources.SetParameter("AndroidNdkDirectory", XamarinAndroid.AndroidSdk.AndroidNdkPath);
|
getAdditionalResources.SetParameter("AndroidNdkDirectory", XamarinAndroid.AndroidSdk.AndroidNdkPath);
|
||||||
getAdditionalResources.SetParameter("Assemblies", "@(ResolvedUserAssemblies)");
|
getAdditionalResources.SetParameter("Assemblies", "@(ResolvedUserAssemblies)");
|
||||||
getAdditionalResources.SetParameter("CacheFile", Path.Combine(intermediateDir, ResourcePaths));
|
getAdditionalResources.SetParameter("CacheFile", Path.Combine(intermediateDir, ResourcePaths));
|
||||||
|
getAdditionalResources.SetParameter("DesignTimeBuild", "False");
|
||||||
|
|
||||||
//Create ItemGroup of Android files
|
//Create ItemGroup of Android files
|
||||||
var androidResources = target.AddItemGroup();
|
var androidResources = target.AddItemGroup();
|
||||||
foreach (var assembly in assemblies)
|
foreach (var assembly in assemblies)
|
||||||
{
|
{
|
||||||
var assemblyName = assembly.GetName().Name;
|
var assemblyName = assembly.GetName().Name;
|
||||||
androidResources.AddItem("AndroidAsset", Path.Combine(intermediateDir, assemblyName, LibraryProjectDir, "assets", "**", "*"));
|
androidResources.AddItem("AndroidAsset", Path.Combine(intermediateDir, LibraryProjectDir, assemblyName, ImportsDirectory, "assets", "**", "*"));
|
||||||
androidResources.AddItem("AndroidJavaSource", Path.Combine(intermediateDir, assemblyName, LibraryProjectDir, "java", "**", "*.java"));
|
androidResources.AddItem("AndroidJavaSource", Path.Combine(intermediateDir, LibraryProjectDir, assemblyName, ImportsDirectory, "java", "**", "*.java"));
|
||||||
androidResources.AddItem("AndroidResource", Path.Combine(intermediateDir, assemblyName, LibraryProjectDir, "res", "**", "*"));
|
androidResources.AddItem("AndroidResource", Path.Combine(intermediateDir, LibraryProjectDir, assemblyName, ImportsDirectory, "res", "**", "*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Copy Task, to copy AndroidAsset files
|
//Copy Task, to copy AndroidAsset files
|
||||||
|
|
|
@ -19,8 +19,9 @@ Task("Download-Xamarin-Android")
|
||||||
Console.WriteLine("Downloading Xamarin.Android SDK, this will take a while...");
|
Console.WriteLine("Downloading Xamarin.Android SDK, this will take a while...");
|
||||||
|
|
||||||
//We can also update this URL later from here: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/lastSuccessfulBuild/Azure/
|
//We can also update this URL later from here: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/lastSuccessfulBuild/Azure/
|
||||||
var artifact = "oss-xamarin.android_v7.4.99.16_Darwin-x86_64_master_e83c99c";
|
var artifact = "oss-xamarin.android_v8.0.0.37_Darwin-x86_64_HEAD_376f684";
|
||||||
var url = $"https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/444/Azure/processDownloadRequest/xamarin-android/{artifact}.zip";
|
var buildId = 682;
|
||||||
|
var url = $"https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/{buildId}/Azure/processDownloadRequest/xamarin-android/{artifact}.zip";
|
||||||
var temp = DownloadFile(url);
|
var temp = DownloadFile(url);
|
||||||
var tempDir = temp.GetDirectory() + "/" + artifact;
|
var tempDir = temp.GetDirectory() + "/" + artifact;
|
||||||
try
|
try
|
||||||
|
|
|
@ -33,6 +33,14 @@ public class AndroidImpl extends DesktopImpl {
|
||||||
String cacheDir = context.getCacheDir ().getAbsolutePath ();
|
String cacheDir = context.getCacheDir ().getAbsolutePath ();
|
||||||
String dataDir = app.nativeLibraryDir;
|
String dataDir = app.nativeLibraryDir;
|
||||||
ClassLoader loader = context.getClassLoader ();
|
ClassLoader loader = context.getClassLoader ();
|
||||||
|
java.io.File external0 = android.os.Environment.getExternalStorageDirectory ();
|
||||||
|
String externalDir = new java.io.File (
|
||||||
|
external0,
|
||||||
|
"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath ();
|
||||||
|
String externalLegacyDir = new java.io.File (
|
||||||
|
external0,
|
||||||
|
"../legacy/Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath ();
|
||||||
|
|
||||||
|
|
||||||
mono.android.Runtime.init (
|
mono.android.Runtime.init (
|
||||||
language,
|
language,
|
||||||
|
@ -44,9 +52,10 @@ public class AndroidImpl extends DesktopImpl {
|
||||||
dataDir,
|
dataDir,
|
||||||
},
|
},
|
||||||
loader,
|
loader,
|
||||||
new java.io.File (
|
new String[] {
|
||||||
android.os.Environment.getExternalStorageDirectory (),
|
externalDir,
|
||||||
"Android/data/" + context.getPackageName () + "/files/.__override__").getAbsolutePath (),
|
externalLegacyDir
|
||||||
|
},
|
||||||
new String[] {
|
new String[] {
|
||||||
library + ".dll",
|
library + ".dll",
|
||||||
"Resource.designer.dll"
|
"Resource.designer.dll"
|
||||||
|
|
Загрузка…
Ссылка в новой задаче