Use the new yaml and dotnet tools

This commit is contained in:
Matthew Leibowitz 2019-08-28 04:52:02 +02:00
Родитель 6a56aacc78
Коммит 8fedc1f740
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3650EBE4AA155AF9
20 изменённых файлов: 159 добавлений и 3930 удалений

Просмотреть файл

@ -1,109 +1,73 @@
trigger:
- master
- refs/tags/*
variables:
MONO_VERSION: 5_16_0
XCODE_VERSION: 10.1
VERBOSITY: minimal
# XAMARIN_ANDROID_PATH: <path to Xamarin.Android>
# MONO_API_INFO_XML_URL: <url to api-info.xml>
resources:
repositories:
- repository: xamarin-templates
- repository: internal-templates
type: github
name: xamarin/yaml-templates
endpoint: xamarin
ref: refs/heads/dev/signing-job
- repository: components
type: github
name: xamarin/XamarinComponents
endpoint: xamarin
ref: refs/heads/dev/templating
jobs:
- job: build
displayName: 'Build Libraries & NuGets (macOS)'
timeoutInMinutes: 360
pool:
vmImage: macos-10.13
steps:
# Make sure to select the correct Xamarin and mono
- bash: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh $(MONO_VERSION)
displayName: 'Switch to the latest Xamarin SDK'
- bash: echo '##vso[task.setvariable variable=MD_APPLE_SDK_ROOT;]'/Applications/Xcode_$(XCODE_VERSION).app;sudo xcode-select --switch /Applications/Xcode_$(XCODE_VERSION).app/Contents/Developer
displayName: 'Switch to the latest Xcode'
# Build the libraries and packages
- bash: sh build.sh --target=ci --settings_skipverification=true --verbosity=$(VERBOSITY)
displayName: 'Build NuGets'
- script: |
# Make a temp folder to move the created nugets to before we fat package them
mkdir -p $(Build.SourcesDirectory)/tmp/nuget
mkdir -p $(Build.SourcesDirectory)/tmp/output
# Move all of the nupkg files from output into the temp folder we just created
mv $(Build.SourcesDirectory)/output/*.nupkg $(Build.SourcesDirectory)/tmp/nuget
# Move the remaining output bits to a temp location so they don't get overwritten
mv $(Build.SourcesDirectory)/output/* $(Build.SourcesDirectory)/tmp/output
sh build.sh --script nuget.cake \
--localSource=$(Build.SourcesDirectory)/tmp/nuget \
--packagesPath=$(Build.SourcesDirectory)/tmp/pkgs \
--workingPath=$(Build.SourcesDirectory)/tmp/working \
--outputPath=$(Build.SourcesDirectory)/output \
--incrementVersion=False \
--packLatestOnly=True \
--useExplicitVersion=True
# Move the other output bits back to the original output folder
mv $(Build.SourcesDirectory)/tmp/output/* $(Build.SourcesDirectory)/output
displayName: 'NuGet FAT'
enabled: false
# Publish the artifacts
- task: PublishBuildArtifacts@1
displayName: 'Publish unsigned artifacts'
inputs:
pathToPublish: '$(Build.SourcesDirectory)/output'
artifactName: 'nuget'
- job: build_windows
displayName: 'Build Libraries & NuGets (Windows)'
timeoutInMinutes: 360
pool:
vmImage: vs2017-win2016
steps:
# Build the libraries and packages
- powershell: .\build.ps1 --target=ci --settings_skipverification=true --verbosity=$(VERBOSITY)
displayName: 'Build everything'
# Publish the artifacts
- task: PublishBuildArtifacts@1
displayName: 'Publish Windows artifacts'
inputs:
pathToPublish: '$(Build.SourcesDirectory)/output'
artifactName: 'windows_output'
# Run some internal auditing
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
condition: not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: Component Detection - Log
inputs:
scanType: LogOnly
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
displayName: Component Detection - Report
- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@1
condition: eq(variables['System.TeamProject'], 'devdiv')
displayName: 'PoliCheck'
inputs:
targetType: F
# only sign the packages when running on Windows, and using the private server which has the certificates
- template: .ci/prepare.yml@components
parameters:
buildType: 'basic'
masterBranchName: 'master'
- template: .ci/build.yml@components
parameters:
cakeTemplatesBranch: 'dev/templating'
cakeExtraArgs: '--settings_skipverification=true --nuget_useinprocessclient=false'
tools:
- 'xamarin.androidbinderator.tool': '0.3.0'
- 'xamarin.androidx.migration.tool': '1.0.0-preview03'
postBuildSteps:
- script: |
# Make a temp folder to move the created nugets to before we fat package them
mkdir -p $(Build.SourcesDirectory)/tmp/nuget
mkdir -p $(Build.SourcesDirectory)/tmp/output
# Move all of the nupkg files from output into the temp folder we just created
mv $(Build.SourcesDirectory)/output/*.nupkg $(Build.SourcesDirectory)/tmp/nuget
# Move the remaining output bits to a temp location so they don't get overwritten
mv $(Build.SourcesDirectory)/output/* $(Build.SourcesDirectory)/tmp/output
sh build.sh --script nuget.cake \
--localSource=$(Build.SourcesDirectory)/tmp/nuget \
--packagesPath=$(Build.SourcesDirectory)/tmp/pkgs \
--workingPath=$(Build.SourcesDirectory)/tmp/working \
--outputPath=$(Build.SourcesDirectory)/output \
--incrementVersion=False \
--packLatestOnly=True \
--useExplicitVersion=True
# Move the other output bits back to the original output folder
mv $(Build.SourcesDirectory)/tmp/output/* $(Build.SourcesDirectory)/output
displayName: 'NuGet FAT'
enabled: false
# Run some internal auditing on Windows
- ${{ if and(eq(variables['System.TeamProject'], 'devdiv'), eq(variables['System.JobName'], 'windows')) }}:
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
condition: not(startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
displayName: Component Detection - Log
inputs:
scanType: LogOnly
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
displayName: Component Detection - Report
- task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@1
condition: eq(variables['System.TeamProject'], 'devdiv')
displayName: 'PoliCheck'
inputs:
targetType: F
- ${{ if eq(variables['System.TeamProject'], 'devdiv') }}:
- job: signing
displayName: Signing NuGets
dependsOn: build
pool:
name: VSEng-XamarinCustom
demands:
- corpnet
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'],'refs/tags/'))
steps:
# don't checkout code and sign the packages
- checkout: none
- template: sign-artifacts.yml@xamarin-templates
parameters:
targetFolder: '$(Build.ArtifactStagingDirectory)/signed'
# publish the signed packages
- task: PublishBuildArtifacts@1
displayName: 'Publish Signed NuGets'
inputs:
artifactName: nuget-signed
pathToPublish: '$(Build.ArtifactStagingDirectory)/signed'
- template: sign-artifacts/jobs/v1.yml@internal-templates
parameters:
dependsOn: [ 'build' ]

Просмотреть файл

@ -1,67 +1,83 @@
// Tools needed by cake addins
#tool nuget:?package=ILRepack&version=2.0.13
#tool nuget:?package=Cake.MonoApiTools&version=3.0.1
#tool nuget:?package=Microsoft.DotNet.BuildTools.GenAPI&version=1.0.0-beta-00081
#tool nuget:?package=vswhere
#tool nuget:?package=vswhere&version=2.7.1
// Cake Addins
#addin nuget:?package=Cake.FileHelpers&version=3.1.0
#addin nuget:?package=Cake.Compression&version=0.1.6
#addin nuget:?package=Cake.MonoApiTools&version=3.0.1
#addin nuget:?package=Xamarin.Nuget.Validator&version=1.1.1
// From Cake.Xamarin.Build, dumps out versions of things
//LogSystemInfo ();
using System.Xml.Linq;
var TARGET = Argument ("t", Argument ("target", "Default"));
var BUILD_CONFIG = Argument ("config", "Release");
var VERBOSITY = (Verbosity) Enum.Parse (typeof(Verbosity), Argument ("v", Argument ("verbosity", "Normal")), true);
var MAX_CPU_COUNT = Int32.Parse(Argument("maxcpucount", "0"));
var VERBOSITY = Argument ("v", Argument ("verbosity", Verbosity.Normal));
var MAX_CPU_COUNT = Argument("maxcpucount", 0);
// Lists all the artifacts and their versions for com.android.support.*
// https://dl.google.com/dl/android/maven2/com/android/support/group-index.xml
// Master list of all the packages in the repo:
// https://dl.google.com/dl/android/maven2/master-index.xml
var NUGET_PRE = "";
// FROM: https://dl.google.com/android/repository/addon2-1.xml
var BUILD_TOOLS_URL = "https://dl-ssl.google.com/android/repository/build-tools_r28-macosx.zip";
var ANDROID_SDK_VERSION = IsRunningOnWindows () ? "v9.0" : "android-28";
var RENDERSCRIPT_FOLDER = "android-8.1.0";
var TF_MONIKER = "monoandroid90";
var REF_DOCS_URL = "https://bosstoragemirror.blob.core.windows.net/android-docs-scraper/ea/ea65204c51cf20873c17c32584f3b12ed390ac55/android-support.zip";
// We grab the previous release's api-info.xml to use as a comparison for this build's generated info to make an api-diff
var BASE_API_INFO_URL = EnvironmentVariable("MONO_API_INFO_XML_URL") ?? "https://github.com/xamarin/AndroidSupportComponents/releases/download/27.1.1-rc/api-info.xml";
var MONODROID_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/" + ANDROID_SDK_VERSION + "/";
if (IsRunningOnWindows ()) {
var vsInstallPath = VSWhereLatest (new VSWhereLatestSettings { Requires = "Component.Xamarin" });
MONODROID_PATH = vsInstallPath.Combine ("Common7/IDE/ReferenceAssemblies/Microsoft/Framework/MonoAndroid/" + ANDROID_SDK_VERSION).FullPath;
// Resolve Xamarin.Android installation
var XAMARIN_ANDROID_PATH = EnvironmentVariable ("XAMARIN_ANDROID_PATH");
var ANDROID_SDK_BASE_VERSION = "v1.0";
var ANDROID_SDK_VERSION = "v9.0";
if (string.IsNullOrEmpty(XAMARIN_ANDROID_PATH)) {
if (IsRunningOnWindows()) {
var vsInstallPath = VSWhereLatest(new VSWhereLatestSettings { Requires = "Component.Xamarin" });
XAMARIN_ANDROID_PATH = vsInstallPath.Combine("Common7/IDE/ReferenceAssemblies/Microsoft/Framework/MonoAndroid").FullPath;
} else {
if (DirectoryExists("/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xamarin.android/xbuild-frameworks/MonoAndroid"))
XAMARIN_ANDROID_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xamarin.android/xbuild-frameworks/MonoAndroid";
else
XAMARIN_ANDROID_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xbuild-frameworks/MonoAndroid";
}
}
if (!DirectoryExists($"{XAMARIN_ANDROID_PATH}/{ANDROID_SDK_VERSION}"))
throw new Exception($"Unable to find Xamarin.Android {ANDROID_SDK_VERSION} at {XAMARIN_ANDROID_PATH}.");
var MSCORLIB_PATH = "/Library/Frameworks/Xamarin.Android.framework/Libraries/mono/2.1/";
if (IsRunningOnWindows ()) {
// Load all the git variables
var BUILD_COMMIT = EnvironmentVariable("BUILD_SOURCEVERSION") ?? "DEV";
var BUILD_NUMBER = EnvironmentVariable("BUILD_NUMBER") ?? "DEBUG";
var BUILD_TIMESTAMP = DateTime.UtcNow.ToString();
var DOTNETDIR = new DirectoryPath (Environment.GetFolderPath (Environment.SpecialFolder.Windows)).Combine ("Microsoft.NET/");
var REQUIRED_DOTNET_TOOLS = new [] {
"xamarin-android-binderator",
"xamarin.androidx.migration.tool"
};
if (DirectoryExists (DOTNETDIR.Combine ("Framework64")))
MSCORLIB_PATH = MakeAbsolute (DOTNETDIR.Combine("Framework64/v4.0.30319/")).FullPath;
else
MSCORLIB_PATH = MakeAbsolute (DOTNETDIR.Combine("Framework/v4.0.30319/")).FullPath;
}
var ANDROIDX_MAPPER_EXE = MakeAbsolute ((FilePath)$"util/AndroidXMapper/AndroidXMapper/bin/{BUILD_CONFIG}/net47/AndroidXMapper.exe");
Information ("MONODROID_PATH: {0}", MONODROID_PATH);
Information ("MSCORLIB_PATH: {0}", MSCORLIB_PATH);
// Log some variables
Information ("XAMARIN_ANDROID_PATH: {0}", XAMARIN_ANDROID_PATH);
Information ("ANDROID_SDK_VERSION: {0}", ANDROID_SDK_VERSION);
Information ("BUILD_COMMIT: {0}", BUILD_COMMIT);
Information ("BUILD_NUMBER: {0}", BUILD_NUMBER);
Information ("BUILD_TIMESTAMP: {0}", BUILD_TIMESTAMP);
// You shouldn't have to configure anything below here
// ######################################################
void RunProcess(FilePath fileName, string processArguments)
{
var exitCode = StartProcess(fileName, processArguments);
if (exitCode != 0)
throw new Exception ($"Process {fileName} exited with code {exitCode}.");
}
string[] RunProcessWithOutput(FilePath fileName, string processArguments)
{
var exitCode = StartProcess(fileName, new ProcessSettings {
Arguments = processArguments,
RedirectStandardOutput = true,
RedirectStandardError = true
}, out var procOut);
if (exitCode != 0)
throw new Exception ($"Process {fileName} exited with code {exitCode}.");
return procOut.ToArray();;
}
Task("javadocs")
.Does(() =>
{
@ -79,44 +95,50 @@ Task("javadocs")
var outTxtPath = srcJarPath.Replace("-sources.jar", "-paramnames.txt");
var outXmlPath = srcJarPath.Replace("-sources.jar", "-paramnames.xml");
StartProcess("java", "-jar \"" + MakeAbsolute(astJar).FullPath + "\" --text \"" + srcJarPath + "\" \"" + outTxtPath + "\"");
StartProcess("java", "-jar \"" + MakeAbsolute(astJar).FullPath + "\" --xml \"" + srcJarPath + "\" \"" + outXmlPath + "\"");
RunProcess("java", "-jar \"" + MakeAbsolute(astJar).FullPath + "\" --text \"" + srcJarPath + "\" \"" + outTxtPath + "\"");
RunProcess("java", "-jar \"" + MakeAbsolute(astJar).FullPath + "\" --xml \"" + srcJarPath + "\" \"" + outXmlPath + "\"");
}
});
Task("check-tools")
.Does(() =>
{
var installedTools = RunProcessWithOutput("dotnet", "tool list -g");
foreach (var toolName in REQUIRED_DOTNET_TOOLS) {
if (installedTools.All(l => l.IndexOf(toolName, StringComparison.OrdinalIgnoreCase) == -1))
throw new Exception ($"Missing dotnet tool: {toolName}");
}
});
Task("binderate")
.Does(() =>
{
if (!DirectoryExists("./util/binderator"))
{
EnsureDirectoryExists("./util/binderator");
Unzip ("./util/binderator.zip", "./util/binderator");
var configFile = MakeAbsolute(new FilePath("./config.json")).FullPath;
var basePath = MakeAbsolute(new DirectoryPath ("./")).FullPath;
// Run the dotnet tool for binderator
RunProcess("xamarin-android-binderator",
$"--config=\"{configFile}\" --basepath=\"{basePath}\"");
// format the targets file so they are pretty in the package
var targetsFiles = GetFiles("generated/**/*.targets");
var xmlns = (XNamespace)"http://schemas.microsoft.com/developer/msbuild/2003";
foreach (var targets in targetsFiles) {
var xdoc = XDocument.Load(targets.FullPath);
xdoc.Save(targets.FullPath);
}
var configFile = new FilePath("./config.json");
var basePath = new DirectoryPath ("./");
StartProcess("dotnet", "./util/binderator/android-binderator.dll --config=\""
+ MakeAbsolute(configFile).FullPath + "\" --basepath=\"" + MakeAbsolute(basePath).FullPath + "\"");
});
Task("libs")
.IsDependentOn("nuget-restore")
.Does(() =>
{
NuGetRestore("./generated/AndroidSupport.sln", new NuGetRestoreSettings { });
MSBuild("./generated/AndroidSupport.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("nuget-restore")
.Does(() =>
{
NuGetRestore("./generated/AndroidSupport.sln", new NuGetRestoreSettings { });
});
Task("nuget")
.IsDependentOn("libs")
.Does(() =>
@ -129,190 +151,41 @@ Task("nuget")
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
c.Properties.Add("DesignTimeBuild", new [] { "false" });
c.Properties.Add("NoBuild", new [] { "true" });
});
});
Task("nuget-validation")
.IsDependentOn("nuget")
.Does(()=>
{
//setup validation options
var options = new Xamarin.Nuget.Validator.NugetValidatorOptions()
{
Copyright = "© Microsoft Corporation. All rights reserved.",
Author = "Microsoft",
Owner = "Microsoft",
NeedsProjectUrl = true,
NeedsLicenseUrl = true,
ValidateRequireLicenseAcceptance = true,
ValidPackageNamespace = new [] { "Xamarin" },
};
var nupkgFiles = GetFiles ("./output/*.nupkg");
Information ("Found ({0}) Nuget's to validate", nupkgFiles.Count ());
foreach (var nupkgFile in nupkgFiles)
{
Information ("Verifiying Metadata of {0}", nupkgFile.GetFilename ());
var result = Xamarin.Nuget.Validator.NugetValidator.Validate(MakeAbsolute(nupkgFile).FullPath, options);
if (!result.Success)
{
Information ("Metadata validation failed for: {0} \n\n", nupkgFile.GetFilename ());
Information (string.Join("\n ", result.ErrorMessages));
throw new Exception ($"Invalid Metadata for: {nupkgFile.GetFilename ()}");
}
else
{
Information ("Metadata validation passed for: {0}", nupkgFile.GetFilename ());
}
}
});
Task ("androidxmapper")
.Does (() =>
{
MSBuild (
"./util/AndroidXMapper/AndroidXMapper.sln", c => {
c.Configuration = BUILD_CONFIG;
c.MaxCpuCount = 0;
c.Verbosity = VERBOSITY;
c.Restore = true;
});
});
Task ("diff")
.WithCriteria (!IsRunningOnWindows ())
.IsDependentOn ("merge")
.Does (() =>
{
var SEARCH_DIRS = new DirectoryPath [] {
MONODROID_PATH,
"/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/xbuild-frameworks/MonoAndroid/v1.0/",
"/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/"
};
MonoApiInfo ("./output/AndroidSupport.Merged.dll",
"./output/AndroidSupport.api-info.xml",
new MonoApiInfoToolSettings { SearchPaths = SEARCH_DIRS });
// Grab the last public release's api-info.xml to use as a base to compare and make an API diff
DownloadFile (BASE_API_INFO_URL, "./output/AndroidSupport.api-info.previous.xml");
// Now diff against current release'd api info
// eg: mono mono-api-diff.exe ./gps.r26.xml ./gps.r27.xml > gps.diff.xml
MonoApiDiff ("./output/AndroidSupport.api-info.previous.xml",
"./output/AndroidSupport.api-info.xml",
"./output/AndroidSupport.api-diff.xml");
// Now let's make a purty html file
// eg: mono mono-api-html.exe -c -x ./gps.previous.info.xml ./gps.current.info.xml > gps.diff.html
MonoApiHtml ("./output/AndroidSupport.api-info.previous.xml",
"./output/AndroidSupport.api-info.xml",
"./output/AndroidSupport.api-diff.html");
});
Task ("merge")
.IsDependentOn ("androidxmapper")
.IsDependentOn ("libs")
.Does (() =>
{
var allDlls = GetFiles ($"./generated/*/bin/{BUILD_CONFIG}/{TF_MONIKER}/Xamarin.*.dll");
var allDlls = GetFiles ($"./generated/*/bin/{BUILD_CONFIG}/monoandroid*/Xamarin.*.dll");
var mergeDlls = allDlls
.GroupBy(d => new FileInfo(d.FullPath).Name)
.Select(g => g.FirstOrDefault())
.ToList();
EnsureDirectoryExists("./output/");
var result = StartProcess(ANDROIDX_MAPPER_EXE,
RunProcess("androidx-migrator",
$"merge" +
$" -a {string.Join(" -a ", mergeDlls)} " +
$" -o " + MakeAbsolute((FilePath)"./output/AndroidSupport.Merged.dll") +
$" -s \"{MONODROID_PATH}\" " +
$" --inject-assemblyname");
if (result != 0)
throw new Exception($"The androidxmapper failed with error code {result}.");
$" --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");
});
Task ("ci-setup")
.WithCriteria (!BuildSystem.IsLocalBuild)
.Does (() =>
Task("inject-variables")
.WithCriteria(!BuildSystem.IsLocalBuild)
.Does(() =>
{
var buildCommit = "DEV";
var buildNumber = "DEBUG";
var buildTimestamp = DateTime.UtcNow.ToString ();
if (BuildSystem.IsRunningOnJenkins) {
buildNumber = BuildSystem.Jenkins.Environment.Build.BuildTag;
buildCommit = EnvironmentVariable("GIT_COMMIT") ?? buildCommit;
} else if (!string.IsNullOrWhiteSpace(EnvironmentVariable("TF_BUILD"))) {
// Running on AzureDevOps
buildNumber = BuildSystem.TFBuild.Environment.Build.Number;
buildCommit = BuildSystem.TFBuild.Environment.Repository.SourceVersion;
}
var glob = "./source/AssemblyInfo.cs";
ReplaceTextInFiles(glob, "{BUILD_COMMIT}", buildCommit);
ReplaceTextInFiles(glob, "{BUILD_NUMBER}", buildNumber);
ReplaceTextInFiles(glob, "{BUILD_TIMESTAMP}", buildTimestamp);
ReplaceTextInFiles(glob, "{BUILD_COMMIT}", BUILD_COMMIT);
ReplaceTextInFiles(glob, "{BUILD_NUMBER}", BUILD_NUMBER);
ReplaceTextInFiles(glob, "{BUILD_TIMESTAMP}", BUILD_TIMESTAMP);
});
// Task ("genapi")
// .IsDependentOn ("libs")
// .Does (() =>
// {
// var GenApiToolPath = GetFiles ("./tools/**/GenAPI.exe").FirstOrDefault ();
// // For some reason GenAPI.exe can't handle absolute paths on mac/unix properly, so always make them relative
// // GenAPI.exe -libPath:$(MONOANDROID) -out:Some.generated.cs -w:TypeForwards ./relative/path/to/Assembly.dll
// var libDirPrefix = IsRunningOnWindows () ? "output/" : "";
// var libs = new FilePath [] {
// "./" + libDirPrefix + "Xamarin.Android.Support.Compat.dll",
// "./" + libDirPrefix + "Xamarin.Android.Support.Core.UI.dll",
// "./" + libDirPrefix + "Xamarin.Android.Support.Core.Utils.dll",
// "./" + libDirPrefix + "Xamarin.Android.Support.Fragment.dll",
// "./" + libDirPrefix + "Xamarin.Android.Support.Media.Compat.dll",
// };
// foreach (var lib in libs) {
// var genName = lib.GetFilename () + ".generated.cs";
// var libPath = IsRunningOnWindows () ? MakeAbsolute (lib).FullPath : lib.FullPath;
// var monoDroidPath = IsRunningOnWindows () ? "\"" + MONODROID_PATH + "\"" : MONODROID_PATH;
// Information ("GenAPI: {0}", lib.FullPath);
// StartProcess (GenApiToolPath, new ProcessSettings {
// Arguments = string.Format("-libPath:{0} -out:{1}{2} -w:TypeForwards {3}",
// monoDroidPath + "," + MSCORLIB_PATH,
// IsRunningOnWindows () ? "" : "./",
// genName,
// libPath),
// WorkingDirectory = "./output/",
// });
// }
// MSBuild ("./AndroidSupport.TypeForwarders.sln", c => c.Configuration = BUILD_CONFIG);
// CopyFile ("./support-v4/source/bin/" + BUILD_CONFIG + "/Xamarin.Android.Support.v4.dll", "./output/Xamarin.Android.Support.v4.dll");
// });
// Task ("buildtasks")
// .Does (() =>
// {
// NuGetRestore ("./support-vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj");
// MSBuild ("./support-vector-drawable/buildtask/Vector-Drawable-BuildTasks.csproj", c => c.Configuration = BUILD_CONFIG);
// });
Task ("clean")
.Does (() =>
{
@ -329,9 +202,10 @@ Task ("clean")
});
Task ("ci")
.IsDependentOn ("ci-setup")
.IsDependentOn ("check-tools")
.IsDependentOn ("inject-variables")
.IsDependentOn ("binderate")
.IsDependentOn ("nuget-validation")
.IsDependentOn ("diff");
.IsDependentOn ("merge")
.IsDependentOn ("nuget");
RunTarget (TARGET);

241
build.ps1
Просмотреть файл

@ -1,241 +0,0 @@
##########################################################################
# This is the Cake bootstrapper script for PowerShell.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
<#
.SYNOPSIS
This is a Powershell script to bootstrap a Cake build.
.DESCRIPTION
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
and execute your Cake build script with the parameters you provide.
.PARAMETER Script
The build script to execute.
.PARAMETER Target
The build script target to run.
.PARAMETER Configuration
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
.PARAMETER ShowDescription
Shows description about tasks.
.PARAMETER DryRun
Performs a dry run.
.PARAMETER Experimental
Uses the nightly builds of the Roslyn script engine.
.PARAMETER Mono
Uses the Mono Compiler rather than the Roslyn script engine.
.PARAMETER SkipToolPackageRestore
Skips restoring of packages.
.PARAMETER ScriptArgs
Remaining arguments are added here.
.LINK
https://cakebuild.net
#>
[CmdletBinding()]
Param(
[string]$Script = "build.cake",
[string]$Target,
[string]$Configuration,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
[string]$Verbosity,
[switch]$ShowDescription,
[Alias("WhatIf", "Noop")]
[switch]$DryRun,
[switch]$Experimental,
[switch]$Mono,
[switch]$SkipToolPackageRestore,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
function MD5HashFile([string] $filePath)
{
if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
{
return $null
}
[System.IO.Stream] $file = $null;
[System.Security.Cryptography.MD5] $md5 = $null;
try
{
$md5 = [System.Security.Cryptography.MD5]::Create()
$file = [System.IO.File]::OpenRead($filePath)
return [System.BitConverter]::ToString($md5.ComputeHash($file))
}
finally
{
if ($file -ne $null)
{
$file.Dispose()
}
}
}
function GetProxyEnabledWebClient
{
$wc = New-Object System.Net.WebClient
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
$wc.Proxy = $proxy
return $wc
}
Write-Host "Preparing to run build script..."
if(!$PSScriptRoot){
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
}
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
$CAKE_PACKAGES_CONFIG = Join-Path $PSScriptRoot "cake.packages.config"
# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
Write-Verbose -Message "Creating tools directory..."
New-Item -Path $TOOLS_DIR -Type directory | out-null
}
# Make sure that packages.config exist.
if (!(Test-Path $PACKAGES_CONFIG)) {
if (!(Test-Path $CAKE_PACKAGES_CONFIG)) {
Write-Verbose -Message "Downloading packages.config..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
Throw "Could not download packages.config."
}
} else {
Write-Verbose -Message "using local cake.packages.config..."
Copy-Item $CAKE_PACKAGES_CONFIG $PACKAGES_CONFIG
}
}
# Try find NuGet.exe in path if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
$existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
}
}
# Try download NuGet.exe if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Downloading NuGet.exe..."
try {
$wc = GetProxyEnabledWebClient
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
} catch {
Throw "Could not download NuGet.exe."
}
}
# Save nuget.exe path to environment to be available to child processed
$ENV:NUGET_EXE = $NUGET_EXE
# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent) {
Push-Location
Set-Location $TOOLS_DIR
# Check for changes in packages.config and remove installed tools if true.
[string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
Write-Verbose -Message "Missing or changed package.config hash..."
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
Remove-Item -Recurse
}
Write-Verbose -Message "Restoring tools from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet tools."
}
else
{
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
Write-Verbose -Message ($NuGetOutput | out-string)
Pop-Location
}
# Restore addins from NuGet
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
Push-Location
Set-Location $ADDINS_DIR
Write-Verbose -Message "Restoring addins from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet addins."
}
Write-Verbose -Message ($NuGetOutput | out-string)
Pop-Location
}
# Restore modules from NuGet
if (Test-Path $MODULES_PACKAGES_CONFIG) {
Push-Location
Set-Location $MODULES_DIR
Write-Verbose -Message "Restoring modules from NuGet..."
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
if ($LASTEXITCODE -ne 0) {
Throw "An error occurred while restoring NuGet modules."
}
Write-Verbose -Message ($NuGetOutput | out-string)
Pop-Location
}
# Make sure that Cake has been installed.
if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}
# Build Cake arguments
$cakeArguments = @("$Script");
if ($Target) { $cakeArguments += "-target=$Target" }
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
if ($ShowDescription) { $cakeArguments += "-showdescription" }
if ($DryRun) { $cakeArguments += "-dryrun" }
if ($Experimental) { $cakeArguments += "-experimental" }
if ($Mono) { $cakeArguments += "-mono" }
$cakeArguments += $ScriptArgs
# Start Cake
Write-Host "Running build script..."
&$CAKE_EXE $cakeArguments
exit $LASTEXITCODE

125
build.sh
Просмотреть файл

@ -1,125 +0,0 @@
#!/usr/bin/env bash
##########################################################################
# This is the Cake bootstrapper script for Linux and OS X.
# This file was downloaded from https://github.com/cake-build/resources
# Feel free to change this file to fit your needs.
##########################################################################
# Define directories.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$SCRIPT_DIR/tools
ADDINS_DIR=$TOOLS_DIR/Addins
MODULES_DIR=$TOOLS_DIR/Modules
NUGET_EXE=$TOOLS_DIR/nuget.exe
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
PACKAGES_CONFIG=$TOOLS_DIR/packages.config
PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum
ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config
MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config
# Define md5sum or md5 depending on Linux/OSX
MD5_EXE=
if [[ "$(uname -s)" == "Darwin" ]]; then
MD5_EXE="md5 -r"
else
MD5_EXE="md5sum"
fi
# Define default arguments.
SCRIPT="build.cake"
CAKE_ARGUMENTS=()
# Parse arguments.
for i in "$@"; do
case $1 in
-s|--script) SCRIPT="$2"; shift ;;
--) shift; CAKE_ARGUMENTS+=("$@"); break ;;
*) CAKE_ARGUMENTS+=("$1") ;;
esac
shift
done
# Make sure the tools folder exist.
if [ ! -d "$TOOLS_DIR" ]; then
mkdir "$TOOLS_DIR"
fi
# Make sure that packages.config exist.
if [ ! -f "$TOOLS_DIR/packages.config" ]; then
if [ ! -f "$SCRIPT_DIR/cake.packages.config" ]; then
echo "Downloading packages.config..."
curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages
if [ $? -ne 0 ]; then
echo "An error occurred while downloading packages.config."
exit 1
fi
else
echo "using local cake.packages.config..."
cp "$SCRIPT_DIR/cake.packages.config" "$TOOLS_DIR/packages.config"
fi
else
echo "using local cake.packages.config..."
cp "$SCRIPT_DIR/cake.packages.config" "$TOOLS_DIR/packages.config"
fi
# Download NuGet if it does not exist.
if [ ! -f "$NUGET_EXE" ]; then
echo "Downloading NuGet..."
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
if [ $? -ne 0 ]; then
echo "An error occurred while downloading nuget.exe."
exit 1
fi
fi
# Restore tools from NuGet.
pushd "$TOOLS_DIR" >/dev/null
if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then
find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf
fi
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet tools."
exit 1
fi
$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5"
popd >/dev/null
# Restore addins from NuGet.
if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then
pushd "$ADDINS_DIR" >/dev/null
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet addins."
exit 1
fi
popd >/dev/null
fi
# Restore modules from NuGet.
if [ -f "$MODULES_PACKAGES_CONFIG" ]; then
pushd "$MODULES_DIR" >/dev/null
mono "$NUGET_EXE" install -ExcludeVersion
if [ $? -ne 0 ]; then
echo "Could not restore NuGet modules."
exit 1
fi
popd >/dev/null
fi
# Make sure that Cake has been installed.
if [ ! -f "$CAKE_EXE" ]; then
echo "Could not find Cake.exe at '$CAKE_EXE'."
exit 1
fi
# Start Cake
exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}"

Просмотреть файл

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.30.0" />
</packages>

288
util/AndroidXMapper/.gitignore поставляемый
Просмотреть файл

@ -1,288 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# DNX
project.lock.json
artifacts/
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Build
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
fastlane/report.xml
fastlane/screenshots
.vscode/

Просмотреть файл

@ -1,25 +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("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AndroidXMapper", "AndroidXMapper\AndroidXMapper.csproj", "{FC5A597E-B645-4F7A-994B-639787F92FA0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FC5A597E-B645-4F7A-994B-639787F92FA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC5A597E-B645-4F7A-994B-639787F92FA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC5A597E-B645-4F7A-994B-639787F92FA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC5A597E-B645-4F7A-994B-639787F92FA0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6B1166B4-0102-495F-B720-E755FA917EC8}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -1,14 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net47</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ILRepack.Lib" Version="2.0.16" />
<PackageReference Include="Mono.Cecil" Version="0.10.3" />
<PackageReference Include="Mono.Options" Version="5.3.0.1" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,185 +0,0 @@
using ILRepacking;
using Mono.Cecil;
using Mono.Cecil.Cil;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace AndroidXMapper
{
public class AssemblyMerger
{
private const string InjectedAttributeNamespace = "Xamarin.AndroidX.Internal";
private const string InjectedAttributeTypeName = "InjectedAssemblyNameAttribute";
public AssemblyMerger(List<string> assemblies, List<string> searchDirectories, bool injectAssemblyNames)
{
Assemblies = assemblies ?? throw new ArgumentNullException(nameof(assemblies));
SearchDirectories = searchDirectories ?? new List<string>();
InjectAssemblyNames = injectAssemblyNames;
}
public List<string> Assemblies { get; }
public List<string> SearchDirectories { get; }
public bool InjectAssemblyNames { get; }
public void Merge(string outputPath)
{
var assemblies = Assemblies;
if (Program.Verbose)
{
Console.WriteLine("Merging:");
foreach (var include in assemblies)
Console.WriteLine($" - {include}");
}
var tempRoot = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
if (InjectAssemblyNames)
{
assemblies = assemblies.ToList();
if (!Directory.Exists(tempRoot))
Directory.CreateDirectory(tempRoot);
for (int i = 0; i < assemblies.Count; i++)
{
var ass = assemblies[i];
var temp = Path.Combine(tempRoot, Guid.NewGuid().ToString() + ".dll");
InjectAssemblyName(ass, temp);
assemblies[i] = temp;
}
if (Program.Verbose)
{
Console.WriteLine("Temporary assemblies:");
foreach (var include in assemblies)
Console.WriteLine($" - {include}");
}
}
var options = new RepackOptions
{
InputAssemblies = assemblies.ToArray(),
OutputFile = outputPath,
SearchDirectories = SearchDirectories.ToArray(),
CopyAttributes = true,
AllowMultipleAssemblyLevelAttributes = true,
LogVerbose = Program.Verbose
};
var repacker = new ILRepack(options);
repacker.Repack();
if (InjectAssemblyNames)
{
MergeAssemblyNameAttributes(outputPath);
if (Directory.Exists(tempRoot))
Directory.Delete(tempRoot, true);
}
}
private void InjectAssemblyName(string assemblyPath, string outputPath)
{
var assemblyName = Path.GetFileNameWithoutExtension(assemblyPath);
using (var assembly = AssemblyDefinition.ReadAssembly(assemblyPath))
{
var module = assembly.MainModule;
var mscorlibName = module.AssemblyReferences.FirstOrDefault(a => a.Name == "mscorlib");
var mscorlib = module.AssemblyResolver.Resolve(mscorlibName);
var attributeType = mscorlib.MainModule.GetType("System.Attribute");
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);
}
}
private void MergeAssemblyNameAttributes(string assemblyPath)
{
using (var assembly = AssemblyDefinition.ReadAssembly(assemblyPath, new ReaderParameters { ReadWrite = true }))
{
var correct = assembly.MainModule.GetType(InjectedAttributeNamespace + "." + InjectedAttributeTypeName);
correct.Attributes |= TypeAttributes.Public;
correct.CustomAttributes.Clear();
foreach (var type in assembly.MainModule.Types.ToArray())
{
var attribute = type.CustomAttributes.FirstOrDefault(a => IsRandomType(a.AttributeType));
if (attribute != null && attribute.Constructor.DeclaringType != correct)
{
type.CustomAttributes.Add(new CustomAttribute(correct.Methods[0])
{
ConstructorArguments = { attribute.ConstructorArguments[0] }
});
type.CustomAttributes.Remove(attribute);
}
}
foreach (var type in assembly.MainModule.Types.Where(IsRandomType).ToArray())
{
assembly.MainModule.Types.Remove(type);
}
assembly.Write();
}
bool IsRandomType(TypeReference attr)
{
return
attr.Namespace == InjectedAttributeNamespace &&
attr.Name.EndsWith(InjectedAttributeTypeName) &&
attr.Name != InjectedAttributeTypeName;
}
}
}
}

Просмотреть файл

@ -1,41 +0,0 @@
using System.Collections.Generic;
namespace AndroidXMapper
{
public struct BindingType
{
public static BindingType Empty = new BindingType(FullType.Empty, FullType.Empty);
public FullType NetType;
public 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,53 +0,0 @@
namespace AndroidXMapper
{
public struct FullType
{
public static FullType Empty = new FullType(string.Empty, string.Empty, string.Empty);
public string Container;
public string Namespace;
public string Name;
public FullType(string ns, string n)
{
Container = string.Empty;
Namespace = ns;
Name = n;
}
public FullType(string container, string ns, string n)
{
Container = container;
Namespace = ns;
Name = n;
}
public string FullName =>
$"{Namespace}.{Name}";
public bool IsEmpty =>
string.IsNullOrEmpty(Namespace) || string.IsNullOrEmpty(Name);
public override bool Equals(object obj) =>
obj is FullType other && Container == other.Container && Namespace == other.Namespace && Name == other.Name;
public override int GetHashCode() =>
(Container, Namespace, Name).GetHashCode();
public override string ToString() =>
FullName;
public void Deconstruct(out string c, out string ns, out string n)
{
c = Container;
ns = Namespace;
n = Name;
}
public static implicit operator (string Container, string Namespace, string Name) (FullType value) =>
(value.Container, value.Namespace, value.Name);
public static implicit operator FullType((string Container, string Namespace, string Name) value) =>
new FullType(value.Container, value.Namespace, value.Name);
}
}

Просмотреть файл

@ -1,141 +0,0 @@
using Mono.Options;
using System;
using System.Collections.Generic;
using System.IO;
namespace AndroidXMapper
{
public class GenerateCommand : Command
{
public GenerateCommand()
: base("generate", "Generates the mapping file.")
{
Options = new OptionSet
{
$"usage: {Program.Name} {Name} [OPTIONS]",
"",
Help,
"",
{ "s|support=", "The path to the merged Android.Support api-info.xml", v => AndroidSupportApi = v },
{ "x|androidx=", "The path to the merged AndroidX api-info.xml", v => AndroidXApi = 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 },
{ "?|h|help", "Show this message and exit", _ => ShowHelp = 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;
}
public bool ShowHelp { get; private set; }
public bool ExcludeWarnings { get; private set; }
public string AndroidSupportApi { get; private set; }
public string AndroidXApi { get; private set; }
public string JavaTypeMapping { get; private set; }
public string OverrideMapping { get; private set; }
public string OutputPath { get; private set; }
public override int Invoke(IEnumerable<string> args)
{
StreamWriter writer = null;
try
{
var extra = Options.Parse(args);
if (ShowHelp)
{
Options.WriteOptionDescriptions(CommandSet.Out);
return 0;
}
if (!ValidateArguments())
return 1;
var outputWriter = string.IsNullOrWhiteSpace(OutputPath)
? Console.Out
: (writer = new StreamWriter(OutputPath));
var generator = new MappingGenerator(AndroidSupportApi, AndroidXApi, OverrideMapping, JavaTypeMapping);
generator.Generate(outputWriter, !ExcludeWarnings);
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine($"{Program.Name}: An error occurred: `{ex.Message}`.");
if (Program.Verbose)
Console.Error.WriteLine(ex);
return 1;
}
finally
{
writer?.Dispose();
}
}
private bool ValidateArguments()
{
var hasError = false;
if (string.IsNullOrEmpty(AndroidSupportApi))
{
Console.Error.WriteLine($"{Program.Name}: Missing required argument `--support=PATH`.");
hasError = true;
}
else if (!File.Exists(AndroidSupportApi))
{
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{AndroidSupportApi}`.");
hasError = true;
}
if (string.IsNullOrEmpty(AndroidXApi))
{
Console.Error.WriteLine($"{Program.Name}: Missing required argument `--androidx=PATH`.");
hasError = true;
}
else if (!File.Exists(AndroidXApi))
{
Console.Error.WriteLine($"{Program.Name}: File does not exist: `{AndroidXApi}`.");
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;
}
}
}

Просмотреть файл

@ -1,295 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Linq;
namespace AndroidXMapper
{
public class MappingGenerator
{
private readonly Dictionary<BindingType, BindingType> typeMappings = new Dictionary<BindingType, BindingType>();
public string SupportApiPath { get; }
public string AndroidXApiPath { get; }
public string OverridesPath { get; }
public string JavaMappingPath { get; }
public MappingGenerator(string supportApiPath, string androidXApiPath, string overridesPath, string javaMappingPath)
{
SupportApiPath = supportApiPath ?? throw new ArgumentNullException(nameof(supportApiPath));
AndroidXApiPath = androidXApiPath ?? throw new ArgumentNullException(nameof(androidXApiPath));
OverridesPath = overridesPath;
JavaMappingPath = javaMappingPath;
}
public void Generate(TextWriter writer, bool includeWarnings)
{
var supportTypes = GetAllTypes(SupportApiPath);
var xTypes = GetAllTypes(AndroidXApiPath);
var overrideMappings = LoadMapping(OverridesPath);
var javaMappings = LoadMapping(JavaMappingPath);
WriteRecord(
writer,
new BindingType(
new FullType("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");
foreach (var supportType in supportTypes)
{
var useJavaType = !supportType.JavaType.IsEmpty && javaMappings.Count > 0;
if (TryGetMapping(overrideMappings, supportType.NetType, out var overrideType))
{
var matched = xTypes.Where(t => t.NetType.FullName == overrideType).ToList();
if (matched.Count == 1)
{
typeMappings[supportType] = matched[0];
}
else if (matched.Count > 1)
{
if (includeWarnings)
WriteRecord(writer, $"WARNING: Too many override types found for type {overrideType}: {string.Join(", ", matched)}.");
}
else
{
if (includeWarnings)
WriteRecord(writer, $"WARNING: Unable to find override type for type {overrideType}.");
}
}
else if (TryGetExactMatch(xTypes, supportType, out var exactMatch))
{
typeMappings[supportType] = exactMatch;
}
else if (useJavaType && TryGetMapping(javaMappings, supportType.JavaType, out var androidx))
{
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 == 1)
{
typeMappings[supportType] = matched[0];
}
else if (matched.Count > 1)
{
if (includeWarnings)
WriteRecord(writer, $"WARNING: Too many AndroidX types found for Java type {androidx}: {string.Join(", ", matched)}.");
}
else
{
if (includeWarnings)
WriteRecord(writer, $"WARNING: Unable to find AndroidX type for Java type {androidx}.");
}
}
else
{
if (includeWarnings && useJavaType)
WriteRecord(writer, $"WARNING: Unable to find a Java mapping for {supportType}. Trying managed mapping...");
var matched = xTypes.Where(xt => xt.NetType.Name == supportType.NetType.Name).ToList();
if (matched.Count == 1)
{
typeMappings[supportType] = matched[0];
if (includeWarnings && useJavaType)
WriteRecord(writer, $"WARNING: Found a type that appears to match {matched[0]}.");
}
else if (matched.Count > 1)
{
if (includeWarnings)
WriteRecord(writer, $"WARNING: Too many AndroidX types found for .NET type {supportType.NetType}: {string.Join(", ", matched)}.");
}
else
{
if (includeWarnings)
WriteRecord(writer, $"WARNING: Unable to find AndroidX type for .NET type {supportType.NetType}.");
}
}
if (typeMappings.TryGetValue(supportType, out var androidXType))
WriteRecord(writer, supportType, androidXType);
}
foreach (var mapping in javaMappings.Skip(1))
{
var mapped = typeMappings.Keys.FirstOrDefault(k => k.JavaType.FullName == mapping.Key);
if (!mapped.JavaType.IsEmpty)
continue;
WriteRecord(
writer,
new BindingType(FullType.Empty, GetJavaFullType(mapping.Key)),
new BindingType(FullType.Empty, GetJavaFullType(mapping.Value)),
$"WARNING: The .NET assemblies did not use the Java type {mapping.Key} => {mapping.Value}.");
}
}
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}," +
$"{androidXType.NetType.Container}," +
$"{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.Name = 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 api)
{
if (string.IsNullOrWhiteSpace(api))
throw new ArgumentException($"Invalid api.xml path: {api}", nameof(api));
if (!File.Exists(api))
throw new FileNotFoundException($"The api.xml does not exist: {api}");
var xdoc = XDocument.Load(api);
var classes = xdoc.Descendants("class");
return classes.Select(GetFullType).ToList();
}
private BindingType GetFullType(XElement element)
{
var assembly = GetAttributeValue(element, "Xamarin.AndroidX.Internal.InjectedAssemblyNameAttribute", "AssemblyName");
var ns = "";
var name = element.Attribute("name").Value;
var java = GetJavaType(element);
var parent = element.Parent?.Parent;
while (parent != null)
{
if (parent.Name == "class")
{
name = parent.Attribute("name").Value + "." + name;
assembly = GetAttributeValue(parent, "Xamarin.AndroidX.Internal.InjectedAssemblyNameAttribute", "AssemblyName");
}
else if (parent.Name == "namespace")
{
ns = parent.Attribute("name").Value;
}
parent = parent.Parent?.Parent;
}
return new BindingType(new FullType(assembly, ns, name), java);
}
private static string GetAttributeValue(XElement element, string attributeType, string propertyName)
{
var attributeElement = element
?.Element("attributes")
?.Elements("attribute")
?.FirstOrDefault(e => e.Attribute("name")?.Value == attributeType);
var value = attributeElement
?.Element("properties")
?.Elements("property")
?.FirstOrDefault(e => e.Attribute("name")?.Value == propertyName)
?.Attribute("value")?.Value ?? string.Empty;
return value;
}
private FullType GetJavaType(XElement element)
{
var javaType = GetAttributeValue(element, "Android.Runtime.RegisterAttribute", "Name");
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,113 +0,0 @@
using Mono.Options;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace AndroidXMapper
{
public class MergeCommand : Command
{
public MergeCommand()
: base("merge", "Merges the various AndroidX libraries.")
{
Options = new OptionSet
{
$"usage: {Program.Name} {Name} [OPTIONS]",
"",
Help,
"",
{ "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 },
{ "?|h|help", "Show this message and exit", _ => ShowHelp = true },
};
}
private void SetOutputPath(string path)
{
if (string.IsNullOrWhiteSpace(path))
return;
if (path.EndsWith("/") || path.EndsWith("\\"))
path += "AndroidX.Merged.dll";
var dir = Path.GetDirectoryName(path);
if (!string.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
Directory.CreateDirectory(dir);
OutputPath = path;
}
public bool ShowHelp { get; private set; }
public List<string> Assemblies { get; } = new List<string>();
public string OutputPath { get; private set; }
public List<string> SearchDirectories { get; } = new List<string>();
public bool InjectAssemblyNames { get; private set; }
public override int Invoke(IEnumerable<string> args)
{
try
{
var extra = Options.Parse(args);
if (ShowHelp)
{
Options.WriteOptionDescriptions(CommandSet.Out);
return 0;
}
if (!ValidateArguments())
return 1;
var merger = new AssemblyMerger(Assemblies, SearchDirectories, InjectAssemblyNames);
merger.Merge(OutputPath);
return 0;
}
catch (Exception ex)
{
Console.Error.WriteLine($"{Program.Name}: An error occurred: `{ex.Message}`.");
if (Program.Verbose)
Console.Error.WriteLine(ex);
return 1;
}
}
private bool ValidateArguments()
{
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;
}
}
}

Просмотреть файл

@ -1,29 +0,0 @@
using Mono.Options;
namespace AndroidXMapper
{
public class Program
{
public const string Name = "androidxmapper";
public static bool Verbose;
static int Main(string[] args)
{
var commands = new CommandSet(Name)
{
$"usage: {Name} COMMAND [OPTIONS]",
"",
"A utility that helps create the Android.Support to AndroidX mapping file.",
"",
"Global options:",
{ "v|verbose", "Use a more verbose output", _ => Verbose = true },
"",
"Available commands:",
new GenerateCommand(),
new MergeCommand(),
};
return commands.Run(args);
}
}
}

Просмотреть файл

@ -1,8 +0,0 @@
{
"profiles": {
"AndroidXMapper": {
"commandName": "Project",
"commandLineArgs": "generate -s C:\\Projects\\AndroidX\\output\\api-info.previous.xml -x C:\\Projects\\AndroidX\\output\\api-info.xml -j C:\\Projects\\AndroidX\\util\\AndroidXMapper\\Resources\\androidx-class-mapping.csv"
}
}
}

Просмотреть файл

@ -1,104 +0,0 @@
Old build artifact,AndroidX build artifact
android.arch.core:common,androidx.arch.core:core-common:2.0.0-rc01
android.arch.core:core,androidx.arch.core:core:2.0.0-rc01
android.arch.core:core-testing,androidx.arch.core:core-testing:2.0.0-rc01
android.arch.core:runtime,androidx.arch.core:core-runtime:2.0.0-rc01
android.arch.lifecycle:common,androidx.lifecycle:lifecycle-common:2.0.0-rc01
android.arch.lifecycle:common-java8,androidx.lifecycle:lifecycle-common-java8:2.0.0-rc01
android.arch.lifecycle:compiler,androidx.lifecycle:lifecycle-compiler:2.0.0-rc01
android.arch.lifecycle:extensions,androidx.lifecycle:lifecycle-extensions:2.0.0-rc01
android.arch.lifecycle:livedata,androidx.lifecycle:lifecycle-livedata:2.0.0-rc01
android.arch.lifecycle:livedata-core,androidx.lifecycle:lifecycle-livedata-core:2.0.0-rc01
android.arch.lifecycle:reactivestreams,androidx.lifecycle:lifecycle-reactivestreams:2.0.0-rc01
android.arch.lifecycle:runtime,androidx.lifecycle:lifecycle-runtime:2.0.0-rc01
android.arch.lifecycle:viewmodel,androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01
android.arch.paging:common,androidx.paging:paging-common:2.0.0-rc01
android.arch.paging:runtime,androidx.paging:paging-runtime:2.0.0-rc01
android.arch.paging:rxjava2,androidx.paging:paging-rxjava2:2.0.0-rc01
android.arch.persistence.room:common,androidx.room:room-common:2.0.0-rc01
android.arch.persistence.room:compiler,androidx.room:room-compiler:2.0.0-rc01
android.arch.persistence.room:guava,androidx.room:room-guava:2.0.0-rc01
android.arch.persistence.room:migration,androidx.room:room-migration:2.0.0-rc01
android.arch.persistence.room:runtime,androidx.room:room-runtime:2.0.0-rc01
android.arch.persistence.room:rxjava2,androidx.room:room-rxjava2:2.0.0-rc01
android.arch.persistence.room:testing,androidx.room:room-testing:2.0.0-rc01
android.arch.persistence:db,androidx.sqlite:sqlite:2.0.0-rc01
android.arch.persistence:db-framework,androidx.sqlite:sqlite-framework:2.0.0-rc01
com.android.support.constraint:constraint-layout,androidx.constraintlayout:constraintlayout:1.1.2
com.android.support.constraint:constraint-layout-solver,androidx.constraintlayout:constraintlayout-solver:1.1.2
com.android.support.test.espresso.idling:idling-concurrent,androidx.test.espresso.idling:idling-concurrent:3.1.0
com.android.support.test.espresso.idling:idling-net,androidx.test.espresso.idling:idling-net:3.1.0
com.android.support.test.espresso:espresso-accessibility,androidx.test.espresso:espresso-accessibility:3.1.0
com.android.support.test.espresso:espresso-contrib,androidx.test.espresso:espresso-contrib:3.1.0
com.android.support.test.espresso:espresso-core,androidx.test.espresso:espresso-core:3.1.0
com.android.support.test.espresso:espresso-idling-resource,androidx.test.espresso:espresso-idling-resource:3.1.0
com.android.support.test.espresso:espresso-intents,androidx.test.espresso:espresso-intents:3.1.0
com.android.support.test.espresso:espresso-remote,androidx.test.espresso:espresso-remote:3.1.0
com.android.support.test.espresso:espresso-web,androidx.test.espresso:espresso-web:3.1.0
com.android.support.test.janktesthelper:janktesthelper,androidx.test.jank:janktesthelper:1.0.1
com.android.support.test.services:test-services,androidx.test:test-services:1.1.0
com.android.support.test.uiautomator:uiautomator,androidx.test.uiautomator:uiautomator:2.2.0
com.android.support.test:monitor,androidx.test:monitor:1.1.0
com.android.support.test:orchestrator,androidx.test:orchestrator:1.1.0
com.android.support.test:rules,androidx.test:rules:1.1.0
com.android.support.test:runner,androidx.test:runner:1.1.0
com.android.support:animated-vector-drawable,androidx.vectordrawable:vectordrawable-animated:1.0.0
com.android.support:appcompat-v7,androidx.appcompat:appcompat:1.0.0
com.android.support:asynclayoutinflater,androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
com.android.support:car,androidx.car:car:1.0.0-alpha5
com.android.support:cardview-v7,androidx.cardview:cardview:1.0.0
com.android.support:collections,androidx.collection:collection:1.0.0
com.android.support:coordinatorlayout,androidx.coordinatorlayout:coordinatorlayout:1.0.0
com.android.support:cursoradapter,androidx.cursoradapter:cursoradapter:1.0.0
com.android.support:customtabs,androidx.browser:browser:1.0.0
com.android.support:customview,androidx.customview:customview:1.0.0
com.android.support:design,com.google.android.material:material:1.0.0-rc01
com.android.support:documentfile,androidx.documentfile:documentfile:1.0.0
com.android.support:drawerlayout,androidx.drawerlayout:drawerlayout:1.0.0
com.android.support:exifinterface,androidx.exifinterface:exifinterface:1.0.0
com.android.support:gridlayout-v7,androidx.gridlayout:gridlayout:1.0.0
com.android.support:heifwriter,androidx.heifwriter:heifwriter:1.0.0
com.android.support:interpolator,androidx.interpolator:interpolator:1.0.0
com.android.support:leanback-v17,androidx.leanback:leanback:1.0.0
com.android.support:loader,androidx.loader:loader:1.0.0
com.android.support:localbroadcastmanager,androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
com.android.support:media2,androidx.media2:media2:1.0.0-alpha03
com.android.support:media2-exoplayer,androidx.media2:media2-exoplayer:1.0.0-alpha01
com.android.support:mediarouter-v7,androidx.mediarouter:mediarouter:1.0.0
com.android.support:multidex,androidx.multidex:multidex:2.0.0
com.android.support:multidex-instrumentation,androidx.multidex:multidex-instrumentation:2.0.0
com.android.support:palette-v7,androidx.palette:palette:1.0.0
com.android.support:percent,androidx.percentlayout:percentlayout:1.0.0
com.android.support:preference-leanback-v17,androidx.leanback:leanback-preference:1.0.0
com.android.support:preference-v14,androidx.legacy:legacy-preference-v14:1.0.0
com.android.support:preference-v7,androidx.preference:preference:1.0.0
com.android.support:print,androidx.print:print:1.0.0
com.android.support:recommendation,androidx.recommendation:recommendation:1.0.0
com.android.support:recyclerview-selection,androidx.recyclerview:recyclerview-selection:1.0.0
com.android.support:recyclerview-v7,androidx.recyclerview:recyclerview:1.0.0
com.android.support:slices-builders,androidx.slice:slice-builders:1.0.0
com.android.support:slices-core,androidx.slice:slice-core:1.0.0
com.android.support:slices-view,androidx.slice:slice-view:1.0.0
com.android.support:slidingpanelayout,androidx.slidingpanelayout:slidingpanelayout:1.0.0
com.android.support:support-annotations,androidx.annotation:annotation:1.0.0
com.android.support:support-compat,androidx.core:core:1.0.0
com.android.support:support-content,androidx.contentpager:contentpager:1.0.0
com.android.support:support-core-ui,androidx.legacy:legacy-support-core-ui:1.0.0
com.android.support:support-core-utils,androidx.legacy:legacy-support-core-utils:1.0.0
com.android.support:support-dynamic-animation,androidx.dynamicanimation:dynamicanimation:1.0.0
com.android.support:support-emoji,androidx.emoji:emoji:1.0.0
com.android.support:support-emoji-appcompat,androidx.emoji:emoji-appcompat:1.0.0
com.android.support:support-emoji-bundled,androidx.emoji:emoji-bundled:1.0.0
com.android.support:support-fragment,androidx.fragment:fragment:1.0.0
com.android.support:support-media-compat,androidx.media:media:1.0.0
com.android.support:support-tv-provider,androidx.tvprovider:tvprovider:1.0.0
com.android.support:support-v13,androidx.legacy:legacy-support-v13:1.0.0
com.android.support:support-v4,androidx.legacy:legacy-support-v4:1.0.0
com.android.support:support-vector-drawable,androidx.vectordrawable:vectordrawable:1.0.0
com.android.support:swiperefreshlayout,androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
com.android.support:textclassifier,androidx.textclassifier:textclassifier:1.0.0
com.android.support:transition,androidx.transition:transition:1.0.0
com.android.support:versionedparcelable,androidx.versionedparcelable:versionedparcelable:1.0.0
com.android.support:viewpager,androidx.viewpager:viewpager:1.0.0
com.android.support:wear,androidx.wear:wear:1.0.0
com.android.support:webkit,androidx.webkit:webkit:1.0.0
1 Old build artifact AndroidX build artifact
2 android.arch.core:common androidx.arch.core:core-common:2.0.0-rc01
3 android.arch.core:core androidx.arch.core:core:2.0.0-rc01
4 android.arch.core:core-testing androidx.arch.core:core-testing:2.0.0-rc01
5 android.arch.core:runtime androidx.arch.core:core-runtime:2.0.0-rc01
6 android.arch.lifecycle:common androidx.lifecycle:lifecycle-common:2.0.0-rc01
7 android.arch.lifecycle:common-java8 androidx.lifecycle:lifecycle-common-java8:2.0.0-rc01
8 android.arch.lifecycle:compiler androidx.lifecycle:lifecycle-compiler:2.0.0-rc01
9 android.arch.lifecycle:extensions androidx.lifecycle:lifecycle-extensions:2.0.0-rc01
10 android.arch.lifecycle:livedata androidx.lifecycle:lifecycle-livedata:2.0.0-rc01
11 android.arch.lifecycle:livedata-core androidx.lifecycle:lifecycle-livedata-core:2.0.0-rc01
12 android.arch.lifecycle:reactivestreams androidx.lifecycle:lifecycle-reactivestreams:2.0.0-rc01
13 android.arch.lifecycle:runtime androidx.lifecycle:lifecycle-runtime:2.0.0-rc01
14 android.arch.lifecycle:viewmodel androidx.lifecycle:lifecycle-viewmodel:2.0.0-rc01
15 android.arch.paging:common androidx.paging:paging-common:2.0.0-rc01
16 android.arch.paging:runtime androidx.paging:paging-runtime:2.0.0-rc01
17 android.arch.paging:rxjava2 androidx.paging:paging-rxjava2:2.0.0-rc01
18 android.arch.persistence.room:common androidx.room:room-common:2.0.0-rc01
19 android.arch.persistence.room:compiler androidx.room:room-compiler:2.0.0-rc01
20 android.arch.persistence.room:guava androidx.room:room-guava:2.0.0-rc01
21 android.arch.persistence.room:migration androidx.room:room-migration:2.0.0-rc01
22 android.arch.persistence.room:runtime androidx.room:room-runtime:2.0.0-rc01
23 android.arch.persistence.room:rxjava2 androidx.room:room-rxjava2:2.0.0-rc01
24 android.arch.persistence.room:testing androidx.room:room-testing:2.0.0-rc01
25 android.arch.persistence:db androidx.sqlite:sqlite:2.0.0-rc01
26 android.arch.persistence:db-framework androidx.sqlite:sqlite-framework:2.0.0-rc01
27 com.android.support.constraint:constraint-layout androidx.constraintlayout:constraintlayout:1.1.2
28 com.android.support.constraint:constraint-layout-solver androidx.constraintlayout:constraintlayout-solver:1.1.2
29 com.android.support.test.espresso.idling:idling-concurrent androidx.test.espresso.idling:idling-concurrent:3.1.0
30 com.android.support.test.espresso.idling:idling-net androidx.test.espresso.idling:idling-net:3.1.0
31 com.android.support.test.espresso:espresso-accessibility androidx.test.espresso:espresso-accessibility:3.1.0
32 com.android.support.test.espresso:espresso-contrib androidx.test.espresso:espresso-contrib:3.1.0
33 com.android.support.test.espresso:espresso-core androidx.test.espresso:espresso-core:3.1.0
34 com.android.support.test.espresso:espresso-idling-resource androidx.test.espresso:espresso-idling-resource:3.1.0
35 com.android.support.test.espresso:espresso-intents androidx.test.espresso:espresso-intents:3.1.0
36 com.android.support.test.espresso:espresso-remote androidx.test.espresso:espresso-remote:3.1.0
37 com.android.support.test.espresso:espresso-web androidx.test.espresso:espresso-web:3.1.0
38 com.android.support.test.janktesthelper:janktesthelper androidx.test.jank:janktesthelper:1.0.1
39 com.android.support.test.services:test-services androidx.test:test-services:1.1.0
40 com.android.support.test.uiautomator:uiautomator androidx.test.uiautomator:uiautomator:2.2.0
41 com.android.support.test:monitor androidx.test:monitor:1.1.0
42 com.android.support.test:orchestrator androidx.test:orchestrator:1.1.0
43 com.android.support.test:rules androidx.test:rules:1.1.0
44 com.android.support.test:runner androidx.test:runner:1.1.0
45 com.android.support:animated-vector-drawable androidx.vectordrawable:vectordrawable-animated:1.0.0
46 com.android.support:appcompat-v7 androidx.appcompat:appcompat:1.0.0
47 com.android.support:asynclayoutinflater androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
48 com.android.support:car androidx.car:car:1.0.0-alpha5
49 com.android.support:cardview-v7 androidx.cardview:cardview:1.0.0
50 com.android.support:collections androidx.collection:collection:1.0.0
51 com.android.support:coordinatorlayout androidx.coordinatorlayout:coordinatorlayout:1.0.0
52 com.android.support:cursoradapter androidx.cursoradapter:cursoradapter:1.0.0
53 com.android.support:customtabs androidx.browser:browser:1.0.0
54 com.android.support:customview androidx.customview:customview:1.0.0
55 com.android.support:design com.google.android.material:material:1.0.0-rc01
56 com.android.support:documentfile androidx.documentfile:documentfile:1.0.0
57 com.android.support:drawerlayout androidx.drawerlayout:drawerlayout:1.0.0
58 com.android.support:exifinterface androidx.exifinterface:exifinterface:1.0.0
59 com.android.support:gridlayout-v7 androidx.gridlayout:gridlayout:1.0.0
60 com.android.support:heifwriter androidx.heifwriter:heifwriter:1.0.0
61 com.android.support:interpolator androidx.interpolator:interpolator:1.0.0
62 com.android.support:leanback-v17 androidx.leanback:leanback:1.0.0
63 com.android.support:loader androidx.loader:loader:1.0.0
64 com.android.support:localbroadcastmanager androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
65 com.android.support:media2 androidx.media2:media2:1.0.0-alpha03
66 com.android.support:media2-exoplayer androidx.media2:media2-exoplayer:1.0.0-alpha01
67 com.android.support:mediarouter-v7 androidx.mediarouter:mediarouter:1.0.0
68 com.android.support:multidex androidx.multidex:multidex:2.0.0
69 com.android.support:multidex-instrumentation androidx.multidex:multidex-instrumentation:2.0.0
70 com.android.support:palette-v7 androidx.palette:palette:1.0.0
71 com.android.support:percent androidx.percentlayout:percentlayout:1.0.0
72 com.android.support:preference-leanback-v17 androidx.leanback:leanback-preference:1.0.0
73 com.android.support:preference-v14 androidx.legacy:legacy-preference-v14:1.0.0
74 com.android.support:preference-v7 androidx.preference:preference:1.0.0
75 com.android.support:print androidx.print:print:1.0.0
76 com.android.support:recommendation androidx.recommendation:recommendation:1.0.0
77 com.android.support:recyclerview-selection androidx.recyclerview:recyclerview-selection:1.0.0
78 com.android.support:recyclerview-v7 androidx.recyclerview:recyclerview:1.0.0
79 com.android.support:slices-builders androidx.slice:slice-builders:1.0.0
80 com.android.support:slices-core androidx.slice:slice-core:1.0.0
81 com.android.support:slices-view androidx.slice:slice-view:1.0.0
82 com.android.support:slidingpanelayout androidx.slidingpanelayout:slidingpanelayout:1.0.0
83 com.android.support:support-annotations androidx.annotation:annotation:1.0.0
84 com.android.support:support-compat androidx.core:core:1.0.0
85 com.android.support:support-content androidx.contentpager:contentpager:1.0.0
86 com.android.support:support-core-ui androidx.legacy:legacy-support-core-ui:1.0.0
87 com.android.support:support-core-utils androidx.legacy:legacy-support-core-utils:1.0.0
88 com.android.support:support-dynamic-animation androidx.dynamicanimation:dynamicanimation:1.0.0
89 com.android.support:support-emoji androidx.emoji:emoji:1.0.0
90 com.android.support:support-emoji-appcompat androidx.emoji:emoji-appcompat:1.0.0
91 com.android.support:support-emoji-bundled androidx.emoji:emoji-bundled:1.0.0
92 com.android.support:support-fragment androidx.fragment:fragment:1.0.0
93 com.android.support:support-media-compat androidx.media:media:1.0.0
94 com.android.support:support-tv-provider androidx.tvprovider:tvprovider:1.0.0
95 com.android.support:support-v13 androidx.legacy:legacy-support-v13:1.0.0
96 com.android.support:support-v4 androidx.legacy:legacy-support-v4:1.0.0
97 com.android.support:support-vector-drawable androidx.vectordrawable:vectordrawable:1.0.0
98 com.android.support:swiperefreshlayout androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
99 com.android.support:textclassifier androidx.textclassifier:textclassifier:1.0.0
100 com.android.support:transition androidx.transition:transition:1.0.0
101 com.android.support:versionedparcelable androidx.versionedparcelable:versionedparcelable:1.0.0
102 com.android.support:viewpager androidx.viewpager:viewpager:1.0.0
103 com.android.support:wear androidx.wear:wear:1.0.0
104 com.android.support:webkit androidx.webkit:webkit:1.0.0

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,6 +0,0 @@
Old 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
1 Old type AndroidX type
2 Android.Support.V4.Media.MediaSessionManager AndroidX.Media.MediaSessionManager
3 Android.Support.V4.App.ActionBarDrawerToggle.IDelegate AndroidX.Legacy.App.ActionBarDrawerToggle.IDelegate
4 Android.Support.V4.App.ActionBarDrawerToggle.IDelegateProvider AndroidX.Legacy.App.ActionBarDrawerToggle.IDelegateProvider
5 Android.Support.V7.App.ActionBarDrawerToggle.IDelegate AndroidX.AppCompat.App.ActionBarDrawerToggle.IDelegate
6 Android.Support.V7.App.ActionBarDrawerToggle.IDelegateProvider AndroidX.AppCompat.App.ActionBarDrawerToggle.IDelegateProvider

Двоичные данные
util/binderator.zip

Двоичный файл не отображается.