зеркало из https://github.com/xamarin/AndroidX.git
Merge branch 'mu-20220518-installreferrer' of https://github.com/xamarin/AndroidX into mu-20220518-installreferrer
This commit is contained in:
Коммит
3dccc65103
|
@ -69,9 +69,10 @@ jobs:
|
|||
boots --url $(LegacyXamarinAndroidVsix) --downgrade-first
|
||||
condition: eq(variables['System.JobName'], 'windows')
|
||||
|
||||
postBuildSteps:
|
||||
postDiffBuildSteps:
|
||||
- pwsh: |
|
||||
dotnet cake utilities.cake -t=verify-namespace-file
|
||||
displayName: Verify published namespaces
|
||||
tools:
|
||||
- 'xamarin.androidbinderator.tool': '$(AndroidBinderatorVersion)'
|
||||
- 'xamarin.androidx.migration.tool': '$(AndroidXMigrationVersion)'
|
||||
|
|
526
build.cake
526
build.cake
|
@ -32,9 +32,6 @@ var VERBOSITY = Argument ("v", Argument ("verbosity", Verbosity.Normal));
|
|||
|
||||
var REF_DOCS_URL = "https://bosstoragemirror.blob.core.windows.net/android-docs-scraper/a7/a712886a8b4ee709f32d51823223039883d38734/androidx.zip";
|
||||
|
||||
// In order to create the type mapping, we need to get the AndroidSupport.Merged.dll
|
||||
var SUPPORT_MERGED_DLL_URL = EnvironmentVariable("SUPPORT_MERGED_DLL_URL") ?? $"https://github.com/xamarin/AndroidSupportComponents/releases/download/28.0.0.3/AndroidSupport.Merged.dll";
|
||||
|
||||
var JAVA_INTEROP_ZIP_URL = "https://github.com/xamarin/java.interop/archive/d17-2.zip";
|
||||
|
||||
var SUPPORT_CONFIG_URL = "https://raw.githubusercontent.com/xamarin/AndroidSupportComponents/master/config.json";
|
||||
|
@ -68,8 +65,7 @@ var BUILD_NUMBER = EnvironmentVariable("BUILD_NUMBER") ?? "DEBUG";
|
|||
var BUILD_TIMESTAMP = DateTime.UtcNow.ToString();
|
||||
|
||||
var REQUIRED_DOTNET_TOOLS = new [] {
|
||||
"xamarin-android-binderator",
|
||||
"xamarin.androidx.migration.tool"
|
||||
"xamarin-android-binderator"
|
||||
};
|
||||
|
||||
string JAVA_HOME = EnvironmentVariable ("JAVA_HOME") ?? Argument ("java_home", "");
|
||||
|
@ -232,16 +228,12 @@ Task("tools-update")
|
|||
dotnet tool install -g Cake.Tool
|
||||
dotnet tool uninstall -g xamarin.androidbinderator.tool
|
||||
dotnet tool install -g xamarin.androidbinderator.tool
|
||||
dotnet tool uninstall -g xamarin.androidx.migration.tool
|
||||
dotnet tool install -g xamarin.androidx.migration.tool
|
||||
|
||||
StartProcess("dotnet", "tool uninstall -g Cake.Tool");
|
||||
StartProcess("dotnet", "tool install -g Cake.Tool");
|
||||
*/
|
||||
StartProcess("dotnet", "tool uninstall -g xamarin.androidbinderator.tool");
|
||||
StartProcess("dotnet", "tool install -g xamarin.androidbinderator.tool");
|
||||
StartProcess("dotnet", "tool uninstall -g xamarin.androidx.migration.tool");
|
||||
StartProcess("dotnet", "tool install -g xamarin.androidx.migration.tool");
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -725,7 +717,6 @@ Task("samples-generate-all-targets")
|
|||
Task("samples")
|
||||
.IsDependentOn("nuget")
|
||||
.IsDependentOn("samples-generate-all-targets")
|
||||
.IsDependentOn("migration-nuget")
|
||||
.Does(() =>
|
||||
{
|
||||
// clear the packages folder so we always use the latest
|
||||
|
@ -753,470 +744,11 @@ Task("samples")
|
|||
MSBuild("./samples/BuildAll/BuildAll.sln", settings);
|
||||
});
|
||||
|
||||
// Migration Preparation
|
||||
|
||||
Task("generate-mapping")
|
||||
.IsDependentOn("merge")
|
||||
.IsDependentOn("nuget")
|
||||
.Does(() =>
|
||||
{
|
||||
EnsureDirectoryExists("./output/mappings/");
|
||||
|
||||
// download the AndroidSupport.Merged.dll from a past build
|
||||
if (!FileExists("./output/AndroidSupport.Merged.dll"))
|
||||
DownloadFile(SUPPORT_MERGED_DLL_URL, "./output/AndroidSupport.Merged.dll");
|
||||
|
||||
// copy the overrides
|
||||
CopyFileToDirectory("./mappings/override-mapping.csv", "./output/mappings/");
|
||||
|
||||
// generate the mapping
|
||||
Information("Generating the androidx-mapping.csv file...");
|
||||
RunProcess("androidx-migrator",
|
||||
$"generate -v " +
|
||||
$" --support ./output/AndroidSupport.Merged.dll" +
|
||||
$" --androidx ./output/AndroidX.Merged.dll" +
|
||||
$" --output ./output/mappings/androidx-mapping.csv");
|
||||
var mappingLines = FileReadLines("./output/mappings/androidx-mapping.csv");
|
||||
mappingLines = mappingLines.Where(l => !l.Contains("InjectedAssemblyNameAttribute")).ToArray();
|
||||
FileWriteLines("./output/mappings/androidx-mapping.csv", mappingLines);
|
||||
CopyFileToDirectory("./output/mappings/androidx-mapping.csv", "./mappings/");
|
||||
|
||||
// generate the dependency tree
|
||||
Information("Generating the dependencies.json file...");
|
||||
RunProcess("androidx-migrator",
|
||||
$"deptree -v " +
|
||||
$" --directory ./output/" +
|
||||
$" --output ./output/mappings/dependencies.json");
|
||||
using (var jsonReader = System.IO.File.OpenText("./output/mappings/dependencies.json")) {
|
||||
var o = (JObject)JToken.ReadFrom(new JsonTextReader(jsonReader));
|
||||
// special case for the fact that we can't actually read the real nuget package yet
|
||||
foreach (var p in o["packages"]) {
|
||||
if (p["id"].Value<string>() == "Xamarin.AndroidX.Migration") {
|
||||
p["dependencies"] = new JArray(new [] {
|
||||
"Xamarin.AndroidX.MultiDex"
|
||||
});
|
||||
}
|
||||
}
|
||||
var j = o.ToString();
|
||||
jsonReader.Dispose();
|
||||
FileWriteText("./output/mappings/dependencies.json", j);
|
||||
}
|
||||
CopyFileToDirectory("./output/mappings/dependencies.json", "./mappings/");
|
||||
|
||||
Information("generate the nuget mappings");
|
||||
Information("Generating the androidx-assemblies.csv file...");
|
||||
var support = "./externals/android.support";
|
||||
var supportJson = support + "/config.json";
|
||||
EnsureDirectoryExists(support);
|
||||
if (!FileExists(supportJson))
|
||||
DownloadFile(SUPPORT_CONFIG_URL, supportJson);
|
||||
|
||||
Information("read the newly generated mapping file");
|
||||
var csvReader = new StreamReader("./mappings/androidx-mapping.csv");
|
||||
var csv = new CsvReader(csvReader, System.Globalization.CultureInfo.CurrentCulture);
|
||||
|
||||
Information("csv.GetRecords<dynamic>()");
|
||||
var records = csv.GetRecords<dynamic>()
|
||||
.Cast<IDictionary<string, object>>()
|
||||
.Select(r => $"{r["Support .NET assembly"]}|{r["AndroidX .NET assembly"]}")
|
||||
.Union(new [] {
|
||||
"Xamarin.Android.Support.v4|Xamarin.AndroidX.Legacy.Support.V4",
|
||||
"Xamarin.Android.Support.MultiDex|Xamarin.AndroidX.MultiDex",
|
||||
})
|
||||
.Distinct()
|
||||
.Select(r => new {
|
||||
Support = r.Split("|")[0],
|
||||
AndroidX = r.Split("|")[1],
|
||||
})
|
||||
.Where(r => !string.IsNullOrEmpty(r.Support))
|
||||
.OrderBy(r => r.AndroidX)
|
||||
.OrderBy(r => r.Support)
|
||||
.ToArray();
|
||||
|
||||
var lines = new List<string> {
|
||||
"Support .NET assembly," +
|
||||
"AndroidX .NET assembly," +
|
||||
"Support NuGet," +
|
||||
"AndroidX NuGet," +
|
||||
"AndroidX NuGet Version",
|
||||
};
|
||||
|
||||
Information("iterate records");
|
||||
foreach (var record in records) {
|
||||
Information($"record.Support = {record.Support}");
|
||||
Information($"record.AndroidX = {record.AndroidX}");
|
||||
var androidxNuget = GetNuGetId(record.AndroidX);
|
||||
Information($"record.androidxNuget = {androidxNuget}");
|
||||
lines.Add(
|
||||
record.Support + "," +
|
||||
record.AndroidX + "," +
|
||||
GetNuGetId(record.Support, supportJson) + "," +
|
||||
androidxNuget + "," +
|
||||
GetNuGetVersion(androidxNuget));
|
||||
}
|
||||
FileWriteLines("./output/mappings/androidx-assemblies.csv", lines.ToArray());
|
||||
CopyFileToDirectory("./output/mappings/androidx-assemblies.csv", "./mappings/");
|
||||
|
||||
Information("update the props");
|
||||
Information("Generating the Xamarin.AndroidX.Migration.props file...");
|
||||
var propsPath = "./source/migration/BuildTasks/Xamarin.AndroidX.Migration.props";
|
||||
var xprops = XDocument.Load(propsPath);
|
||||
var xmlns = xprops.Root.Name.Namespace;
|
||||
var xitems = xprops.Descendants(xmlns + "_AndroidXSupportAssembly");
|
||||
var xparent = xitems.FirstOrDefault().Parent;
|
||||
xitems.Remove();
|
||||
xparent.Add(records.OrderBy(r => r.Support).Select(r => r.Support).Distinct().Select(r =>
|
||||
new XElement(xmlns + "_AndroidXSupportAssembly",
|
||||
new XAttribute("Include", r))));
|
||||
xitems = xprops.Descendants(xmlns + "_AndroidXAssembly");
|
||||
xparent = xitems.FirstOrDefault().Parent;
|
||||
xitems.Remove();
|
||||
xparent.Add(records.OrderBy(r => r.AndroidX).Select(r => r.AndroidX).Distinct().Select(r =>
|
||||
new XElement(xmlns + "_AndroidXAssembly",
|
||||
new XAttribute("Include", r))));
|
||||
xitems = xprops.Descendants(xmlns + "_AndroidXMavenArtifact");
|
||||
xparent = xitems.FirstOrDefault().Parent;
|
||||
xitems.Remove();
|
||||
xparent.Add(GetArtifacts().OrderBy(r => r).Select(r => r).Distinct().Select(r =>
|
||||
new XElement(xmlns + "_AndroidXMavenArtifact",
|
||||
new XAttribute("Include", r))));
|
||||
var xmlSettings = new XmlWriterSettings {
|
||||
Encoding = new UTF8Encoding(),
|
||||
Indent = true,
|
||||
IndentChars = " ",
|
||||
NewLineChars = "\n",
|
||||
};
|
||||
using (var xmlWriter = XmlWriter.Create(propsPath, xmlSettings)) {
|
||||
xprops.Save(xmlWriter);
|
||||
}
|
||||
FileAppendText(propsPath, "\n");
|
||||
CopyFileToDirectory(propsPath, "./output/mappings/");
|
||||
});
|
||||
|
||||
Task ("merge")
|
||||
.IsDependentOn ("libs")
|
||||
.Does (() =>
|
||||
{
|
||||
// find all the dlls
|
||||
var allDlls = GetFiles($"./generated/*/bin/Release/monoandroid*/Xamarin.*.dll");
|
||||
var mergeDlls = allDlls
|
||||
.GroupBy(d => d.GetFilename().FullPath)
|
||||
.Where
|
||||
(
|
||||
g =>
|
||||
! g.Key.Contains("Xamarin.AndroidX.Migration")
|
||||
&&
|
||||
! g.Key.Contains("Xamarin.Google.Guava")
|
||||
&&
|
||||
! g.Key.Contains("Xamarin.Kotlin")
|
||||
&&
|
||||
! g.Key.Contains("Xamarin.KotlinX")
|
||||
&&
|
||||
! g.Key.Contains("Xamarin.Jetbrains")
|
||||
&&
|
||||
! g.Key.Contains("Xamarin.Android.ReactiveStreams")
|
||||
&&
|
||||
! g.Key.Contains("Xamarin.Android.ReactiveX")
|
||||
&&
|
||||
! g.Key.Contains("Xamarin.Google.AutoValue")
|
||||
&&
|
||||
! g.Key.Contains("Xamarin.Google.Android.Installreferrer")
|
||||
)
|
||||
.Select(g => g.FirstOrDefault())
|
||||
.ToList();
|
||||
|
||||
string merged_dlls = string.Join(System.Environment.NewLine, mergeDlls);
|
||||
Information($"---------------------------------------------------------------------------");
|
||||
Information($"Merged Assemblies (dlls):");
|
||||
Information($"{merged_dlls}");
|
||||
Information($"---------------------------------------------------------------------------");
|
||||
System.IO.File.WriteAllText("./output/merged-assemblies-dlls.csv", merged_dlls);
|
||||
|
||||
// merge them all
|
||||
EnsureDirectoryExists("./output/");
|
||||
RunProcess("androidx-migrator",
|
||||
$"merge" +
|
||||
" --verbose" +
|
||||
$" --assembly " + string.Join(" --assembly ", mergeDlls) +
|
||||
$" --output ./output/AndroidX.Merged.dll" +
|
||||
$" --search \"{XAMARIN_ANDROID_PATH}/{ANDROID_SDK_VERSION}\" " +
|
||||
$" --search \"{XAMARIN_ANDROID_PATH}/{ANDROID_SDK_BASE_VERSION}\" " +
|
||||
$" --inject-assemblyname");
|
||||
});
|
||||
|
||||
// Migration External Assets
|
||||
|
||||
Task("jetifier-wrapper")
|
||||
.Does(() =>
|
||||
{
|
||||
var root = "./source/migration/JetifierWrapper/";
|
||||
|
||||
RunGradle(root, "jar");
|
||||
|
||||
var outputDir = MakeAbsolute((DirectoryPath)"./output/JetifierWrapper");
|
||||
EnsureDirectoryExists(outputDir);
|
||||
|
||||
CopyFileToDirectory($"{root}build/libs/jetifierWrapper-1.0.jar", outputDir);
|
||||
});
|
||||
|
||||
// Migration
|
||||
|
||||
Task("migration-externals")
|
||||
.Does(() =>
|
||||
{
|
||||
var interop = "./externals/java.interop";
|
||||
|
||||
EnsureDirectoryExists(interop);
|
||||
if (!FileExists(interop + "/source.zip")) {
|
||||
DownloadFile(JAVA_INTEROP_ZIP_URL, interop + "/source.zip");
|
||||
Unzip(interop + "/source.zip", interop);
|
||||
MoveDirectory(interop + "/java.interop-" + System.IO.Path.GetFileNameWithoutExtension(JAVA_INTEROP_ZIP_URL), interop + "/java.interop");
|
||||
}
|
||||
});
|
||||
|
||||
Task("migration-libs")
|
||||
.IsDependentOn("jetifier-wrapper")
|
||||
.IsDependentOn("generate-mapping")
|
||||
.IsDependentOn("migration-externals")
|
||||
.Does(() =>
|
||||
{
|
||||
var settings = new MSBuildSettings()
|
||||
.SetConfiguration(CONFIGURATION)
|
||||
.SetVerbosity(VERBOSITY)
|
||||
.SetMaxCpuCount(0)
|
||||
.EnableBinaryLogger($"./output/migration-libs.{CONFIGURATION}.binlog")
|
||||
.WithRestore()
|
||||
.WithProperty("PackageVersion", MIGRATION_PACKAGE_VERSION);
|
||||
|
||||
if (!string.IsNullOrEmpty(ANDROID_HOME))
|
||||
settings.WithProperty("AndroidSdkDirectory", $"{ANDROID_HOME}");
|
||||
|
||||
if (!string.IsNullOrEmpty(MSBUILD_PATH))
|
||||
settings.ToolPath = MSBUILD_PATH;
|
||||
|
||||
MSBuild("./source/migration/Xamarin.AndroidX.Migration.sln", settings);
|
||||
});
|
||||
|
||||
Task("migration-nuget")
|
||||
.IsDependentOn("migration-libs")
|
||||
.Does(() =>
|
||||
{
|
||||
var settings = new MSBuildSettings()
|
||||
.SetConfiguration(CONFIGURATION)
|
||||
.SetVerbosity(VERBOSITY)
|
||||
.SetMaxCpuCount(0)
|
||||
.EnableBinaryLogger($"./output/migration-nuget.{CONFIGURATION}.binlog")
|
||||
.WithProperty("NoBuild", "true")
|
||||
.WithRestore()
|
||||
.WithProperty("PackageVersion", MIGRATION_PACKAGE_VERSION)
|
||||
.WithProperty("MultiDexVersion", MULTIDEX_PACKAGE_VERSION)
|
||||
.WithProperty("PackageRequireLicenseAcceptance", "true")
|
||||
.WithProperty("PackageOutputPath", MakeAbsolute((DirectoryPath)"./output/").FullPath)
|
||||
.WithTarget("Pack");
|
||||
|
||||
if (!string.IsNullOrEmpty(ANDROID_HOME))
|
||||
settings.WithProperty("AndroidSdkDirectory", $"{ANDROID_HOME}");
|
||||
|
||||
if (!string.IsNullOrEmpty(MSBUILD_PATH))
|
||||
settings.ToolPath = MSBUILD_PATH;
|
||||
|
||||
MSBuild("./source/migration/BuildTasks/Xamarin.AndroidX.Migration.BuildTasks.csproj", settings);
|
||||
|
||||
settings.EnableBinaryLogger($"./output/migration-tool-nuget.{CONFIGURATION}.binlog");
|
||||
|
||||
MSBuild("./source/migration/Tool/Xamarin.AndroidX.Migration.Tool.csproj", settings);
|
||||
});
|
||||
|
||||
// Migration Tests
|
||||
|
||||
Task("migration-tests-externals")
|
||||
.Does(() =>
|
||||
{
|
||||
// download the facebook sdk to test with
|
||||
//{
|
||||
// var sdkRoot = "./externals/test-assets/facebook-sdk/";
|
||||
// var facebookFilename = "facebook-android-sdk";
|
||||
// var facebookVersion = "4.40.0";
|
||||
// var facebookFullName = $"{facebookFilename}-{facebookVersion}";
|
||||
// var facebookTestUrl = $"https://origincache.facebook.com/developers/resources/?id={facebookFullName}.zip";
|
||||
// var zipName = $"{sdkRoot}{facebookFilename}.zip";
|
||||
// EnsureDirectoryExists(sdkRoot);
|
||||
// if (!FileExists(zipName)) {
|
||||
// DownloadFile(facebookTestUrl, zipName);
|
||||
// Unzip(zipName, sdkRoot);
|
||||
// }
|
||||
//}
|
||||
|
||||
// downlaod some dodgy dlls
|
||||
{
|
||||
var sdkRoot = "./externals/test-assets/active-directory/";
|
||||
var adUrl = "https://www.nuget.org/api/v2/package/Microsoft.IdentityModel.Clients.ActiveDirectory/5.2.4";
|
||||
var zipName = $"{sdkRoot}/ad.zip";
|
||||
EnsureDirectoryExists(sdkRoot);
|
||||
if (!FileExists(zipName)) {
|
||||
DownloadFile(adUrl, zipName);
|
||||
Unzip(zipName, sdkRoot);
|
||||
}
|
||||
}
|
||||
|
||||
// build the special test projects
|
||||
{
|
||||
var nativeProjects = new [] {
|
||||
"./tests/AndroidXMigrationTests/Aarxersise.Java.AndroidX/",
|
||||
"./tests/AndroidXMigrationTests/Aarxersise.Java.Support/",
|
||||
};
|
||||
foreach (var native in nativeProjects) {
|
||||
RunGradle (native, "assembleDebug");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Task("migration-tests")
|
||||
.IsDependentOn("migration-tests-externals")
|
||||
.IsDependentOn("migration-libs")
|
||||
.Does(() =>
|
||||
{
|
||||
// build
|
||||
var settings = new MSBuildSettings()
|
||||
.SetConfiguration(CONFIGURATION)
|
||||
.SetVerbosity(VERBOSITY)
|
||||
.SetMaxCpuCount(0)
|
||||
.EnableBinaryLogger($"./output/migration-tests.{CONFIGURATION}.binlog")
|
||||
.WithRestore();
|
||||
|
||||
if (!string.IsNullOrEmpty(ANDROID_HOME))
|
||||
settings.WithProperty("AndroidSdkDirectory", $"{ANDROID_HOME}");
|
||||
|
||||
if (!string.IsNullOrEmpty(MSBUILD_PATH))
|
||||
settings.ToolPath = MSBUILD_PATH;
|
||||
|
||||
MSBuild("./tests/AndroidXMigrationTests.sln", settings);
|
||||
|
||||
// test
|
||||
DotNetTest("Xamarin.AndroidX.Migration.Tests.csproj", new DotNetTestSettings {
|
||||
Configuration = CONFIGURATION,
|
||||
NoBuild = true,
|
||||
Logger = "trx;LogFileName=Xamarin.AndroidX.Migration.Tests.trx",
|
||||
WorkingDirectory = "./tests/AndroidXMigrationTests/Tests/",
|
||||
ResultsDirectory = "./output/test-results/",
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var TF_MONIKER = "monoandroid120";
|
||||
string SUPPORT_MERGED_DLL = "./output/AndroidSupport.Merged.dll";
|
||||
string ANDROIDX_MERGED_DLL = "./output/AndroidX.Merged.dll";
|
||||
string MAPPING_URL = "https://raw.githubusercontent.com/xamarin/AndroidX/master/mappings/androidx-mapping.csv";
|
||||
string MAPPING_LOCAL = "./output/androidx-mapping.csv";
|
||||
string API_INFO_OLD = "./output/AndroidSupport.Merged.api-info.xml";
|
||||
string API_INFO_OLD_MIGRATED = "./output/AndroidSupport.Merged.Migrated.api-info.xml";
|
||||
string API_INFO_NEW = "./output/AndroidX.Merged.api-info.xml";
|
||||
|
||||
|
||||
var MONODROID_BASE_PATH = (DirectoryPath)"/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xbuild-frameworks/MonoAndroid/";
|
||||
if (IsRunningOnWindows ()) {
|
||||
var vsInstallPath = VSWhereLatest (new VSWhereLatestSettings { Requires = "Component.Xamarin", IncludePrerelease = true });
|
||||
MONODROID_BASE_PATH = vsInstallPath.Combine ("Common7/IDE/ReferenceAssemblies/Microsoft/Framework/MonoAndroid/");
|
||||
}
|
||||
var MONODROID_PATH = MONODROID_BASE_PATH.Combine(ANDROID_SDK_VERSION);
|
||||
|
||||
|
||||
Task("api-info-migrate")
|
||||
.Does
|
||||
(
|
||||
() =>
|
||||
{
|
||||
EnsureDirectoryExists ("./output/");
|
||||
|
||||
DownloadFile (SUPPORT_MERGED_DLL_URL, SUPPORT_MERGED_DLL);
|
||||
|
||||
var result1 = StartProcess($"api-tools", $"api-info {SUPPORT_MERGED_DLL}");
|
||||
if (result1 != 0)
|
||||
throw new Exception($"The androidxmapper failed with error code {result1}.");
|
||||
|
||||
|
||||
DownloadFile (MAPPING_URL, MAPPING_LOCAL);
|
||||
string[] lines_mapping_local = FileReadLines(MAPPING_LOCAL);
|
||||
List<(string, string)> mapping = new List<(string, string)>();
|
||||
lines_mapping_local.ToList()
|
||||
.ForEach( x => { var r = x.Split(new char[] {','}); mapping.Add( (r[0], r[2]) ); } );
|
||||
mapping.GroupBy(g => new Tuple<string, string>(g.Item1, g.Item2))
|
||||
.Select(g => g.First())
|
||||
.ToList()
|
||||
.ForEach( x => { Console.WriteLine(x); } );
|
||||
|
||||
|
||||
string[] lines_api_info = FileReadLines(API_INFO_OLD);
|
||||
// lines_api_info.ToList()
|
||||
// .ForEach( x => { Console.WriteLine(x); } );
|
||||
List<string> lines_api_info_migrated = new List<string>();
|
||||
foreach(string l in lines_api_info)
|
||||
{
|
||||
string line_new = null;
|
||||
|
||||
foreach((string, string) m in mapping)
|
||||
{
|
||||
if (string.IsNullOrEmpty(m.Item1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if( l.Contains(m.Item1) )
|
||||
{
|
||||
line_new = l.Replace(m.Item1, m.Item2);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
line_new = l;
|
||||
}
|
||||
}
|
||||
lines_api_info_migrated.Add(line_new);
|
||||
}
|
||||
|
||||
FileWriteLines(API_INFO_OLD_MIGRATED, lines_api_info_migrated.ToArray());
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Task("merge-fresh")
|
||||
.Does
|
||||
(
|
||||
() =>
|
||||
{
|
||||
var allDlls = GetFiles ($"./generated/*/bin/Release/{TF_MONIKER}/Xamarin.AndroidX.*.dll");
|
||||
var mergeDlls = allDlls
|
||||
.GroupBy(d => new FileInfo(d.FullPath).Name)
|
||||
.Select(g => g.FirstOrDefault())
|
||||
.ToList();
|
||||
mergeDlls.ForEach( x => { Console.WriteLine(x); });
|
||||
var result2 = StartProcess
|
||||
(
|
||||
"api-tools",
|
||||
"merge -n Xamarin.AndroidX.Merged" +
|
||||
$" {string.Join(" ", mergeDlls)} " +
|
||||
$" -s /Library/Frameworks/Xamarin.Android.framework/Versions/9.1.0-17/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v9.0/" +
|
||||
$" -s /Library/Frameworks/Xamarin.Android.framework/Versions/10.1.0.29/lib/xamarin.android/xbuild-frameworks/MonoAndroid/v1.0/" +
|
||||
$" -o " + MakeAbsolute((FilePath)"./output/AndroidX.Merged.dll") +
|
||||
$" --inject-assemblyname"
|
||||
);
|
||||
var result1 = StartProcess($"api-tools", $"api-info {ANDROIDX_MERGED_DLL}");
|
||||
if (result1 != 0)
|
||||
throw new Exception($"The androidxmapper failed with error code {result1}.");
|
||||
|
||||
return;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Task("api-diff")
|
||||
.IsDependentOn ("merge")
|
||||
.IsDependentOn ("api-info-migrate")
|
||||
.IsDependentOn ("merge-fresh")
|
||||
.IsDependentOn ("bindings-verify")
|
||||
.Does
|
||||
(
|
||||
() =>
|
||||
{
|
||||
{ /*
|
||||
// https://github.com/Redth/Cake.MonoApiTools/
|
||||
MonoApiDiff(API_INFO_OLD_MIGRATED, API_INFO_NEW, "./output/api-info-diff.xml");
|
||||
string[] lines_xml = FileReadLines("./output/api-info-diff.xml");
|
||||
|
@ -1311,12 +843,18 @@ Task("api-diff")
|
|||
FileWriteLines("./output/moved-types.final.csv", moved_types.ToArray());
|
||||
|
||||
return;
|
||||
*/
|
||||
}
|
||||
);
|
||||
|
||||
var MONODROID_BASE_PATH = (DirectoryPath)"/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xbuild-frameworks/MonoAndroid/";
|
||||
if (IsRunningOnWindows ()) {
|
||||
var vsInstallPath = VSWhereLatest (new VSWhereLatestSettings { Requires = "Component.Xamarin", IncludePrerelease = true });
|
||||
MONODROID_BASE_PATH = vsInstallPath.Combine ("Common7/IDE/ReferenceAssemblies/Microsoft/Framework/MonoAndroid/");
|
||||
}
|
||||
var MONODROID_PATH = MONODROID_BASE_PATH.Combine(ANDROID_SDK_VERSION);
|
||||
|
||||
Task ("diff")
|
||||
.IsDependentOn ("merge")
|
||||
.IsDependentOn ("bindings-verify")
|
||||
.Does (() =>
|
||||
{
|
||||
var SEARCH_DIRS = new DirectoryPath [] {
|
||||
|
@ -1339,40 +877,6 @@ Task ("diff")
|
|||
MonoApiMarkdown ("./output/api-info.previous.xml", "./output/api-info.xml", "./output/api-diff.md");
|
||||
});
|
||||
|
||||
|
||||
Task("bindings-verify")
|
||||
.Does
|
||||
(
|
||||
() =>
|
||||
{
|
||||
List<string> missing_java_type = new List<string>();
|
||||
List<string> missing_dotnet_type = new List<string>();
|
||||
List<string> missing_dotnet_override_type = new List<string>();
|
||||
|
||||
string[] lines = System.IO.File.ReadAllLines("./mappings/androidx-mapping.csv");
|
||||
foreach(string line in lines)
|
||||
{
|
||||
if (line.StartsWith(",,,,,,,,,,WARNING: Unable to find AndroidX type for Java type "))
|
||||
{
|
||||
missing_java_type.Add(line);
|
||||
}
|
||||
else if (line.StartsWith(",,,,,,,,,,WARNING: Unable to find AndroidX type for .NET type "))
|
||||
{
|
||||
missing_dotnet_type.Add(line);
|
||||
|
||||
}
|
||||
else if (line.StartsWith(",,,,,,,,,,WARNING: Unable to find override type for type "))
|
||||
{
|
||||
missing_dotnet_override_type.Add(line);
|
||||
}
|
||||
}
|
||||
|
||||
System.IO.File.WriteAllLines("./output/missing_java_type.csv", missing_java_type.ToArray());
|
||||
System.IO.File.WriteAllLines("./output/missing_dotnet_type.csv", missing_dotnet_type.ToArray());
|
||||
System.IO.File.WriteAllLines("./output/missing_dotnet_override_type.csv", missing_dotnet_override_type.ToArray());
|
||||
}
|
||||
);
|
||||
|
||||
Task ("clean")
|
||||
.Does (() =>
|
||||
{
|
||||
|
@ -1394,21 +898,11 @@ Task ("full-run")
|
|||
.IsDependentOn ("nuget")
|
||||
.IsDependentOn ("samples");
|
||||
|
||||
Task ("nuget-and-migration")
|
||||
.IsDependentOn ("nuget")
|
||||
.IsDependentOn ("generate-mapping")
|
||||
.IsDependentOn ("migration-nuget")
|
||||
.IsDependentOn ("migration-tests");
|
||||
|
||||
Task ("ci")
|
||||
.IsDependentOn ("check-tools")
|
||||
.IsDependentOn ("inject-variables")
|
||||
.IsDependentOn ("binderate")
|
||||
.IsDependentOn ("nuget")
|
||||
.IsDependentOn ("generate-mapping")
|
||||
.IsDependentOn ("migration-nuget")
|
||||
.IsDependentOn ("migration-tests")
|
||||
.IsDependentOn ("bindings-verify")
|
||||
.IsDependentOn ("samples");
|
||||
|
||||
// for local builds, conditionally do the first binderate
|
||||
|
|
423
config.json
423
config.json
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,104 +0,0 @@
|
|||
Old build artifact,AndroidX build artifact
|
||||
android.arch.core:common,androidx.arch.core:core-common
|
||||
android.arch.core:core,androidx.arch.core:core
|
||||
android.arch.core:core-testing,androidx.arch.core:core-testing
|
||||
android.arch.core:runtime,androidx.arch.core:core-runtime
|
||||
android.arch.lifecycle:common,androidx.lifecycle:lifecycle-common
|
||||
android.arch.lifecycle:common-java8,androidx.lifecycle:lifecycle-common-java8
|
||||
android.arch.lifecycle:compiler,androidx.lifecycle:lifecycle-compiler
|
||||
android.arch.lifecycle:extensions,androidx.lifecycle:lifecycle-extensions
|
||||
android.arch.lifecycle:livedata,androidx.lifecycle:lifecycle-livedata
|
||||
android.arch.lifecycle:livedata-core,androidx.lifecycle:lifecycle-livedata-core
|
||||
android.arch.lifecycle:reactivestreams,androidx.lifecycle:lifecycle-reactivestreams
|
||||
android.arch.lifecycle:runtime,androidx.lifecycle:lifecycle-runtime
|
||||
android.arch.lifecycle:viewmodel,androidx.lifecycle:lifecycle-viewmodel
|
||||
android.arch.paging:common,androidx.paging:paging-common
|
||||
android.arch.paging:runtime,androidx.paging:paging-runtime
|
||||
android.arch.paging:rxjava2,androidx.paging:paging-rxjava2
|
||||
android.arch.persistence.room:common,androidx.room:room-common
|
||||
android.arch.persistence.room:compiler,androidx.room:room-compiler
|
||||
android.arch.persistence.room:guava,androidx.room:room-guava
|
||||
android.arch.persistence.room:migration,androidx.room:room-migration
|
||||
android.arch.persistence.room:runtime,androidx.room:room-runtime
|
||||
android.arch.persistence.room:rxjava2,androidx.room:room-rxjava2
|
||||
android.arch.persistence.room:testing,androidx.room:room-testing
|
||||
android.arch.persistence:db,androidx.sqlite:sqlite
|
||||
android.arch.persistence:db-framework,androidx.sqlite:sqlite-framework
|
||||
com.android.support.constraint:constraint-layout,androidx.constraintlayout:constraintlayout
|
||||
com.android.support.constraint:constraint-layout-solver,androidx.constraintlayout:constraintlayout-solver
|
||||
com.android.support.test.espresso.idling:idling-concurrent,androidx.test.espresso.idling:idling-concurrent
|
||||
com.android.support.test.espresso.idling:idling-net,androidx.test.espresso.idling:idling-net
|
||||
com.android.support.test.espresso:espresso-accessibility,androidx.test.espresso:espresso-accessibility
|
||||
com.android.support.test.espresso:espresso-contrib,androidx.test.espresso:espresso-contrib
|
||||
com.android.support.test.espresso:espresso-core,androidx.test.espresso:espresso-core
|
||||
com.android.support.test.espresso:espresso-idling-resource,androidx.test.espresso:espresso-idling-resource
|
||||
com.android.support.test.espresso:espresso-intents,androidx.test.espresso:espresso-intents
|
||||
com.android.support.test.espresso:espresso-remote,androidx.test.espresso:espresso-remote
|
||||
com.android.support.test.espresso:espresso-web,androidx.test.espresso:espresso-web
|
||||
com.android.support.test.janktesthelper:janktesthelper,androidx.test.jank:janktesthelper
|
||||
com.android.support.test.services:test-services,androidx.test:test-services
|
||||
com.android.support.test.uiautomator:uiautomator,androidx.test.uiautomator:uiautomator
|
||||
com.android.support.test:monitor,androidx.test:monitor
|
||||
com.android.support.test:orchestrator,androidx.test:orchestrator
|
||||
com.android.support.test:rules,androidx.test:rules
|
||||
com.android.support.test:runner,androidx.test:runner
|
||||
com.android.support:animated-vector-drawable,androidx.vectordrawable:vectordrawable-animated
|
||||
com.android.support:appcompat-v7,androidx.appcompat:appcompat
|
||||
com.android.support:asynclayoutinflater,androidx.asynclayoutinflater:asynclayoutinflater
|
||||
com.android.support:car,androidx.car:car
|
||||
com.android.support:cardview-v7,androidx.cardview:cardview
|
||||
com.android.support:collections,androidx.collection:collection
|
||||
com.android.support:coordinatorlayout,androidx.coordinatorlayout:coordinatorlayout
|
||||
com.android.support:cursoradapter,androidx.cursoradapter:cursoradapter
|
||||
com.android.support:customtabs,androidx.browser:browser
|
||||
com.android.support:customview,androidx.customview:customview
|
||||
com.android.support:design,com.google.android.material:material
|
||||
com.android.support:documentfile,androidx.documentfile:documentfile
|
||||
com.android.support:drawerlayout,androidx.drawerlayout:drawerlayout
|
||||
com.android.support:exifinterface,androidx.exifinterface:exifinterface
|
||||
com.android.support:gridlayout-v7,androidx.gridlayout:gridlayout
|
||||
com.android.support:heifwriter,androidx.heifwriter:heifwriter
|
||||
com.android.support:interpolator,androidx.interpolator:interpolator
|
||||
com.android.support:leanback-v17,androidx.leanback:leanback
|
||||
com.android.support:loader,androidx.loader:loader
|
||||
com.android.support:localbroadcastmanager,androidx.localbroadcastmanager:localbroadcastmanager
|
||||
com.android.support:media2,androidx.media2:media2
|
||||
com.android.support:media2-exoplayer,androidx.media2:media2-exoplayer
|
||||
com.android.support:mediarouter-v7,androidx.mediarouter:mediarouter
|
||||
com.android.support:multidex,androidx.multidex:multidex
|
||||
com.android.support:multidex-instrumentation,androidx.multidex:multidex-instrumentation
|
||||
com.android.support:palette-v7,androidx.palette:palette
|
||||
com.android.support:percent,androidx.percentlayout:percentlayout
|
||||
com.android.support:preference-leanback-v17,androidx.leanback:leanback-preference
|
||||
com.android.support:preference-v14,androidx.legacy:legacy-preference-v14
|
||||
com.android.support:preference-v7,androidx.preference:preference
|
||||
com.android.support:print,androidx.print:print
|
||||
com.android.support:recommendation,androidx.recommendation:recommendation
|
||||
com.android.support:recyclerview-selection,androidx.recyclerview:recyclerview-selection
|
||||
com.android.support:recyclerview-v7,androidx.recyclerview:recyclerview
|
||||
com.android.support:slices-builders,androidx.slice:slice-builders
|
||||
com.android.support:slices-core,androidx.slice:slice-core
|
||||
com.android.support:slices-view,androidx.slice:slice-view
|
||||
com.android.support:slidingpanelayout,androidx.slidingpanelayout:slidingpanelayout
|
||||
com.android.support:support-annotations,androidx.annotation:annotation
|
||||
com.android.support:support-compat,androidx.core:core
|
||||
com.android.support:support-content,androidx.contentpager:contentpager
|
||||
com.android.support:support-core-ui,androidx.legacy:legacy-support-core-ui
|
||||
com.android.support:support-core-utils,androidx.legacy:legacy-support-core-utils
|
||||
com.android.support:support-dynamic-animation,androidx.dynamicanimation:dynamicanimation
|
||||
com.android.support:support-emoji,androidx.emoji:emoji
|
||||
com.android.support:support-emoji-appcompat,androidx.emoji:emoji-appcompat
|
||||
com.android.support:support-emoji-bundled,androidx.emoji:emoji-bundled
|
||||
com.android.support:support-fragment,androidx.fragment:fragment
|
||||
com.android.support:support-media-compat,androidx.media:media
|
||||
com.android.support:support-tv-provider,androidx.tvprovider:tvprovider
|
||||
com.android.support:support-v13,androidx.legacy:legacy-support-v13
|
||||
com.android.support:support-v4,androidx.legacy:legacy-support-v4
|
||||
com.android.support:support-vector-drawable,androidx.vectordrawable:vectordrawable
|
||||
com.android.support:swiperefreshlayout,androidx.swiperefreshlayout:swiperefreshlayout
|
||||
com.android.support:textclassifier,androidx.textclassifier:textclassifier
|
||||
com.android.support:transition,androidx.transition:transition
|
||||
com.android.support:versionedparcelable,androidx.versionedparcelable:versionedparcelable
|
||||
com.android.support:viewpager,androidx.viewpager:viewpager
|
||||
com.android.support:wear,androidx.wear:wear
|
||||
com.android.support:webkit,androidx.webkit:webkit
|
|
|
@ -1,78 +0,0 @@
|
|||
Support .NET assembly,AndroidX .NET assembly,Support NuGet,AndroidX NuGet,AndroidX NuGet Version
|
||||
Xamarin.Android.Arch.Core.Common,Xamarin.AndroidX.Arch.Core.Common,Xamarin.Android.Arch.Core.Common,Xamarin.AndroidX.Arch.Core.Common,2.1.0.14
|
||||
Xamarin.Android.Arch.Core.Runtime,Xamarin.AndroidX.Arch.Core.Runtime,Xamarin.Android.Arch.Core.Runtime,Xamarin.AndroidX.Arch.Core.Runtime,2.1.0.14
|
||||
Xamarin.Android.Arch.Lifecycle.Common,Xamarin.AndroidX.Lifecycle.Common,Xamarin.Android.Arch.Lifecycle.Common,Xamarin.AndroidX.Lifecycle.Common,2.4.1.1
|
||||
Xamarin.Android.Arch.Lifecycle.Extensions,Xamarin.AndroidX.Lifecycle.Extensions,Xamarin.Android.Arch.Lifecycle.Extensions,Xamarin.AndroidX.Lifecycle.Extensions,2.2.0.13
|
||||
Xamarin.Android.Arch.Lifecycle.Extensions,Xamarin.AndroidX.Lifecycle.Process,Xamarin.Android.Arch.Lifecycle.Extensions,Xamarin.AndroidX.Lifecycle.Process,2.4.1.1
|
||||
Xamarin.Android.Arch.Lifecycle.Extensions,Xamarin.AndroidX.Lifecycle.Service,Xamarin.Android.Arch.Lifecycle.Extensions,Xamarin.AndroidX.Lifecycle.Service,2.4.1.1
|
||||
Xamarin.Android.Arch.Lifecycle.LiveData,Xamarin.AndroidX.Lifecycle.LiveData,Xamarin.Android.Arch.Lifecycle.LiveData,Xamarin.AndroidX.Lifecycle.LiveData,2.4.1.1
|
||||
Xamarin.Android.Arch.Lifecycle.LiveData.Core,Xamarin.AndroidX.Lifecycle.LiveData.Core,Xamarin.Android.Arch.Lifecycle.LiveData.Core,Xamarin.AndroidX.Lifecycle.LiveData.Core,2.4.1.1
|
||||
Xamarin.Android.Arch.Lifecycle.Runtime,Xamarin.AndroidX.Lifecycle.Runtime,Xamarin.Android.Arch.Lifecycle.Runtime,Xamarin.AndroidX.Lifecycle.Runtime,2.4.1.1
|
||||
Xamarin.Android.Arch.Lifecycle.ViewModel,Xamarin.AndroidX.Lifecycle.ViewModel,Xamarin.Android.Arch.Lifecycle.ViewModel,Xamarin.AndroidX.Lifecycle.ViewModel,2.4.1.1
|
||||
Xamarin.Android.Arch.Persistence.Db,Xamarin.AndroidX.Sqlite,Xamarin.Android.Arch.Persistence.Db,Xamarin.AndroidX.Sqlite,2.2.0.1
|
||||
Xamarin.Android.Arch.Persistence.Db.Framework,Xamarin.AndroidX.Sqlite.Framework,Xamarin.Android.Arch.Persistence.Db.Framework,Xamarin.AndroidX.Sqlite.Framework,2.2.0.1
|
||||
Xamarin.Android.Arch.Persistence.Room.Common,Xamarin.AndroidX.Media2.Widget,Xamarin.Android.Arch.Persistence.Room.Common,Xamarin.AndroidX.Media2.Widget,1.2.1.1
|
||||
Xamarin.Android.Arch.Persistence.Room.Common,Xamarin.AndroidX.Room.Common,Xamarin.Android.Arch.Persistence.Room.Common,Xamarin.AndroidX.Room.Common,2.4.2.1
|
||||
Xamarin.Android.Arch.Persistence.Room.Runtime,Xamarin.AndroidX.Room.Runtime,Xamarin.Android.Arch.Persistence.Room.Runtime,Xamarin.AndroidX.Room.Runtime,2.4.2.1
|
||||
Xamarin.Android.Arch.Work.Runtime,Xamarin.AndroidX.Work.Runtime,Xamarin.Android.Arch.Work.Runtime,Xamarin.AndroidX.Work.Runtime,2.7.1.3
|
||||
Xamarin.Android.Support.Animated.Vector.Drawable,Xamarin.AndroidX.VectorDrawable.Animated,Xamarin.Android.Support.Animated.Vector.Drawable,Xamarin.AndroidX.VectorDrawable.Animated,1.1.0.13
|
||||
Xamarin.Android.Support.Annotations,Xamarin.AndroidX.Annotation,Xamarin.Android.Support.Annotations,Xamarin.AndroidX.Annotation,1.3.0.3
|
||||
Xamarin.Android.Support.Annotations,Xamarin.AndroidX.Media2.Widget,Xamarin.Android.Support.Annotations,Xamarin.AndroidX.Media2.Widget,1.2.1.1
|
||||
Xamarin.Android.Support.AsyncLayoutInflater,Xamarin.AndroidX.AsyncLayoutInflater,Xamarin.Android.Support.AsyncLayoutInflater,Xamarin.AndroidX.AsyncLayoutInflater,1.0.0.13
|
||||
Xamarin.Android.Support.Collections,Xamarin.AndroidX.Collection,Xamarin.Android.Support.Collections,Xamarin.AndroidX.Collection,1.2.0.3
|
||||
Xamarin.Android.Support.Compat,Xamarin.AndroidX.Core,Xamarin.Android.Support.Compat,Xamarin.AndroidX.Core,1.7.0.2
|
||||
Xamarin.Android.Support.Constraint.Layout,Xamarin.AndroidX.ConstraintLayout,Xamarin.Android.Support.Constraint.Layout,Xamarin.AndroidX.ConstraintLayout,2.1.3.1
|
||||
Xamarin.Android.Support.Constraint.Layout,Xamarin.AndroidX.DataBinding.DataBindingAdapters,Xamarin.Android.Support.Constraint.Layout,Xamarin.AndroidX.DataBinding.DataBindingAdapters,7.2.0
|
||||
Xamarin.Android.Support.Constraint.Layout,Xamarin.AndroidX.DataBinding.DataBindingRuntime,Xamarin.Android.Support.Constraint.Layout,Xamarin.AndroidX.DataBinding.DataBindingRuntime,7.2.0
|
||||
Xamarin.Android.Support.Constraint.Layout,Xamarin.AndroidX.DataBinding.ViewBinding,Xamarin.Android.Support.Constraint.Layout,Xamarin.AndroidX.DataBinding.ViewBinding,7.2.0
|
||||
Xamarin.Android.Support.Constraint.Layout.Solver,Xamarin.AndroidX.ConstraintLayout.Solver,Xamarin.Android.Support.Constraint.Layout.Solver,Xamarin.AndroidX.ConstraintLayout.Solver,2.0.4.8
|
||||
Xamarin.Android.Support.CoordinaterLayout,Xamarin.AndroidX.CoordinatorLayout,Xamarin.Android.Support.CoordinaterLayout,Xamarin.AndroidX.CoordinatorLayout,1.2.0.1
|
||||
Xamarin.Android.Support.Core.UI,Xamarin.AndroidX.Legacy.Support.Core.UI,Xamarin.Android.Support.Core.UI,Xamarin.AndroidX.Legacy.Support.Core.UI,1.0.0.14
|
||||
Xamarin.Android.Support.Core.Utils,Xamarin.AndroidX.Legacy.Support.Core.Utils,Xamarin.Android.Support.Core.Utils,Xamarin.AndroidX.Legacy.Support.Core.Utils,1.0.0.13
|
||||
Xamarin.Android.Support.CursorAdapter,Xamarin.AndroidX.CursorAdapter,Xamarin.Android.Support.CursorAdapter,Xamarin.AndroidX.CursorAdapter,1.0.0.13
|
||||
Xamarin.Android.Support.CustomTabs,Xamarin.AndroidX.Browser,Xamarin.Android.Support.CustomTabs,Xamarin.AndroidX.Browser,1.4.0.1
|
||||
Xamarin.Android.Support.CustomView,Xamarin.AndroidX.CustomView,Xamarin.Android.Support.CustomView,Xamarin.AndroidX.CustomView,1.1.0.12
|
||||
Xamarin.Android.Support.Design,Xamarin.AndroidX.Annotation.Experimental,Xamarin.Android.Support.Design,Xamarin.AndroidX.Annotation.Experimental,1.2.0.1
|
||||
Xamarin.Android.Support.Design,Xamarin.Google.Android.Material,Xamarin.Android.Support.Design,Xamarin.Google.Android.Material,1.6.0
|
||||
Xamarin.Android.Support.DocumentFile,Xamarin.AndroidX.DocumentFile,Xamarin.Android.Support.DocumentFile,Xamarin.AndroidX.DocumentFile,1.0.1.13
|
||||
Xamarin.Android.Support.DrawerLayout,Xamarin.AndroidX.DrawerLayout,Xamarin.Android.Support.DrawerLayout,Xamarin.AndroidX.DrawerLayout,1.1.1.8
|
||||
Xamarin.Android.Support.Dynamic.Animation,Xamarin.AndroidX.DynamicAnimation,Xamarin.Android.Support.Dynamic.Animation,Xamarin.AndroidX.DynamicAnimation,1.0.0.13
|
||||
Xamarin.Android.Support.Emoji,Xamarin.AndroidX.Emoji,Xamarin.Android.Support.Emoji,Xamarin.AndroidX.Emoji,1.1.0.8
|
||||
Xamarin.Android.Support.Emoji.AppCompat,Xamarin.AndroidX.Emoji.AppCompat,Xamarin.Android.Support.Emoji.AppCompat,Xamarin.AndroidX.Emoji.AppCompat,1.1.0.8
|
||||
Xamarin.Android.Support.Emoji.Bundled,Xamarin.AndroidX.Emoji.Bundled,Xamarin.Android.Support.Emoji.Bundled,Xamarin.AndroidX.Emoji.Bundled,1.1.0.8
|
||||
Xamarin.Android.Support.Exif,Xamarin.AndroidX.ExifInterface,Xamarin.Android.Support.Exif,Xamarin.AndroidX.ExifInterface,1.3.3.5
|
||||
Xamarin.Android.Support.Fragment,Xamarin.AndroidX.Fragment,Xamarin.Android.Support.Fragment,Xamarin.AndroidX.Fragment,1.4.1.1
|
||||
Xamarin.Android.Support.HeifWriter,Xamarin.AndroidX.HeifWriter,Xamarin.Android.Support.HeifWriter,Xamarin.AndroidX.HeifWriter,1.0.0.13
|
||||
Xamarin.Android.Support.Interpolator,Xamarin.AndroidX.Interpolator,Xamarin.Android.Support.Interpolator,Xamarin.AndroidX.Interpolator,1.0.0.13
|
||||
Xamarin.Android.Support.Loader,Xamarin.AndroidX.Loader,Xamarin.Android.Support.Loader,Xamarin.AndroidX.Loader,1.1.0.13
|
||||
Xamarin.Android.Support.LocalBroadcastManager,Xamarin.AndroidX.LocalBroadcastManager,Xamarin.Android.Support.LocalBroadcastManager,Xamarin.AndroidX.LocalBroadcastManager,1.1.0.1
|
||||
Xamarin.Android.Support.Media.Compat,Xamarin.AndroidX.Media,Xamarin.Android.Support.Media.Compat,Xamarin.AndroidX.Media,1.6.0
|
||||
Xamarin.Android.Support.MultiDex,Xamarin.AndroidX.MultiDex,Xamarin.Android.Support.MultiDex,Xamarin.AndroidX.MultiDex,2.0.1.13
|
||||
Xamarin.Android.Support.Percent,Xamarin.AndroidX.PercentLayout,Xamarin.Android.Support.Percent,Xamarin.AndroidX.PercentLayout,1.0.0.14
|
||||
Xamarin.Android.Support.Print,Xamarin.AndroidX.Print,Xamarin.Android.Support.Print,Xamarin.AndroidX.Print,1.0.0.13
|
||||
Xamarin.Android.Support.Recommendation,Xamarin.AndroidX.Recommendation,Xamarin.Android.Support.Recommendation,Xamarin.AndroidX.Recommendation,1.0.0.13
|
||||
Xamarin.Android.Support.RecyclerView.Selection,Xamarin.AndroidX.RecyclerView.Selection,Xamarin.Android.Support.RecyclerView.Selection,Xamarin.AndroidX.RecyclerView.Selection,1.1.0.7
|
||||
Xamarin.Android.Support.Slices.Builders,Xamarin.AndroidX.Slice.Builders,Xamarin.Android.Support.Slices.Builders,Xamarin.AndroidX.Slice.Builders,1.0.0.13
|
||||
Xamarin.Android.Support.Slices.Core,Xamarin.AndroidX.Slice.Core,Xamarin.Android.Support.Slices.Core,Xamarin.AndroidX.Slice.Core,1.0.0.13
|
||||
Xamarin.Android.Support.Slices.View,Xamarin.AndroidX.Slice.View,Xamarin.Android.Support.Slices.View,Xamarin.AndroidX.Slice.View,1.0.0.13
|
||||
Xamarin.Android.Support.SlidingPaneLayout,Xamarin.AndroidX.SlidingPaneLayout,Xamarin.Android.Support.SlidingPaneLayout,Xamarin.AndroidX.SlidingPaneLayout,1.2.0.1
|
||||
Xamarin.Android.Support.SwipeRefreshLayout,Xamarin.AndroidX.SwipeRefreshLayout,Xamarin.Android.Support.SwipeRefreshLayout,Xamarin.AndroidX.SwipeRefreshLayout,1.1.0.8
|
||||
Xamarin.Android.Support.Transition,Xamarin.AndroidX.Transition,Xamarin.Android.Support.Transition,Xamarin.AndroidX.Transition,1.4.1.6
|
||||
Xamarin.Android.Support.TV.Provider,Xamarin.AndroidX.TvProvider,Xamarin.Android.Support.TV.Provider,Xamarin.AndroidX.TvProvider,1.0.0.15
|
||||
Xamarin.Android.Support.v13,Xamarin.AndroidX.Legacy.Support.V13,Xamarin.Android.Support.v13,Xamarin.AndroidX.Legacy.Support.V13,1.0.0.13
|
||||
Xamarin.Android.Support.v17.Leanback,Xamarin.AndroidX.Leanback,Xamarin.Android.Support.v17.Leanback,Xamarin.AndroidX.Leanback,1.0.0.15
|
||||
Xamarin.Android.Support.v17.Preference.Leanback,Xamarin.AndroidX.Leanback.Preference,Xamarin.Android.Support.v17.Preference.Leanback,Xamarin.AndroidX.Leanback.Preference,1.0.0.13
|
||||
Xamarin.Android.Support.v4,Xamarin.AndroidX.Legacy.Support.V4,Xamarin.Android.Support.v4,Xamarin.AndroidX.Legacy.Support.V4,1.0.0.13
|
||||
Xamarin.Android.Support.v7.AppCompat,Xamarin.AndroidX.AppCompat,Xamarin.Android.Support.v7.AppCompat,Xamarin.AndroidX.AppCompat,1.4.1.1
|
||||
Xamarin.Android.Support.v7.AppCompat,Xamarin.AndroidX.AppCompat.AppCompatResources,Xamarin.Android.Support.v7.AppCompat,Xamarin.AndroidX.AppCompat.AppCompatResources,1.4.1.1
|
||||
Xamarin.Android.Support.v7.CardView,Xamarin.AndroidX.CardView,Xamarin.Android.Support.v7.CardView,Xamarin.AndroidX.CardView,1.0.0.15
|
||||
Xamarin.Android.Support.v7.GridLayout,Xamarin.AndroidX.GridLayout,Xamarin.Android.Support.v7.GridLayout,Xamarin.AndroidX.GridLayout,1.0.0.13
|
||||
Xamarin.Android.Support.v7.MediaRouter,Xamarin.AndroidX.MediaRouter,Xamarin.Android.Support.v7.MediaRouter,Xamarin.AndroidX.MediaRouter,1.3.0
|
||||
Xamarin.Android.Support.v7.Palette,Xamarin.AndroidX.Palette,Xamarin.Android.Support.v7.Palette,Xamarin.AndroidX.Palette,1.0.0.13
|
||||
Xamarin.Android.Support.v7.Preference,Xamarin.AndroidX.Preference,Xamarin.Android.Support.v7.Preference,Xamarin.AndroidX.Preference,1.2.0.1
|
||||
Xamarin.Android.Support.v7.RecyclerView,Xamarin.AndroidX.RecyclerView,Xamarin.Android.Support.v7.RecyclerView,Xamarin.AndroidX.RecyclerView,1.2.1.6
|
||||
Xamarin.Android.Support.Vector.Drawable,Xamarin.AndroidX.VectorDrawable,Xamarin.Android.Support.Vector.Drawable,Xamarin.AndroidX.VectorDrawable,1.1.0.13
|
||||
Xamarin.Android.Support.VersionedParcelable,Xamarin.AndroidX.VersionedParcelable,Xamarin.Android.Support.VersionedParcelable,Xamarin.AndroidX.VersionedParcelable,1.1.1.13
|
||||
Xamarin.Android.Support.ViewPager,Xamarin.AndroidX.ViewPager,Xamarin.Android.Support.ViewPager,Xamarin.AndroidX.ViewPager,1.0.0.13
|
||||
Xamarin.Android.Support.Wear,Xamarin.AndroidX.Wear,Xamarin.Android.Support.Wear,Xamarin.AndroidX.Wear,1.2.0.5
|
||||
Xamarin.Android.Support.WebKit,Xamarin.AndroidX.WebKit,Xamarin.Android.Support.WebKit,Xamarin.AndroidX.WebKit,1.4.0.7
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,6 +0,0 @@
|
|||
Support type,AndroidX type
|
||||
Android.Support.V4.Media.MediaSessionManager,AndroidX.Media.MediaSessionManager
|
||||
Android.Support.V4.App.ActionBarDrawerToggle.IDelegate,AndroidX.Legacy.App.ActionBarDrawerToggle.IDelegate
|
||||
Android.Support.V4.App.ActionBarDrawerToggle.IDelegateProvider,AndroidX.Legacy.App.ActionBarDrawerToggle.IDelegateProvider
|
||||
Android.Support.V7.App.ActionBarDrawerToggle.IDelegate,AndroidX.AppCompat.App.ActionBarDrawerToggle.IDelegate
|
||||
Android.Support.V7.App.ActionBarDrawerToggle.IDelegateProvider,AndroidX.AppCompat.App.ActionBarDrawerToggle.IDelegateProvider
|
|
|
@ -478,5 +478,4 @@ Xamarin.KotlinX.Coroutines.Scheduling
|
|||
Xamarin.KotlinX.Coroutines.Selects
|
||||
Xamarin.KotlinX.Coroutines.Stream
|
||||
Xamarin.KotlinX.Coroutines.Sync
|
||||
Xamarin.KotlinX.Coroutines.Test
|
||||
Xamarin.KotlinX.Coroutines.Time
|
||||
|
|
|
@ -220,7 +220,7 @@
|
|||
@if (@Model.NuGetPackageId == "Xamarin.AndroidX.Annotation")
|
||||
{
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\source\migration\Dummy\Xamarin.AndroidX.Migration.Dummy.csproj" PrivateAssets="none" Condition=" '$(TargetFramework)' == 'MonoAndroid12.0' " />
|
||||
<PackageReference Include="Xamarin.AndroidX.Migration" Version="1.0.10" PrivateAssets="none" Condition=" '$(TargetFramework)' == 'MonoAndroid12.0' " />
|
||||
</ItemGroup>
|
||||
}
|
||||
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
using Microsoft.Build.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration.BuildTasks
|
||||
{
|
||||
public class CecilfyFiles : MigrationToolTask
|
||||
{
|
||||
[Required]
|
||||
public ITaskItem[] Assemblies { get; set; }
|
||||
|
||||
public ITaskItem[] References { get; set; }
|
||||
|
||||
public bool SkipEmbeddedResources { get; set; }
|
||||
|
||||
public bool Verbose { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
var pairs = new List<MigrationPair>(Assemblies.Length);
|
||||
|
||||
var refs = References.Select(r => r.ItemSpec).ToList();
|
||||
|
||||
foreach (var file in Assemblies)
|
||||
{
|
||||
var f = file.ItemSpec;
|
||||
|
||||
// create the migration pair
|
||||
pairs.Add(new MigrationPair(f, f));
|
||||
|
||||
// replace the original with the migrated assembly
|
||||
refs.RemoveAll(r => Path.GetFileName(r) == Path.GetFileName(f));
|
||||
refs.Add(f);
|
||||
}
|
||||
|
||||
var cecilfier = new CecilMigrator
|
||||
{
|
||||
SkipEmbeddedResources = SkipEmbeddedResources,
|
||||
References = refs,
|
||||
Verbose = Verbose
|
||||
};
|
||||
|
||||
cecilfier.MessageLogged += (sender, e) => LogToolMessage(e);
|
||||
|
||||
try
|
||||
{
|
||||
var result = cecilfier.Migrate(pairs);
|
||||
|
||||
Log.LogMessage($"Result of cecilfication: {result}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.LogErrorFromException(ex, true);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return !cecilfier.HasLoggedErrors;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration.BuildTasks
|
||||
{
|
||||
public class CollectAllFiles : Task
|
||||
{
|
||||
[Required]
|
||||
public ITaskItem[] Directories { get; set; }
|
||||
|
||||
[Output]
|
||||
public ITaskItem[] OutputFiles { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
var output = new List<ITaskItem>();
|
||||
|
||||
foreach (var directory in Directories)
|
||||
{
|
||||
if (!Directory.Exists(directory.ItemSpec))
|
||||
continue;
|
||||
|
||||
var files = Directory.EnumerateFiles(directory.ItemSpec, "*.*", SearchOption.AllDirectories);
|
||||
|
||||
var taskItems = files.Select(f =>
|
||||
{
|
||||
var item = new TaskItem(f, new Dictionary<string, string>
|
||||
{
|
||||
{ "OriginalDirectory", directory.ItemSpec},
|
||||
});
|
||||
directory.CopyMetadataTo(item);
|
||||
return item;
|
||||
});
|
||||
|
||||
output.AddRange(taskItems);
|
||||
}
|
||||
|
||||
OutputFiles = output.ToArray();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
using Microsoft.Build.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration.BuildTasks
|
||||
{
|
||||
public class JetifyFiles : MigrationToolTask
|
||||
{
|
||||
// file inputs
|
||||
|
||||
public ITaskItem[] Files { get; set; }
|
||||
public ITaskItem[] JetifiedFiles { get; set; }
|
||||
public string JetifiedDirectory { get; set; }
|
||||
|
||||
// configuration inputs
|
||||
|
||||
public string JavaPath { get; set; }
|
||||
public string ConfigurationPath { get; set; }
|
||||
public bool Verbose { get; set; }
|
||||
public bool Dejetify { get; set; }
|
||||
public bool IsStrict { get; set; }
|
||||
public bool ShouldRebuildTopOfTree { get; set; }
|
||||
public bool ShouldStripSignatures { get; set; }
|
||||
public bool IsProGuard { get; set; }
|
||||
public bool Parallel { get; set; }
|
||||
public bool UseIntermediateFile { get; set; }
|
||||
public string IntermediateFilePath { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
// make sure there is input
|
||||
if (Files == null || Files.Length == 0)
|
||||
{
|
||||
Log.LogError($"Nothing to jetify. No files were provided via the \"{nameof(Files)}\" attribute.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// make sure the output files are valid
|
||||
if (JetifiedFiles?.Length > 0)
|
||||
{
|
||||
if (Files.Length != JetifiedFiles?.Length)
|
||||
{
|
||||
Log.LogError($"The length of {nameof(Files)} and {nameof(JetifiedFiles)} must be the same.");
|
||||
return false;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(JetifiedDirectory))
|
||||
{
|
||||
Log.LogError($"The {nameof(JetifiedDirectory)} and {nameof(JetifiedFiles)} cannot both be set.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// make sure the intermediate file is valid
|
||||
if (UseIntermediateFile)
|
||||
{
|
||||
if (string.IsNullOrEmpty(IntermediateFilePath))
|
||||
{
|
||||
Log.LogError($"Invalid intermediate path \"{IntermediateFilePath}\".");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var filesToJetify = CreateMigrationPairs().ToList();
|
||||
|
||||
foreach (var file in filesToJetify)
|
||||
{
|
||||
if (file.Source.Equals(file.Destination, StringComparison.OrdinalIgnoreCase))
|
||||
Log.LogMessage(MessageImportance.Low, $"Queuing jetification for {file.Source}.");
|
||||
else
|
||||
Log.LogMessage(MessageImportance.Low, $"Queuing jetification for {file.Source} to {file.Destination}.");
|
||||
}
|
||||
|
||||
var jetifier = new Jetifier
|
||||
{
|
||||
ConfigurationPath = ConfigurationPath,
|
||||
Verbose = Verbose,
|
||||
Dejetify = Dejetify,
|
||||
IsStrict = IsStrict,
|
||||
ShouldRebuildTopOfTree = ShouldRebuildTopOfTree,
|
||||
ShouldStripSignatures = ShouldStripSignatures,
|
||||
IsProGuard = IsProGuard,
|
||||
Parallel = Parallel,
|
||||
UseIntermediateFile = UseIntermediateFile,
|
||||
IntermediateFilePath = IntermediateFilePath,
|
||||
JavaPath = JavaPath,
|
||||
};
|
||||
|
||||
jetifier.MessageLogged += (sender, e) => LogToolMessage(e);
|
||||
|
||||
if (!string.IsNullOrEmpty(JetifiedDirectory) && !Directory.Exists(JetifiedDirectory))
|
||||
Directory.CreateDirectory(JetifiedDirectory);
|
||||
|
||||
return jetifier.Jetify(filesToJetify);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.LogErrorFromException(ex, true);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<MigrationPair> CreateMigrationPairs()
|
||||
{
|
||||
var filesLength = Files?.Length ?? 0;
|
||||
for (int i = 0; i < filesLength; i++)
|
||||
{
|
||||
var inputFile = Files[i].ItemSpec;
|
||||
var outputFile = GetOutputFile(i) ?? inputFile;
|
||||
|
||||
yield return (Path.GetFullPath(inputFile), Path.GetFullPath(outputFile));
|
||||
}
|
||||
}
|
||||
|
||||
private string GetOutputFile(int index)
|
||||
{
|
||||
if (JetifiedFiles?.Length > index)
|
||||
return JetifiedFiles[index].ItemSpec;
|
||||
|
||||
if (!string.IsNullOrEmpty(JetifiedDirectory))
|
||||
{
|
||||
var extension = Path.GetExtension(Files[index].ItemSpec);
|
||||
return Path.Combine(JetifiedDirectory, Guid.NewGuid().ToString() + extension);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration.BuildTasks
|
||||
{
|
||||
public abstract class MigrationToolTask : Task
|
||||
{
|
||||
protected void LogToolMessage(MessageLoggedEventArgs e)
|
||||
{
|
||||
if (e.Exception != null)
|
||||
Log.LogErrorFromException(e.Exception);
|
||||
else if (e.IsError)
|
||||
Log.LogError(e.Message);
|
||||
else if (e.IsVerbose)
|
||||
Log.LogMessage(MessageImportance.Low, e.Message);
|
||||
else
|
||||
Log.LogMessage(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration.BuildTasks
|
||||
{
|
||||
public class RemoveSkippedEmbeddedFiles : Task
|
||||
{
|
||||
[Required]
|
||||
public string AssemblyIdentityMapFile { get; set; }
|
||||
|
||||
public ITaskItem[] Files { get; set; }
|
||||
|
||||
public ITaskItem[] ContainersToSkip { get; set; }
|
||||
|
||||
public string OutputImportDirectory { get; set; }
|
||||
|
||||
public bool Verbose { get; set; }
|
||||
|
||||
[Output]
|
||||
public ITaskItem[] OutputFiles { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
// if there are no files, then we are done
|
||||
if (Files == null || Files.Length == 0)
|
||||
{
|
||||
Log.LogMessage(MessageImportance.Low, $"There were no files to check.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// if there is nothing to skip, then we are done
|
||||
if (ContainersToSkip == null || ContainersToSkip.Length == 0)
|
||||
{
|
||||
Log.LogMessage(MessageImportance.Low, $"There were no containers to check.");
|
||||
|
||||
OutputFiles = Files;
|
||||
return true;
|
||||
}
|
||||
|
||||
// if there is no map file, then error
|
||||
if (string.IsNullOrWhiteSpace(AssemblyIdentityMapFile) || !File.Exists(AssemblyIdentityMapFile))
|
||||
{
|
||||
Log.LogError($"The map.cache file '{AssemblyIdentityMapFile}' does not exist.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// try and determine the full "lp" directory
|
||||
if (!string.IsNullOrWhiteSpace(OutputImportDirectory))
|
||||
OutputImportDirectory = Path.GetFullPath(OutputImportDirectory);
|
||||
else
|
||||
OutputImportDirectory = Path.GetDirectoryName(AssemblyIdentityMapFile);
|
||||
if (OutputImportDirectory[OutputImportDirectory.Length - 1] != Path.DirectorySeparatorChar)
|
||||
OutputImportDirectory += Path.DirectorySeparatorChar;
|
||||
|
||||
// now process all the files
|
||||
OutputFiles = GetIncludedFiles().ToArray();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerable<ITaskItem> GetIncludedFiles()
|
||||
{
|
||||
var containers = ContainersToSkip.Select(c => c.ItemSpec).ToArray();
|
||||
|
||||
var mapCache = File.ReadAllLines(AssemblyIdentityMapFile);
|
||||
|
||||
foreach (var file in Files)
|
||||
{
|
||||
if (ShouldSkip(file, out var container))
|
||||
{
|
||||
Log.LogMessage($"Skipping '{file}' because it matched '{container}'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.LogMessage(MessageImportance.Low, $"The file '{file}' did not match any skippable containers.");
|
||||
|
||||
yield return file;
|
||||
}
|
||||
}
|
||||
|
||||
bool ShouldSkip(ITaskItem file, out string container)
|
||||
{
|
||||
container = null;
|
||||
|
||||
var fullPath = Path.GetFullPath(file.ItemSpec);
|
||||
if (!fullPath.StartsWith(OutputImportDirectory, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
var subDir = fullPath.IndexOf(Path.DirectorySeparatorChar, OutputImportDirectory.Length);
|
||||
if (subDir == -1)
|
||||
return false;
|
||||
|
||||
var indexStr = fullPath.Substring(OutputImportDirectory.Length, subDir - OutputImportDirectory.Length);
|
||||
|
||||
if (!int.TryParse(indexStr, out int index) || index < 0 || index >= mapCache.Length)
|
||||
return false;
|
||||
|
||||
container = mapCache[index];
|
||||
|
||||
if (Array.IndexOf(containers, container) == -1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,158 +0,0 @@
|
|||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration.BuildTasks
|
||||
{
|
||||
public class ResolveEmbeddedFiles : Task
|
||||
{
|
||||
private string[] containers;
|
||||
private string[] mapCache;
|
||||
|
||||
public ITaskItem[] ResourceDirectories { get; set; }
|
||||
|
||||
public ITaskItem[] JavaLibraries { get; set; }
|
||||
|
||||
public ITaskItem[] Resources { get; set; }
|
||||
|
||||
public string OutputImportDirectory { get; set; }
|
||||
|
||||
public string AssemblyIdentityMapFile { get; set; }
|
||||
|
||||
public ITaskItem[] ContainersToSkip { get; set; }
|
||||
|
||||
public bool Verbose { get; set; }
|
||||
|
||||
[Output]
|
||||
public ITaskItem[] OutputFiles { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
// load the conainers and cache into memory
|
||||
containers = ContainersToSkip?.Length > 0
|
||||
? ContainersToSkip.Select(c => c.ItemSpec).ToArray()
|
||||
: Array.Empty<string>();
|
||||
mapCache = !string.IsNullOrWhiteSpace(AssemblyIdentityMapFile) && File.Exists(AssemblyIdentityMapFile)
|
||||
? File.ReadAllLines(AssemblyIdentityMapFile)
|
||||
: Array.Empty<string>();
|
||||
|
||||
// try and determine the full "lp" directory
|
||||
if (!string.IsNullOrWhiteSpace(OutputImportDirectory))
|
||||
OutputImportDirectory = Path.GetFullPath(OutputImportDirectory);
|
||||
else if (!string.IsNullOrWhiteSpace(AssemblyIdentityMapFile))
|
||||
OutputImportDirectory = Path.GetDirectoryName(AssemblyIdentityMapFile);
|
||||
else
|
||||
OutputImportDirectory = null;
|
||||
if (OutputImportDirectory != null && OutputImportDirectory[OutputImportDirectory.Length - 1] != Path.DirectorySeparatorChar)
|
||||
OutputImportDirectory += Path.DirectorySeparatorChar;
|
||||
|
||||
var output = new List<ITaskItem>();
|
||||
|
||||
// look through all the extracted resources
|
||||
if (ResourceDirectories?.Length > 0)
|
||||
{
|
||||
var resources = GetExtractedResources();
|
||||
output.AddRange(resources);
|
||||
}
|
||||
|
||||
// go through all the jar files
|
||||
if (JavaLibraries?.Length > 0)
|
||||
{
|
||||
foreach (var library in JavaLibraries)
|
||||
{
|
||||
if (bool.TrueString.Equals(library.GetMetadata("AndroidXSkipAndroidXMigration"), StringComparison.OrdinalIgnoreCase))
|
||||
continue;
|
||||
|
||||
var lib = library.ItemSpec;
|
||||
|
||||
if (ShouldSkipResource(lib, out var container) || !File.Exists(lib))
|
||||
continue;
|
||||
|
||||
library.SetMetadata("InputItemSpec", lib);
|
||||
|
||||
output.Add(library);
|
||||
}
|
||||
}
|
||||
|
||||
// go through all the app resources
|
||||
if (Resources?.Length > 0)
|
||||
{
|
||||
foreach (var resource in Resources)
|
||||
{
|
||||
if (bool.TrueString.Equals(resource.GetMetadata("AndroidXSkipAndroidXMigration"), StringComparison.OrdinalIgnoreCase))
|
||||
continue;
|
||||
|
||||
var ext = Path.GetExtension(resource.ItemSpec);
|
||||
if (ext == null || !ext.Equals(".xml", StringComparison.OrdinalIgnoreCase))
|
||||
continue;
|
||||
|
||||
resource.SetMetadata("InputItemSpec", resource.GetMetadata("OriginalItemSpec"));
|
||||
|
||||
output.Add(resource);
|
||||
}
|
||||
}
|
||||
|
||||
OutputFiles = output.ToArray();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerable<ITaskItem> GetExtractedResources()
|
||||
{
|
||||
// go through all the resource directories and find the resources
|
||||
foreach (var directory in ResourceDirectories)
|
||||
{
|
||||
if (bool.TrueString.Equals(directory.GetMetadata("AndroidXSkipAndroidXMigration"), StringComparison.OrdinalIgnoreCase))
|
||||
continue;
|
||||
|
||||
var dir = directory.ItemSpec;
|
||||
|
||||
if (ShouldSkipResource(dir, out var container) || !Directory.Exists(dir))
|
||||
continue;
|
||||
|
||||
var files = Directory.EnumerateFiles(dir, "*.xml", SearchOption.AllDirectories);
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
var item = new TaskItem(file, new Dictionary<string, string>
|
||||
{
|
||||
{ "OriginalDirectory", dir},
|
||||
{ "InputItemSpec", file },
|
||||
});
|
||||
|
||||
directory.CopyMetadataTo(item);
|
||||
|
||||
yield return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool ShouldSkipResource(string path, out string container)
|
||||
{
|
||||
container = null;
|
||||
|
||||
var fullPath = Path.GetFullPath(path);
|
||||
if (!fullPath.StartsWith(OutputImportDirectory, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
var subDir = fullPath.IndexOf(Path.DirectorySeparatorChar, OutputImportDirectory.Length);
|
||||
if (subDir == -1)
|
||||
return false;
|
||||
|
||||
var indexStr = fullPath.Substring(OutputImportDirectory.Length, subDir - OutputImportDirectory.Length);
|
||||
|
||||
if (!int.TryParse(indexStr, out int index) || index < 0 || index >= mapCache.Length)
|
||||
return false;
|
||||
|
||||
container = mapCache[index];
|
||||
|
||||
if (Array.IndexOf(containers, container) == -1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration.BuildTasks
|
||||
{
|
||||
public class ValidateAndroidXPackages : Task
|
||||
{
|
||||
[Required]
|
||||
public ITaskItem[] ResolvedAssemblies { get; set; }
|
||||
|
||||
public bool Verbose { get; set; }
|
||||
|
||||
public bool UseWarningsInsteadOfErrors { get; set; }
|
||||
|
||||
[Output]
|
||||
public bool ContainsSupportAssemblies { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
// if there are no assemblies, then we are done
|
||||
if (ResolvedAssemblies == null || ResolvedAssemblies.Length == 0)
|
||||
{
|
||||
Log.LogMessage($"There were no assemblies to check.");
|
||||
return true;
|
||||
}
|
||||
|
||||
var hasMissing = false;
|
||||
|
||||
var assemblyNames = ResolvedAssemblies.Select(a => Path.GetFileNameWithoutExtension(a.ItemSpec));
|
||||
|
||||
var mapping = new AndroidXAssembliesCsvMapping();
|
||||
|
||||
var assemblyPairs = new Dictionary<string, string>();
|
||||
var androidxAssemblies = new Dictionary<string, bool>();
|
||||
|
||||
foreach (var support in assemblyNames)
|
||||
{
|
||||
// if there was no mapping found, then we don't care
|
||||
if (!mapping.TryGetAndroidXAssembly(support, out var androidx))
|
||||
continue;
|
||||
|
||||
ContainsSupportAssemblies = true;
|
||||
|
||||
Log.LogMessage(MessageImportance.Low, $"Making sure that the Android Support assembly '{support}' has a replacement Android X assembly...");
|
||||
|
||||
// make sure the mapped assembly is referenced
|
||||
var exists = assemblyNames.Contains(androidx);
|
||||
androidxAssemblies[androidx] = exists;
|
||||
assemblyPairs[androidx] = support;
|
||||
|
||||
if (exists)
|
||||
{
|
||||
Log.LogMessage(MessageImportance.Low, $"Found the Android X assembly '{androidx}'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.LogMessage(MessageImportance.Low, $"Missing the Android X assembly '{androidx}'.");
|
||||
hasMissing = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasMissing)
|
||||
{
|
||||
var missing = androidxAssemblies.Where(p => !p.Value).Select(p => p.Key).ToArray();
|
||||
|
||||
var tree = PackageDependencyTree.Load();
|
||||
|
||||
var reduced = tree.Reduce(missing).ToArray();
|
||||
|
||||
var packages = new StringBuilder();
|
||||
var references = new StringBuilder();
|
||||
|
||||
foreach (var assembly in reduced)
|
||||
{
|
||||
mapping.TryGetAndroidXPackage(assembly, out var package);
|
||||
mapping.TryGetAndroidXVersion(assembly, out var version);
|
||||
|
||||
packages.AppendLine();
|
||||
packages.Append($" - {package}");
|
||||
|
||||
references.AppendLine();
|
||||
references.Append($" <PackageReference Include=\"{package}\" Version=\"{version}\" />");
|
||||
}
|
||||
|
||||
var msg =
|
||||
$"Could not find {missing.Length} Android X assemblies, make sure to install the following NuGet packages:" +
|
||||
packages + Environment.NewLine +
|
||||
$"You can also copy-and-paste the following snippet into your .csproj file:" +
|
||||
references;
|
||||
|
||||
if (UseWarningsInsteadOfErrors)
|
||||
Log.LogWarning(msg);
|
||||
else
|
||||
Log.LogError(msg);
|
||||
}
|
||||
|
||||
return !hasMissing || UseWarningsInsteadOfErrors;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<PackageId>Xamarin.AndroidX.Migration</PackageId>
|
||||
<NuspecFile>Xamarin.AndroidX.Migration.nuspec</NuspecFile>
|
||||
<NuspecProperties>multidex=$(MultiDexVersion);version=$(PackageVersion)</NuspecProperties>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
|
||||
<PackageReference Include="Microsoft.Build.Framework" Version="17.2.0" />
|
||||
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="17.2.0" />
|
||||
<ProjectReference Include="..\Migration\Xamarin.AndroidX.Migration.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,57 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package>
|
||||
<metadata>
|
||||
|
||||
<!-- package -->
|
||||
<id>Xamarin.AndroidX.Migration</id>
|
||||
<title>Migration Tools for Xamarin AndroidX</title>
|
||||
<version>$version$</version>
|
||||
<description>
|
||||
This package provides a set of tools and MSBuild tasks to aid in the migration from Android Support to Android X.
|
||||
</description>
|
||||
<summary>
|
||||
This package provides a set of tools and MSBuild tasks to aid in the migration from Android Support to Android X.
|
||||
</summary>
|
||||
<projectUrl>https://go.microsoft.com/fwlink/?linkid=2099353</projectUrl>
|
||||
<iconUrl>https://go.microsoft.com/fwlink/?linkid=2099392</iconUrl>
|
||||
<tags>Xamarin.AndroidX Xamarin Android Support AndroidX Migration</tags>
|
||||
|
||||
<!-- legal -->
|
||||
<license type="file">LICENSE.md</license>
|
||||
<authors>Microsoft</authors>
|
||||
<owners>Microsoft</owners>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
|
||||
|
||||
<dependencies>
|
||||
<group targetFramework="monoandroid120">
|
||||
<dependency id="Xamarin.AndroidX.MultiDex" version="$multidex$" include="All" />
|
||||
</group>
|
||||
</dependencies>
|
||||
|
||||
</metadata>
|
||||
<files>
|
||||
|
||||
<file src="bin\Release\netstandard2.0\Tools\**\*" target="build\monoandroid120\Tools" />
|
||||
<file src="bin\Release\netstandard2.0\Mono.*.dll" target="build\monoandroid120" />
|
||||
<file src="bin\Release\netstandard2.0\Xamarin.*.dll" target="build\monoandroid120" />
|
||||
<file src="bin\Release\netstandard2.0\ILRepack.dll" target="build\monoandroid120" />
|
||||
<file src="Xamarin.AndroidX.Migration.props" target="build\monoandroid120" />
|
||||
<file src="Xamarin.AndroidX.Migration.targets" target="build\monoandroid120" />
|
||||
|
||||
<file src="bin\Release\netstandard2.0\Tools\**\*" target="buildTransitive\monoandroid120\Tools" />
|
||||
<file src="bin\Release\netstandard2.0\Mono.*.dll" target="buildTransitive\monoandroid120" />
|
||||
<file src="bin\Release\netstandard2.0\Xamarin.*.dll" target="buildTransitive\monoandroid120" />
|
||||
<file src="bin\Release\netstandard2.0\ILRepack.dll" target="buildTransitive\monoandroid120" />
|
||||
<file src="Xamarin.AndroidX.Migration.props" target="buildTransitive\monoandroid120" />
|
||||
<file src="Xamarin.AndroidX.Migration.targets" target="buildTransitive\monoandroid120" />
|
||||
|
||||
<file src="_._" target="lib\monoandroid120\_._" />
|
||||
|
||||
<file src="readme.txt" target="readme.txt" />
|
||||
|
||||
<file src="..\..\..\LICENSE.md" target="LICENSE.md" />
|
||||
<file src="..\..\..\External-Dependency-Info.txt" target="THIRD-PARTY-NOTICES.txt" />
|
||||
|
||||
</files>
|
||||
</package>
|
|
@ -1,381 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<AndroidXIsUsingAndroidXLibraries>true</AndroidXIsUsingAndroidXLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<_BeforeLinkAssemblies>
|
||||
$(_BeforeLinkAssemblies);
|
||||
_AndroidXCecilfyShrink;
|
||||
</_BeforeLinkAssemblies>
|
||||
<BeforeGenerateAndroidManifest>
|
||||
$(BeforeGenerateAndroidManifest);
|
||||
_AndroidXCecilfyNoShrink;
|
||||
</BeforeGenerateAndroidManifest>
|
||||
<AfterGenerateAndroidManifest>
|
||||
$(AfterGenerateAndroidManifest);
|
||||
_AndroidXJetifyManifest;
|
||||
</AfterGenerateAndroidManifest>
|
||||
<_AfterGenerateAndroidResourceDir>
|
||||
$(_AfterGenerateAndroidResourceDir);
|
||||
_AndroidXJetifyEmbeddedFiles;
|
||||
</_AfterGenerateAndroidResourceDir>
|
||||
<_BeforeCompileDex>
|
||||
$(_BeforeCompileDex);
|
||||
_AndroidXJetifyJavaLibraryRules;
|
||||
_AndroidXJetifyProguardRules;
|
||||
</_BeforeCompileDex>
|
||||
</PropertyGroup>
|
||||
<!-- all the Android Support assemblies -->
|
||||
<ItemGroup>
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Core.Common" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Core.Runtime" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Lifecycle.Common" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Lifecycle.Extensions" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Lifecycle.LiveData" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Lifecycle.LiveData.Core" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Lifecycle.Runtime" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Lifecycle.ViewModel" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Persistence.Db" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Persistence.Db.Framework" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Persistence.Room.Common" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Persistence.Room.Runtime" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Arch.Work.Runtime" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Animated.Vector.Drawable" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Annotations" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.AsyncLayoutInflater" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Collections" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Compat" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Constraint.Layout" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Constraint.Layout.Solver" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.CoordinaterLayout" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Core.UI" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Core.Utils" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.CursorAdapter" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.CustomTabs" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.CustomView" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Design" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.DocumentFile" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.DrawerLayout" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Dynamic.Animation" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Emoji" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Emoji.AppCompat" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Emoji.Bundled" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Exif" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Fragment" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.HeifWriter" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Interpolator" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Loader" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.LocalBroadcastManager" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Media.Compat" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.MultiDex" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Percent" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Print" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Recommendation" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.RecyclerView.Selection" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Slices.Builders" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Slices.Core" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Slices.View" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.SlidingPaneLayout" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.SwipeRefreshLayout" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Transition" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.TV.Provider" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v13" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v17.Leanback" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v17.Preference.Leanback" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v4" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v7.AppCompat" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v7.CardView" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v7.GridLayout" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v7.MediaRouter" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v7.Palette" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v7.Preference" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.v7.RecyclerView" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Vector.Drawable" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.VersionedParcelable" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.ViewPager" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.Wear" />
|
||||
<_AndroidXSupportAssembly Include="Xamarin.Android.Support.WebKit" />
|
||||
</ItemGroup>
|
||||
<!-- all the AndroidX assemblies -->
|
||||
<ItemGroup>
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Annotation" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Annotation.Experimental" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.AppCompat" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.AppCompat.AppCompatResources" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Arch.Core.Common" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Arch.Core.Runtime" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.AsyncLayoutInflater" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Browser" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.CardView" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Collection" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.ConstraintLayout" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.ConstraintLayout.Solver" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.CoordinatorLayout" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Core" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.CursorAdapter" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.CustomView" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.DataBinding.DataBindingAdapters" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.DataBinding.DataBindingRuntime" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.DataBinding.ViewBinding" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.DocumentFile" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.DrawerLayout" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.DynamicAnimation" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Emoji" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Emoji.AppCompat" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Emoji.Bundled" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.ExifInterface" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Fragment" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.GridLayout" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.HeifWriter" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Interpolator" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Leanback" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Leanback.Preference" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Legacy.Support.Core.UI" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Legacy.Support.Core.Utils" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Legacy.Support.V13" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Legacy.Support.V4" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Lifecycle.Common" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Lifecycle.Extensions" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Lifecycle.LiveData" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Lifecycle.Process" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Lifecycle.Runtime" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Lifecycle.Service" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Lifecycle.ViewModel" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Loader" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.LocalBroadcastManager" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Media" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Media2.Widget" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.MediaRouter" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.MultiDex" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Palette" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.PercentLayout" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Preference" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Print" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Recommendation" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.RecyclerView" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.RecyclerView.Selection" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Room.Common" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Room.Runtime" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Slice.Builders" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Slice.Core" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Slice.View" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.SlidingPaneLayout" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Sqlite" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Sqlite.Framework" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.SwipeRefreshLayout" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Transition" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.TvProvider" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.VectorDrawable" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.VectorDrawable.Animated" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.VersionedParcelable" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.ViewPager" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Wear" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.WebKit" />
|
||||
<_AndroidXAssembly Include="Xamarin.AndroidX.Work.Runtime" />
|
||||
<_AndroidXAssembly Include="Xamarin.Google.Android.Material" />
|
||||
</ItemGroup>
|
||||
<!-- all the AndroidX maven artifacts (groupId.artifactId) -->
|
||||
<ItemGroup>
|
||||
<_AndroidXMavenArtifact Include="androidx.activity.activity" />
|
||||
<_AndroidXMavenArtifact Include="androidx.activity.activity-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.ads.ads-identifier" />
|
||||
<_AndroidXMavenArtifact Include="androidx.ads.ads-identifier-common" />
|
||||
<_AndroidXMavenArtifact Include="androidx.ads.ads-identifier-provider" />
|
||||
<_AndroidXMavenArtifact Include="androidx.annotation.annotation" />
|
||||
<_AndroidXMavenArtifact Include="androidx.annotation.annotation-experimental" />
|
||||
<_AndroidXMavenArtifact Include="androidx.appcompat.appcompat" />
|
||||
<_AndroidXMavenArtifact Include="androidx.appcompat.appcompat-resources" />
|
||||
<_AndroidXMavenArtifact Include="androidx.arch.core.core-common" />
|
||||
<_AndroidXMavenArtifact Include="androidx.arch.core.core-runtime" />
|
||||
<_AndroidXMavenArtifact Include="androidx.asynclayoutinflater.asynclayoutinflater" />
|
||||
<_AndroidXMavenArtifact Include="androidx.autofill.autofill" />
|
||||
<_AndroidXMavenArtifact Include="androidx.biometric.biometric" />
|
||||
<_AndroidXMavenArtifact Include="androidx.browser.browser" />
|
||||
<_AndroidXMavenArtifact Include="androidx.camera.camera-camera2" />
|
||||
<_AndroidXMavenArtifact Include="androidx.camera.camera-core" />
|
||||
<_AndroidXMavenArtifact Include="androidx.camera.camera-lifecycle" />
|
||||
<_AndroidXMavenArtifact Include="androidx.car.app.app" />
|
||||
<_AndroidXMavenArtifact Include="androidx.car.car" />
|
||||
<_AndroidXMavenArtifact Include="androidx.car.car-cluster" />
|
||||
<_AndroidXMavenArtifact Include="androidx.cardview.cardview" />
|
||||
<_AndroidXMavenArtifact Include="androidx.collection.collection" />
|
||||
<_AndroidXMavenArtifact Include="androidx.collection.collection-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.animation.animation" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.animation.animation-core" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.foundation.foundation" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.foundation.foundation-layout" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.material.material" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.material.material-icons-core" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.material.material-icons-extended" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.material.material-ripple" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.runtime.runtime" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.runtime.runtime-livedata" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.runtime.runtime-rxjava2" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.runtime.runtime-saveable" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.ui.ui" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.ui.ui-geometry" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.ui.ui-graphics" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.ui.ui-text" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.ui.ui-unit" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.ui.ui-util" />
|
||||
<_AndroidXMavenArtifact Include="androidx.compose.ui.ui-viewbinding" />
|
||||
<_AndroidXMavenArtifact Include="androidx.concurrent.concurrent-futures" />
|
||||
<_AndroidXMavenArtifact Include="androidx.constraintlayout.constraintlayout" />
|
||||
<_AndroidXMavenArtifact Include="androidx.constraintlayout.constraintlayout-core" />
|
||||
<_AndroidXMavenArtifact Include="androidx.constraintlayout.constraintlayout-solver" />
|
||||
<_AndroidXMavenArtifact Include="androidx.contentpager.contentpager" />
|
||||
<_AndroidXMavenArtifact Include="androidx.coordinatorlayout.coordinatorlayout" />
|
||||
<_AndroidXMavenArtifact Include="androidx.core.core" />
|
||||
<_AndroidXMavenArtifact Include="androidx.core.core-animation" />
|
||||
<_AndroidXMavenArtifact Include="androidx.core.core-google-shortcuts" />
|
||||
<_AndroidXMavenArtifact Include="androidx.core.core-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.core.core-role" />
|
||||
<_AndroidXMavenArtifact Include="androidx.core.core-splashscreen" />
|
||||
<_AndroidXMavenArtifact Include="androidx.cursoradapter.cursoradapter" />
|
||||
<_AndroidXMavenArtifact Include="androidx.customview.customview" />
|
||||
<_AndroidXMavenArtifact Include="androidx.databinding.databinding-adapters" />
|
||||
<_AndroidXMavenArtifact Include="androidx.databinding.databinding-common" />
|
||||
<_AndroidXMavenArtifact Include="androidx.databinding.databinding-runtime" />
|
||||
<_AndroidXMavenArtifact Include="androidx.databinding.viewbinding" />
|
||||
<_AndroidXMavenArtifact Include="androidx.documentfile.documentfile" />
|
||||
<_AndroidXMavenArtifact Include="androidx.drawerlayout.drawerlayout" />
|
||||
<_AndroidXMavenArtifact Include="androidx.dynamicanimation.dynamicanimation" />
|
||||
<_AndroidXMavenArtifact Include="androidx.emoji.emoji" />
|
||||
<_AndroidXMavenArtifact Include="androidx.emoji.emoji-appcompat" />
|
||||
<_AndroidXMavenArtifact Include="androidx.emoji.emoji-bundled" />
|
||||
<_AndroidXMavenArtifact Include="androidx.emoji2.emoji2" />
|
||||
<_AndroidXMavenArtifact Include="androidx.emoji2.emoji2-views-helper" />
|
||||
<_AndroidXMavenArtifact Include="androidx.exifinterface.exifinterface" />
|
||||
<_AndroidXMavenArtifact Include="androidx.fragment.fragment" />
|
||||
<_AndroidXMavenArtifact Include="androidx.fragment.fragment-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.gridlayout.gridlayout" />
|
||||
<_AndroidXMavenArtifact Include="androidx.heifwriter.heifwriter" />
|
||||
<_AndroidXMavenArtifact Include="androidx.interpolator.interpolator" />
|
||||
<_AndroidXMavenArtifact Include="androidx.leanback.leanback" />
|
||||
<_AndroidXMavenArtifact Include="androidx.leanback.leanback-preference" />
|
||||
<_AndroidXMavenArtifact Include="androidx.legacy.legacy-preference-v14" />
|
||||
<_AndroidXMavenArtifact Include="androidx.legacy.legacy-support-core-ui" />
|
||||
<_AndroidXMavenArtifact Include="androidx.legacy.legacy-support-core-utils" />
|
||||
<_AndroidXMavenArtifact Include="androidx.legacy.legacy-support-v13" />
|
||||
<_AndroidXMavenArtifact Include="androidx.legacy.legacy-support-v4" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-common" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-common-java8" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-extensions" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-livedata" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-livedata-core" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-livedata-core-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-livedata-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-process" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-reactivestreams" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-reactivestreams-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-runtime" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-runtime-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-service" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-viewmodel" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-viewmodel-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.lifecycle.lifecycle-viewmodel-savedstate" />
|
||||
<_AndroidXMavenArtifact Include="androidx.loader.loader" />
|
||||
<_AndroidXMavenArtifact Include="androidx.localbroadcastmanager.localbroadcastmanager" />
|
||||
<_AndroidXMavenArtifact Include="androidx.media.media" />
|
||||
<_AndroidXMavenArtifact Include="androidx.media2.media2-common" />
|
||||
<_AndroidXMavenArtifact Include="androidx.media2.media2-session" />
|
||||
<_AndroidXMavenArtifact Include="androidx.media2.media2-widget" />
|
||||
<_AndroidXMavenArtifact Include="androidx.mediarouter.mediarouter" />
|
||||
<_AndroidXMavenArtifact Include="androidx.multidex.multidex" />
|
||||
<_AndroidXMavenArtifact Include="androidx.navigation.navigation-common" />
|
||||
<_AndroidXMavenArtifact Include="androidx.navigation.navigation-common-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.navigation.navigation-fragment" />
|
||||
<_AndroidXMavenArtifact Include="androidx.navigation.navigation-fragment-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.navigation.navigation-runtime" />
|
||||
<_AndroidXMavenArtifact Include="androidx.navigation.navigation-runtime-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.navigation.navigation-ui" />
|
||||
<_AndroidXMavenArtifact Include="androidx.navigation.navigation-ui-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.paging.paging-common" />
|
||||
<_AndroidXMavenArtifact Include="androidx.paging.paging-common-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.paging.paging-runtime" />
|
||||
<_AndroidXMavenArtifact Include="androidx.paging.paging-runtime-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.paging.paging-rxjava2" />
|
||||
<_AndroidXMavenArtifact Include="androidx.paging.paging-rxjava2-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.palette.palette" />
|
||||
<_AndroidXMavenArtifact Include="androidx.palette.palette-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.percentlayout.percentlayout" />
|
||||
<_AndroidXMavenArtifact Include="androidx.preference.preference" />
|
||||
<_AndroidXMavenArtifact Include="androidx.preference.preference-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.print.print" />
|
||||
<_AndroidXMavenArtifact Include="androidx.profileinstaller.profileinstaller" />
|
||||
<_AndroidXMavenArtifact Include="androidx.recommendation.recommendation" />
|
||||
<_AndroidXMavenArtifact Include="androidx.recyclerview.recyclerview" />
|
||||
<_AndroidXMavenArtifact Include="androidx.recyclerview.recyclerview-selection" />
|
||||
<_AndroidXMavenArtifact Include="androidx.resourceinspection.resourceinspection-annotation" />
|
||||
<_AndroidXMavenArtifact Include="androidx.room.room-common" />
|
||||
<_AndroidXMavenArtifact Include="androidx.room.room-guava" />
|
||||
<_AndroidXMavenArtifact Include="androidx.room.room-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.room.room-runtime" />
|
||||
<_AndroidXMavenArtifact Include="androidx.room.room-rxjava2" />
|
||||
<_AndroidXMavenArtifact Include="androidx.room.room-rxjava3" />
|
||||
<_AndroidXMavenArtifact Include="androidx.savedstate.savedstate" />
|
||||
<_AndroidXMavenArtifact Include="androidx.savedstate.savedstate-ktx" />
|
||||
<_AndroidXMavenArtifact Include="androidx.security.security-crypto" />
|
||||
<_AndroidXMavenArtifact Include="androidx.slice.slice-builders" />
|
||||
<_AndroidXMavenArtifact Include="androidx.slice.slice-core" />
|
||||
<_AndroidXMavenArtifact Include="androidx.slice.slice-view" />
|
||||
<_AndroidXMavenArtifact Include="androidx.slidingpanelayout.slidingpanelayout" />
|
||||
<_AndroidXMavenArtifact Include="androidx.sqlite.sqlite" />
|
||||
<_AndroidXMavenArtifact Include="androidx.sqlite.sqlite-framework" />
|
||||
<_AndroidXMavenArtifact Include="androidx.startup.startup-runtime" />
|
||||
<_AndroidXMavenArtifact Include="androidx.swiperefreshlayout.swiperefreshlayout" />
|
||||
<_AndroidXMavenArtifact Include="androidx.tracing.tracing" />
|
||||
<_AndroidXMavenArtifact Include="androidx.transition.transition" />
|
||||
<_AndroidXMavenArtifact Include="androidx.tvprovider.tvprovider" />
|
||||
<_AndroidXMavenArtifact Include="androidx.vectordrawable.vectordrawable" />
|
||||
<_AndroidXMavenArtifact Include="androidx.vectordrawable.vectordrawable-animated" />
|
||||
<_AndroidXMavenArtifact Include="androidx.versionedparcelable.versionedparcelable" />
|
||||
<_AndroidXMavenArtifact Include="androidx.viewpager.viewpager" />
|
||||
<_AndroidXMavenArtifact Include="androidx.viewpager2.viewpager2" />
|
||||
<_AndroidXMavenArtifact Include="androidx.wear.wear" />
|
||||
<_AndroidXMavenArtifact Include="androidx.wear.wear-input" />
|
||||
<_AndroidXMavenArtifact Include="androidx.wear.wear-ongoing" />
|
||||
<_AndroidXMavenArtifact Include="androidx.wear.wear-phone-interactions" />
|
||||
<_AndroidXMavenArtifact Include="androidx.wear.wear-remote-interactions" />
|
||||
<_AndroidXMavenArtifact Include="androidx.webkit.webkit" />
|
||||
<_AndroidXMavenArtifact Include="androidx.window.window" />
|
||||
<_AndroidXMavenArtifact Include="androidx.window.window-extensions" />
|
||||
<_AndroidXMavenArtifact Include="androidx.window.window-java" />
|
||||
<_AndroidXMavenArtifact Include="androidx.work.work-runtime" />
|
||||
<_AndroidXMavenArtifact Include="androidx.work.work-runtime-ktx" />
|
||||
<_AndroidXMavenArtifact Include="com.android.installreferrer.installreferrer" />
|
||||
<_AndroidXMavenArtifact Include="com.google.android.gms.play-services-basement" />
|
||||
<_AndroidXMavenArtifact Include="com.google.android.gms.play-services-wearable" />
|
||||
<_AndroidXMavenArtifact Include="com.google.android.material.material" />
|
||||
<_AndroidXMavenArtifact Include="com.google.auto.value.auto-value-annotations" />
|
||||
<_AndroidXMavenArtifact Include="com.google.code.findbugs.jsr305" />
|
||||
<_AndroidXMavenArtifact Include="com.google.code.gson.gson" />
|
||||
<_AndroidXMavenArtifact Include="com.google.crypto.tink.tink-android" />
|
||||
<_AndroidXMavenArtifact Include="com.google.errorprone.error_prone_annotations" />
|
||||
<_AndroidXMavenArtifact Include="com.google.firebase.firebase-appindexing" />
|
||||
<_AndroidXMavenArtifact Include="com.google.guava.failureaccess" />
|
||||
<_AndroidXMavenArtifact Include="com.google.guava.guava" />
|
||||
<_AndroidXMavenArtifact Include="com.google.guava.listenablefuture" />
|
||||
<_AndroidXMavenArtifact Include="com.google.j2objc.j2objc-annotations" />
|
||||
<_AndroidXMavenArtifact Include="com.xamarin.androidx.migration" />
|
||||
<_AndroidXMavenArtifact Include="io.reactivex.rxjava2.rxjava" />
|
||||
<_AndroidXMavenArtifact Include="io.reactivex.rxjava3.rxjava" />
|
||||
<_AndroidXMavenArtifact Include="org.checkerframework.checker-qual" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.annotations" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlin.kotlin-reflect" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlin.kotlin-stdlib" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlin.kotlin-stdlib-common" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlin.kotlin-stdlib-jdk7" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlin.kotlin-stdlib-jdk8" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlinx.kotlinx-coroutines-android" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlinx.kotlinx-coroutines-core" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlinx.kotlinx-coroutines-core-jvm" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlinx.kotlinx-coroutines-guava" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlinx.kotlinx-coroutines-jdk8" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlinx.kotlinx-coroutines-reactive" />
|
||||
<_AndroidXMavenArtifact Include="org.jetbrains.kotlinx.kotlinx-coroutines-rx2" />
|
||||
<_AndroidXMavenArtifact Include="org.reactivestreams.reactive-streams" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,416 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<UsingTask TaskName="Xamarin.AndroidX.Migration.BuildTasks.CecilfyFiles"
|
||||
AssemblyFile="$(MSBuildThisFileDirectory)Xamarin.AndroidX.Migration.BuildTasks.dll" />
|
||||
<UsingTask TaskName="Xamarin.AndroidX.Migration.BuildTasks.JetifyFiles"
|
||||
AssemblyFile="$(MSBuildThisFileDirectory)Xamarin.AndroidX.Migration.BuildTasks.dll" />
|
||||
<UsingTask TaskName="Xamarin.AndroidX.Migration.BuildTasks.ValidateAndroidXPackages"
|
||||
AssemblyFile="$(MSBuildThisFileDirectory)Xamarin.AndroidX.Migration.BuildTasks.dll" />
|
||||
<UsingTask TaskName="Xamarin.AndroidX.Migration.BuildTasks.ResolveEmbeddedFiles"
|
||||
AssemblyFile="$(MSBuildThisFileDirectory)Xamarin.AndroidX.Migration.BuildTasks.dll" />
|
||||
<!--
|
||||
<UsingTask TaskName="Xamarin.AndroidX.Migration.BuildTasks.RemoveSkippedEmbeddedFiles"
|
||||
AssemblyFile="$(MSBuildThisFileDirectory)Xamarin.AndroidX.Migration.BuildTasks.dll" />
|
||||
<UsingTask TaskName="Xamarin.AndroidX.Migration.BuildTasks.CollectAllFiles"
|
||||
AssemblyFile="$(MSBuildThisFileDirectory)Xamarin.AndroidX.Migration.BuildTasks.dll" />
|
||||
-->
|
||||
|
||||
<!-- public properties -->
|
||||
<PropertyGroup>
|
||||
<!-- a flag to control whether or not to entirely disable migration -->
|
||||
<AndroidXSkipMigration Condition="'$(AndroidXSkipMigration)' == ''">false</AndroidXSkipMigration>
|
||||
|
||||
<!-- a flag for checking the installed packages -->
|
||||
<AndroidXSkipValidateInstalledPackages Condition="'$(AndroidXSkipValidateInstalledPackages)' == ''">false</AndroidXSkipValidateInstalledPackages>
|
||||
<AndroidXPackageValidationUseWarnings Condition="'$(AndroidXPackageValidationUseWarnings)' == ''">false</AndroidXPackageValidationUseWarnings>
|
||||
|
||||
<!-- a flag for checking the Xamarin.Android version -->
|
||||
<AndroidXSkipValidateXamarinAndroid Condition="'$(AndroidXSkipValidateXamarinAndroid)' == ''">false</AndroidXSkipValidateXamarinAndroid>
|
||||
<AndroidXXamarinAndroidValidationUseWarnings Condition="'$(AndroidXXamarinAndroidValidationUseWarnings)' == ''">false</AndroidXXamarinAndroidValidationUseWarnings>
|
||||
|
||||
<!-- always use portable pdb so we can cecilfy and not cause issues -->
|
||||
<AndroidXAlwaysUsePortablePdb Condition="'$(AndroidXAlwaysUsePortablePdb)' == ''">true</AndroidXAlwaysUsePortablePdb>
|
||||
<DebugType Condition="'$(AndroidXAlwaysUsePortablePdb)' == 'true'">portable</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- "private" properties -->
|
||||
<PropertyGroup>
|
||||
<_AndroidXShouldRunMigration Condition="'$(_AndroidXShouldRunMigration)' == '' and ('$(AndroidApplication)' == 'true' or '$(OutputType)' == 'Exe') and '$(AndroidXIsUsingAndroidXLibraries)' == 'true' and '$(AndroidXSkipMigration)' != 'true'">true</_AndroidXShouldRunMigration>
|
||||
<_AndroidXIntermediateOutputPath>$(IntermediateOutputPath)androidx\</_AndroidXIntermediateOutputPath>
|
||||
<_AndroidXProguardIntermediateOutputPath>$(_AndroidXIntermediateOutputPath)proguard\</_AndroidXProguardIntermediateOutputPath>
|
||||
<_AndroidXJavaLibraryIntermediateOutputPath>$(_AndroidXIntermediateOutputPath)jl\</_AndroidXJavaLibraryIntermediateOutputPath>
|
||||
<_AndroidXUseVerboseToolOutput Condition="'$(_AndroidXUseVerboseToolOutput)' == ''">false</_AndroidXUseVerboseToolOutput>
|
||||
<_AndroidXParallelJetifier Condition="'$(_AndroidXParallelJetifier)' == ''">true</_AndroidXParallelJetifier>
|
||||
|
||||
<!-- Skip the Android.Support checks if we aren't using Android Support -->
|
||||
<XamarinAndroidSupportSkipVerifyVersions Condition="'$(XamarinAndroidSupportSkipVerifyVersions)' == '' and '$(_AndroidXShouldRunMigration)' == 'true'">true</XamarinAndroidSupportSkipVerifyVersions>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- we want to ignore everything for the Android Support Java bits -->
|
||||
<ItemDefinitionGroup Condition="'$(_AndroidXShouldRunMigration)' == 'true'">
|
||||
<_AndroidXSupportAssemblyToSkip>
|
||||
<AndroidSkipResourceExtraction>true</AndroidSkipResourceExtraction>
|
||||
<AndroidSkipJavaStubGeneration>true</AndroidSkipJavaStubGeneration>
|
||||
<AndroidSkipAddToPackage>true</AndroidSkipAddToPackage>
|
||||
<AndroidSkipResourceProcessing>true</AndroidSkipResourceProcessing>
|
||||
<AndroidXSkipAndroidXMigration>true</AndroidXSkipAndroidXMigration>
|
||||
</_AndroidXSupportAssemblyToSkip>
|
||||
<_AndroidXAssemblyToSkip>
|
||||
<AndroidSkipResourceProcessing>true</AndroidSkipResourceProcessing>
|
||||
<AndroidXSkipAndroidXMigration>true</AndroidXSkipAndroidXMigration>
|
||||
</_AndroidXAssemblyToSkip>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<!-- add all the items to ignore -->
|
||||
<ItemGroup Condition="'$(_AndroidXShouldRunMigration)' == 'true'">
|
||||
<_AndroidXSupportAssemblyToSkip Include="@(_AndroidXSupportAssembly)" />
|
||||
<_AndroidXAssemblyToSkip Include="@(_AndroidXAssembly)" />
|
||||
<_AndroidXMavenArtifactToSkip Include="@(_AndroidXMavenArtifact)" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- let the build system append all the metadata to the assemblies -->
|
||||
<ItemGroup Condition="'$(_AndroidXShouldRunMigration)' == 'true'">
|
||||
<AndroidCustomMetaDataForReferences Include="@(_AndroidXSupportAssemblyToSkip)" />
|
||||
<AndroidCustomMetaDataForReferences Include="@(_AndroidXAssemblyToSkip)" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--
|
||||
***************************************************************************
|
||||
* RESOLVE JAVA PATH
|
||||
* This target will make sure that the path to java.exe has been resolved.
|
||||
***************************************************************************
|
||||
-->
|
||||
<Target Name="_AndroidXResolveJavaPath"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'">
|
||||
|
||||
<PropertyGroup>
|
||||
<_AndroidXJavaPath Condition="'$(_AndroidXJavaPath)' == '' and '$(OS)' == 'Unix'">$(JavaSdkDirectory)\bin\java</_AndroidXJavaPath>
|
||||
<_AndroidXJavaPath Condition="'$(_AndroidXJavaPath)' == '' and '$(OS)' != 'Unix'">$(JavaSdkDirectory)\bin\java.exe</_AndroidXJavaPath>
|
||||
</PropertyGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
***************************************************************************
|
||||
* VALIDATE XAMARIN.ANDROID VERSION
|
||||
* This target will make sure that the correct version of Xamarin.Android
|
||||
* is being used.
|
||||
***************************************************************************
|
||||
-->
|
||||
<Target Name="_AndroidXValidateXamarinAndroid"
|
||||
BeforeTargets="BeforeBuild"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true' and '$(AndroidXSkipValidateXamarinAndroid)' != 'true'">
|
||||
|
||||
<PropertyGroup>
|
||||
<_AndroidXMinimumXamarinAndroidVersion>9.4.0</_AndroidXMinimumXamarinAndroidVersion>
|
||||
<_AndroidXXamarinAndroidVersion>$(XamarinAndroidVersion.Split('-')[0])</_AndroidXXamarinAndroidVersion>
|
||||
<_AndroidXXamarinAndroidVersionIsValid Condition="$([System.Version]::Parse($(_AndroidXXamarinAndroidVersion))) >= $([System.Version]::Parse($(_AndroidXMinimumXamarinAndroidVersion)))">true</_AndroidXXamarinAndroidVersionIsValid>
|
||||
<_AndroidXXamarinAndroidVersionMessage>Android X migration requires a minimum Xamarin.Android version of $(_AndroidXMinimumXamarinAndroidVersion). Your version is $(_AndroidXXamarinAndroidVersion). Please upgrade your Xamarin installation to a newer version.</_AndroidXXamarinAndroidVersionMessage>
|
||||
</PropertyGroup>
|
||||
|
||||
<Warning Text="$(_AndroidXXamarinAndroidVersionMessage)"
|
||||
Condition="'$(AndroidXXamarinAndroidValidationUseWarnings)' == 'true' and '$(_AndroidXXamarinAndroidVersionIsValid)' != 'true'" />
|
||||
|
||||
<Error Text="$(_AndroidXXamarinAndroidVersionMessage)"
|
||||
Condition="'$(AndroidXXamarinAndroidValidationUseWarnings)' != 'true' and '$(_AndroidXXamarinAndroidVersionIsValid)' != 'true'" />
|
||||
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
***************************************************************************
|
||||
* VALIDATE INSTALLED PACKAGES
|
||||
* This target will make sure that all the correct Android X pacakges are
|
||||
* installed into the project.
|
||||
***************************************************************************
|
||||
-->
|
||||
<Target Name="_AndroidXValidateInstalledPackages"
|
||||
AfterTargets="ResolveAssemblyReferences"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true' and '$(AndroidXSkipValidateInstalledPackages)' != 'true'">
|
||||
|
||||
<ValidateAndroidXPackages ResolvedAssemblies="@(ReferencePath)"
|
||||
UseWarningsInsteadOfErrors="$(AndroidXPackageValidationUseWarnings)"
|
||||
Verbose="$(_AndroidXUseVerboseToolOutput)">
|
||||
<Output TaskParameter="ContainsSupportAssemblies" PropertyName="_AndroidXContainsSupportAssemblies" />
|
||||
</ValidateAndroidXPackages>
|
||||
|
||||
<PropertyGroup>
|
||||
<_AndroidXShouldRunMigration Condition="'$(_AndroidXContainsSupportAssemblies)' == 'false'">false</_AndroidXShouldRunMigration>
|
||||
</PropertyGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
***************************************************************************
|
||||
* CECILFY
|
||||
* This is a set of targets that will migrate all the managed/.NET
|
||||
* assemblies (the .dll files).
|
||||
***************************************************************************
|
||||
-->
|
||||
<Target Name="_AndroidXCecilfyShrinkFindFiles"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true' and '$(AndroidLinkMode)' != 'none'">
|
||||
|
||||
<ItemGroup>
|
||||
<_AndroidXResolvedUserAssemblies Include="@(ResolvedUserAssemblies)"
|
||||
Condition="'%(ResolvedUserAssemblies.AndroidXSkipAndroidXMigration)' != 'true'" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- pre Xamarin.Android 10.1 uses 'linksrc' -->
|
||||
<ItemGroup>
|
||||
<_AndroidXFileToCecilfy Include="@(_AndroidXResolvedUserAssemblies->'$(MonoAndroidLinkerInputDir)%(Filename)%(Extension)')"
|
||||
Condition="'$(MonoAndroidLinkerInputDir)' != ''" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<!-- Xamarin.Android 10.1 uses the originals, so copy to 'androidx\cecil' -->
|
||||
<Target Name="_AndroidXCecilfyShrinkCopyFiles"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true' and '$(AndroidLinkMode)' != 'none' and '$(MonoAndroidLinkerInputDir)' == ''"
|
||||
Inputs="@(_AndroidXResolvedUserAssemblies)"
|
||||
Outputs="@(_AndroidXResolvedUserAssemblies->'$(IntermediateOutputPath)androidx\cecil\%(Filename)%(Extension)')">
|
||||
|
||||
<ItemGroup>
|
||||
<_AndroidXResolvedPdbs Include="@(_AndroidXResolvedUserAssemblies->'%(RootDir)%(Directory)%(Filename).pdb')" />
|
||||
<_AndroidXResolvedMdbs Include="@(_AndroidXResolvedUserAssemblies->'%(RootDir)%(Directory)%(Filename)%(Extension).mdb')" />
|
||||
<_AndroidXResolvedSymbols Condition="Exists(%(Identity))" Include="@(_AndroidXResolvedPdbs);@(_AndroidXResolvedMdbs)" />
|
||||
</ItemGroup>
|
||||
|
||||
<Copy SourceFiles="@(_AndroidXResolvedUserAssemblies)"
|
||||
DestinationFiles="@(_AndroidXResolvedUserAssemblies->'$(IntermediateOutputPath)androidx\cecil\%(Filename)%(Extension)')" />
|
||||
<Copy SourceFiles="@(_AndroidXResolvedSymbols)"
|
||||
DestinationFiles="@(_AndroidXResolvedSymbols->'$(IntermediateOutputPath)androidx\cecil\%(Filename)%(Extension)')" />
|
||||
|
||||
<ItemGroup>
|
||||
<_AndroidXFileToCecilfy Include="@(_AndroidXResolvedUserAssemblies->'$(IntermediateOutputPath)androidx\cecil\%(Filename)%(Extension)')" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!--Fix up our existing item groups-->
|
||||
<ResolvedAssemblies Remove="@(_AndroidXResolvedUserAssemblies)" />
|
||||
<ResolvedAssemblies Include="@(_AndroidXFileToCecilfy)" />
|
||||
<ResolvedUserAssemblies Remove="@(_AndroidXResolvedUserAssemblies)" />
|
||||
<ResolvedUserAssemblies Include="@(_AndroidXFileToCecilfy)" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FileWrites Include="$(IntermediateOutputPath)androidx\cecil\%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="_AndroidXCecilfyNoShrinkFindFiles"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true' and '$(AndroidLinkMode)' == 'none'">
|
||||
|
||||
<ItemGroup>
|
||||
<_AndroidXFileToCecilfy Include="@(ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssetsDir)%(Filename)%(Extension)')"
|
||||
Condition="('%(ResolvedUserAssemblies.TargetFrameworkIdentifier)' == 'MonoAndroid' or '%(ResolvedUserAssemblies.HasMonoAndroidReference)' == 'true') and ('%(ResolvedUserAssemblies.AndroidXSkipAndroidXMigration)' != 'true')" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="_AndroidXCecilfyNoShrink"
|
||||
DependsOnTargets="_AndroidXCecilfy"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true' and '$(AndroidLinkMode)' == 'none'">
|
||||
</Target>
|
||||
|
||||
<Target Name="_AndroidXCecilfyShrink"
|
||||
DependsOnTargets="_AndroidXCecilfy"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true' and '$(AndroidLinkMode)' != 'none'">
|
||||
</Target>
|
||||
|
||||
<Target Name="_AndroidXCecilfy"
|
||||
DependsOnTargets="_ValidateLinkMode;_AndroidXCecilfyShrinkFindFiles;_AndroidXCecilfyShrinkCopyFiles;_AndroidXCecilfyNoShrinkFindFiles"
|
||||
Inputs="@(_AndroidXFileToCecilfy);$(_AndroidStampDirectory)_CopyIntermediateAssemblies.stamp"
|
||||
Outputs="$(_AndroidStampDirectory)_AndroidXCecilfy.stamp"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'">
|
||||
|
||||
<CecilfyFiles Assemblies="@(_AndroidXFileToCecilfy)"
|
||||
References="@(ResolvedAssemblies)"
|
||||
SkipEmbeddedResources="true"
|
||||
Verbose="$(_AndroidXUseVerboseToolOutput)" />
|
||||
|
||||
<Touch Files="$(_AndroidStampDirectory)_CopyIntermediateAssemblies.stamp;$(_AndroidStampDirectory)_AndroidXCecilfy.stamp" AlwaysCreate="True" />
|
||||
|
||||
<ItemGroup>
|
||||
<FileWrites Include="$(_AndroidStampDirectory)_AndroidXCecilfy.stamp" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<!-- HACK START -->
|
||||
<!-- This is to get around the fact that _ValidateLinkMode is not run when pressing the green arrow in the IDE -->
|
||||
<Target Name="_AndroidXCreatePropertiesCacheFixup"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'"
|
||||
DependsOnTargets="_ValidateLinkMode"
|
||||
BeforeTargets="_CreatePropertiesCache">
|
||||
</Target>
|
||||
<!-- HACK END -->
|
||||
|
||||
<!--
|
||||
***************************************************************************
|
||||
* JETIFY MANIFEST
|
||||
* This target will migrate the AndroidManifest.xml files.
|
||||
***************************************************************************
|
||||
-->
|
||||
<Target Name="_AndroidXJetifyManifest"
|
||||
Inputs="$(IntermediateOutputPath)android\AndroidManifest.xml;$(_AndroidStampDirectory)_GenerateJavaStubs.stamp"
|
||||
Outputs="$(_AndroidStampDirectory)_AndroidXJetifyManifest.stamp"
|
||||
DependsOnTargets="_AndroidXResolveJavaPath"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'">
|
||||
|
||||
<JetifyFiles Files="$(IntermediateOutputPath)android\AndroidManifest.xml"
|
||||
IntermediateFilePath="$(IntermediateOutputPath)androidx\_AndroidXJetifyManifest.jetify"
|
||||
UseIntermediateFile="true"
|
||||
Parallel="$(_AndroidXParallelJetifier)"
|
||||
JavaPath="$(_AndroidXJavaPath)"
|
||||
Verbose="$(_AndroidXUseVerboseToolOutput)" />
|
||||
|
||||
<Touch Files="$(_AndroidStampDirectory)_GenerateJavaStubs.stamp;$(_AndroidStampDirectory)_AndroidXJetifyManifest.stamp" AlwaysCreate="True" />
|
||||
|
||||
<ItemGroup>
|
||||
<FileWrites Include="$(_AndroidStampDirectory)_AndroidXJetifyManifest.stamp;$(IntermediateOutputPath)androidx\_AndroidXJetifyManifest.jetify" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
***************************************************************************
|
||||
* JETIFY EMBEDDED FILES
|
||||
* This target will migrate the .xml resource files and the .jar files
|
||||
* embedded in either .dll files or .aar files.
|
||||
***************************************************************************
|
||||
-->
|
||||
<Target Name="_AndroidXFindJetifyEmbeddedFiles"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'">
|
||||
|
||||
<ResolveEmbeddedFiles ResourceDirectories="@(LibraryResourceDirectories)"
|
||||
JavaLibraries="@(ExtractedJarImports)"
|
||||
Resources="@(_AndroidResourceDest)"
|
||||
OutputImportDirectory="$(_AndroidLibrayProjectIntermediatePath)"
|
||||
AssemblyIdentityMapFile="$(_AndroidLibrayProjectAssemblyMapFile)"
|
||||
ContainersToSkip="@(_AndroidXSupportAssemblyToSkip);@(_AndroidXAssemblyToSkip);@(_AndroidXMavenArtifactToSkip)"
|
||||
Verbose="$(_AndroidXUseVerboseToolOutput)">
|
||||
<Output TaskParameter="OutputFiles" ItemName="_AndroidXEmbeddedFileToJetify" />
|
||||
</ResolveEmbeddedFiles>
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="_AndroidXJetifyEmbeddedFiles"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'"
|
||||
DependsOnTargets="_AndroidXResolveJavaPath;_AndroidXFindJetifyEmbeddedFiles"
|
||||
Inputs="@(_AndroidXEmbeddedFileToJetify->'%(InputItemSpec)');$(_AndroidResFlagFile);$(_AndroidStampDirectory)_ResolveLibraryProjectImports.stamp"
|
||||
Outputs="$(_AndroidStampDirectory)_AndroidXJetifyEmbeddedFiles.stamp">
|
||||
|
||||
<JetifyFiles Files="@(_AndroidXEmbeddedFileToJetify)"
|
||||
IntermediateFilePath="$(IntermediateOutputPath)androidx\_AndroidXJetifyEmbeddedFiles.jetify"
|
||||
UseIntermediateFile="true"
|
||||
Parallel="$(_AndroidXParallelJetifier)"
|
||||
JavaPath="$(_AndroidXJavaPath)"
|
||||
Verbose="$(_AndroidXUseVerboseToolOutput)" />
|
||||
<Touch Files="$(_AndroidResFlagFile);$(_AndroidStampDirectory)_ResolveLibraryProjectImports.stamp;$(_AndroidStampDirectory)_AndroidXJetifyEmbeddedFiles.stamp" AlwaysCreate="True" />
|
||||
|
||||
<ItemGroup>
|
||||
<FileWrites Include="$(_AndroidStampDirectory)_AndroidXJetifyEmbeddedFiles.stamp;$(IntermediateOutputPath)androidx\_AndroidXJetifyEmbeddedFiles.jetify" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<!-- HACK START -->
|
||||
<!-- This is to get around the fact that the resources are modfied in the compile step -->
|
||||
<Target Name="_AndroidXJetifyEmbeddedFilesFixup"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'"
|
||||
AfterTargets="_UpdateAndroidResgen">
|
||||
|
||||
<Touch Files="$(_AndroidStampDirectory)_AndroidXJetifyEmbeddedFiles.stamp" />
|
||||
|
||||
</Target>
|
||||
<!-- HACK END -->
|
||||
|
||||
<!--
|
||||
***************************************************************************
|
||||
* JETIFY PROGUARD FILES
|
||||
* This target will migrate the various proguard files directly added to the
|
||||
* project or via any .targets files in NuGets.
|
||||
***************************************************************************
|
||||
-->
|
||||
<Target Name="_AndroidXFindJetifyProguardFiles"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'">
|
||||
<ItemGroup>
|
||||
<_AndroidXProguardToJetify Include="@(ProguardConfiguration)"
|
||||
Condition="'%(ProguardConfiguration.AndroidXSkipAndroidXMigration)' != 'true'" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="_AndroidXJetifyProguardRules"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'"
|
||||
DependsOnTargets="_AndroidXResolveJavaPath;_AndroidXFindJetifyProguardFiles"
|
||||
Inputs="@(_AndroidXProguardToJetify)"
|
||||
Outputs="$(_AndroidStampDirectory)_AndroidXJetifyProguardRules.stamp">
|
||||
|
||||
<RemoveDir Directories="$(_AndroidXProguardIntermediateOutputPath)" />
|
||||
<JetifyFiles Files="@(_AndroidXProguardToJetify)"
|
||||
JetifiedDirectory="$(_AndroidXProguardIntermediateOutputPath)"
|
||||
IsProGuard="true"
|
||||
IntermediateFilePath="$(IntermediateOutputPath)androidx\_AndroidXJetifyProguardRules.jetify"
|
||||
UseIntermediateFile="true"
|
||||
Parallel="$(_AndroidXParallelJetifier)"
|
||||
JavaPath="$(_AndroidXJavaPath)"
|
||||
Verbose="$(_AndroidXUseVerboseToolOutput)" />
|
||||
<Touch Files="$(_AndroidStampDirectory)_AndroidXJetifyProguardRules.stamp" AlwaysCreate="True" />
|
||||
|
||||
<ItemGroup>
|
||||
<_AndroidXProguardJetified Include="$(_AndroidXProguardIntermediateOutputPath)*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProguardConfiguration Remove="@(_AndroidXProguardToJetify)" />
|
||||
<ProguardConfiguration Include="@(_AndroidXProguardJetified)" />
|
||||
<FileWrites Include="@(_AndroidXProguardJetified);$(_AndroidStampDirectory)_AndroidXJetifyProguardRules.stamp;$(IntermediateOutputPath)androidx\_AndroidXJetifyProguardRules.jetify" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
<!--
|
||||
***************************************************************************
|
||||
* JETIFY JAVA LIBRARY FILES
|
||||
* This target will migrate the various .jar files directly added to the
|
||||
* project or via any .targets files in NuGets.
|
||||
***************************************************************************
|
||||
-->
|
||||
<Target Name="_AndroidXFindJetifyJavaLibraryFiles"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'">
|
||||
<ItemGroup>
|
||||
<_AndroidXJavaLibraryToJetify Include="@(AndroidJavaLibrary)"
|
||||
Condition="'%(AndroidJavaLibrary.AndroidXSkipAndroidXMigration)' != 'true'" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="_AndroidXJetifyJavaLibraryRules"
|
||||
Condition="'$(_AndroidXShouldRunMigration)' == 'true'"
|
||||
DependsOnTargets="_AndroidXResolveJavaPath;_AndroidXFindJetifyJavaLibraryFiles"
|
||||
Inputs="@(_AndroidXJavaLibraryToJetify)"
|
||||
Outputs="$(_AndroidStampDirectory)_AndroidXJetifyJavaLibraryRules.stamp">
|
||||
|
||||
<RemoveDir Directories="$(_AndroidXJavaLibraryIntermediateOutputPath)" />
|
||||
<JetifyFiles Files="@(_AndroidXJavaLibraryToJetify)"
|
||||
JetifiedDirectory="$(_AndroidXJavaLibraryIntermediateOutputPath)"
|
||||
IntermediateFilePath="$(IntermediateOutputPath)androidx\_AndroidXJetifyJavaLibraryRules.jetify"
|
||||
UseIntermediateFile="true"
|
||||
Parallel="$(_AndroidXParallelJetifier)"
|
||||
JavaPath="$(_AndroidXJavaPath)"
|
||||
Verbose="$(_AndroidXUseVerboseToolOutput)" />
|
||||
<Touch Files="$(_AndroidStampDirectory)_AndroidXJetifyJavaLibraryRules.stamp;$(IntermediateOutputPath)androidx\_AndroidXJetifyJavaLibraryRules.jetify" AlwaysCreate="True" />
|
||||
|
||||
<ItemGroup>
|
||||
<_AndroidXJavaLibraryJetified Include="$(_AndroidXJavaLibraryIntermediateOutputPath)*" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AndroidJavaLibrary Remove="@(_AndroidXJavaLibraryToJetify)" />
|
||||
<AndroidJavaLibrary Include="@(_AndroidXJavaLibraryJetified)" />
|
||||
<FileWrites Include="@(_AndroidXJavaLibraryJetified);$(_AndroidStampDirectory)_AndroidXJetifyJavaLibraryRules.stamp" />
|
||||
</ItemGroup>
|
||||
|
||||
</Target>
|
||||
|
||||
</Project>
|
|
@ -1,55 +0,0 @@
|
|||
Xamarin AndroidX Migration
|
||||
==========================
|
||||
|
||||
If you are looking for the source code to the _Xamarin AndroidX bindings_,
|
||||
it is available in the "AndroidX" repo:
|
||||
|
||||
https://github.com/xamarin/AndroidX/
|
||||
|
||||
The Migration package helps apps which are transitioning to AndroidX but haven't
|
||||
yet updated their own source code to the new AndroidX API's, or still depend on
|
||||
third party libraries which have not been updated to use the new AndroidX API's.
|
||||
|
||||
|
||||
Add the Xamarin.AndroidX.Migration NuGet package to your app
|
||||
------------------------------------------------------------
|
||||
|
||||
You should add the `Xamarin.AndroidX.Migration` NuGet package to your Xamarin
|
||||
Android application project and any Xamarin.Android library projects it
|
||||
references.
|
||||
|
||||
|
||||
Keep the Xamarin.Android.Support.* NuGet packages
|
||||
-------------------------------------------------
|
||||
|
||||
You will need to keep your existing references to Xamarin.Android.Support.*
|
||||
NuGet packages as any remaining usage of the old Android Support API's will
|
||||
require this for compiling before the migration build step does its job. The
|
||||
Android Support libraries will not be bundled into your apk.
|
||||
|
||||
|
||||
Add references to the correct AndroidX NuGet packages
|
||||
-----------------------------------------------------
|
||||
|
||||
The migration package contains a validation step which helps ensure you have
|
||||
references to all of the AndroidX NuGet packages that the Android Support
|
||||
library NuGet packages you reference in your app map to.
|
||||
|
||||
You will see a build error generated telling you which packages are missing
|
||||
which you need to add.
|
||||
|
||||
|
||||
When can I remove the Migration package?
|
||||
----------------------------------------
|
||||
|
||||
As soon as all of your own source code, layout files, proguard configurations,
|
||||
and manifest files are converted over to using the new AndroidX API's, and all
|
||||
of the libraries you depend on have done the same, you can safely remove the
|
||||
AndroidX Migration NuGet package along with all of the old Android Support
|
||||
library NuGet packages.
|
||||
|
||||
|
||||
Current Limitations or known issues
|
||||
-----------------------------------
|
||||
|
||||
- Android Designer may become unusable after adding AndroidX Migration package
|
|
@ -1,11 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<PackageId>Xamarin.AndroidX.Migration</PackageId>
|
||||
<IsPackable>false</IsPackable>
|
||||
<PackageVersion>$(MigrationPackageVersion)</PackageVersion>
|
||||
<Nullable>disable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="bin/main" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
</classpath>
|
|
@ -1,2 +0,0 @@
|
|||
# Undo the main ignore
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="useAutoImport" value="true" />
|
||||
<option name="useQualifiedModuleNames" value="true" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
|
@ -1,69 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalProjectsData">
|
||||
<projectState path="$PROJECT_DIR$">
|
||||
<ProjectState />
|
||||
</projectState>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../../.." />
|
||||
</component>
|
||||
<component name="ProjectId" id="1Q5wuMtEGCP4KdNNXUlq5L8YQET" />
|
||||
<component name="PropertiesComponent">
|
||||
<property name="ASKED_ADD_EXTERNAL_FILES" value="true" />
|
||||
<property name="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
|
||||
<property name="project.structure.last.edited" value="Libraries" />
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.21130031" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Application.Main">
|
||||
<configuration name="Main" type="Application" factoryName="Application" nameIsGenerated="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.xamarin.androidx.jetifierWrapper.Main" />
|
||||
<module name="jetifierWrapper.main" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="com.xamarin.androidx.jetifierWrapper.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration name="jetifierWrapper [jar]" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="externalSystemIdString" value="GRADLE" />
|
||||
<option name="scriptParameters" />
|
||||
<option name="taskDescriptions">
|
||||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="jar" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
||||
<GradleScriptDebugEnabled>true</GradleScriptDebugEnabled>
|
||||
<method v="2" />
|
||||
</configuration>
|
||||
<list>
|
||||
<item itemvalue="Application.Main" />
|
||||
<item itemvalue="Gradle.jetifierWrapper [jar]" />
|
||||
</list>
|
||||
</component>
|
||||
</project>
|
|
@ -1,34 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>jetifierWrapper</name>
|
||||
<comment>Project JetifierWrapper created by Buildship.</comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1633513535677</id>
|
||||
<name></name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.core.resources.regexFilterMatcher</id>
|
||||
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
|
@ -1,13 +0,0 @@
|
|||
arguments=
|
||||
auto.sync=false
|
||||
build.scans.enabled=false
|
||||
connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
|
||||
connection.project.dir=
|
||||
eclipse.preferences.version=1
|
||||
gradle.user.home=
|
||||
java.home=/Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home
|
||||
jvm.arguments=
|
||||
offline.mode=false
|
||||
override.workspace.settings=true
|
||||
show.console.view=true
|
||||
show.executions.view=true
|
|
@ -1,4 +0,0 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
|
@ -1,39 +0,0 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id "de.undercouch.download" version "4.0.0"
|
||||
}
|
||||
|
||||
group 'com.xamarin.androidx'
|
||||
version '1.0'
|
||||
|
||||
def jetifierVersion = '1.0.0-beta08'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: "$buildDir/jetifier-standalone/lib", include: ['*.jar'])
|
||||
}
|
||||
|
||||
task downloadZipFile(type: Download) {
|
||||
src "https://dl.google.com/dl/android/studio/jetifier-zips/$jetifierVersion/jetifier-standalone.zip"
|
||||
dest new File(buildDir, 'jetifier-standalone.zip')
|
||||
onlyIfModified true
|
||||
}
|
||||
|
||||
task downloadAndUnzipFile(dependsOn: downloadZipFile, type: Copy) {
|
||||
from zipTree(downloadZipFile.dest)
|
||||
into buildDir
|
||||
}
|
||||
|
||||
compileJava {
|
||||
dependsOn downloadAndUnzipFile
|
||||
}
|
||||
|
||||
jar {
|
||||
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
# Project-wide Gradle settings.
|
||||
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
Двоичный файл не отображается.
|
@ -1,6 +0,0 @@
|
|||
#Mon Nov 25 22:32:57 CAT 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip
|
|
@ -1,172 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
|
@ -1,84 +0,0 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
|
@ -1,2 +0,0 @@
|
|||
rootProject.name = 'jetifierWrapper'
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Main-Class: com.xamarin.androidx.jetifierWrapper.Main
|
||||
Created-By: 0.1.0 (© Microsoft Corporation. All rights reserved.)
|
||||
Name: Jetifier Wrapper
|
||||
Specification-Title: Xamarin AndroidX Jetifier Wrapper
|
||||
Specification-Version: 0.1.0
|
||||
Specification-Vendor: © Microsoft Corporation. All rights reserved.
|
|
@ -1,38 +0,0 @@
|
|||
package com.xamarin.androidx.jetifierWrapper;
|
||||
|
||||
import com.android.tools.build.jetifier.processor.archive.ArchiveFile;
|
||||
import com.android.tools.build.jetifier.processor.archive.ArchiveItem;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import static com.android.tools.build.jetifier.standalone.Main.Companion;
|
||||
|
||||
class JetifierCallable implements Callable<JetifierData> {
|
||||
private JetifierData jetifierData;
|
||||
|
||||
public JetifierCallable (JetifierData jetifierData) {
|
||||
this.jetifierData = jetifierData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JetifierData call() throws Exception {
|
||||
if (jetifierData.isLibrary())
|
||||
Companion.main(jetifierData.getArguments());
|
||||
else if (jetifierData.isResource()) {
|
||||
jetifierData.getProcessor().visit((ArchiveFile)jetifierData.getArchiveItem());
|
||||
save(jetifierData.getArchiveItem(), jetifierData.getFileMapping().getTo().getAbsolutePath());
|
||||
} else if (jetifierData.isProGuard()) {
|
||||
jetifierData.getProGuardTransformer().runTransform((ArchiveFile)jetifierData.getArchiveItem());
|
||||
save(jetifierData.getArchiveItem(), jetifierData.getFileMapping().getTo().getAbsolutePath());
|
||||
}
|
||||
|
||||
return jetifierData;
|
||||
}
|
||||
|
||||
private void save(ArchiveItem archiveItem, String outputFilename) throws IOException {
|
||||
FileOutputStream outputStream = new FileOutputStream(outputFilename);
|
||||
archiveItem.writeSelfTo(outputStream);
|
||||
}
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
package com.xamarin.androidx.jetifierWrapper;
|
||||
|
||||
import com.android.tools.build.jetifier.processor.FileMapping;
|
||||
import com.android.tools.build.jetifier.processor.Processor;
|
||||
import com.android.tools.build.jetifier.processor.archive.ArchiveItem;
|
||||
import com.android.tools.build.jetifier.processor.transform.proguard.ProGuardTransformer;
|
||||
|
||||
class JetifierData {
|
||||
private FileMapping fileMapping;
|
||||
private String[] arguments;
|
||||
private ArchiveItem archiveItem;
|
||||
private Processor processor;
|
||||
private ProGuardTransformer proGuardTransformer;
|
||||
private boolean isLibrary;
|
||||
private boolean isResource;
|
||||
private boolean isProGuard;
|
||||
|
||||
public JetifierData (FileMapping fileMapping, String[] arguments) {
|
||||
this.fileMapping = fileMapping;
|
||||
this.arguments = arguments;
|
||||
this.isLibrary = true;
|
||||
}
|
||||
|
||||
public JetifierData (FileMapping fileMapping, ArchiveItem archiveItem, Processor processor) {
|
||||
this.fileMapping = fileMapping;
|
||||
this.archiveItem = archiveItem;
|
||||
this.processor = processor;
|
||||
this.isResource = true;
|
||||
}
|
||||
|
||||
public JetifierData (FileMapping fileMapping, ArchiveItem archiveItem, ProGuardTransformer proGuardTransformer) {
|
||||
this.fileMapping = fileMapping;
|
||||
this.archiveItem = archiveItem;
|
||||
this.proGuardTransformer = proGuardTransformer;
|
||||
this.isProGuard = true;
|
||||
}
|
||||
|
||||
public FileMapping getFileMapping() {
|
||||
return fileMapping;
|
||||
}
|
||||
|
||||
public String[] getArguments() {
|
||||
return arguments;
|
||||
}
|
||||
|
||||
public ArchiveItem getArchiveItem() {
|
||||
return archiveItem;
|
||||
}
|
||||
|
||||
public Processor getProcessor() {
|
||||
return processor;
|
||||
}
|
||||
|
||||
public ProGuardTransformer getProGuardTransformer() {
|
||||
return proGuardTransformer;
|
||||
}
|
||||
|
||||
public boolean isLibrary() {
|
||||
return isLibrary;
|
||||
}
|
||||
|
||||
public boolean isResource() {
|
||||
return isResource;
|
||||
}
|
||||
|
||||
public boolean isProGuard() {
|
||||
return isProGuard;
|
||||
}
|
||||
}
|
|
@ -1,319 +0,0 @@
|
|||
package com.xamarin.androidx.jetifierWrapper;
|
||||
|
||||
import com.android.tools.build.jetifier.core.config.*;
|
||||
import com.android.tools.build.jetifier.core.pom.DependencyVersions;
|
||||
import com.android.tools.build.jetifier.core.utils.Log;
|
||||
import com.android.tools.build.jetifier.processor.FileMapping;
|
||||
import com.android.tools.build.jetifier.processor.Processor;
|
||||
import com.android.tools.build.jetifier.processor.archive.*;
|
||||
import com.android.tools.build.jetifier.processor.transform.TransformationContext;
|
||||
import com.android.tools.build.jetifier.processor.transform.proguard.ProGuardTransformer;
|
||||
|
||||
import org.apache.commons.cli.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.nio.file.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Scanner;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
import static com.android.tools.build.jetifier.standalone.Main.Companion;
|
||||
|
||||
public class Main {
|
||||
private static final int MAX_THREADS = 10;
|
||||
private static final Options OPTIONS;
|
||||
private static Option INPUT_OPTION;
|
||||
private static Option OUTPUT_OPTION;
|
||||
private static Option CONFIG_OPTION;
|
||||
private static Option LOG_LEVEL_OPTION;
|
||||
private static Option REVERSED_OPTION;
|
||||
private static Option STRICT_OPTION;
|
||||
private static Option REBUILD_TOP_OF_TREE_OPTION;
|
||||
private static Option STRIP_SIGNATURES_OPTION;
|
||||
private static Option PRO_GUARD_OPTION;
|
||||
private static Option INTERMEDIATE_OPTION;
|
||||
private static Option PARALLEL_OPTION;
|
||||
private static Option HELP_OPTION;
|
||||
|
||||
private static boolean IS_REVERSED;
|
||||
private static boolean IS_STRICT;
|
||||
private static boolean SHOULD_REBUILD_TOP_OF_TREE;
|
||||
private static boolean SHOULD_STRIP_SIGNATURES;
|
||||
private static boolean IS_PRO_GUARD;
|
||||
private static boolean HAS_INTERMEDIATE;
|
||||
private static boolean HAS_LOG_LEVEL;
|
||||
private static boolean HAS_CONFIG;
|
||||
private static boolean IS_PARALLEL;
|
||||
private static boolean HAS_INPUTS;
|
||||
private static boolean HAS_OUTPUTS;
|
||||
|
||||
private static CommandLine COMMAND_LINE;
|
||||
|
||||
private static List<String> INPUT_VALUES;
|
||||
private static List<String> OUTPUT_VALUES;
|
||||
|
||||
private static Config JETIFIER_CONFIG;
|
||||
private static Processor JETIFIER_PROCESSOR;
|
||||
private static ProGuardTransformer PRO_GUARD_TRANSFORMER;
|
||||
|
||||
private static long START_TIME;
|
||||
private static long END_TIME;
|
||||
|
||||
public static void main(String[] args) {
|
||||
// create options
|
||||
createOptionsFromJetifier();
|
||||
INPUT_OPTION = OPTIONS.getOption("i");
|
||||
OUTPUT_OPTION = OPTIONS.getOption("o");
|
||||
CONFIG_OPTION = OPTIONS.getOption("c");
|
||||
LOG_LEVEL_OPTION = OPTIONS.getOption("l");
|
||||
REVERSED_OPTION = OPTIONS.getOption("r");
|
||||
STRICT_OPTION = OPTIONS.getOption("s");
|
||||
REBUILD_TOP_OF_TREE_OPTION = OPTIONS.getOption("rebuildTopOfTree");
|
||||
STRIP_SIGNATURES_OPTION = OPTIONS.getOption("stripSignatures");
|
||||
PRO_GUARD_OPTION = OPTIONS.getOption("isProGuard");
|
||||
INTERMEDIATE_OPTION = OPTIONS.getOption("intermediate");
|
||||
PARALLEL_OPTION = OPTIONS.getOption("p");
|
||||
HELP_OPTION = OPTIONS.getOption("h");
|
||||
|
||||
// parse options
|
||||
try {
|
||||
COMMAND_LINE = new DefaultParser().parse(OPTIONS, args);
|
||||
} catch (ParseException e) {
|
||||
Log.INSTANCE.e("Main", e.getMessage());
|
||||
printHelp();
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
if (COMMAND_LINE.hasOption(HELP_OPTION.getOpt())) {
|
||||
printHelp();
|
||||
System.exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
HAS_CONFIG = COMMAND_LINE.hasOption(CONFIG_OPTION.getOpt());
|
||||
HAS_LOG_LEVEL = COMMAND_LINE.hasOption(LOG_LEVEL_OPTION.getOpt());
|
||||
IS_REVERSED = COMMAND_LINE.hasOption(REVERSED_OPTION.getOpt());
|
||||
IS_STRICT = COMMAND_LINE.hasOption(STRICT_OPTION.getOpt());
|
||||
SHOULD_REBUILD_TOP_OF_TREE = COMMAND_LINE.hasOption(REBUILD_TOP_OF_TREE_OPTION.getOpt());
|
||||
SHOULD_STRIP_SIGNATURES = COMMAND_LINE.hasOption(STRIP_SIGNATURES_OPTION.getOpt());
|
||||
IS_PRO_GUARD = COMMAND_LINE.hasOption(PRO_GUARD_OPTION.getOpt());
|
||||
HAS_INTERMEDIATE = COMMAND_LINE.hasOption(INTERMEDIATE_OPTION.getOpt());
|
||||
IS_PARALLEL = COMMAND_LINE.hasOption(PARALLEL_OPTION.getOpt());
|
||||
HAS_INPUTS = COMMAND_LINE.hasOption(INPUT_OPTION.getOpt());
|
||||
HAS_OUTPUTS = COMMAND_LINE.hasOption(OUTPUT_OPTION.getOpt());
|
||||
|
||||
INPUT_VALUES = new ArrayList<>();
|
||||
OUTPUT_VALUES = new ArrayList<>();
|
||||
|
||||
if (HAS_INPUTS || HAS_OUTPUTS) {
|
||||
String[] inputs = COMMAND_LINE.getOptionValues(INPUT_OPTION.getOpt());
|
||||
String[] outputs = COMMAND_LINE.getOptionValues(OUTPUT_OPTION.getOpt());
|
||||
|
||||
if (HAS_INPUTS != HAS_OUTPUTS || inputs.length != outputs.length) {
|
||||
Log.INSTANCE.e("Main", "The length of inputs and outputs must be the same.");
|
||||
printHelp();
|
||||
System.exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
Collections.addAll(INPUT_VALUES, inputs);
|
||||
Collections.addAll(OUTPUT_VALUES, outputs);
|
||||
}
|
||||
|
||||
if (HAS_INTERMEDIATE) {
|
||||
String intermediatePath = COMMAND_LINE.getOptionValue(INTERMEDIATE_OPTION.getOpt());
|
||||
try {
|
||||
loadIntermediateFile(intermediatePath, INPUT_VALUES, OUTPUT_VALUES);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
JETIFIER_CONFIG = ConfigParser.INSTANCE.loadDefaultConfig();
|
||||
|
||||
try {
|
||||
executeJetifier();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
END_TIME = System.currentTimeMillis();
|
||||
double duration = (END_TIME - START_TIME) / 1000.0;
|
||||
|
||||
Log.INSTANCE.i("Main","The jetifier process took: " + duration + " seconds");
|
||||
}
|
||||
|
||||
private static void loadIntermediateFile(String intermediatePath, List<String> inputs, List<String> outputs) throws FileNotFoundException {
|
||||
Scanner sc = new Scanner(new File(intermediatePath), "UTF-8");
|
||||
List<String> lines = new ArrayList<String>();
|
||||
while (sc.hasNextLine()) {
|
||||
String line = sc.nextLine();
|
||||
if (line.isEmpty())
|
||||
continue;
|
||||
String[] parts = line.split(";");
|
||||
inputs.add(parts[0]);
|
||||
if (parts.length > 0)
|
||||
outputs.add(parts[1]);
|
||||
else
|
||||
outputs.add(parts[0]);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createOptionsFromJetifier() {
|
||||
for (Option option : Companion.getOPTIONS().getOptions()) {
|
||||
String description = option.getDescription();
|
||||
boolean hasArguments = option.hasArgs();
|
||||
boolean isRequired = option.isRequired();
|
||||
|
||||
switch (option.getOpt()) {
|
||||
case "i":
|
||||
case "o":
|
||||
description += ". Can be used multiple times";
|
||||
hasArguments = true;
|
||||
isRequired = false;
|
||||
break;
|
||||
case "c":
|
||||
case "l":
|
||||
hasArguments = true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
OPTIONS.addOption(createOption(option.getOpt(), option.getLongOpt(), description, hasArguments, isRequired));
|
||||
}
|
||||
|
||||
OPTIONS.addOption(createOption("isProGuard", "isProGuard", "Files should be processed as ProGuard files.", false, false));
|
||||
OPTIONS.addOption(createOption("intermediate", "intermediate", "Files should be read from the intermediate file.", true, false));
|
||||
OPTIONS.addOption(createOption("p", "parallel", "Jetifiy the aar/zip files in parallel.", false, false));
|
||||
OPTIONS.addOption(createOption("h", "help", "Show this message.", false, false));
|
||||
}
|
||||
|
||||
private static final Option createOption(final String argumentName, final String argumentNameLong, final String description, final boolean hasArguments, final boolean isRequired) {
|
||||
final Option op = new Option(argumentName, argumentNameLong, hasArguments, description);
|
||||
op.setRequired(isRequired);
|
||||
return op;
|
||||
}
|
||||
|
||||
private static void printHelp() {
|
||||
new HelpFormatter().printHelp("Jetifier Wrapper", OPTIONS);
|
||||
}
|
||||
|
||||
private static ProGuardTransformer createProGuardTransformer() {
|
||||
DependencyVersions versionsMap = DependencyVersions.Companion.parseFromVersionSetTypeId(JETIFIER_CONFIG.getVersionsMap(), null);
|
||||
TransformationContext transformationContext = new TransformationContext(JETIFIER_CONFIG, SHOULD_REBUILD_TOP_OF_TREE, IS_REVERSED, !IS_STRICT, false, versionsMap);
|
||||
return new ProGuardTransformer (transformationContext);
|
||||
}
|
||||
|
||||
private static void executeJetifier() throws IOException {
|
||||
int inputsLength = INPUT_VALUES.size();
|
||||
int threads = (inputsLength > MAX_THREADS) ? MAX_THREADS : inputsLength;
|
||||
int numberOfThreads = IS_PARALLEL ? threads : 1;
|
||||
|
||||
Log.INSTANCE.i("Main", "Executing jetifier tool in " + (IS_PARALLEL ? "parallel" : "serial") + "way.");
|
||||
|
||||
ExecutorService executor = Executors.newFixedThreadPool(numberOfThreads);
|
||||
List<Future<JetifierData>> jetifierWorks = new ArrayList<>();
|
||||
|
||||
if (IS_PRO_GUARD) {
|
||||
PRO_GUARD_TRANSFORMER = createProGuardTransformer();
|
||||
} else {
|
||||
JETIFIER_PROCESSOR = Processor.Companion.createProcessor3(JETIFIER_CONFIG, IS_REVERSED, SHOULD_REBUILD_TOP_OF_TREE, !IS_STRICT, false, SHOULD_STRIP_SIGNATURES, null);
|
||||
}
|
||||
|
||||
for (int i = 0; i < inputsLength; i++) {
|
||||
String inputFile = INPUT_VALUES.get(i);
|
||||
String outputFile = OUTPUT_VALUES.get(i);
|
||||
FileMapping fileMapping = new FileMapping(new File(inputFile), new File(outputFile));
|
||||
|
||||
JetifierData jetifierData = null;
|
||||
if (IS_PRO_GUARD) {
|
||||
ArchiveItem archiveItem = getArchiveFile(inputFile);
|
||||
jetifierData = new JetifierData(fileMapping, archiveItem, PRO_GUARD_TRANSFORMER);
|
||||
} else {
|
||||
String from = inputFile.toLowerCase();
|
||||
if (from.endsWith(".aar") || from.endsWith(".zip") || from.endsWith(".jar")) {
|
||||
String[] arguments = getArgumentsForJetifier(inputFile, outputFile);
|
||||
jetifierData = new JetifierData(fileMapping, arguments);
|
||||
} else {
|
||||
ArchiveItem archiveItem = getArchiveFile(inputFile);
|
||||
jetifierData = new JetifierData(fileMapping, archiveItem, JETIFIER_PROCESSOR);
|
||||
}
|
||||
}
|
||||
|
||||
Log.INSTANCE.v("Main", "Jetifiying " + inputFile + " file into " + outputFile + " file.");
|
||||
|
||||
Callable<JetifierData> jetifier = new JetifierCallable(jetifierData);
|
||||
Future<JetifierData> jetifierWork = executor.submit(jetifier);
|
||||
jetifierWorks.add(jetifierWork);
|
||||
}
|
||||
|
||||
for (Future<JetifierData> jetifierWork : jetifierWorks) {
|
||||
try {
|
||||
JetifierData jetifierData = jetifierWork.get();
|
||||
Log.INSTANCE.v("Main", "File " + jetifierData.getFileMapping().getFrom().getAbsolutePath() + " jetified into " + jetifierData.getFileMapping().getTo().getAbsolutePath() + " file.");
|
||||
} catch (InterruptedException e) {
|
||||
Log.INSTANCE.e("Main", e.getMessage());
|
||||
} catch (ExecutionException e) {
|
||||
Log.INSTANCE.e("Main", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
executor.shutdown();
|
||||
}
|
||||
|
||||
private static String[] getArgumentsForJetifier(String inputFile, String outputFile) {
|
||||
ArrayList<String> argumentsList = new ArrayList<>();
|
||||
|
||||
if (HAS_CONFIG) {
|
||||
argumentsList.add("-" + CONFIG_OPTION.getOpt());
|
||||
argumentsList.add(COMMAND_LINE.getOptionValue(CONFIG_OPTION.getOpt()));
|
||||
}
|
||||
|
||||
if (HAS_LOG_LEVEL) {
|
||||
String logLevel = COMMAND_LINE.getOptionValue(LOG_LEVEL_OPTION.getOpt());
|
||||
Log.INSTANCE.setLevel(logLevel);
|
||||
argumentsList.add("-" + LOG_LEVEL_OPTION.getOpt());
|
||||
argumentsList.add(logLevel);
|
||||
}
|
||||
|
||||
if (IS_REVERSED)
|
||||
argumentsList.add("-" + REVERSED_OPTION.getOpt());
|
||||
|
||||
if (IS_STRICT)
|
||||
argumentsList.add("-" + STRICT_OPTION.getOpt());
|
||||
|
||||
if (SHOULD_REBUILD_TOP_OF_TREE)
|
||||
argumentsList.add("-" + REBUILD_TOP_OF_TREE_OPTION.getOpt());
|
||||
|
||||
if (SHOULD_STRIP_SIGNATURES)
|
||||
argumentsList.add("-" + STRIP_SIGNATURES_OPTION.getOpt());
|
||||
|
||||
argumentsList.add("-i");
|
||||
argumentsList.add(inputFile);
|
||||
|
||||
argumentsList.add("-o");
|
||||
argumentsList.add(outputFile);
|
||||
|
||||
String[] arguments = new String[argumentsList.size()];
|
||||
return argumentsList.toArray(arguments);
|
||||
}
|
||||
|
||||
public static ArchiveFile getArchiveFile(String inputFilename) throws IOException {
|
||||
Path path = Paths.get(inputFilename);
|
||||
byte[] fileContent = Files.readAllBytes(path);
|
||||
return new ArchiveFile(path, fileContent);
|
||||
}
|
||||
|
||||
static {
|
||||
START_TIME = System.currentTimeMillis();
|
||||
OPTIONS = new Options();
|
||||
}
|
||||
}
|
|
@ -1,70 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class AndroidXAssembliesCsvMapping : CsvMapping
|
||||
{
|
||||
private readonly SortedDictionary<string, string> assemblyMapping = new SortedDictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly SortedDictionary<string, string> packageMapping = new SortedDictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly SortedDictionary<string, string> versionMapping = new SortedDictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
public AndroidXAssembliesCsvMapping()
|
||||
{
|
||||
LoadMapping(Resources.AssembliesMappingPath);
|
||||
}
|
||||
|
||||
public AndroidXAssembliesCsvMapping(string mappingFile)
|
||||
: base(mappingFile)
|
||||
{
|
||||
}
|
||||
|
||||
public AndroidXAssembliesCsvMapping(Stream csv)
|
||||
: base(csv)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnLoadRecord(string[] record)
|
||||
{
|
||||
if (record.Length < (int)Column.AndroidXNuGet)
|
||||
return;
|
||||
|
||||
var supportAssembly = record[(int)Column.SupportNetAssembly];
|
||||
var xAssembly = record[(int)Column.AndroidXNetAssembly];
|
||||
var xPackage = record[(int)Column.AndroidXNuGet];
|
||||
var xVersion = record[(int)Column.AndroidXVersion];
|
||||
|
||||
if (string.IsNullOrWhiteSpace(supportAssembly) ||
|
||||
string.IsNullOrWhiteSpace(xAssembly) ||
|
||||
string.IsNullOrWhiteSpace(xPackage) ||
|
||||
string.IsNullOrWhiteSpace(xVersion))
|
||||
return;
|
||||
|
||||
assemblyMapping[supportAssembly] = xAssembly;
|
||||
packageMapping[xAssembly] = xPackage;
|
||||
versionMapping[xAssembly] = xVersion;
|
||||
}
|
||||
|
||||
public bool TryGetAndroidXAssembly(string supportAssembly, out string xAssembly) =>
|
||||
assemblyMapping.TryGetValue(supportAssembly, out xAssembly);
|
||||
|
||||
public bool TryGetAndroidXPackage(string xAssembly, out string xPackage) =>
|
||||
packageMapping.TryGetValue(xAssembly, out xPackage);
|
||||
|
||||
public bool TryGetAndroidXVersion(string xAssembly, out string xVersion) =>
|
||||
versionMapping.TryGetValue(xAssembly, out xVersion);
|
||||
|
||||
public bool ContainsSupportAssembly(string supportAssembly) =>
|
||||
assemblyMapping.ContainsKey(supportAssembly);
|
||||
|
||||
public enum Column
|
||||
{
|
||||
SupportNetAssembly,
|
||||
AndroidXNetAssembly,
|
||||
SupportNuGet,
|
||||
AndroidXNuGet,
|
||||
AndroidXVersion
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,100 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class AndroidXTypesCsvMapping : CsvMapping
|
||||
{
|
||||
private readonly SortedDictionary<string, FullType> mapping = new SortedDictionary<string, FullType>();
|
||||
private readonly SortedDictionary<string, FullType> reverseMapping = new SortedDictionary<string, FullType>();
|
||||
private readonly SortedDictionary<string, FullType> javaMapping = new SortedDictionary<string, FullType>();
|
||||
|
||||
public AndroidXTypesCsvMapping()
|
||||
{
|
||||
LoadMapping(Resources.TypesMappingFilePath);
|
||||
}
|
||||
|
||||
public AndroidXTypesCsvMapping(string mappingFile)
|
||||
: base(mappingFile)
|
||||
{
|
||||
}
|
||||
|
||||
public AndroidXTypesCsvMapping(Stream csv)
|
||||
: base(csv)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnLoadRecord(string[] record)
|
||||
{
|
||||
if (record.Length < (int)Column.Messages)
|
||||
return;
|
||||
|
||||
var supportNamespace = record[(int)Column.SupportNetNamespace];
|
||||
var supportType = record[(int)Column.SupportNetType];
|
||||
var xNamespace = record[(int)Column.AndroidXNetNamespace];
|
||||
var xType = record[(int)Column.AndroidXNetType];
|
||||
var xAssembly = record[(int)Column.AndroidXNetAssembly];
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(supportNamespace) &&
|
||||
!string.IsNullOrWhiteSpace(supportType) &&
|
||||
!string.IsNullOrWhiteSpace(xNamespace) &&
|
||||
!string.IsNullOrWhiteSpace(xType) &&
|
||||
!string.IsNullOrWhiteSpace(xAssembly))
|
||||
{
|
||||
var support = new FullType(supportNamespace, supportType);
|
||||
var androidX = new FullType(xAssembly, xNamespace, xType);
|
||||
mapping[support.FullName] = androidX;
|
||||
reverseMapping[androidX.FullName] = support;
|
||||
}
|
||||
|
||||
var supportPackage = record[(int)Column.SupportJavaPackage];
|
||||
var supportClass = record[(int)Column.SupportJavaClass];
|
||||
var xPackage = record[(int)Column.AndroidXJavaPackage];
|
||||
var xClass = record[(int)Column.AndroidXJavaClass];
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(supportPackage) &&
|
||||
!string.IsNullOrWhiteSpace(supportClass) &&
|
||||
!string.IsNullOrWhiteSpace(xPackage) &&
|
||||
!string.IsNullOrWhiteSpace(xClass))
|
||||
{
|
||||
var supportJava = new FullType(supportPackage, supportClass);
|
||||
var androidXJava = new FullType(xPackage, xClass);
|
||||
javaMapping[supportJava.JavaFullName] = androidXJava;
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetAndroidXType(string supportFullName, out FullType androidxType) =>
|
||||
mapping.TryGetValue(supportFullName, out androidxType);
|
||||
|
||||
public bool TryGetAndroidXClass(string supportJavaFullName, out FullType androidxClass) =>
|
||||
javaMapping.TryGetValue(supportJavaFullName, out androidxClass);
|
||||
|
||||
public bool TryGetSupportType(string androidxFullName, out FullType supportType) =>
|
||||
reverseMapping.TryGetValue(androidxFullName, out supportType);
|
||||
|
||||
public bool ContainsSupportType(string supportFullName) =>
|
||||
mapping.ContainsKey(supportFullName);
|
||||
|
||||
public bool ContainsSupportClass(string supportJavaFullName) =>
|
||||
javaMapping.ContainsKey(supportJavaFullName);
|
||||
|
||||
public bool ContainsAndroidXType(string androidxFullName) =>
|
||||
reverseMapping.ContainsKey(androidxFullName);
|
||||
|
||||
public enum Column
|
||||
{
|
||||
SupportNetNamespace,
|
||||
SupportNetType,
|
||||
AndroidXNetNamespace,
|
||||
AndroidXNetType,
|
||||
SupportNetAssembly,
|
||||
AndroidXNetAssembly,
|
||||
SupportJavaPackage,
|
||||
SupportJavaClass,
|
||||
AndroidXJavaPackage,
|
||||
AndroidXJavaClass,
|
||||
Messages
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class ArchivesPair
|
||||
{
|
||||
public string Source { get; private set; }
|
||||
public IEnumerable<string> Archives { get; private set; }
|
||||
|
||||
public ArchivesPair(string source, IEnumerable<string> archives)
|
||||
{
|
||||
Source = source;
|
||||
Archives = archives;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
obj is ArchivesPair other &&
|
||||
Source == other.Source &&
|
||||
Archives == other.Archives;
|
||||
|
||||
public override int GetHashCode() =>
|
||||
(Source, Archives).GetHashCode();
|
||||
|
||||
public override string ToString() =>
|
||||
$"{Source} => {{\r\t{string.Join("\r\t", Archives)}\r}}";
|
||||
|
||||
public void Deconstruct(out string source, out IEnumerable<string> archives)
|
||||
{
|
||||
source = Source;
|
||||
archives = Archives;
|
||||
}
|
||||
|
||||
public static implicit operator (string Source, IEnumerable<string> Archives)(ArchivesPair value) =>
|
||||
(value.Source, value.Archives);
|
||||
|
||||
public static implicit operator ArchivesPair((string Source, IEnumerable<string> Archives) value) =>
|
||||
new ArchivesPair(value.Source, value.Archives);
|
||||
}
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
using ILRepacking;
|
||||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class AssemblyMerger : MigrationTool
|
||||
{
|
||||
private const string InjectedAttributeNamespace = "Xamarin.AndroidX.Internal";
|
||||
private const string InjectedAttributeTypeName = "InjectedAssemblyNameAttribute";
|
||||
private const string InjectedAttributeFullName = InjectedAttributeNamespace + "." + InjectedAttributeTypeName;
|
||||
|
||||
public List<string> SearchDirectories { get; set; } = new List<string>();
|
||||
|
||||
public bool InjectAssemblyNames { get; set; }
|
||||
|
||||
public void Merge(IEnumerable<string> assemblies, string outputPath)
|
||||
{
|
||||
var assembliesToMerge = assemblies?.ToList() ?? throw new ArgumentNullException(nameof(assemblies));
|
||||
|
||||
var assemblyResolver = new DefaultAssemblyResolver();
|
||||
if (SearchDirectories != null)
|
||||
{
|
||||
foreach (var dir in SearchDirectories)
|
||||
{
|
||||
assemblyResolver.AddSearchDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
LogVerboseMessage("Merging:");
|
||||
foreach (var include in assembliesToMerge)
|
||||
LogVerboseMessage($" - {include}");
|
||||
|
||||
var tempRoot = Path.Combine(Path.GetTempPath(), "Xamarin.AndroidX.Migration", "AssemblyMerger", Guid.NewGuid().ToString());
|
||||
|
||||
if (InjectAssemblyNames)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(tempRoot) && !Directory.Exists(tempRoot))
|
||||
Directory.CreateDirectory(tempRoot);
|
||||
|
||||
assembliesToMerge = assembliesToMerge.ToList();
|
||||
|
||||
for (int i = 0; i < assembliesToMerge.Count; i++)
|
||||
{
|
||||
var atm = assembliesToMerge[i];
|
||||
var temp = Path.Combine(tempRoot, Guid.NewGuid().ToString() + ".dll");
|
||||
InjectAssemblyName(assemblyResolver, atm, temp);
|
||||
assembliesToMerge[i] = temp;
|
||||
}
|
||||
|
||||
LogVerboseMessage("Temporary assemblies:");
|
||||
foreach (var include in assembliesToMerge)
|
||||
LogVerboseMessage($" - {include}");
|
||||
}
|
||||
|
||||
var options = new RepackOptions
|
||||
{
|
||||
InputAssemblies = assembliesToMerge.ToArray(),
|
||||
OutputFile = outputPath,
|
||||
SearchDirectories = SearchDirectories.ToArray(),
|
||||
CopyAttributes = true,
|
||||
AllowMultipleAssemblyLevelAttributes = true,
|
||||
LogVerbose = Verbose
|
||||
};
|
||||
options.AllowedDuplicateTypes.Add(InjectedAttributeFullName, InjectedAttributeFullName);
|
||||
|
||||
var repacker = new ILRepack(options);
|
||||
repacker.Repack();
|
||||
|
||||
if (InjectAssemblyNames)
|
||||
{
|
||||
if (Directory.Exists(tempRoot))
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.Delete(tempRoot, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InjectAssemblyName(IAssemblyResolver assemblyResolver, string assemblyPath, string outputPath)
|
||||
{
|
||||
var assemblyName = Path.GetFileNameWithoutExtension(assemblyPath);
|
||||
|
||||
using (var assembly = AssemblyDefinition.ReadAssembly(assemblyPath))
|
||||
{
|
||||
var module = assembly.MainModule;
|
||||
|
||||
var attributeType = ResolveSystemAttribute(module);
|
||||
var baseCtor = attributeType.Methods.FirstOrDefault(m => m.Name == ".ctor");
|
||||
|
||||
var iana = new TypeDefinition(InjectedAttributeNamespace, InjectedAttributeTypeName, TypeAttributes.Class);
|
||||
iana.BaseType = module.ImportReference(attributeType);
|
||||
|
||||
var field = new FieldDefinition("assemblyName", FieldAttributes.Private | FieldAttributes.InitOnly, module.TypeSystem.String);
|
||||
|
||||
var getterAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName;
|
||||
var getter = new MethodDefinition("get_AssemblyName", getterAttributes, module.TypeSystem.String);
|
||||
getter.DeclaringType = iana;
|
||||
getter.HasThis = true;
|
||||
getter.IsGetter = true;
|
||||
getter.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
|
||||
getter.Body.Instructions.Add(Instruction.Create(OpCodes.Ldfld, field));
|
||||
getter.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
|
||||
|
||||
var property = new PropertyDefinition("AssemblyName", PropertyAttributes.None, module.TypeSystem.String);
|
||||
property.HasThis = true;
|
||||
property.GetMethod = getter;
|
||||
|
||||
var methodAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName | MethodAttributes.RTSpecialName;
|
||||
var ctor = new MethodDefinition(".ctor", methodAttributes, module.TypeSystem.Void);
|
||||
var param = new ParameterDefinition("assemblyName", ParameterAttributes.None, module.TypeSystem.String);
|
||||
ctor.Parameters.Add(param);
|
||||
|
||||
ctor.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
|
||||
ctor.Body.Instructions.Add(Instruction.Create(OpCodes.Call, module.ImportReference(baseCtor)));
|
||||
ctor.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
|
||||
ctor.Body.Instructions.Add(Instruction.Create(OpCodes.Nop));
|
||||
ctor.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
|
||||
ctor.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_1));
|
||||
ctor.Body.Instructions.Add(Instruction.Create(OpCodes.Stfld, field));
|
||||
ctor.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
|
||||
|
||||
iana.Fields.Add(field);
|
||||
iana.Properties.Add(property);
|
||||
iana.Methods.Add(ctor);
|
||||
iana.Methods.Add(getter);
|
||||
module.Types.Add(iana);
|
||||
|
||||
foreach (var type in module.Types)
|
||||
{
|
||||
type.CustomAttributes.Add(new CustomAttribute(ctor)
|
||||
{
|
||||
ConstructorArguments = { new CustomAttributeArgument(module.TypeSystem.String, assemblyName) }
|
||||
});
|
||||
}
|
||||
|
||||
assembly.Write(outputPath);
|
||||
}
|
||||
|
||||
TypeDefinition ResolveSystemAttribute(ModuleDefinition module)
|
||||
{
|
||||
foreach (var reference in module.AssemblyReferences)
|
||||
{
|
||||
var resolved = assemblyResolver.Resolve(reference);
|
||||
var attributeType = resolved.MainModule.GetType("System.Attribute");
|
||||
if (attributeType != null)
|
||||
return attributeType;
|
||||
}
|
||||
throw new Exception("Unable to locate System.Attribute in any of the assemblies.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public readonly struct BindingType
|
||||
{
|
||||
public static BindingType Empty = new BindingType(FullType.Empty, FullType.Empty);
|
||||
|
||||
public readonly FullType NetType;
|
||||
public readonly FullType JavaType;
|
||||
|
||||
public BindingType(FullType netType, FullType javaType)
|
||||
{
|
||||
NetType = netType;
|
||||
JavaType = javaType;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
obj is BindingType other &&
|
||||
EqualityComparer<FullType>.Default.Equals(NetType, other.NetType) &&
|
||||
EqualityComparer<FullType>.Default.Equals(JavaType, other.JavaType);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
(NetType, JavaType).GetHashCode();
|
||||
|
||||
public override string ToString() =>
|
||||
$"{NetType} ({JavaType})";
|
||||
|
||||
public void Deconstruct(out FullType netType, out FullType javaType)
|
||||
{
|
||||
netType = NetType;
|
||||
javaType = JavaType;
|
||||
}
|
||||
|
||||
public static implicit operator (FullType NetType, FullType JavaType)(BindingType value) =>
|
||||
(value.NetType, value.JavaType);
|
||||
|
||||
public static implicit operator BindingType((FullType NetType, FullType JavaType) value) =>
|
||||
new BindingType(value.NetType, value.JavaType);
|
||||
}
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
[Flags]
|
||||
public enum CecilMigrationResult
|
||||
{
|
||||
Skipped = 0,
|
||||
|
||||
ContainedSupport = 1 << 0,
|
||||
PotentialJni = 1 << 1,
|
||||
ContainedJni = 1 << 2,
|
||||
PotentialJavaArtifacts = 1 << 3,
|
||||
ContainedJavaArtifacts = 1 << 4,
|
||||
}
|
||||
}
|
|
@ -1,620 +0,0 @@
|
|||
using Mono.Cecil;
|
||||
using Mono.Cecil.Cil;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Xamarin.Android.Tools.Bytecode;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class CecilMigrator : MigrationTool
|
||||
{
|
||||
private const string RegisterAttributeFullName = "Android.Runtime.RegisterAttribute";
|
||||
private const string StringFullName = "System.String";
|
||||
|
||||
private const string EmbeddedAarName = "__AndroidLibraryProjects__.zip";
|
||||
private const string EmbeddedJarExtension = ".jar";
|
||||
|
||||
public CecilMigrator()
|
||||
: this(new AndroidXTypesCsvMapping())
|
||||
{
|
||||
}
|
||||
|
||||
public CecilMigrator(Stream stream)
|
||||
: this(new AndroidXTypesCsvMapping(stream))
|
||||
{
|
||||
}
|
||||
|
||||
public CecilMigrator(AndroidXTypesCsvMapping mapping)
|
||||
{
|
||||
Mapping = mapping;
|
||||
}
|
||||
|
||||
public AndroidXTypesCsvMapping Mapping { get; }
|
||||
|
||||
public bool SkipEmbeddedResources { get; set; }
|
||||
|
||||
public List<string> References { get; set; }
|
||||
|
||||
public bool RenameTypes { get; set; }
|
||||
|
||||
public string JavaPath { get; set; } = "java";
|
||||
|
||||
public CecilMigrationResult Migrate(IEnumerable<MigrationPair> assemblies)
|
||||
{
|
||||
var result = CecilMigrationResult.Skipped;
|
||||
|
||||
foreach (var pair in assemblies)
|
||||
{
|
||||
result |= Migrate(pair.Source, pair.Destination);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public CecilMigrationResult Migrate(MigrationPair assemblies) =>
|
||||
Migrate(assemblies.Source, assemblies.Destination);
|
||||
|
||||
public CecilMigrationResult Migrate(string source, string destination)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(source))
|
||||
throw new ArgumentException($"Invalid source assembly path specified: '{source}'.", nameof(source));
|
||||
if (string.IsNullOrWhiteSpace(destination))
|
||||
throw new ArgumentException($"Invalid destination assembly path specified: '{destination}'.", nameof(destination));
|
||||
if (!File.Exists(source))
|
||||
throw new FileNotFoundException($"Source assembly does not exist: '{source}'.", source);
|
||||
|
||||
var pdbPath = Path.ChangeExtension(destination, "pdb");
|
||||
var mdbPath = destination + ".mdb";
|
||||
|
||||
// copy the files to the dest to start off
|
||||
if (CopyFile(source, destination))
|
||||
{
|
||||
LogVerboseMessage($"Copying source assembly '{source}' to '{destination}'.");
|
||||
|
||||
CopyFile(Path.ChangeExtension(source, "pdb"), pdbPath);
|
||||
CopyFile(source + ".mdb", mdbPath);
|
||||
}
|
||||
|
||||
var hasSymbols = File.Exists(pdbPath) || File.Exists(mdbPath);
|
||||
|
||||
// start the migration
|
||||
var result = CecilMigrationResult.Skipped;
|
||||
var requiresSave = false;
|
||||
using (var resolver = new AssemblyResolver())
|
||||
{
|
||||
if (References?.Count > 0)
|
||||
{
|
||||
var refs = References
|
||||
.Where(r => Path.GetFileName(r) != Path.GetFileName(destination))
|
||||
.ToList();
|
||||
foreach (var reference in refs)
|
||||
{
|
||||
resolver.AddAssembly(reference);
|
||||
}
|
||||
}
|
||||
|
||||
LogVerboseMessage($"Processing assembly '{source}'...");
|
||||
using (var assembly = ReadAssembly(resolver, destination))
|
||||
{
|
||||
result = MigrateAssembly(assembly);
|
||||
|
||||
requiresSave =
|
||||
result.HasFlag(CecilMigrationResult.ContainedSupport) ||
|
||||
result.HasFlag(CecilMigrationResult.ContainedJni) ||
|
||||
result.HasFlag(CecilMigrationResult.ContainedJavaArtifacts);
|
||||
|
||||
if (requiresSave)
|
||||
{
|
||||
assembly.Write(new WriterParameters
|
||||
{
|
||||
WriteSymbols = hasSymbols,
|
||||
SymbolWriterProvider = hasSymbols ? new PortablePdbWriterProvider() : null,
|
||||
});
|
||||
|
||||
LogMessage($"Migrated assembly to '{destination}'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogVerboseMessage($"Skipped assembly '{source}' due to lack of support types.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (requiresSave)
|
||||
{
|
||||
// remove .dll.mdb as that is not supported
|
||||
if (File.Exists(mdbPath))
|
||||
File.Delete(mdbPath);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool MigrateJniString(string jniString, out string newJniString)
|
||||
{
|
||||
if (string.IsNullOrEmpty(jniString))
|
||||
{
|
||||
newJniString = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// process a straight type
|
||||
if (TryMapJavaClass(jniString, out var registration))
|
||||
{
|
||||
newJniString = registration;
|
||||
return true;
|
||||
}
|
||||
|
||||
// process a method signature
|
||||
var method = ParseMethodSignature(jniString, out var name);
|
||||
if (method != null)
|
||||
{
|
||||
var changed = false;
|
||||
var newjni = new StringBuilder();
|
||||
|
||||
newjni.Append("(");
|
||||
foreach (var param in method.Parameters)
|
||||
{
|
||||
changed |= GetNewJniPart(param, out var newParam);
|
||||
newjni.Append(newParam ?? param);
|
||||
}
|
||||
newjni.Append(")");
|
||||
|
||||
changed |= GetNewJniPart(method.ReturnTypeSignature, out var newReturn);
|
||||
newjni.Append(newReturn ?? method.ReturnTypeSignature);
|
||||
|
||||
if (changed)
|
||||
{
|
||||
newJniString = newjni.ToString();
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
newJniString = $"{name}.{newJniString}";
|
||||
}
|
||||
else
|
||||
{
|
||||
newJniString = null;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
newJniString = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private CecilMigrationResult MigrateAssembly(AssemblyDefinition assembly)
|
||||
{
|
||||
var result = MigrateNetTypes(assembly);
|
||||
|
||||
if (result.HasFlag(CecilMigrationResult.PotentialJni))
|
||||
{
|
||||
result |= MigrateJniStrings(assembly);
|
||||
}
|
||||
|
||||
result |= MigrateEmbeddedResources(assembly);
|
||||
|
||||
if (RenameTypes)
|
||||
{
|
||||
result |= MigrateActualTypes(assembly);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private CecilMigrationResult MigrateActualTypes(AssemblyDefinition assembly)
|
||||
{
|
||||
var result = CecilMigrationResult.Skipped;
|
||||
|
||||
LogMessage($"*** WARNING: Renaming types! This will result in an invalid assembly! ***");
|
||||
|
||||
foreach (var type in assembly.MainModule.GetTypes())
|
||||
{
|
||||
if (Mapping.TryGetAndroidXType(type.FullName, out var androidx) && type.FullName != androidx.FullName)
|
||||
{
|
||||
type.Namespace = androidx.Namespace;
|
||||
type.Name = androidx.Name;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private CecilMigrationResult MigrateEmbeddedResources(AssemblyDefinition assembly)
|
||||
{
|
||||
var result = CecilMigrationResult.Skipped;
|
||||
|
||||
if (assembly.MainModule.HasResources)
|
||||
result |= CecilMigrationResult.PotentialJavaArtifacts;
|
||||
|
||||
if (SkipEmbeddedResources || !assembly.MainModule.HasResources)
|
||||
return result;
|
||||
|
||||
var embeddedResources = assembly.MainModule.Resources
|
||||
.Where(ShouldJetifyResource)
|
||||
.OfType<EmbeddedResource>()
|
||||
.ToList();
|
||||
|
||||
if (embeddedResources.Count == 0)
|
||||
return result;
|
||||
|
||||
var tempRoot = Path.Combine(Path.GetTempPath(), "Xamarin.AndroidX.Migration", "Cecilfier", Guid.NewGuid().ToString());
|
||||
if (!string.IsNullOrWhiteSpace(tempRoot) && !Directory.Exists(tempRoot))
|
||||
Directory.CreateDirectory(tempRoot);
|
||||
|
||||
LogVerboseMessage($" Migrating embedded resources...");
|
||||
|
||||
foreach (var embedded in embeddedResources)
|
||||
{
|
||||
var jetifier = new Jetifier
|
||||
{
|
||||
Verbose = Verbose,
|
||||
JavaPath = JavaPath,
|
||||
};
|
||||
|
||||
jetifier.MessageLogged += (sender, e) => Log(e);
|
||||
|
||||
var tempFile = Path.Combine(tempRoot, Guid.NewGuid().ToString() + Path.GetExtension(embedded.Name));
|
||||
|
||||
LogVerboseMessage($" Migrating embedded resource '{embedded.Name}'...");
|
||||
|
||||
using (var fileStream = File.OpenWrite(tempFile))
|
||||
using (var resourceStream = embedded.GetResourceStream())
|
||||
{
|
||||
resourceStream.CopyTo(fileStream);
|
||||
}
|
||||
|
||||
if (!jetifier.Jetify(tempFile, tempFile))
|
||||
throw new Exception("Errors occured during the migration of embedded assets.");
|
||||
|
||||
assembly.MainModule.Resources.Remove(embedded);
|
||||
|
||||
var data = File.ReadAllBytes(tempFile);
|
||||
File.Delete(tempFile);
|
||||
|
||||
assembly.MainModule.Resources.Add(new EmbeddedResource(embedded.Name, embedded.Attributes, data));
|
||||
|
||||
result |= CecilMigrationResult.ContainedJavaArtifacts;
|
||||
}
|
||||
|
||||
if (Directory.Exists(tempRoot))
|
||||
{
|
||||
try
|
||||
{
|
||||
Directory.Delete(tempRoot, true);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
bool ShouldJetifyResource(Resource resource) =>
|
||||
resource.Name.Equals(EmbeddedAarName, StringComparison.OrdinalIgnoreCase) ||
|
||||
Path.GetExtension(resource.Name).Equals(EmbeddedJarExtension, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private CecilMigrationResult MigrateNetTypes(AssemblyDefinition assembly)
|
||||
{
|
||||
var result = CecilMigrationResult.Skipped;
|
||||
|
||||
foreach (var support in assembly.MainModule.GetTypeReferences())
|
||||
{
|
||||
if (!Mapping.TryGetAndroidXType(support.FullName, out var androidx) ||
|
||||
(support.FullName == androidx.FullName && support.Scope.Name == androidx.Assembly))
|
||||
{
|
||||
if (!result.HasFlag(CecilMigrationResult.PotentialJni))
|
||||
{
|
||||
if (support.FullName == RegisterAttributeFullName)
|
||||
result |= CecilMigrationResult.PotentialJni;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
LogVerboseMessage($" Processing type reference '{support.FullName}'...");
|
||||
|
||||
var old = support.FullName;
|
||||
support.Namespace = androidx.Namespace;
|
||||
|
||||
LogVerboseMessage($" Mapped type '{old}' to '{support.FullName}'.");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(androidx.Assembly) && support.Scope.Name != androidx.Assembly)
|
||||
{
|
||||
LogVerboseMessage($" Mapped assembly '{support.Scope.Name}' to '{androidx.Assembly}'.");
|
||||
|
||||
var assemblyReferences = assembly.MainModule.AssemblyReferences;
|
||||
var reference = assemblyReferences.FirstOrDefault(a => a.Name == androidx.Assembly);
|
||||
if (reference == null)
|
||||
{
|
||||
reference = new AssemblyNameReference(androidx.Assembly, new Version(1, 0, 0, 0));
|
||||
assemblyReferences.Add(reference);
|
||||
}
|
||||
|
||||
if (support.Scope is AssemblyNameReference oldAssRef)
|
||||
assemblyReferences.Remove(oldAssRef);
|
||||
|
||||
support.Scope = reference;
|
||||
}
|
||||
else if (support.Scope.Name == androidx.Assembly)
|
||||
{
|
||||
LogVerboseMessage($" Already mapped assembly '{support.Scope.Name}'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
LogMessage($" *** Potential error for assembly {support.Scope.Name}' to '{androidx.Assembly}'. ***");
|
||||
}
|
||||
|
||||
result |= CecilMigrationResult.ContainedSupport;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private CecilMigrationResult MigrateJniStrings(AssemblyDefinition assembly)
|
||||
{
|
||||
var result = CecilMigrationResult.Skipped;
|
||||
|
||||
foreach (var type in assembly.MainModule.GetTypes())
|
||||
{
|
||||
// no [Register] attribute means that this type cannot have any JNI
|
||||
var registerAttribute = GetRegisterAttribute(type.CustomAttributes);
|
||||
if (registerAttribute == null)
|
||||
continue;
|
||||
|
||||
LogVerboseMessage($" Processing type '{type.FullName}'...");
|
||||
|
||||
if (MigrateRegisterAttribute(registerAttribute))
|
||||
result |= CecilMigrationResult.ContainedJni;
|
||||
|
||||
// migrate the [Register] attributes on the properties
|
||||
foreach (var property in type.Properties)
|
||||
{
|
||||
var propertyRegister = GetRegisterAttribute(property.CustomAttributes);
|
||||
if (propertyRegister == null)
|
||||
continue;
|
||||
|
||||
LogVerboseMessage($" Processing property '{property.Name}'...");
|
||||
|
||||
if (MigrateRegisterAttribute(propertyRegister))
|
||||
result |= CecilMigrationResult.ContainedJni;
|
||||
}
|
||||
|
||||
// migrate the [Register] attributes on the methods and the JNI in the bodies
|
||||
foreach (var method in type.Methods)
|
||||
{
|
||||
var methodRegister = GetRegisterAttribute(method.CustomAttributes);
|
||||
|
||||
LogVerboseMessage($" Processing method '{method.Name}'...");
|
||||
|
||||
if (methodRegister != null && MigrateRegisterAttribute(methodRegister))
|
||||
result |= CecilMigrationResult.ContainedJni;
|
||||
|
||||
if (MigrateMethodBody(method))
|
||||
result |= CecilMigrationResult.ContainedJni;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private bool MigrateRegisterAttribute(CustomAttribute registerAttribute)
|
||||
{
|
||||
if (!registerAttribute.HasConstructorArguments)
|
||||
return false;
|
||||
|
||||
var changed = false;
|
||||
|
||||
var args = registerAttribute.ConstructorArguments;
|
||||
for (int i = 0; i < args.Count; i++)
|
||||
{
|
||||
if (args[i] is CustomAttributeArgument caa &&
|
||||
caa.Type.FullName == StringFullName &&
|
||||
MigrateJniString(caa.Value as string, out var newValue))
|
||||
{
|
||||
args[i] = new CustomAttributeArgument(caa.Type, newValue);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
private bool MigrateMethodBody(MethodDefinition method)
|
||||
{
|
||||
if (!method.HasBody)
|
||||
return false;
|
||||
|
||||
var hasChanges = false;
|
||||
|
||||
foreach (var instruction in method.Body.Instructions)
|
||||
{
|
||||
if (instruction.OpCode != OpCodes.Ldstr ||
|
||||
!(instruction.Operand is string operand) ||
|
||||
string.IsNullOrWhiteSpace(operand))
|
||||
continue;
|
||||
|
||||
if (MigrateJniString(operand, out var migratedJni))
|
||||
{
|
||||
instruction.Operand = migratedJni;
|
||||
hasChanges = true;
|
||||
}
|
||||
}
|
||||
|
||||
return hasChanges;
|
||||
}
|
||||
|
||||
private CustomAttribute GetRegisterAttribute(IList<CustomAttribute> attributes) =>
|
||||
attributes.FirstOrDefault(attr => attr.AttributeType.FullName == RegisterAttributeFullName);
|
||||
|
||||
private bool TryMapJavaClass(string javaClass, out string newJavaClass)
|
||||
{
|
||||
if (string.IsNullOrEmpty(javaClass))
|
||||
{
|
||||
newJavaClass = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// try it straight
|
||||
if (Mapping.TryGetAndroidXClass(javaClass, out var newClass))
|
||||
{
|
||||
newJavaClass = newClass.JavaFullName;
|
||||
return javaClass != newJavaClass;
|
||||
}
|
||||
|
||||
// work backwards, removing each nested class
|
||||
string nested = "";
|
||||
while (javaClass.Contains("$"))
|
||||
{
|
||||
nested = javaClass.Substring(javaClass.LastIndexOf('$')) + nested;
|
||||
javaClass = javaClass.Substring(0, javaClass.LastIndexOf('$'));
|
||||
|
||||
if (Mapping.TryGetAndroidXClass(javaClass, out newClass))
|
||||
{
|
||||
newJavaClass = newClass.JavaFullName + nested;
|
||||
return javaClass != newJavaClass;
|
||||
}
|
||||
}
|
||||
|
||||
newJavaClass = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool GetNewJniPart(string javaFullName, out string newJavaFullName)
|
||||
{
|
||||
newJavaFullName = null;
|
||||
|
||||
if (string.IsNullOrEmpty(javaFullName))
|
||||
return false;
|
||||
|
||||
var semicolonIndex = javaFullName.IndexOf(';');
|
||||
if (semicolonIndex != javaFullName.Length - 1)
|
||||
return false;
|
||||
|
||||
var start = 0;
|
||||
while (start < javaFullName.Length && (javaFullName[start] == '[' || javaFullName[start] == 'L'))
|
||||
start++;
|
||||
|
||||
if (start <= 0 || start >= semicolonIndex)
|
||||
return false;
|
||||
|
||||
var javaClass = javaFullName.Substring(start, semicolonIndex - start);
|
||||
if (!TryMapJavaClass(javaClass, out var newFullName))
|
||||
return false;
|
||||
|
||||
newJavaFullName = $"{javaFullName.Substring(0, start)}{newFullName};";
|
||||
return true;
|
||||
}
|
||||
|
||||
private MethodTypeSignature ParseMethodSignature(string support, out string name)
|
||||
{
|
||||
name = null;
|
||||
|
||||
// must have an open parenthesis
|
||||
var openIndex = support.IndexOf('(');
|
||||
if (openIndex < 0 || openIndex >= support.Length)
|
||||
return null;
|
||||
|
||||
// must have a close parenthesis after the open
|
||||
var closeIndex = support.IndexOf(')');
|
||||
if (closeIndex <= openIndex || closeIndex >= support.Length)
|
||||
return null;
|
||||
|
||||
// try the "(ABC)D"
|
||||
if (openIndex == 0)
|
||||
{
|
||||
name = null;
|
||||
return TryCreate(support);
|
||||
}
|
||||
|
||||
// try the "name.(ABC)D"
|
||||
var dotIndex = support.IndexOf('.');
|
||||
if (dotIndex > 0 && dotIndex == openIndex - 1)
|
||||
{
|
||||
name = support.Substring(0, dotIndex);
|
||||
return TryCreate(support.Substring(dotIndex + 1));
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
MethodTypeSignature TryCreate(string jni)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new MethodTypeSignature(jni);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool CopyFile(string src, string dst)
|
||||
{
|
||||
if (!File.Exists(src))
|
||||
return false;
|
||||
|
||||
src = Path.GetFullPath(src);
|
||||
dst = Path.GetFullPath(dst);
|
||||
if (src.Equals(dst, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
var dir = Path.GetDirectoryName(dst);
|
||||
if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
File.Copy(src, dst, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private AssemblyDefinition ReadAssembly(AssemblyResolver resolver, string path)
|
||||
{
|
||||
var readerParams = new ReaderParameters
|
||||
{
|
||||
ReadSymbols = true,
|
||||
ReadWrite = true,
|
||||
AssemblyResolver = resolver,
|
||||
};
|
||||
|
||||
var pdbPath = Path.ChangeExtension(path, "pdb");
|
||||
var mdbPath = path + ".mdb";
|
||||
|
||||
if (File.Exists(pdbPath) || File.Exists(mdbPath))
|
||||
{
|
||||
// if there are symbols, then try using them
|
||||
try
|
||||
{
|
||||
return AssemblyDefinition.ReadAssembly(path, readerParams);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// do nothing
|
||||
LogMessage($" Debug symbols were found for the assembly, but they couldn't be used: " + ex.Message);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LogVerboseMessage($" No debug symbols found for the assembly.");
|
||||
}
|
||||
|
||||
// just ignore all symbols, there is nothing that can be done about bad symbols
|
||||
readerParams.ReadSymbols = false;
|
||||
return AssemblyDefinition.ReadAssembly(path, readerParams);
|
||||
}
|
||||
|
||||
private sealed class AssemblyResolver : DefaultAssemblyResolver
|
||||
{
|
||||
public void AddAssembly(string assembly)
|
||||
{
|
||||
RegisterAssembly(AssemblyDefinition.ReadAssembly(assembly, new ReaderParameters
|
||||
{
|
||||
AssemblyResolver = this,
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
using System.IO;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public abstract class CsvMapping
|
||||
{
|
||||
protected CsvMapping()
|
||||
{
|
||||
}
|
||||
|
||||
protected CsvMapping(string mappingFile)
|
||||
{
|
||||
LoadMapping(mappingFile);
|
||||
}
|
||||
|
||||
protected CsvMapping(Stream csv)
|
||||
{
|
||||
LoadMapping(csv);
|
||||
}
|
||||
|
||||
protected void LoadMapping(string mappingFile)
|
||||
{
|
||||
using (var stream = File.OpenRead(mappingFile))
|
||||
using (var reader = new StreamReader(stream))
|
||||
{
|
||||
LoadMapping(reader);
|
||||
}
|
||||
}
|
||||
|
||||
protected void LoadMapping(Stream csv)
|
||||
{
|
||||
using (var reader = new StreamReader(csv))
|
||||
{
|
||||
LoadMapping(reader);
|
||||
}
|
||||
}
|
||||
|
||||
protected void LoadMapping(TextReader reader)
|
||||
{
|
||||
foreach (var line in reader.ReadToEnd().Split('\r', '\n'))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(line))
|
||||
continue;
|
||||
|
||||
var split = line.Split(',');
|
||||
|
||||
OnLoadRecord(split);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void OnLoadRecord(string[] record);
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public readonly struct FullType
|
||||
{
|
||||
public static FullType Empty = new FullType(string.Empty, string.Empty, string.Empty);
|
||||
|
||||
public readonly string Assembly;
|
||||
public readonly string Namespace;
|
||||
public readonly string Name;
|
||||
|
||||
public FullType(string ns, string n)
|
||||
{
|
||||
Assembly = string.Empty;
|
||||
Namespace = ns;
|
||||
Name = n;
|
||||
}
|
||||
|
||||
public FullType(string assembly, string ns, string n)
|
||||
{
|
||||
Assembly = assembly;
|
||||
Namespace = ns;
|
||||
Name = n;
|
||||
}
|
||||
|
||||
public string FullName =>
|
||||
$"{Namespace}.{Name}";
|
||||
|
||||
public string JavaFullName =>
|
||||
$"{Namespace.Replace('.', '/')}/{Name.Replace('.', '$')}";
|
||||
|
||||
public bool IsEmpty =>
|
||||
Namespace == string.Empty || Name == string.Empty;
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
obj is FullType other && Assembly == other.Assembly && Namespace == other.Namespace && Name == other.Name;
|
||||
|
||||
public override int GetHashCode() =>
|
||||
(Assembly, Namespace, Name).GetHashCode();
|
||||
|
||||
public override string ToString() =>
|
||||
FullName;
|
||||
|
||||
public FullType WithName(string name) =>
|
||||
new FullType(Assembly, Namespace, name);
|
||||
|
||||
public FullType WithNamespace(string ns) =>
|
||||
new FullType(Assembly, ns, Name);
|
||||
|
||||
public void Deconstruct(out string c, out string ns, out string n)
|
||||
{
|
||||
c = Assembly;
|
||||
ns = Namespace;
|
||||
n = Name;
|
||||
}
|
||||
|
||||
public static implicit operator (string Assembly, string Namespace, string Name) (FullType value) =>
|
||||
(value.Assembly, value.Namespace, value.Name);
|
||||
|
||||
public static implicit operator FullType((string Assembly, string Namespace, string Name) value) =>
|
||||
new FullType(value.Assembly, value.Namespace, value.Name);
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class Jetifier : MigrationTool
|
||||
{
|
||||
public string ConfigurationPath { get; set; }
|
||||
|
||||
public bool Dejetify { get; set; }
|
||||
|
||||
public bool IsStrict { get; set; }
|
||||
|
||||
public bool ShouldRebuildTopOfTree { get; set; }
|
||||
|
||||
public bool ShouldStripSignatures { get; set; }
|
||||
|
||||
public bool IsProGuard { get; set; }
|
||||
|
||||
public bool Parallel { get; set; }
|
||||
|
||||
public bool UseIntermediateFile { get; set; }
|
||||
|
||||
public string IntermediateFilePath { get; set; }
|
||||
|
||||
public string JavaPath { get; set; } = "java";
|
||||
|
||||
public string JetifierWrapperPath { get; set; } = Resources.JetifierWrapperDirectory;
|
||||
|
||||
public bool Jetify(MigrationPair archives) =>
|
||||
Jetify(new[] { archives });
|
||||
|
||||
public bool Jetify(string source, string destination) =>
|
||||
Jetify(new[] { new MigrationPair(source, destination) });
|
||||
|
||||
public bool Jetify(IEnumerable<MigrationPair> archives)
|
||||
{
|
||||
if (archives == null)
|
||||
throw new ArgumentNullException(nameof(archives), "There's nothing to jetify.");
|
||||
|
||||
var jars = Directory.GetFiles(Resources.JetifierWrapperDirectory, "*.jar");
|
||||
|
||||
var inputs = string.Empty;
|
||||
if (UseIntermediateFile)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(IntermediateFilePath))
|
||||
{
|
||||
var tempRoot = Path.Combine(Path.GetTempPath(), "Xamarin.AndroidX.Migration", "Jetifier", Guid.NewGuid().ToString());
|
||||
IntermediateFilePath = tempRoot;
|
||||
}
|
||||
|
||||
var dir = Path.GetDirectoryName(IntermediateFilePath);
|
||||
if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
using (var intermediate = File.CreateText(IntermediateFilePath))
|
||||
{
|
||||
foreach (var file in archives)
|
||||
{
|
||||
intermediate.WriteLine($"{file.Source};{file.Destination}");
|
||||
}
|
||||
}
|
||||
|
||||
inputs = $" -intermediate \"{IntermediateFilePath}\"";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var file in archives)
|
||||
{
|
||||
inputs += $" -i \"{file.Source}\" -o \"{file.Destination}\"";
|
||||
}
|
||||
}
|
||||
|
||||
var classPath = string.Join(Path.PathSeparator.ToString(), jars);
|
||||
var c = !string.IsNullOrWhiteSpace(ConfigurationPath) ? $" -c \"{ConfigurationPath}\"" : string.Empty;
|
||||
var l = Verbose ? $" -l verbose" : string.Empty;
|
||||
var r = Dejetify ? " -r" : string.Empty;
|
||||
var s = IsStrict ? " -s" : string.Empty;
|
||||
var rebuildTopOfTree = ShouldRebuildTopOfTree ? " -rebuildTopOfTree" : string.Empty;
|
||||
var stripSignatures = ShouldStripSignatures ? " -stripSignatures" : string.Empty;
|
||||
var isProGuard = IsProGuard ? " -isProGuard" : string.Empty;
|
||||
var parallel = Parallel ? " -parallel" : string.Empty;
|
||||
var options = $"{c}{l}{r}{s}{rebuildTopOfTree}{stripSignatures}{isProGuard}{parallel}";
|
||||
var arguments = $"-classpath \"{classPath}\" \"{Resources.JetifierWrapperMain}\" {inputs} {options}";
|
||||
|
||||
return ExecuteExternalProcess(JavaPath, arguments);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,310 +0,0 @@
|
|||
using Mono.Cecil;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class MappingGenerator : MigrationTool
|
||||
{
|
||||
private readonly List<TypeMapping> typeMappings = new List<TypeMapping>();
|
||||
|
||||
public string OverridesPath { get; set; } = Resources.MappingOverridesPath;
|
||||
|
||||
public string JavaMappingPath { get; set; } = Resources.JavaClassMappingPath;
|
||||
|
||||
public bool IncludeWarnings { get; set; }
|
||||
|
||||
public void Generate(string supportAssemblyPath, string androidXAssemblyPath, TextWriter writer)
|
||||
{
|
||||
_ = supportAssemblyPath ?? throw new ArgumentNullException(nameof(supportAssemblyPath));
|
||||
_ = androidXAssemblyPath ?? throw new ArgumentNullException(nameof(androidXAssemblyPath));
|
||||
|
||||
// load all the types and mappings
|
||||
var supportTypes = GetAllTypes(supportAssemblyPath);
|
||||
var xTypes = GetAllTypes(androidXAssemblyPath);
|
||||
var overrideMappings = LoadMapping(OverridesPath);
|
||||
var javaMappings = LoadMapping(JavaMappingPath);
|
||||
|
||||
WriteRecord(
|
||||
writer,
|
||||
new BindingType(
|
||||
new FullType("Support .NET assembly", "Support .NET namespace", "Support .NET type name"),
|
||||
new FullType("Support Java package", "Support Java class")),
|
||||
new BindingType(
|
||||
new FullType("AndroidX .NET assembly", "AndroidX .NET namespace", "AndroidX .NET type name"),
|
||||
new FullType("AndroidX Java package", "AndroidX Java class")),
|
||||
"Messages");
|
||||
|
||||
// PART A: Go through all the types in the Support assembly and
|
||||
// try and find a matching AndroidX type.
|
||||
foreach (var supportType in supportTypes)
|
||||
{
|
||||
var useJavaType = !supportType.JavaType.IsEmpty && javaMappings.Count > 0;
|
||||
|
||||
if (TryGetMapping(overrideMappings, supportType.NetType, out var overrideType))
|
||||
{
|
||||
// 1. First check the specific/manual overrides provided.
|
||||
|
||||
var matched = xTypes.Where(t => t.NetType.FullName == overrideType).ToList();
|
||||
if (matched.Count == 0)
|
||||
{
|
||||
if (IncludeWarnings)
|
||||
WriteRecord(writer, $"WARNING: Unable to find override type for type {overrideType}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var m in matched)
|
||||
{
|
||||
typeMappings.Add(new TypeMapping(supportType, m));
|
||||
WriteRecord(writer, supportType, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (TryGetExactMatch(xTypes, supportType, out var exactMatch))
|
||||
{
|
||||
// 2. Then, check to see if there is an exact match for the
|
||||
// full name of the .NET or Java type.
|
||||
|
||||
typeMappings.Add(new TypeMapping(supportType, exactMatch));
|
||||
WriteRecord(writer, supportType, exactMatch);
|
||||
}
|
||||
else if (useJavaType && TryGetMapping(javaMappings, supportType.JavaType, out var androidx))
|
||||
{
|
||||
// 3. If not, then do a look up based on the Java types.
|
||||
|
||||
var matched = xTypes.Where(t => t.JavaType.FullName == androidx).ToList();
|
||||
|
||||
// a special case for the XxxConsts types
|
||||
const string ConstsSuffix = "Consts";
|
||||
if (matched.Count == 2 && matched.Any(m => m.NetType.Name.EndsWith(ConstsSuffix)))
|
||||
{
|
||||
matched.RemoveAll(m => m.NetType.Name.EndsWith(ConstsSuffix) != supportType.NetType.Name.EndsWith(ConstsSuffix));
|
||||
}
|
||||
|
||||
if (matched.Count == 0)
|
||||
{
|
||||
if (IncludeWarnings)
|
||||
WriteRecord(writer, $"WARNING: Unable to find AndroidX type for Java type {androidx}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// if we have an exact name match, then use that
|
||||
var exact = matched.Where(m => m.NetType.Name == supportType.NetType.Name).ToList();
|
||||
if (exact.Count == 1)
|
||||
matched = exact;
|
||||
|
||||
foreach (var m in matched)
|
||||
{
|
||||
typeMappings.Add(new TypeMapping(supportType, m));
|
||||
WriteRecord(writer, supportType, m);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 4. As a last resort, use the .NET class name and try
|
||||
// and find a match using just the name.
|
||||
|
||||
var matched = xTypes.Where(xt => xt.NetType.Name == supportType.NetType.Name).ToList();
|
||||
if (matched.Count == 0)
|
||||
{
|
||||
if (IncludeWarnings)
|
||||
WriteRecord(writer, $"WARNING: Unable to find AndroidX type for .NET type {supportType.NetType}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var m in matched)
|
||||
{
|
||||
var msg = string.Empty;
|
||||
if (IncludeWarnings && useJavaType)
|
||||
{
|
||||
msg = $"WARNING: Unable to find a Java mapping, so took a guess.";
|
||||
if (matched.Count > 1)
|
||||
msg += $" Found more than 1 item: " + string.Join(", ", matched);
|
||||
}
|
||||
|
||||
typeMappings.Add(new TypeMapping(supportType, m));
|
||||
WriteRecord(writer, supportType, m, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PART B: Make sure all the Java mappings exist in the final CSV.
|
||||
foreach (var mapping in javaMappings.Skip(1))
|
||||
{
|
||||
var mapped = typeMappings.FirstOrDefault(k => k.SupportType.JavaType.FullName == mapping.Key);
|
||||
if (!mapped.SupportType.JavaType.IsEmpty)
|
||||
continue;
|
||||
|
||||
WriteRecord(
|
||||
writer,
|
||||
new BindingType(FullType.Empty, GetJavaFullType(mapping.Key)),
|
||||
new BindingType(FullType.Empty, GetJavaFullType(mapping.Value)),
|
||||
$"WARNING: No .NET types found.");
|
||||
}
|
||||
}
|
||||
|
||||
private static FullType GetJavaFullType(string javaFullName)
|
||||
{
|
||||
for (var i = 1; i < javaFullName.Length; i++)
|
||||
{
|
||||
if (char.IsUpper(javaFullName, i) && javaFullName[i - 1] == '.')
|
||||
return new FullType(
|
||||
javaFullName.Substring(0, i - 1),
|
||||
javaFullName.Substring(i));
|
||||
}
|
||||
|
||||
return FullType.Empty;
|
||||
}
|
||||
|
||||
private static void WriteRecord(TextWriter writer, string message) =>
|
||||
WriteRecord(writer, BindingType.Empty, BindingType.Empty, message);
|
||||
|
||||
private static void WriteRecord(TextWriter writer, BindingType supportType, BindingType androidXType, string message = "")
|
||||
{
|
||||
writer.WriteLine(
|
||||
$"{supportType.NetType.Namespace}," +
|
||||
$"{supportType.NetType.Name}," +
|
||||
$"{androidXType.NetType.Namespace}," +
|
||||
$"{androidXType.NetType.Name}," +
|
||||
$"{supportType.NetType.Assembly}," +
|
||||
$"{androidXType.NetType.Assembly}," +
|
||||
$"{supportType.JavaType.Namespace}," +
|
||||
$"{supportType.JavaType.Name}," +
|
||||
$"{androidXType.JavaType.Namespace}," +
|
||||
$"{androidXType.JavaType.Name}," +
|
||||
message);
|
||||
}
|
||||
|
||||
private bool TryGetExactMatch(IEnumerable<BindingType> xTypes, BindingType supportType, out BindingType exactMatch)
|
||||
{
|
||||
var netMatches = xTypes.Where(t => t.NetType.FullName == supportType.NetType.FullName).ToList();
|
||||
if (netMatches.Count == 1)
|
||||
{
|
||||
exactMatch = netMatches[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
var javaMatches = xTypes.Where(t => t.JavaType.FullName == supportType.JavaType.FullName).ToList();
|
||||
if (javaMatches.Count == 1)
|
||||
{
|
||||
exactMatch = javaMatches[0];
|
||||
return true;
|
||||
}
|
||||
|
||||
exactMatch = BindingType.Empty;
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool TryGetMapping(Dictionary<string, string> mappings, FullType type, out string androidx)
|
||||
{
|
||||
if (mappings.TryGetValue(type.FullName, out androidx))
|
||||
return true;
|
||||
|
||||
string nested = "";
|
||||
while (type.Name.Contains("."))
|
||||
{
|
||||
nested = type.Name.Substring(type.Name.LastIndexOf(".")) + nested;
|
||||
type = type.WithName(type.Name.Substring(0, type.Name.LastIndexOf(".")));
|
||||
|
||||
if (mappings.TryGetValue(type.FullName, out androidx))
|
||||
{
|
||||
androidx += nested;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Dictionary<string, string> LoadMapping(string mapping)
|
||||
{
|
||||
var dic = new Dictionary<string, string>();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(mapping) && File.Exists(mapping))
|
||||
{
|
||||
var lines = File.ReadAllLines(mapping);
|
||||
foreach (var line in lines)
|
||||
{
|
||||
var parts = line.Split(',');
|
||||
dic.Add(parts[0], parts[1]);
|
||||
}
|
||||
}
|
||||
|
||||
return dic;
|
||||
}
|
||||
|
||||
private List<BindingType> GetAllTypes(string assemblyPath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(assemblyPath))
|
||||
throw new ArgumentException($"Invalid assembly path: {assemblyPath}", nameof(assemblyPath));
|
||||
if (!File.Exists(assemblyPath))
|
||||
throw new FileNotFoundException($"The assembly does not exist: {assemblyPath}");
|
||||
|
||||
using (var assembly = AssemblyDefinition.ReadAssembly(assemblyPath))
|
||||
{
|
||||
var types = assembly.MainModule.GetTypes();
|
||||
return types.Where(IsValidType).Select(GetFullType).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsValidType(TypeDefinition typeDefinition)
|
||||
{
|
||||
if (typeDefinition.Namespace == "Java.Interop" && typeDefinition.Name.EndsWith("__TypeRegistrations"))
|
||||
return false;
|
||||
|
||||
if (typeDefinition.Name == "<Module>" || typeDefinition.Name.StartsWith("<>c__DisplayClass"))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private BindingType GetFullType(TypeDefinition typeDefinition)
|
||||
{
|
||||
var assembly = GetAttributeValue(typeDefinition, "Xamarin.AndroidX.Internal.InjectedAssemblyNameAttribute");
|
||||
var ns = typeDefinition.Namespace;
|
||||
var name = typeDefinition.Name;
|
||||
var java = GetJavaType(typeDefinition);
|
||||
|
||||
var parent = typeDefinition.DeclaringType;
|
||||
while (parent != null)
|
||||
{
|
||||
assembly = GetAttributeValue(parent, "Xamarin.AndroidX.Internal.InjectedAssemblyNameAttribute");
|
||||
ns = parent.Namespace;
|
||||
name = parent.Name + "." + name;
|
||||
parent = parent.DeclaringType;
|
||||
}
|
||||
|
||||
return new BindingType(new FullType(assembly, ns, name), java);
|
||||
}
|
||||
|
||||
private static string GetAttributeValue(TypeDefinition typeDefinition, string attributeType, int index = 0)
|
||||
{
|
||||
var attribute = typeDefinition
|
||||
?.CustomAttributes
|
||||
?.FirstOrDefault(a => a.AttributeType.FullName == attributeType);
|
||||
|
||||
var value = attribute
|
||||
?.ConstructorArguments
|
||||
?.Skip(index)
|
||||
?.FirstOrDefault()
|
||||
.Value as string ?? string.Empty;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private FullType GetJavaType(TypeDefinition typeDefinition)
|
||||
{
|
||||
var javaType = GetAttributeValue(typeDefinition, "Android.Runtime.RegisterAttribute");
|
||||
var parts = javaType?.Split('/');
|
||||
var type = parts?.LastOrDefault()?.Split('$');
|
||||
if (parts?.Length > 0 && type?.Length > 0)
|
||||
return new FullType(string.Join(".", parts.Take(parts.Length - 1)), string.Join(".", type));
|
||||
else
|
||||
return FullType.Empty;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class MessageLoggedEventArgs : EventArgs
|
||||
{
|
||||
public MessageLoggedEventArgs(
|
||||
string message,
|
||||
bool isError = false,
|
||||
bool isVerbose = false,
|
||||
Exception exception = null)
|
||||
{
|
||||
Message = message;
|
||||
IsError = isError;
|
||||
IsVerbose = isVerbose;
|
||||
Exception = exception;
|
||||
}
|
||||
|
||||
public string Message { get; }
|
||||
|
||||
public bool IsError { get; }
|
||||
|
||||
public bool IsVerbose { get; }
|
||||
|
||||
public Exception Exception { get; }
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public struct MigrationPair
|
||||
{
|
||||
public readonly string Source;
|
||||
public readonly string Destination;
|
||||
|
||||
public MigrationPair(string source, string destination)
|
||||
{
|
||||
Source = source;
|
||||
Destination = destination;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
obj is MigrationPair other &&
|
||||
Source == other.Source &&
|
||||
Destination == other.Destination;
|
||||
|
||||
public override int GetHashCode() =>
|
||||
(Source, Destination).GetHashCode();
|
||||
|
||||
public override string ToString() =>
|
||||
$"{Source} => {Destination}";
|
||||
|
||||
public void Deconstruct(out string source, out string destination)
|
||||
{
|
||||
source = Source;
|
||||
destination = Destination;
|
||||
}
|
||||
|
||||
public static implicit operator (string Source, string Destination) (MigrationPair value) =>
|
||||
(value.Source, value.Destination);
|
||||
|
||||
public static implicit operator MigrationPair((string Source, string Destination) value) =>
|
||||
new MigrationPair(value.Source, value.Destination);
|
||||
}
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class MigrationTool
|
||||
{
|
||||
public bool HasLoggedErrors { get; private set; }
|
||||
|
||||
public bool Verbose { get; set; }
|
||||
|
||||
public event EventHandler<MessageLoggedEventArgs> MessageLogged;
|
||||
|
||||
protected virtual void LogMessage(string message) =>
|
||||
Log(new MessageLoggedEventArgs(message));
|
||||
|
||||
protected virtual void LogVerboseMessage(string message) =>
|
||||
Log(new MessageLoggedEventArgs(message, isVerbose: true));
|
||||
|
||||
protected virtual void LogError(string message) =>
|
||||
Log(new MessageLoggedEventArgs(message, isError: true));
|
||||
|
||||
protected virtual void LogError(Exception ex) =>
|
||||
Log(new MessageLoggedEventArgs(ex.Message, exception: ex));
|
||||
|
||||
protected virtual void Log(MessageLoggedEventArgs e)
|
||||
{
|
||||
if (e.IsError)
|
||||
HasLoggedErrors = true;
|
||||
|
||||
MessageLogged?.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected bool ExecuteExternalProcess(
|
||||
string command,
|
||||
string arguments = "",
|
||||
string workingDirectory = "",
|
||||
CancellationToken cancellationToken = default(CancellationToken))
|
||||
{
|
||||
LogVerboseMessage($"Running command:");
|
||||
LogVerboseMessage($" Command: {command}");
|
||||
LogVerboseMessage($" Arguments: {arguments}");
|
||||
|
||||
var psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = command,
|
||||
Arguments = arguments,
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true,
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
WorkingDirectory = workingDirectory,
|
||||
};
|
||||
|
||||
using (var outputEvent = new ManualResetEvent(false))
|
||||
using (var errorEvent = new ManualResetEvent(false))
|
||||
using (var proc = new Process())
|
||||
{
|
||||
proc.OutputDataReceived += (sender, e) =>
|
||||
{
|
||||
if (e.Data != null)
|
||||
LogMessage(e.Data);
|
||||
else
|
||||
outputEvent.Set();
|
||||
};
|
||||
proc.ErrorDataReceived += (sender, e) =>
|
||||
{
|
||||
if (e.Data != null)
|
||||
LogError(e.Data);
|
||||
else
|
||||
errorEvent.Set();
|
||||
};
|
||||
|
||||
proc.StartInfo = psi;
|
||||
proc.Start();
|
||||
proc.BeginOutputReadLine();
|
||||
proc.BeginErrorReadLine();
|
||||
|
||||
cancellationToken.Register(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
proc.Kill();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
});
|
||||
|
||||
proc.WaitForExit();
|
||||
|
||||
if (psi.RedirectStandardError)
|
||||
errorEvent.WaitOne(TimeSpan.FromSeconds(30));
|
||||
|
||||
if (psi.RedirectStandardOutput)
|
||||
outputEvent.WaitOne(TimeSpan.FromSeconds(30));
|
||||
|
||||
return proc.ExitCode == 0 && !HasLoggedErrors;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
[DataContract]
|
||||
public class Package
|
||||
{
|
||||
public Package()
|
||||
{
|
||||
}
|
||||
|
||||
public Package(string id)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
[DataMember(Name = "id", Order = 0)]
|
||||
public string Id { get; set; }
|
||||
|
||||
[DataMember(Name = "dependencies", Order = 1)]
|
||||
public List<string> Dependencies { get; set; } = new List<string>();
|
||||
|
||||
public override string ToString() =>
|
||||
$"{Id}: {Dependencies?.Count ?? 0}";
|
||||
}
|
||||
}
|
|
@ -1,167 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.Serialization.Json;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public class PackageDependencyTree
|
||||
{
|
||||
private readonly Dictionary<string, Package> tree = new Dictionary<string, Package>();
|
||||
|
||||
public List<Package> Packages => tree.Values.ToList();
|
||||
|
||||
public Package GetOrCreate(string id)
|
||||
{
|
||||
var treeKey = id.ToLowerInvariant();
|
||||
|
||||
if (!tree.TryGetValue(treeKey, out var package))
|
||||
{
|
||||
package = new Package(id);
|
||||
tree[treeKey] = package;
|
||||
}
|
||||
|
||||
return package;
|
||||
}
|
||||
|
||||
public IEnumerable<string> Reduce(IEnumerable<string> ids)
|
||||
{
|
||||
var requirements = Flatten(ids).ToDictionary(i => i, i => true);
|
||||
|
||||
var working = requirements.Keys.ToList();
|
||||
foreach (var id in working)
|
||||
{
|
||||
if (!requirements[id])
|
||||
continue;
|
||||
|
||||
var dependencies = Flatten(id, false);
|
||||
|
||||
foreach (var dep in dependencies)
|
||||
requirements[dep] = false;
|
||||
}
|
||||
|
||||
return requirements.Where(p => p.Value).Select(p => p.Key).ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<string> Flatten(IEnumerable<string> ids, bool includeTopLevel = true)
|
||||
{
|
||||
var working = new List<string>(ids.Distinct());
|
||||
|
||||
var dependencies = new Dictionary<string, bool>();
|
||||
if (includeTopLevel)
|
||||
{
|
||||
foreach (var id in working)
|
||||
{
|
||||
dependencies[id] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (var idx = 0; idx < working.Count; idx++)
|
||||
{
|
||||
var id = working[idx];
|
||||
|
||||
var treeKey = id.ToLowerInvariant();
|
||||
if (!tree.TryGetValue(treeKey, out var package) || package.Dependencies.Count == 0)
|
||||
continue;
|
||||
|
||||
foreach (var dep in package.Dependencies)
|
||||
{
|
||||
dependencies[dep] = true;
|
||||
|
||||
if (!working.Contains(dep))
|
||||
working.Add(dep);
|
||||
}
|
||||
}
|
||||
|
||||
return dependencies.Keys.ToList();
|
||||
}
|
||||
|
||||
public IEnumerable<string> Flatten(string id, bool includeTopLevel = true) =>
|
||||
Flatten(new[] { id }, includeTopLevel);
|
||||
|
||||
public void Save(string jsonPath)
|
||||
{
|
||||
var dir = Path.GetDirectoryName(jsonPath);
|
||||
if (!Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
using (var stream = File.Create(jsonPath))
|
||||
{
|
||||
Save(stream);
|
||||
}
|
||||
}
|
||||
|
||||
public void Save(Stream stream)
|
||||
{
|
||||
var serializationObject = new Tree
|
||||
{
|
||||
Packages = Packages
|
||||
};
|
||||
|
||||
var serializer = new DataContractJsonSerializer(typeof(Tree));
|
||||
serializer.WriteObject(stream, serializationObject);
|
||||
}
|
||||
|
||||
public static PackageDependencyTree Load()
|
||||
{
|
||||
var tree = new PackageDependencyTree();
|
||||
tree.Deserialize(Resources.DependenciesPath);
|
||||
return tree;
|
||||
}
|
||||
|
||||
public static PackageDependencyTree Load(string dependenciesFile)
|
||||
{
|
||||
var tree = new PackageDependencyTree();
|
||||
tree.Deserialize(dependenciesFile);
|
||||
return tree;
|
||||
}
|
||||
|
||||
public static PackageDependencyTree Load(Stream json)
|
||||
{
|
||||
var tree = new PackageDependencyTree();
|
||||
tree.Deserialize(json);
|
||||
return tree;
|
||||
}
|
||||
|
||||
private void Deserialize(string jsonPath)
|
||||
{
|
||||
using (var stream = File.OpenRead(jsonPath))
|
||||
{
|
||||
Deserialize(stream);
|
||||
}
|
||||
}
|
||||
|
||||
private void Deserialize(Stream stream)
|
||||
{
|
||||
var serializer = new DataContractJsonSerializer(typeof(Tree));
|
||||
var serializationObject = (Tree)serializer.ReadObject(stream);
|
||||
|
||||
if (serializationObject == null || serializationObject.Packages.Count == 0)
|
||||
return;
|
||||
|
||||
// recreate the tree
|
||||
foreach (var incomingPackage in serializationObject.Packages)
|
||||
{
|
||||
var id = incomingPackage.Id;
|
||||
var package = GetOrCreate(id);
|
||||
|
||||
foreach (var depId in incomingPackage.Dependencies)
|
||||
{
|
||||
var depPackage = GetOrCreate(depId);
|
||||
|
||||
if (package.Dependencies.All(d => !d.Equals(depId, StringComparison.OrdinalIgnoreCase)))
|
||||
package.Dependencies.Add(depId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DataContract]
|
||||
private class Tree
|
||||
{
|
||||
[DataMember(Name = "packages")]
|
||||
public List<Package> Packages { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public static class Resources
|
||||
{
|
||||
private static readonly Assembly assembly = typeof(Resources).Assembly;
|
||||
|
||||
private const string assemblyMapping = "Tools/Mappings/androidx-assemblies.csv";
|
||||
private const string typeMapping = "Tools/Mappings/androidx-mapping.csv";
|
||||
private const string javaMapping = "Tools/Mappings/androidx-class-mapping.csv";
|
||||
private const string mappingOverrides = "Tools/Mappings/override-mapping.csv";
|
||||
private const string dependencies = "Tools/Mappings/dependencies.json";
|
||||
private const string jetiferRoot = "Tools/JetifierWrapper/";
|
||||
|
||||
public static string AssembliesMappingPath = GetFullPath(assemblyMapping);
|
||||
public static string TypesMappingFilePath = GetFullPath(typeMapping);
|
||||
public static string JavaClassMappingPath = GetFullPath(javaMapping);
|
||||
public static string MappingOverridesPath = GetFullPath(mappingOverrides);
|
||||
public static string DependenciesPath = GetFullPath(dependencies);
|
||||
public static string JetifierWrapperDirectory = GetFullPath(jetiferRoot);
|
||||
|
||||
public static string JetifierWrapperJarPath = Path.Combine(JetifierWrapperDirectory, "JetifierWrapper.jar");
|
||||
public static string JetifierWrapperMain = "com.xamarin.androidx.jetifierWrapper.Main";
|
||||
|
||||
public static string GetFullPath(string path) =>
|
||||
Path.Combine(Path.GetDirectoryName(assembly.Location), path);
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace Xamarin.AndroidX.Migration
|
||||
{
|
||||
public struct TypeMapping
|
||||
{
|
||||
public BindingType SupportType;
|
||||
public BindingType AndroidXType;
|
||||
|
||||
public TypeMapping(BindingType supportType, BindingType androidXType)
|
||||
{
|
||||
SupportType = supportType;
|
||||
AndroidXType = androidXType;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj) =>
|
||||
obj is TypeMapping other &&
|
||||
EqualityComparer<BindingType>.Default.Equals(SupportType, other.SupportType) &&
|
||||
EqualityComparer<BindingType>.Default.Equals(AndroidXType, other.AndroidXType);
|
||||
|
||||
public override int GetHashCode() =>
|
||||
(SupportType, AndroidXType).GetHashCode();
|
||||
|
||||
public override string ToString() =>
|
||||
$"{SupportType} => {AndroidXType}";
|
||||
|
||||
public void Deconstruct(out BindingType supportType, out BindingType androidXType)
|
||||
{
|
||||
supportType = SupportType;
|
||||
androidXType = AndroidXType;
|
||||
}
|
||||
|
||||
public static implicit operator (BindingType SupportType, BindingType AndroidXType) (TypeMapping value) =>
|
||||
(value.SupportType, value.AndroidXType);
|
||||
|
||||
public static implicit operator TypeMapping((BindingType SupportType, BindingType AndroidXType) value) =>
|
||||
new TypeMapping(value.SupportType, value.AndroidXType);
|
||||
}
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!--
|
||||
<PackageReference Include="ILRepack.Lib" Version="2.0.18" NoWarn="NU1701" />
|
||||
-->
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
|
||||
<PackageReference Include="ILRepack.Lib" Version="2.0.18" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="..\..\..\mappings\androidx-assemblies.csv" Link="Tools\Mappings\androidx-assemblies.csv" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="..\..\..\mappings\androidx-class-mapping.csv" Link="Tools\Mappings\androidx-class-mapping.csv" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="..\..\..\output\mappings\androidx-mapping.csv" Link="Tools\Mappings\androidx-mapping.csv" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="..\..\..\output\mappings\dependencies.json" Link="Tools\Mappings\dependencies.json" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="..\..\..\output\mappings\override-mapping.csv" Link="Tools\Mappings\override-mapping.csv" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="..\..\..\output\JetifierWrapper\jetifierWrapper-1.0.jar" Link="Tools\JetifierWrapper\jetifierWrapper-1.0.jar" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\externals\java.interop\java.interop\src\Xamarin.Android.Tools.Bytecode\Xamarin.Android.Tools.Bytecode.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="ILRepack.Lib" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,37 +0,0 @@
|
|||
|
||||
Add the Xamarin.AndroidX.Migration NuGet package to your app
|
||||
------------------------------------------------------------
|
||||
|
||||
You should add the `Xamarin.AndroidX.Migration` NuGet package to your Xamarin
|
||||
Android application project and any Xamarin.Android library projects it
|
||||
references.
|
||||
|
||||
|
||||
Keep the Xamarin.Android.Support.* NuGet packages
|
||||
-------------------------------------------------
|
||||
|
||||
You will need to keep your existing references to Xamarin.Android.Support.*
|
||||
NuGet packages as any remaining usage of the old Android Support API's will
|
||||
require this for compiling before the migration build step does its job. The
|
||||
Android Support libraries will not be bundled into your apk.
|
||||
|
||||
|
||||
Add references to the correct AndroidX NuGet packages
|
||||
-----------------------------------------------------
|
||||
|
||||
The migration package contains a validation step which helps ensure you have
|
||||
references to all of the AndroidX NuGet packages that the Android Support
|
||||
library NuGet packages you reference in your app map to.
|
||||
|
||||
You will see a build error generated telling you which packages are missing
|
||||
which you need to add.
|
||||
|
||||
|
||||
When can I remove the Migration package?
|
||||
----------------------------------------
|
||||
|
||||
As soon as all of your own source code, layout files, proguard configurations,
|
||||
and manifest files are converted over to using the new AndroidX API's, and all
|
||||
of the libraries you depend on have done the same, you can safely remove the
|
||||
AndroidX Migration NuGet package along with all of the old Android Support
|
||||
library NuGet packages.
|
|
@ -1,89 +0,0 @@
|
|||
using Mono.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Xamarin.AndroidX.Migration;
|
||||
|
||||
namespace AndroidXMigrator
|
||||
{
|
||||
public abstract class BaseCommand : Command
|
||||
{
|
||||
protected BaseCommand(string name, string help)
|
||||
: this(name, null, help)
|
||||
{
|
||||
}
|
||||
|
||||
protected BaseCommand(string name, string extras, string help)
|
||||
: base(name, help)
|
||||
{
|
||||
var actualOptions = OnCreateOptions();
|
||||
|
||||
if (string.IsNullOrWhiteSpace(extras))
|
||||
extras = "[OPTIONS]";
|
||||
else
|
||||
extras += " [OPTIONS]";
|
||||
|
||||
Options = new OptionSet
|
||||
{
|
||||
$"usage: {Program.Name} {Name} {extras}",
|
||||
"",
|
||||
Help,
|
||||
"",
|
||||
"Options:",
|
||||
};
|
||||
|
||||
foreach (var o in actualOptions)
|
||||
Options.Add(o);
|
||||
|
||||
Options.Add("?|h|help", "Show this message and exit", _ => ShowHelp = true);
|
||||
}
|
||||
|
||||
public bool ShowHelp { get; private set; }
|
||||
|
||||
public override int Invoke(IEnumerable<string> args)
|
||||
{
|
||||
try
|
||||
{
|
||||
var extras = Options.Parse(args);
|
||||
|
||||
if (ShowHelp)
|
||||
{
|
||||
Options.WriteOptionDescriptions(CommandSet.Out);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!OnValidateArguments(extras))
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: Use `{Program.Name} help {Name}` for details.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return OnInvoke(extras) ? 0 : 1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: An error occurred: `{ex.Message}`.");
|
||||
if (Program.Verbose)
|
||||
Console.Error.WriteLine(ex);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract OptionSet OnCreateOptions();
|
||||
|
||||
protected virtual bool OnValidateArguments(IEnumerable<string> extras) => true;
|
||||
|
||||
protected abstract bool OnInvoke(IEnumerable<string> extras);
|
||||
|
||||
protected void LogToolMessage(MessageLoggedEventArgs e)
|
||||
{
|
||||
if (e.Exception != null)
|
||||
Console.Error.WriteLine(e.Exception);
|
||||
else if (e.IsError)
|
||||
Console.Error.WriteLine(e.Message);
|
||||
else if (e.IsVerbose && Program.Verbose)
|
||||
Console.WriteLine(e.Message);
|
||||
else if (!e.IsVerbose)
|
||||
Console.WriteLine(e.Message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
using Mono.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Xamarin.AndroidX.Migration;
|
||||
|
||||
namespace AndroidXMigrator
|
||||
{
|
||||
public class CecilfyCommand : BaseCommand
|
||||
{
|
||||
private bool skipEmbeddedResources;
|
||||
private bool renameTypes;
|
||||
|
||||
public CecilfyCommand()
|
||||
: base("cecilfy", "Migrates a .NET assembly to AndroidX.")
|
||||
{
|
||||
}
|
||||
|
||||
public Dictionary<string, string> Assemblies { get; } = new Dictionary<string, string>();
|
||||
|
||||
public string JavaPath { get; set; } = "java";
|
||||
|
||||
protected override OptionSet OnCreateOptions() => new OptionSet
|
||||
{
|
||||
{ "a|assembly=", "One or more assemblies to cecilfy", v => AddAssembly(v) },
|
||||
{ "skip-embedded", "Do not Jetify the embedded resources", v => skipEmbeddedResources = true },
|
||||
{ "rename-types", "Rename the types inside the assembly (INTERNAL)", v => renameTypes = true },
|
||||
{ "java=", "The path to the Java executable", v => JavaPath = v },
|
||||
};
|
||||
|
||||
protected override bool OnValidateArguments(IEnumerable<string> extras)
|
||||
{
|
||||
var hasError = false;
|
||||
|
||||
if (Assemblies.Count == 0)
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: At least one assembly is required `--assembly=PATH` or `--assembly=PATH|OUTPUT` or `--assembly=PATH=OUTPUT`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
var missing = Assemblies.Keys.Where(i => !File.Exists(i));
|
||||
if (missing.Any())
|
||||
{
|
||||
foreach (var file in missing)
|
||||
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{file}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
return !hasError;
|
||||
}
|
||||
|
||||
protected override bool OnInvoke(IEnumerable<string> extras)
|
||||
{
|
||||
var assemblyPairs = Assemblies.Select(a => new MigrationPair(a.Key, a.Value)).ToArray();
|
||||
|
||||
var migrator = new CecilMigrator
|
||||
{
|
||||
Verbose = Program.Verbose,
|
||||
SkipEmbeddedResources = skipEmbeddedResources,
|
||||
RenameTypes = renameTypes,
|
||||
JavaPath = JavaPath,
|
||||
};
|
||||
|
||||
migrator.MessageLogged += (sender, e) => LogToolMessage(e);
|
||||
|
||||
migrator.Migrate(assemblyPairs);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddAssembly(string assembly)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(assembly))
|
||||
return;
|
||||
|
||||
var parts = assembly.Split('|', '=');
|
||||
|
||||
if (parts.Length < 1)
|
||||
return;
|
||||
|
||||
var input = parts[0];
|
||||
var output = parts.Length == 1 ? input : parts[1];
|
||||
|
||||
Assemblies.Add(input, output);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,218 +0,0 @@
|
|||
using Mono.ApiTools;
|
||||
using Mono.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace AndroidXMigrator
|
||||
{
|
||||
public class CompareCommand : BaseCommand
|
||||
{
|
||||
private string htmlDiff;
|
||||
private string mdDiff;
|
||||
private string xmlDiff;
|
||||
private bool alwaysResolve;
|
||||
private bool excludeNonbreaking;
|
||||
private bool excludeParameterNames;
|
||||
private bool outputApi;
|
||||
|
||||
public CompareCommand()
|
||||
: base("compare", "[FIRST ASSEMBLY] [SECOND ASSEMBLY]", "Compares two .NET assemblies or XML API info files.")
|
||||
{
|
||||
}
|
||||
|
||||
public List<string> Assemblies { get; } = new List<string>();
|
||||
|
||||
public List<string> Directories { get; } = new List<string>();
|
||||
|
||||
protected override OptionSet OnCreateOptions() => new OptionSet
|
||||
{
|
||||
{ "html=", "The output file for the HTML diff", v => htmlDiff = v },
|
||||
{ "md=", "The output file for the Markdown diff", v => mdDiff = v },
|
||||
{ "xml=", "The output file for the XML diff", v => xmlDiff = v },
|
||||
{ "d|directory=", "The directories to search for assemblies", v => AddDirectory(v) },
|
||||
{ "always-resolve", "Always resolve assemblies", v => alwaysResolve = true },
|
||||
{ "exclude-nonbreaking", "Exclude non-breaking changes from the diff", v => excludeNonbreaking = true },
|
||||
{ "exclude-params", "Exclude parameter name changes from the diff", v => excludeParameterNames = true },
|
||||
{ "output-api", "Output the API info for each assembly", v => outputApi = true },
|
||||
};
|
||||
|
||||
protected override bool OnValidateArguments(IEnumerable<string> extras)
|
||||
{
|
||||
var hasError = false;
|
||||
|
||||
Assemblies.AddRange(extras.Where(a => !string.IsNullOrWhiteSpace(a)));
|
||||
|
||||
if (Assemblies.Count != 2)
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: Exactly two assemblies are required.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
var missing = Assemblies.Where(i => !File.Exists(i));
|
||||
if (missing.Any())
|
||||
{
|
||||
foreach (var file in missing)
|
||||
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{file}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
return !hasError;
|
||||
}
|
||||
|
||||
protected override bool OnInvoke(IEnumerable<string> extras)
|
||||
{
|
||||
if (Program.Verbose)
|
||||
{
|
||||
Console.WriteLine($"Comparing the following assemblies:");
|
||||
foreach (var assembly in Assemblies)
|
||||
Console.WriteLine($" - {assembly}");
|
||||
|
||||
if (Directories.Count > 0)
|
||||
{
|
||||
Console.WriteLine($"Using the following search diectories:");
|
||||
foreach (var directory in Directories)
|
||||
Console.WriteLine($" - {directory}");
|
||||
}
|
||||
}
|
||||
|
||||
var infoStreams = new List<Stream>();
|
||||
{
|
||||
var config = new ApiInfoConfig
|
||||
{
|
||||
IgnoreResolutionErrors = !alwaysResolve,
|
||||
SearchDirectories = Directories,
|
||||
};
|
||||
|
||||
foreach (var assembly in Assemblies)
|
||||
{
|
||||
if (Program.Verbose)
|
||||
Console.WriteLine($"Generating API info for {assembly}...");
|
||||
|
||||
var xdoc = GetApiInfoDocument(assembly, config, out var wasXml);
|
||||
|
||||
if (!wasXml && outputApi)
|
||||
{
|
||||
xdoc.Save(assembly + ".api.xml");
|
||||
}
|
||||
|
||||
// in order to compare assemblies, they have to be the same name
|
||||
var xass = xdoc.Element("assemblies").Element("assembly");
|
||||
xass.SetAttributeValue("name", "Assembly");
|
||||
|
||||
var stream = new MemoryStream();
|
||||
xdoc.Save(stream);
|
||||
stream.Position = 0;
|
||||
|
||||
infoStreams.Add(stream);
|
||||
}
|
||||
}
|
||||
|
||||
GenerateDiff(xmlDiff, writer =>
|
||||
{
|
||||
if (Program.Verbose)
|
||||
Console.WriteLine($"Generating XML diff at {xmlDiff}...");
|
||||
|
||||
infoStreams[0].Position = 0;
|
||||
infoStreams[1].Position = 0;
|
||||
ApiDiff.Generate(infoStreams[0], infoStreams[1], writer);
|
||||
});
|
||||
GenerateDiff(htmlDiff, writer =>
|
||||
{
|
||||
if (Program.Verbose)
|
||||
Console.WriteLine($"Generating HTML diff at {htmlDiff}...");
|
||||
|
||||
infoStreams[0].Position = 0;
|
||||
infoStreams[1].Position = 0;
|
||||
var config = new ApiDiffFormattedConfig
|
||||
{
|
||||
Colorize = true,
|
||||
Formatter = ApiDiffFormatter.Html,
|
||||
IgnoreNonbreaking = excludeNonbreaking,
|
||||
IgnoreParameterNameChanges = excludeParameterNames,
|
||||
};
|
||||
ApiDiffFormatted.Generate(infoStreams[0], infoStreams[1], writer, config);
|
||||
});
|
||||
GenerateDiff(mdDiff, writer =>
|
||||
{
|
||||
if (Program.Verbose)
|
||||
Console.WriteLine($"Generating Markdown diff at {mdDiff}...");
|
||||
|
||||
infoStreams[0].Position = 0;
|
||||
infoStreams[1].Position = 0;
|
||||
var config = new ApiDiffFormattedConfig
|
||||
{
|
||||
Formatter = ApiDiffFormatter.Markdown,
|
||||
IgnoreNonbreaking = excludeNonbreaking,
|
||||
IgnoreParameterNameChanges = excludeParameterNames,
|
||||
};
|
||||
ApiDiffFormatted.Generate(infoStreams[0], infoStreams[1], writer, config);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static XDocument GetApiInfoDocument(string assembly, ApiInfoConfig config, out bool wasXml)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var stream = new MemoryStream())
|
||||
{
|
||||
using (var writer = new StreamWriter(stream, new UTF8Encoding(false), 1024, true))
|
||||
{
|
||||
ApiInfo.Generate(assembly, writer, config);
|
||||
}
|
||||
|
||||
stream.Position = 0;
|
||||
wasXml = false;
|
||||
return XDocument.Load(stream);
|
||||
}
|
||||
}
|
||||
catch (BadImageFormatException)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
wasXml = true;
|
||||
return XDocument.Load(assembly);
|
||||
}
|
||||
catch (XmlException)
|
||||
{
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Unable to load {assembly} as it was neither a .NET assembly nor an XML API info file.");
|
||||
}
|
||||
|
||||
private static void GenerateDiff(string path, Action<TextWriter> generate)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
return;
|
||||
|
||||
var dir = Path.GetDirectoryName(path);
|
||||
if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
using (var file = File.Create(path))
|
||||
using (var writer = new StreamWriter(file))
|
||||
{
|
||||
generate(writer);
|
||||
}
|
||||
}
|
||||
|
||||
private void AddDirectory(string directory)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(directory))
|
||||
return;
|
||||
|
||||
if (!Path.IsPathRooted(directory))
|
||||
directory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), directory));
|
||||
|
||||
Directories.Add(directory);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Mono.Options;
|
||||
using NuGet.Packaging;
|
||||
using Xamarin.AndroidX.Migration;
|
||||
|
||||
namespace AndroidXMigrator
|
||||
{
|
||||
public class DependencyTreeCommand : BaseCommand
|
||||
{
|
||||
public DependencyTreeCommand()
|
||||
: base("deptree", "Create a dependency tree of NuGet packages.")
|
||||
{
|
||||
}
|
||||
|
||||
protected override OptionSet OnCreateOptions() => new OptionSet
|
||||
{
|
||||
{ "d|directory=", "The directory to search for packages", v => AddDirectory(v) },
|
||||
{ "o|output=", "The path to the dependencies json", v => OutputPath = v },
|
||||
};
|
||||
|
||||
public List<string> Directories { get; } = new List<string>();
|
||||
|
||||
public string OutputPath { get; set; }
|
||||
|
||||
protected override bool OnValidateArguments(IEnumerable<string> extras)
|
||||
{
|
||||
if (Directories.Count == 0)
|
||||
Directories.Add(Directory.GetCurrentDirectory());
|
||||
|
||||
var hasError = false;
|
||||
|
||||
if (Directories.Count == 0)
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: At least one directory is required `--directory=PATH`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
var missing = Directories.Where(i => !Directory.Exists(i));
|
||||
|
||||
if (missing.Any())
|
||||
{
|
||||
foreach (var file in missing)
|
||||
Console.Error.WriteLine($"{Program.Name}: Directory does not exist: `{file}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
return !hasError;
|
||||
}
|
||||
|
||||
protected override bool OnInvoke(IEnumerable<string> extras)
|
||||
{
|
||||
if (Program.Verbose)
|
||||
{
|
||||
Console.WriteLine($"Creating a dependency tree all the *.nupkg files in:");
|
||||
|
||||
foreach (var directory in Directories)
|
||||
Console.WriteLine($" - {directory}");
|
||||
}
|
||||
|
||||
var nupkgFiles = Directories
|
||||
.SelectMany(d => Directory.GetFiles(d, "*.nupkg", SearchOption.TopDirectoryOnly))
|
||||
.OrderBy(n => Path.GetFileName(n))
|
||||
.ToArray();
|
||||
|
||||
if (Program.Verbose)
|
||||
{
|
||||
Console.WriteLine($"Found {nupkgFiles.Length} files:");
|
||||
|
||||
foreach (var nupkg in nupkgFiles)
|
||||
Console.WriteLine($" - {nupkg}");
|
||||
}
|
||||
|
||||
var tree = new PackageDependencyTree();
|
||||
|
||||
foreach (var nupkg in nupkgFiles)
|
||||
{
|
||||
using (var reader = new PackageArchiveReader(nupkg))
|
||||
{
|
||||
var id = reader.GetIdentity().Id;
|
||||
var package = tree.GetOrCreate(id);
|
||||
|
||||
var dependencies = reader
|
||||
.GetPackageDependencies()
|
||||
.SelectMany(d => d.Packages)
|
||||
.ToArray();
|
||||
foreach (var dep in dependencies)
|
||||
{
|
||||
var depId = dep.Id;
|
||||
var depPackage = tree.GetOrCreate(depId);
|
||||
|
||||
if (package.Dependencies.All(d => !d.Equals(depId, StringComparison.OrdinalIgnoreCase)))
|
||||
package.Dependencies.Add(depId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Program.Verbose)
|
||||
Console.WriteLine($"Final dependency tree:");
|
||||
|
||||
if (Program.Verbose || string.IsNullOrWhiteSpace(OutputPath))
|
||||
{
|
||||
foreach (var package in tree.Packages)
|
||||
{
|
||||
Console.WriteLine($" - {package.Id}:");
|
||||
|
||||
foreach (var dependency in package.Dependencies)
|
||||
Console.WriteLine($" - {dependency }");
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(OutputPath))
|
||||
tree.Save(OutputPath);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void AddDirectory(string directory)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(directory))
|
||||
return;
|
||||
|
||||
if (!Path.IsPathRooted(directory))
|
||||
directory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), directory));
|
||||
|
||||
Directories.Add(directory);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
using Mono.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Xamarin.AndroidX.Migration;
|
||||
|
||||
namespace AndroidXMigrator
|
||||
{
|
||||
public class GenerateCommand : BaseCommand
|
||||
{
|
||||
public GenerateCommand()
|
||||
: base("generate", "Generates the complete AndroidX mapping file.")
|
||||
{
|
||||
}
|
||||
|
||||
public bool ExcludeWarnings { get; set; }
|
||||
|
||||
public string AndroidSupportAssembly { get; set; }
|
||||
|
||||
public string AndroidXAssembly { get; set; }
|
||||
|
||||
public string JavaTypeMapping { get; set; } = Resources.JavaClassMappingPath;
|
||||
|
||||
public string OverrideMapping { get; set; } = Resources.MappingOverridesPath;
|
||||
|
||||
public string OutputPath { get; set; }
|
||||
|
||||
protected override OptionSet OnCreateOptions() => new OptionSet
|
||||
{
|
||||
{ "s|support=", "The path to the merged Android.Support assembly", v => AndroidSupportAssembly = v },
|
||||
{ "x|androidx=", "The path to the merged AndroidX assembly", v => AndroidXAssembly = v },
|
||||
{ "j|java=", "The path to the Java mapping csv", v => JavaTypeMapping = v },
|
||||
{ "m|override=", "The path to the mapping overides csv", v => OverrideMapping = v },
|
||||
{ "o|output=", "The output path to use for the generated mapping", v => SetOutputPath(v) },
|
||||
{ "exclude-warnings", "Include warnings in the output", v => ExcludeWarnings = v != null },
|
||||
};
|
||||
|
||||
protected override bool OnValidateArguments(IEnumerable<string> extras)
|
||||
{
|
||||
var hasError = false;
|
||||
|
||||
if (string.IsNullOrEmpty(AndroidSupportAssembly))
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: Missing required argument `--support=PATH`.");
|
||||
hasError = true;
|
||||
}
|
||||
else if (!File.Exists(AndroidSupportAssembly))
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{AndroidSupportAssembly}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(AndroidXAssembly))
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: Missing required argument `--androidx=PATH`.");
|
||||
hasError = true;
|
||||
}
|
||||
else if (!File.Exists(AndroidXAssembly))
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{AndroidXAssembly}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(JavaTypeMapping) && !File.Exists(JavaTypeMapping))
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{JavaTypeMapping}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(OverrideMapping) && !File.Exists(OverrideMapping))
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{OverrideMapping}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (hasError)
|
||||
Console.Error.WriteLine($"{Program.Name}: Use `{Program.Name} help {Name}` for details.");
|
||||
|
||||
return !hasError;
|
||||
}
|
||||
|
||||
protected override bool OnInvoke(IEnumerable<string> extras)
|
||||
{
|
||||
StreamWriter writer = null;
|
||||
try
|
||||
{
|
||||
var outputWriter = string.IsNullOrWhiteSpace(OutputPath)
|
||||
? Console.Out
|
||||
: (writer = new StreamWriter(OutputPath));
|
||||
|
||||
var generator = new MappingGenerator
|
||||
{
|
||||
OverridesPath = OverrideMapping,
|
||||
JavaMappingPath = JavaTypeMapping,
|
||||
IncludeWarnings = !ExcludeWarnings,
|
||||
Verbose = Program.Verbose,
|
||||
};
|
||||
generator.Generate(AndroidSupportAssembly, AndroidXAssembly, outputWriter);
|
||||
}
|
||||
finally
|
||||
{
|
||||
writer?.Dispose();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetOutputPath(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
return;
|
||||
|
||||
if (path.EndsWith("/") || path.EndsWith("\\"))
|
||||
path += "androidx-mapping.csv";
|
||||
|
||||
var dir = Path.GetDirectoryName(path);
|
||||
if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
OutputPath = path;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
using Mono.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Xamarin.AndroidX.Migration;
|
||||
|
||||
namespace AndroidXMigrator
|
||||
{
|
||||
public class JetifyCommand : BaseCommand
|
||||
{
|
||||
public JetifyCommand()
|
||||
: base("jetify", "Migrates a Java .aar or .jar file to AndroidX.")
|
||||
{
|
||||
}
|
||||
|
||||
public Dictionary<string, string> Archives { get; } = new Dictionary<string, string>();
|
||||
|
||||
public string JavaPath { get; set; } = "java";
|
||||
|
||||
public bool Parallel { get; set; }
|
||||
|
||||
public bool UseIntermediateFile { get; set; }
|
||||
|
||||
protected override OptionSet OnCreateOptions() => new OptionSet
|
||||
{
|
||||
{ "a|archive=", "One or more .jar/.aar files to jetify", v => AddArchive(v) },
|
||||
{ "java=", "The path to the Java executable", v => JavaPath = v },
|
||||
{ "parallel", "Execute in parallel", v => Parallel = true },
|
||||
{ "intermediate", "Use an intermediate file (for long paths)", v => UseIntermediateFile = true },
|
||||
};
|
||||
|
||||
protected override bool OnValidateArguments(IEnumerable<string> extras)
|
||||
{
|
||||
var hasError = false;
|
||||
|
||||
if (Archives.Count == 0)
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: At least one archive is required `--archive=PATH` or `--archive=PATH|OUTPUT` or `--archive=PATH=OUTPUT`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
var missing = Archives.Keys.Where(i => !File.Exists(i));
|
||||
if (missing.Any())
|
||||
{
|
||||
foreach (var file in missing)
|
||||
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{file}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
return !hasError;
|
||||
}
|
||||
|
||||
protected override bool OnInvoke(IEnumerable<string> extras)
|
||||
{
|
||||
var archivePairs = Archives.Select(a => new MigrationPair(a.Key, a.Value)).ToArray();
|
||||
|
||||
var jetifier = new Jetifier
|
||||
{
|
||||
Verbose = Program.Verbose,
|
||||
JavaPath = JavaPath,
|
||||
Parallel = Parallel,
|
||||
UseIntermediateFile = UseIntermediateFile,
|
||||
};
|
||||
|
||||
jetifier.MessageLogged += (sender, e) => LogToolMessage(e);
|
||||
|
||||
return jetifier.Jetify(archivePairs);
|
||||
}
|
||||
|
||||
private void AddArchive(string archive)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(archive))
|
||||
return;
|
||||
|
||||
var parts = archive.Split('|', '=');
|
||||
|
||||
if (parts.Length < 1)
|
||||
return;
|
||||
|
||||
var input = parts[0];
|
||||
var output = parts.Length == 1 ? input : parts[1];
|
||||
|
||||
Archives.Add(input, output);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
using Mono.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Xamarin.AndroidX.Migration;
|
||||
|
||||
namespace AndroidXMigrator
|
||||
{
|
||||
public class MergeCommand : BaseCommand
|
||||
{
|
||||
public MergeCommand()
|
||||
: base("merge", "Merges various .NET assemlies into a single file.")
|
||||
{
|
||||
}
|
||||
|
||||
public List<string> Assemblies { get; } = new List<string>();
|
||||
|
||||
public string OutputPath { get; set; }
|
||||
|
||||
public List<string> SearchDirectories { get; } = new List<string>();
|
||||
|
||||
public bool InjectAssemblyNames { get; set; }
|
||||
|
||||
protected override OptionSet OnCreateOptions() => new OptionSet
|
||||
{
|
||||
{ "a|assembly=", "One or more assemblies to merge", v => Assemblies.Add(v) },
|
||||
{ "o|output=", "The output path to use for the merged assembly", v => SetOutputPath(v) },
|
||||
{ "s|search=", "One or more search directories", v => SearchDirectories.Add(v) },
|
||||
{ "inject-assemblyname", "Add the assembly names to the types", _ => InjectAssemblyNames = true },
|
||||
};
|
||||
|
||||
protected override bool OnValidateArguments(IEnumerable<string> extras)
|
||||
{
|
||||
var hasError = false;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(OutputPath))
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: An output path is required `--output=PATH`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (Assemblies.Count == 0)
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: At least one assembly is required `--assembly=PATH`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
var missing = Assemblies.Where(i => !File.Exists(i));
|
||||
|
||||
if (missing.Any())
|
||||
{
|
||||
foreach (var file in missing)
|
||||
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{file}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (hasError)
|
||||
Console.Error.WriteLine($"{Program.Name}: Use `{Program.Name} help {Name}` for details.");
|
||||
|
||||
return !hasError;
|
||||
}
|
||||
|
||||
protected override bool OnInvoke(IEnumerable<string> extras)
|
||||
{
|
||||
var merger = new AssemblyMerger
|
||||
{
|
||||
SearchDirectories = SearchDirectories,
|
||||
InjectAssemblyNames = InjectAssemblyNames,
|
||||
Verbose = Program.Verbose,
|
||||
};
|
||||
merger.Merge(Assemblies, OutputPath);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void SetOutputPath(string path)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path))
|
||||
return;
|
||||
|
||||
if (path.EndsWith("/") || path.EndsWith("\\"))
|
||||
path += "Merged.dll";
|
||||
|
||||
var dir = Path.GetDirectoryName(path);
|
||||
if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
|
||||
OutputPath = path;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
using Mono.Options;
|
||||
|
||||
namespace AndroidXMigrator
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public const string Name = "androidx-migrator";
|
||||
|
||||
public static bool Verbose { get; private set; }
|
||||
|
||||
static int Main(string[] args)
|
||||
{
|
||||
var commands = new CommandSet(Name)
|
||||
{
|
||||
$"usage: {Name} COMMAND [OPTIONS]",
|
||||
"",
|
||||
"A set of utilities that aids in the migration of assemblies, jars and aars to AndroidX.",
|
||||
"",
|
||||
"Global options:",
|
||||
{ "v|verbose", "Use a more verbose output", _ => Verbose = true },
|
||||
"",
|
||||
"Available commands:",
|
||||
new CecilfyCommand(),
|
||||
new CompareCommand(),
|
||||
new DependencyTreeCommand(),
|
||||
new GenerateCommand(),
|
||||
new JetifyCommand(),
|
||||
new MergeCommand(),
|
||||
new SearchCommand(),
|
||||
};
|
||||
return commands.Run(args);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,168 +0,0 @@
|
|||
using Mono.Options;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using Xamarin.Android.Tools.Bytecode;
|
||||
|
||||
namespace AndroidXMigrator
|
||||
{
|
||||
public class SearchCommand : BaseCommand
|
||||
{
|
||||
public SearchCommand()
|
||||
: base("search", "Search artifacts in directories for Java classes.")
|
||||
{
|
||||
}
|
||||
|
||||
protected override OptionSet OnCreateOptions() => new OptionSet
|
||||
{
|
||||
{ "d|directory=", "The directory to search for artifacts", v => AddDirectory(v) },
|
||||
{ "c|class=", "The Java class to find", v => JavaClasses.Add(v) },
|
||||
};
|
||||
|
||||
public List<string> Directories { get; } = new List<string>();
|
||||
|
||||
public List<string> JavaClasses { get; } = new List<string>();
|
||||
|
||||
protected override bool OnValidateArguments(IEnumerable<string> extras)
|
||||
{
|
||||
if (Directories.Count == 0)
|
||||
Directories.Add(Directory.GetCurrentDirectory());
|
||||
|
||||
var hasError = false;
|
||||
|
||||
if (JavaClasses.Count == 0)
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: At least one Java class is required `--class=PATH`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (Directories.Count == 0)
|
||||
{
|
||||
Console.Error.WriteLine($"{Program.Name}: At least one directory is required `--directory=PATH`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
var missing = Directories.Where(i => !Directory.Exists(i));
|
||||
|
||||
if (missing.Any())
|
||||
{
|
||||
foreach (var file in missing)
|
||||
Console.Error.WriteLine($"{Program.Name}: Directory does not exist: `{file}`.");
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
return !hasError;
|
||||
}
|
||||
|
||||
protected override bool OnInvoke(IEnumerable<string> extras)
|
||||
{
|
||||
if (Program.Verbose)
|
||||
{
|
||||
Console.WriteLine($"Looking for the following classes:");
|
||||
foreach (var javaClass in JavaClasses)
|
||||
Console.WriteLine($" - {javaClass}");
|
||||
Console.WriteLine($"In the following directories:");
|
||||
foreach (var directory in Directories)
|
||||
Console.WriteLine($" - {directory}");
|
||||
}
|
||||
|
||||
foreach (var directory in Directories)
|
||||
{
|
||||
var aarFiles = Directory.EnumerateFiles(directory, "*.aar", SearchOption.AllDirectories);
|
||||
var jarFiles = Directory.EnumerateFiles(directory, "*.jar", SearchOption.AllDirectories);
|
||||
var artifacts = jarFiles.Union(aarFiles);
|
||||
|
||||
foreach (var artifact in artifacts)
|
||||
{
|
||||
if (Program.Verbose)
|
||||
Console.WriteLine($"Processing {artifact}...");
|
||||
|
||||
foreach (var javaClass in JavaClasses)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(javaClass))
|
||||
continue;
|
||||
|
||||
Stream jarStream = null;
|
||||
try
|
||||
{
|
||||
if (Path.GetExtension(artifact).Equals(".aar", StringComparison.OrdinalIgnoreCase))
|
||||
jarStream = ReadZipEntry(artifact, "classes.jar");
|
||||
else if (Path.GetExtension(artifact).Equals(".jar", StringComparison.OrdinalIgnoreCase))
|
||||
jarStream = File.OpenRead(artifact);
|
||||
|
||||
if (jarStream != null)
|
||||
{
|
||||
var classPath = new ClassPath();
|
||||
classPath.Load(jarStream);
|
||||
|
||||
DoSearch(artifact, classPath, javaClass);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
jarStream?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void DoSearch(string artifact, ClassPath classPath, string javaClass)
|
||||
{
|
||||
foreach (var package in classPath.GetPackages())
|
||||
{
|
||||
var classFiles = package.Value;
|
||||
|
||||
foreach (var classFile in classFiles)
|
||||
{
|
||||
var thisClass = classFile.ThisClass;
|
||||
if (thisClass.Name.Value.Contains(javaClass))
|
||||
{
|
||||
Console.WriteLine($"{thisClass.Name.Value}: {artifact}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Stream ReadZipEntry(string archivePath, string entryPath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(entryPath))
|
||||
return null;
|
||||
|
||||
entryPath = entryPath.Replace("\\", "/");
|
||||
|
||||
using (var archive = new ZipArchive(File.OpenRead(archivePath), ZipArchiveMode.Read, false))
|
||||
{
|
||||
var entry = archive.Entries.FirstOrDefault(e => e.FullName.Equals(entryPath, StringComparison.OrdinalIgnoreCase));
|
||||
if (entry != null)
|
||||
{
|
||||
using (var stream = entry.Open())
|
||||
{
|
||||
var output = new MemoryStream();
|
||||
stream.CopyTo(output);
|
||||
output.Position = 0;
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void AddDirectory(string directory)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(directory))
|
||||
return;
|
||||
|
||||
if (!Path.IsPathRooted(directory))
|
||||
directory = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), directory));
|
||||
|
||||
Directories.Add(directory);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<RootNamespace>AndroidXMigrator</RootNamespace>
|
||||
<AssemblyName>androidx-migrator</AssemblyName>
|
||||
<ToolCommandName>androidx-migrator</ToolCommandName>
|
||||
<PackAsTool>true</PackAsTool>
|
||||
|
||||
<PackageId>Xamarin.AndroidX.Migration.Tool</PackageId>
|
||||
<Title>Migration Tools for Xamarin AndroidX</Title>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<AssemblyFileVersion>1.0.0.0</AssemblyFileVersion>
|
||||
<Description>This package provides a set of tools and MSBuild tasks to aid in the migration from Android Support to Android X.</Description>
|
||||
<Summary>This package provides a set of tools and MSBuild tasks to aid in the migration from Android Support to Android X.</Summary>
|
||||
<PackageIcon>icon.png</PackageIcon>
|
||||
<PackageTags>Xamarin.AndroidX Xamarin Android Support AndroidX Migration</PackageTags>
|
||||
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Mono.ApiTools" Version="5.14.0.2" />
|
||||
<PackageReference Include="Mono.Cecil" Version="0.11.4" />
|
||||
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
|
||||
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
|
||||
<PackageReference Include="NuGet.Packaging" Version="6.2.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\externals\java.interop\java.interop\src\Xamarin.Android.Tools.Bytecode\Xamarin.Android.Tools.Bytecode.csproj" />
|
||||
<ProjectReference Include="..\Migration\Xamarin.AndroidX.Migration.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\..\..\LICENSE.md" Pack="True" PackagePath="LICENSE.md" />
|
||||
<None Include="..\..\..\icons\Xamarin.AndroidX_nuget.png" Pack="True" PackagePath="icon.png" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,51 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28606.126
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.AndroidX.Migration.BuildTasks", "BuildTasks\Xamarin.AndroidX.Migration.BuildTasks.csproj", "{450BD878-668D-4739-91F6-87BBCEB55FDF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.AndroidX.Migration.Core", "Migration\Xamarin.AndroidX.Migration.Core.csproj", "{CF645037-0F6E-43D9-A603-A15A4DBE1906}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.AndroidX.Migration.Tool", "Tool\Xamarin.AndroidX.Migration.Tool.csproj", "{06820168-947C-425E-8E5F-E768935B2CDC}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "JetifierWrapper", "JetifierWrapper", "{AAD3DF53-731A-4B5B-AEC0-0FB2260B58D6}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
JetifierWrapper\build.gradle = JetifierWrapper\build.gradle
|
||||
JetifierWrapper\src\main\java\com\xamarin\androidx\jetifierWrapper\JetifierCallable.java = JetifierWrapper\src\main\java\com\xamarin\androidx\jetifierWrapper\JetifierCallable.java
|
||||
JetifierWrapper\src\main\java\com\xamarin\androidx\jetifierWrapper\JetifierData.java = JetifierWrapper\src\main\java\com\xamarin\androidx\jetifierWrapper\JetifierData.java
|
||||
JetifierWrapper\src\main\java\com\xamarin\androidx\jetifierWrapper\Main.java = JetifierWrapper\src\main\java\com\xamarin\androidx\jetifierWrapper\Main.java
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Android.Tools.Bytecode", "..\..\externals\java.interop\java.interop\src\Xamarin.Android.Tools.Bytecode\Xamarin.Android.Tools.Bytecode.csproj", "{51B18B14-0AE6-45EE-A62E-92A199C5A73C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{450BD878-668D-4739-91F6-87BBCEB55FDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{450BD878-668D-4739-91F6-87BBCEB55FDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{450BD878-668D-4739-91F6-87BBCEB55FDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{450BD878-668D-4739-91F6-87BBCEB55FDF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF645037-0F6E-43D9-A603-A15A4DBE1906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CF645037-0F6E-43D9-A603-A15A4DBE1906}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CF645037-0F6E-43D9-A603-A15A4DBE1906}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CF645037-0F6E-43D9-A603-A15A4DBE1906}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{06820168-947C-425E-8E5F-E768935B2CDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{06820168-947C-425E-8E5F-E768935B2CDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{06820168-947C-425E-8E5F-E768935B2CDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{06820168-947C-425E-8E5F-E768935B2CDC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{51B18B14-0AE6-45EE-A62E-92A199C5A73C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{51B18B14-0AE6-45EE-A62E-92A199C5A73C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{51B18B14-0AE6-45EE-A62E-92A199C5A73C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{51B18B14-0AE6-45EE-A62E-92A199C5A73C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D2FF59CE-8753-4D7E-A4FD-172D29AD4496}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,6 +1,11 @@
|
|||
**Xamarin is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may require or install dependencies which are governed by additional licenses.**
|
||||
**Xamarin is not responsible for, nor does it grant any licenses to,
|
||||
third-party packages. Some packages may require or install dependencies which
|
||||
are governed by additional licenses.**
|
||||
|
||||
Note: This component depends on [com.android.installreferrer:installrefererrer]
|
||||
(https://maven.google.com/web/index.html?q=installreferrer#com.android.installreferrer:installreferrer),
|
||||
which is subject to the [Apache 2.0](https://maven.google.com/web/index.html?q=installref#com.android.installreferrer:installreferrer:1.0).
|
||||
|
||||
Note: This component depends on [com.android.installreferrer:installrefererrer](https://maven.google.com/web/index.html?q=installreferrer#com.android.installreferrer:installreferrer), which is subject to the [Apache 2.0](https://developer.android.com/google/play/installreferrer/)
|
||||
|
||||
### Xamarin Component for `com.android.installreferrer:installrefererrer` for Xamarin.Android
|
||||
|
||||
|
@ -8,8 +13,20 @@ Note: This component depends on [com.android.installreferrer:installrefererrer](
|
|||
|
||||
Copyright (c) .NET Foundation Contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
<Authors>Microsoft</Authors>
|
||||
<Owners>Microsoft</Owners>
|
||||
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
|
||||
<PackageLicenseExpression>MIT AND Apache-2.0</PackageLicenseExpression>
|
||||
<PackageVersion>@(Model.NuGetVersion)</PackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroidSupport.Tests", "AndroidSupport.Tests\AndroidSupport.Tests.csproj", "{0BE8A946-F780-48E0-9DFC-6B0BD32B1A67}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{0BE8A946-F780-48E0-9DFC-6B0BD32B1A67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0BE8A946-F780-48E0-9DFC-6B0BD32B1A67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0BE8A946-F780-48E0-9DFC-6B0BD32B1A67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0BE8A946-F780-48E0-9DFC-6B0BD32B1A67}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,189 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{0BE8A946-F780-48E0-9DFC-6B0BD32B1A67}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>AndroidSupport.Tests</RootNamespace>
|
||||
<AssemblyName>AndroidSupport.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
|
||||
<AndroidEnableMultiDex>true</AndroidEnableMultiDex>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<AndroidSupportedAbis>arm64-v8a;armeabi;armeabi-v7a;x86</AndroidSupportedAbis>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
<PlatformTarget>anycpu</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidManagedSymbols>true</AndroidManagedSymbols>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="Xamarin.Android.Support.Annotations">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Annotations.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Compat">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Compat.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Core.UI">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Core.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Core.Utils">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Core.Utils.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.CustomTabs">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.CustomTabs.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Dynamic.Animation">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Dynamic.Animation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Exif">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Exif.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Fragment">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Fragment.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Media.Compat">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Media.Compat.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Percent">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Percent.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Recommendation">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Recommendation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Transition">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Transition.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v7.GridLayout">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v7.GridLayout.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v7.Palette">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v7.Palette.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v7.Preference">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v7.Preference.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v8.RenderScript">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v8.RenderScript.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v13">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v13.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v14.Preference">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v14.Preference.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v17.Leanback">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v17.Leanback.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v17.Preference.Leanback">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v17.Preference.Leanback.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="Xamarin.Android.Support.v4">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Design">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Design.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Animated.Vector.Drawable">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Animated.Vector.Drawable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v7.AppCompat">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v7.AppCompat.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v7.CardView">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v7.CardView.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v7.RecyclerView">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v7.RecyclerView.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.v7.MediaRouter">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.v7.MediaRouter.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Vector.Drawable">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Vector.Drawable.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Arch.Core.Common">
|
||||
<HintPath>..\..\output\Xamarin.Android.Arch.Core.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Arch.Lifecycle.Common">
|
||||
<HintPath>..\..\output\Xamarin.Android.Arch.Lifecycle.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Arch.Lifecycle.Runtime">
|
||||
<HintPath>..\..\output\Xamarin.Android.Arch.Lifecycle.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Emoji.AppCompat">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Emoji.AppCompat.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Emoji.Bundled">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Emoji.Bundled.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.Emoji">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.Emoji.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Xamarin.Android.Support.TV.Provider">
|
||||
<HintPath>..\..\output\Xamarin.Android.Support.TV.Provider.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="xunit.core" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
|
||||
<PackageReference Include="xunit.assert" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.utility" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Tests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\Icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\drawable\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,143 +0,0 @@
|
|||
using Android.App;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
using System;
|
||||
using Xunit.Runners;
|
||||
using System.Threading.Tasks;
|
||||
using Android.Support.V7.App;
|
||||
using Android.Views;
|
||||
|
||||
namespace AndroidSupport.Tests
|
||||
{
|
||||
[Activity(Label = "AndroidSupport.Tests", MainLauncher = true, Theme="@style/Theme.AppCompat.Light", Icon = "@mipmap/icon")]
|
||||
public class MainActivity : AppCompatActivity
|
||||
{
|
||||
public static Activity TestParentActivity { get; set; }
|
||||
|
||||
|
||||
TaskCompletionSource<bool> tcsTests = new TaskCompletionSource<bool>();
|
||||
|
||||
AssemblyRunner assemblyRunner;
|
||||
|
||||
TestResultsAdapter adapter;
|
||||
ListView listView;
|
||||
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate(savedInstanceState);
|
||||
|
||||
TestParentActivity = this;
|
||||
|
||||
// Set our view from the "main" layout resource
|
||||
SetContentView(Resource.Layout.Main);
|
||||
|
||||
listView = FindViewById<ListView>(Resource.Id.listView);
|
||||
|
||||
adapter = new TestResultsAdapter { Parent = this };
|
||||
listView.Adapter = adapter;
|
||||
|
||||
assemblyRunner = AssemblyRunner.WithoutAppDomain(Assembly.GetExecutingAssembly().GetName().Name + ".dll");
|
||||
assemblyRunner.OnDiscoveryComplete = DiscoveryCompleteHandler;;
|
||||
assemblyRunner.OnExecutionComplete = ExecutionCompleteHandler;;
|
||||
assemblyRunner.OnTestFailed = TestFailedHandler;;
|
||||
assemblyRunner.OnTestSkipped = TestSkippedHandler;
|
||||
assemblyRunner.OnTestPassed = TestPassedHandler;
|
||||
assemblyRunner.OnTestOutput = TestOutputHandler;
|
||||
|
||||
Console.WriteLine("Discovering...");
|
||||
assemblyRunner.Start ();
|
||||
}
|
||||
|
||||
bool anyFailed = false;
|
||||
|
||||
void DiscoveryCompleteHandler(DiscoveryCompleteInfo obj)
|
||||
{
|
||||
Console.WriteLine("Discovery Complete.");
|
||||
}
|
||||
|
||||
void ExecutionCompleteHandler(ExecutionCompleteInfo obj)
|
||||
{
|
||||
Console.WriteLine("Test Complete: Success={0}", !anyFailed);
|
||||
tcsTests.TrySetResult(anyFailed);
|
||||
}
|
||||
|
||||
void TestFailedHandler(TestFailedInfo obj)
|
||||
{
|
||||
anyFailed = true;
|
||||
adapter.AddResult(new TestResultInfo
|
||||
{
|
||||
Passed = false,
|
||||
DisplayName = obj.TestDisplayName
|
||||
});
|
||||
}
|
||||
|
||||
void TestSkippedHandler(TestSkippedInfo obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TestOutputHandler(TestOutputInfo obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void TestPassedHandler(TestPassedInfo obj)
|
||||
{
|
||||
adapter.AddResult(new TestResultInfo
|
||||
{
|
||||
Passed = true,
|
||||
DisplayName = obj.TestDisplayName
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class TestResultInfo
|
||||
{
|
||||
public bool Passed { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
}
|
||||
|
||||
class TestResultsAdapter : BaseAdapter<TestResultInfo>
|
||||
{
|
||||
public Activity Parent;
|
||||
List<TestResultInfo> results = new List<TestResultInfo>();
|
||||
|
||||
public void AddResult(TestResultInfo info)
|
||||
{
|
||||
results.Add(info);
|
||||
Parent.RunOnUiThread(() => NotifyDataSetChanged());
|
||||
}
|
||||
|
||||
public override TestResultInfo this[int position]
|
||||
{
|
||||
get { return results[position]; }
|
||||
}
|
||||
|
||||
public override int Count
|
||||
{
|
||||
get { return results.Count; }
|
||||
}
|
||||
|
||||
public override long GetItemId(int position)
|
||||
{
|
||||
return position;
|
||||
}
|
||||
|
||||
public override View GetView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
var view = convertView ?? LayoutInflater.From(Parent).Inflate(Android.Resource.Layout.TwoLineListItem, parent, false);
|
||||
|
||||
var r = this[position];
|
||||
|
||||
view.FindViewById<TextView>(Android.Resource.Id.Text1).Text = r.DisplayName;
|
||||
view.FindViewById<TextView>(Android.Resource.Id.Text2).Text = r.Passed ? "Passed" : "Failed";
|
||||
view.FindViewById<TextView>(Android.Resource.Id.Text2).SetTextColor(r.Passed ? Android.Graphics.Color.Green : Android.Graphics.Color.Maroon);
|
||||
|
||||
return view;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.xamarin.androidsupport_tests">
|
||||
<uses-sdk android:minSdkVersion="10" />
|
||||
<application android:allowBackup="true" android:icon="@mipmap/icon" android:label="@string/app_name">
|
||||
</application>
|
||||
</manifest>
|
|
@ -1,27 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Android.App;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle("AndroidSupport.Tests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("${AuthorCopyright}")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
|
@ -1,44 +0,0 @@
|
|||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.axml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.axml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called "R"
|
||||
(this is an Android convention) that contains the tokens for each one of the resources
|
||||
included. For example, for the above Resources layout, this is what the R class would expose:
|
||||
|
||||
public class R {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
|
||||
to reference the layout/main.axml file, or R.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp">
|
||||
<ListView
|
||||
android:minWidth="25px"
|
||||
android:minHeight="25px"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/listView"
|
||||
android:transitionName="testTransition" />
|
||||
</LinearLayout>
|
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-hdpi/Icon.png
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-hdpi/Icon.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 2.1 KiB |
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-mdpi/Icon.png
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-mdpi/Icon.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-xhdpi/Icon.png
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-xhdpi/Icon.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 3.2 KiB |
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-xxhdpi/Icon.png
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-xxhdpi/Icon.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 5.3 KiB |
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-xxxhdpi/Icon.png
Двоичные данные
tests/AndroidSupport.Tests/Resources/mipmap-xxxhdpi/Icon.png
Двоичный файл не отображается.
До Ширина: | Высота: | Размер: 7.6 KiB |
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="hello">Hello World, Click Me!</string>
|
||||
<string name="app_name">AndroidSupport.Tests</string>
|
||||
</resources>
|
|
@ -1,61 +0,0 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Android.App;
|
||||
using Android.OS;
|
||||
using Android.Support.V4.App;
|
||||
using Xunit;
|
||||
using Xunit.Extensions;
|
||||
|
||||
namespace AndroidSupport.Tests
|
||||
{
|
||||
public class Tests
|
||||
{
|
||||
// https://bugzilla.xamarin.com/show_bug.cgi?id=51180
|
||||
[Fact]
|
||||
public async Task Bugzilla_51180_ToBundle_Compat_Does_Not_Fail()
|
||||
{
|
||||
var tcsUIThread = new TaskCompletionSource<object>();
|
||||
|
||||
Bundle bundleOrig = null;
|
||||
Bundle bundleCompat = null;
|
||||
|
||||
// We need to run these things on the UI Thread
|
||||
MainActivity.TestParentActivity.RunOnUiThread(() => {
|
||||
|
||||
var context = MainActivity.TestParentActivity;
|
||||
var someView = MainActivity.TestParentActivity.FindViewById(Resource.Id.listView);
|
||||
|
||||
var optionsOrig = ActivityOptions.MakeSceneTransitionAnimation(context, someView, "testTransition");
|
||||
var optionsCompat = ActivityOptionsCompat.MakeSceneTransitionAnimation(context, someView, "testTransition");
|
||||
|
||||
bundleOrig = optionsOrig.ToBundle();
|
||||
bundleCompat = optionsCompat.ToBundle();
|
||||
|
||||
tcsUIThread.SetResult(null);
|
||||
});
|
||||
|
||||
await tcsUIThread.Task;
|
||||
|
||||
Assert.NotNull(bundleOrig);
|
||||
Assert.NotNull(bundleCompat);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Support_Design_Internal_Classes_Exist()
|
||||
{
|
||||
var ctx = MainActivity.TestParentActivity;
|
||||
var a = new Android.Support.Design.Internal.BottomNavigationItemView(ctx);
|
||||
var b = new Android.Support.Design.Internal.BottomNavigationMenu(ctx);
|
||||
var c = new Android.Support.Design.Internal.BottomNavigationMenuView(ctx);
|
||||
var d = new Android.Support.Design.Internal.SnackbarContentLayout(ctx);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Support_Design_Classes_Exist()
|
||||
{
|
||||
var ctx = MainActivity.TestParentActivity;
|
||||
var e = new Android.Support.Design.Widget.BottomSheetDialog(ctx);
|
||||
var f = new Android.Support.Design.Widget.BottomSheetDialogFragment();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28606.126
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.AndroidX.Migration.BuildTasks", "..\source\migration\BuildTasks\Xamarin.AndroidX.Migration.BuildTasks.csproj", "{450BD878-668D-4739-91F6-87BBCEB55FDF}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.AndroidX.Migration.Core", "..\source\migration\Migration\Xamarin.AndroidX.Migration.Core.csproj", "{CF645037-0F6E-43D9-A603-A15A4DBE1906}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.AndroidX.Migration.Tool", "..\source\migration\Tool\Xamarin.AndroidX.Migration.Tool.csproj", "{06820168-947C-425E-8E5F-E768935B2CDC}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source", "source", "{7E423CD0-40F0-4964-8B22-F95E29694080}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aarxercise.Binding.AndroidX", "AndroidXMigrationTests\Aarxercise.Binding.AndroidX\Aarxercise.Binding.AndroidX.csproj", "{A387F7E5-9BD1-40F7-A748-96BF84702F3B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aarxercise.Binding.Support", "AndroidXMigrationTests\Aarxercise.Binding.Support\Aarxercise.Binding.Support.csproj", "{2E8C42AD-1DF4-489A-96E3-9671432D1AE4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aarxercise.Managed.AndroidX", "AndroidXMigrationTests\Aarxercise.Managed.AndroidX\Aarxercise.Managed.AndroidX.csproj", "{575ABA0A-7B38-4E3A-B3DA-E245164887BA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aarxercise.Managed.Support", "AndroidXMigrationTests\Aarxercise.Managed.Support\Aarxercise.Managed.Support.csproj", "{3EE93671-9B98-4B5B-925F-4629D3946100}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aarxercise.Old.AndroidX", "AndroidXMigrationTests\Aarxercise.Old.AndroidX\Aarxercise.Old.AndroidX.csproj", "{1E4E7879-779A-4D16-8A5C-4AAE3ED612F5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aarxercise.Old.Support", "AndroidXMigrationTests\Aarxercise.Old.Support\Aarxercise.Old.Support.csproj", "{9E99019A-1523-44D3-885D-A37AC79A8F3D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aarxercise.Reference.AndroidX", "AndroidXMigrationTests\Aarxercise.Reference.AndroidX\Aarxercise.Reference.AndroidX.csproj", "{A387F7E5-9BD1-40F7-A748-96BF84702BBB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aarxercise.Reference.Support", "AndroidXMigrationTests\Aarxercise.Reference.Support\Aarxercise.Reference.Support.csproj", "{2E8C42AD-1DF4-489A-96E3-9671432D1AAA}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.AndroidX.Migration.Tests", "AndroidXMigrationTests\Tests\Xamarin.AndroidX.Migration.Tests.csproj", "{3699B030-1132-4C28-8EDC-6CD7BBCF5F78}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Android.Tools.Bytecode", "..\externals\java.interop\java.interop\src\Xamarin.Android.Tools.Bytecode\Xamarin.Android.Tools.Bytecode.csproj", "{AADCD21E-B54D-48B2-A842-6A6260847C73}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{450BD878-668D-4739-91F6-87BBCEB55FDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{450BD878-668D-4739-91F6-87BBCEB55FDF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{450BD878-668D-4739-91F6-87BBCEB55FDF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{450BD878-668D-4739-91F6-87BBCEB55FDF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CF645037-0F6E-43D9-A603-A15A4DBE1906}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CF645037-0F6E-43D9-A603-A15A4DBE1906}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CF645037-0F6E-43D9-A603-A15A4DBE1906}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CF645037-0F6E-43D9-A603-A15A4DBE1906}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{06820168-947C-425E-8E5F-E768935B2CDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{06820168-947C-425E-8E5F-E768935B2CDC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{06820168-947C-425E-8E5F-E768935B2CDC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{06820168-947C-425E-8E5F-E768935B2CDC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A387F7E5-9BD1-40F7-A748-96BF84702F3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A387F7E5-9BD1-40F7-A748-96BF84702F3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A387F7E5-9BD1-40F7-A748-96BF84702F3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A387F7E5-9BD1-40F7-A748-96BF84702F3B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2E8C42AD-1DF4-489A-96E3-9671432D1AE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2E8C42AD-1DF4-489A-96E3-9671432D1AE4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2E8C42AD-1DF4-489A-96E3-9671432D1AE4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2E8C42AD-1DF4-489A-96E3-9671432D1AE4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{575ABA0A-7B38-4E3A-B3DA-E245164887BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{575ABA0A-7B38-4E3A-B3DA-E245164887BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{575ABA0A-7B38-4E3A-B3DA-E245164887BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{575ABA0A-7B38-4E3A-B3DA-E245164887BA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3EE93671-9B98-4B5B-925F-4629D3946100}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3EE93671-9B98-4B5B-925F-4629D3946100}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3EE93671-9B98-4B5B-925F-4629D3946100}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3EE93671-9B98-4B5B-925F-4629D3946100}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1E4E7879-779A-4D16-8A5C-4AAE3ED612F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1E4E7879-779A-4D16-8A5C-4AAE3ED612F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1E4E7879-779A-4D16-8A5C-4AAE3ED612F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1E4E7879-779A-4D16-8A5C-4AAE3ED612F5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9E99019A-1523-44D3-885D-A37AC79A8F3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9E99019A-1523-44D3-885D-A37AC79A8F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9E99019A-1523-44D3-885D-A37AC79A8F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9E99019A-1523-44D3-885D-A37AC79A8F3D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A387F7E5-9BD1-40F7-A748-96BF84702BBB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A387F7E5-9BD1-40F7-A748-96BF84702BBB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A387F7E5-9BD1-40F7-A748-96BF84702BBB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A387F7E5-9BD1-40F7-A748-96BF84702BBB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2E8C42AD-1DF4-489A-96E3-9671432D1AAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2E8C42AD-1DF4-489A-96E3-9671432D1AAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2E8C42AD-1DF4-489A-96E3-9671432D1AAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2E8C42AD-1DF4-489A-96E3-9671432D1AAA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3699B030-1132-4C28-8EDC-6CD7BBCF5F78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3699B030-1132-4C28-8EDC-6CD7BBCF5F78}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3699B030-1132-4C28-8EDC-6CD7BBCF5F78}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3699B030-1132-4C28-8EDC-6CD7BBCF5F78}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AADCD21E-B54D-48B2-A842-6A6260847C73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AADCD21E-B54D-48B2-A842-6A6260847C73}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AADCD21E-B54D-48B2-A842-6A6260847C73}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AADCD21E-B54D-48B2-A842-6A6260847C73}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{450BD878-668D-4739-91F6-87BBCEB55FDF} = {7E423CD0-40F0-4964-8B22-F95E29694080}
|
||||
{CF645037-0F6E-43D9-A603-A15A4DBE1906} = {7E423CD0-40F0-4964-8B22-F95E29694080}
|
||||
{06820168-947C-425E-8E5F-E768935B2CDC} = {7E423CD0-40F0-4964-8B22-F95E29694080}
|
||||
{AADCD21E-B54D-48B2-A842-6A6260847C73} = {7E423CD0-40F0-4964-8B22-F95E29694080}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {D2FF59CE-8753-4D7E-A4FD-172D29AD4496}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,64 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{A387F7E5-9BD1-40F7-A748-96BF84702F3B}</ProjectGuid>
|
||||
<ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TemplateGuid>{77efb91c-a7e9-4b0e-a7c5-31eeec3c6d46}</TemplateGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Aarxercise</RootNamespace>
|
||||
<AssemblyName>Aarxercise.Binding.AndroidX</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion>
|
||||
<AndroidClassParser>class-parse</AndroidClassParser>
|
||||
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.4.1" />
|
||||
<PackageReference Include="Xamarin.AndroidX.Legacy.Support.Core.UI" Version="1.0.0.13" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<LibraryProjectZip Include="..\Aarxersise.Java.AndroidX\app\build\outputs\aar\app-debug.aar">
|
||||
<Link>Jars\app-debug.aar</Link>
|
||||
</LibraryProjectZip>
|
||||
<None Include="Jars\AboutJars.txt" />
|
||||
<None Include="Additions\AboutAdditions.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<TransformFile Include="Transforms\Metadata.xml" />
|
||||
<TransformFile Include="Transforms\EnumFields.xml" />
|
||||
<TransformFile Include="Transforms\EnumMethods.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
|
||||
</Project>
|
|
@ -1,48 +0,0 @@
|
|||
Additions allow you to add arbitrary C# to the generated classes
|
||||
before they are compiled. This can be helpful for providing convenience
|
||||
methods or adding pure C# classes.
|
||||
|
||||
== Adding Methods to Generated Classes ==
|
||||
|
||||
Let's say the library being bound has a Rectangle class with a constructor
|
||||
that takes an x and y position, and a width and length size. It will look like
|
||||
this:
|
||||
|
||||
public partial class Rectangle
|
||||
{
|
||||
public Rectangle (int x, int y, int width, int height)
|
||||
{
|
||||
// JNI bindings
|
||||
}
|
||||
}
|
||||
|
||||
Imagine we want to add a constructor to this class that takes a Point and
|
||||
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
|
||||
with a partial class containing our new method:
|
||||
|
||||
public partial class Rectangle
|
||||
{
|
||||
public Rectangle (Point location, Size size) :
|
||||
this (location.X, location.Y, size.Width, size.Height)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
At compile time, the additions class will be added to the generated class
|
||||
and the final assembly will a Rectangle class with both constructors.
|
||||
|
||||
|
||||
== Adding C# Classes ==
|
||||
|
||||
Another thing that can be done is adding fully C# managed classes to the
|
||||
generated library. In the above example, let's assume that there isn't a
|
||||
Point class available in Java or our library. The one we create doesn't need
|
||||
to interact with Java, so we'll create it like a normal class in C#.
|
||||
|
||||
By adding a Point.cs file with this class, it will end up in the binding library:
|
||||
|
||||
public class Point
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
This directory is for Android .jars.
|
||||
|
||||
There are 2 types of jars that are supported:
|
||||
|
||||
== Input Jar ==
|
||||
|
||||
This is the jar that bindings should be generated for.
|
||||
|
||||
For example, if you were binding the Google Maps library, this would
|
||||
be Google's "maps.jar".
|
||||
|
||||
Set the build action for these jars in the properties page to "InputJar".
|
||||
|
||||
|
||||
== Reference Jars ==
|
||||
|
||||
These are jars that are referenced by the input jar. C# bindings will
|
||||
not be created for these jars. These jars will be used to resolve
|
||||
types used by the input jar.
|
||||
|
||||
NOTE: Do not add "android.jar" as a reference jar. It will be added automatically
|
||||
based on the Target Framework selected.
|
||||
|
||||
Set the build action for these jars in the properties page to "ReferenceJar".
|
|
@ -1,30 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Android.App;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Aarxercise")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Aarxercise")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,14 +0,0 @@
|
|||
<enum-field-mappings>
|
||||
<!--
|
||||
This example converts the constants Fragment_id, Fragment_name,
|
||||
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
|
||||
to an enum called Android.Support.V4.App.FragmentTagType with values
|
||||
Id, Name, and Tag.
|
||||
|
||||
<mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType">
|
||||
<field jni-name="Fragment_name" clr-name="Name" value="0" />
|
||||
<field jni-name="Fragment_id" clr-name="Id" value="1" />
|
||||
<field jni-name="Fragment_tag" clr-name="Tag" value="2" />
|
||||
</mapping>
|
||||
-->
|
||||
</enum-field-mappings>
|
|
@ -1,13 +0,0 @@
|
|||
<enum-method-mappings>
|
||||
<!--
|
||||
This example changes the Java method:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
|
||||
to be:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
|
||||
when bound in C#.
|
||||
|
||||
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
|
||||
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
|
||||
</mapping>
|
||||
-->
|
||||
</enum-method-mappings>
|
|
@ -1,9 +0,0 @@
|
|||
<metadata>
|
||||
<!--
|
||||
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
|
||||
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
|
||||
|
||||
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
|
||||
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
|
||||
-->
|
||||
</metadata>
|
|
@ -1,63 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{2E8C42AD-1DF4-489A-96E3-9671432D1AE4}</ProjectGuid>
|
||||
<ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TemplateGuid>{77efb91c-a7e9-4b0e-a7c5-31eeec3c6d46}</TemplateGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Aarxercise</RootNamespace>
|
||||
<AssemblyName>Aarxercise.Binding.Support</AssemblyName>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkVersion>v12.0</TargetFrameworkVersion>
|
||||
<AndroidClassParser>class-parse</AndroidClassParser>
|
||||
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>portable</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Mono.Android" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Xamarin.Android.Support.v7.AppCompat" Version="28.0.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<LibraryProjectZip Include="..\Aarxersise.Java.Support\app\build\outputs\aar\app-debug.aar">
|
||||
<Link>Jars\app-debug.aar</Link>
|
||||
</LibraryProjectZip>
|
||||
<None Include="Jars\AboutJars.txt" />
|
||||
<None Include="Additions\AboutAdditions.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<TransformFile Include="Transforms\Metadata.xml" />
|
||||
<TransformFile Include="Transforms\EnumFields.xml" />
|
||||
<TransformFile Include="Transforms\EnumMethods.xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
|
||||
</Project>
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче