This commit is contained in:
Rolf Bjarne Kvinge 2022-09-30 09:30:36 +02:00 коммит произвёл GitHub
Родитель 80fa2dcfaa ed612dcd6e
Коммит 8014146c9c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
241 изменённых файлов: 2340 добавлений и 2262 удалений

6
.github/workflows/autoformat.yml поставляемый
Просмотреть файл

@ -44,6 +44,12 @@ jobs:
cd ..
dotnet format "$SRC_DIR/tools/xibuild/xibuild.csproj"
dotnet format whitespace "$SRC_DIR/tests/cecil-tests/cecil-tests.csproj"
dotnet format whitespace "$SRC_DIR/msbuild/Messaging/Xamarin.Messaging.Build/Xamarin.Messaging.Build.csproj"
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.Localization.MSBuild/Xamarin.Localization.MSBuild.csproj"
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Tasks.csproj"
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj"
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj"
dotnet format whitespace "$SRC_DIR/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj"
# dotnet format "$SRC_DIR/[...]"
# add more projects here...
cd "$SRC_DIR"

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

@ -105,13 +105,16 @@ else
endif
endif
package:
mkdir -p ../package
$(MAKE) -C $(MACCORE_PATH) package
.PHONY: package release
package release:
$(Q) $(MAKE) -C $(TOP)/release release
# copy .pkg, .zip and *updateinfo to the packages directory to be uploaded to storage
$(CP) $(MACCORE_PATH)/release/*.pkg ../package
$(CP) $(MACCORE_PATH)/release/*.zip ../package
$(CP) $(MACCORE_PATH)/release/*updateinfo ../package
$(Q) mkdir -p ../package
$(Q) $(CP) $(TOP)/release/*.pkg ../package
$(Q) $(CP) $(TOP)/release/*.zip ../package
$(Q) $(CP) $(TOP)/release/*updateinfo ../package
$(Q) echo "Packages:"
$(Q) ls -la ../package | sed 's/^/ /'
dotnet-install-system:
$(Q) $(MAKE) -C dotnet install-system

1
builds/.gitignore поставляемый
Просмотреть файл

@ -1,3 +1,4 @@
all-package-references.csproj
dotnet-install.sh
BundledNETCorePlatformsPackageVersion.txt
downloads

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

@ -151,10 +151,14 @@ ifeq ($(CUSTOM_DOTNET_RUNTIME_INSTALL),1)
endif
$(Q) touch $@
.stamp-download-dotnet-packages: $(TOP)/Make.config downloads/$(DOTNET_INSTALL_NAME)
package-download/all-package-references.csproj: $(TOP)/.git/HEAD $(TOP)/.git/index ./create-csproj-for-all-packagereferences.sh
$(Q_GEN) ./create-csproj-for-all-packagereferences.sh --output "$(abspath $@.tmp)" $(if $(V),-v,)
$(Q) mv "$@.tmp" "$@"
.stamp-download-dotnet-packages: $(TOP)/Make.config downloads/$(DOTNET_INSTALL_NAME) package-download/all-package-references.csproj
$(Q_GEN) cd package-download && $(DOTNET) \
build \
download-packages.proj \
download-packages.csproj \
/t:WriteBundledNETCorePlatformsPackageVersion \
/p:WriteFilePath=$(CURDIR)/BundledNETCorePlatformsPackageVersion.txt \
/p:PackageRuntimeIdentifiers="$(DOTNET_RUNTIME_IDENTIFIERS)" \

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

@ -0,0 +1,68 @@
#!/bin/bash -eu
WHITE=$(tput setaf 7 || true)
RED=$(tput setaf 9 || true)
CLEAR=$(tput sgr0 || true)
OUTPUTPATH=
while [[ $# -gt 0 ]]; do
case $1 in
--help | -\? | -h)
echo "$(basename "$0"): --output=<file>"
echo " Find all the 'PackageReference' items in the repository and creates a project listing them all as 'PackageDownload' items."
echo " Options:"
echo " -h --help: Show this help"
echo " -v --verbose: Enable verbose script"
echo " --output=<value>: The output file"
exit 0
;;
--verbose | -v)
set -x
shift
;;
--output)
OUTPUTPATH="$2"
shift 2
;;
--output=*)
OUTPUTPATH="${1#*=}"
shift
;;
*)
echo "${RED}$(basename "$0"): Unknown option: ${WHITE}$1${RED}. Pass --help to view the available options.${CLEAR}"
exit 1
;;
esac
done
TMPPATH=$(PWD)/packagereferences.tmp.csproj
# Go to the root directory
cd "$(git rev-parse --show-toplevel)"
# Find all <PackageReference /> items that has an Include="..." and a Version="..."
git grep -e '<PackageReference.*Include="[a-zA-Z0-9._-]*".*Version="[a-zA-Z0-9._-]*".*>' -h > "$TMPPATH"
# Replace double double quotes with a single double quote. This happens in source code that generates project files (for tests).
sed -i '' 's/""/"/g' "$TMPPATH"
# Remove packages that we build locally
sed -i '' '/Xamarin.Tests.FrameworksInRuntimesNativeDirectory/d' "$TMPPATH"
# Get only the name and version of each package, and write that back in a PackageDownload item
sed -i '' 's@.*<PackageReference.*Include="\([a-zA-Z0-9._-]*\)".*Version="\([a-zA-Z0-9._-]*\)".*>.*@\t\t<PackageDownload Include="\1" Version="[\2]" />@g' "$TMPPATH"
# Sort the references and only list each once.
sort -u -o "$TMPPATH" "$TMPPATH"
# Create the complete/valid csproj
{
echo $'<Project>'
echo $'\t<ItemGroup>'
cat "$TMPPATH"
echo $'\t</ItemGroup>'
echo $'</Project>'
} > "$TMPPATH.2"
mv "$TMPPATH.2" "$TMPPATH"
mv "$TMPPATH" "$OUTPUTPATH"

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

@ -3,6 +3,7 @@
<TargetFramework>net6.0</TargetFramework>
<ActualPackageVersion Condition="'$(CustomDotNetVersion)' != ''">$(CustomDotNetVersion)</ActualPackageVersion>
<ActualPackageVersion Condition="'$(ActualPackageVersion)' == ''">$(BundledNETCorePlatformsPackageVersion)</ActualPackageVersion>
<NoWarn>$(NoWarn);NU1505</NoWarn> <!-- warning NU1505: Duplicate 'PackageDownload' items found. Remove the duplicate items or use the Update functionality to ensure a consistent restore behavior. -->
</PropertyGroup>
<Import Project="../../eng/Versions.props" />
@ -28,6 +29,8 @@
<PackageDownload Include="Microsoft.NET.Workload.Emscripten.net6.Manifest-$(ToolChainManifestVersionBand)" Version="[$(MicrosoftNETWorkloadEmscriptennet7Manifest70100PackageVersion)]" />
</ItemGroup>
<Import Project="all-package-references.csproj" />
<!-- target to write out the BundledNETCorePlatformsPackageVersion to a file -->
<Target Name="WriteBundledNETCorePlatformsPackageVersion" Condition="'$(WriteFilePath)' != ''">
<WriteLinesToFile File="$(WriteFilePath)" Lines="$(ActualPackageVersion)" Overwrite="true" />

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

@ -1,14 +1,11 @@
TOP=../../..
WEBSITE_DOCS ?= $(TOP)/xamarin-docs-pr
XAMARIN_ANALYSIS ?=$(TOP)/xamarin-analysis/shared/Xamarin.Analysis
XAMARIN_ANALYSIS_DOC = xamarin-analysis-doc-tool/bin/Debug
all: xamarin-analysis-doc
all:
cp mtouch-errors.md $(WEBSITE_DOCS)/docs/ios/troubleshooting/mtouch-errors.md
cp mmp-errors.md $(WEBSITE_DOCS)/docs/mac/troubleshooting/mmp-errors.md
cp binding_objc_libs.md $(WEBSITE_DOCS)/docs/cross-platform/macios/binding/objective-c-libraries.md
cp binding_types_reference_guide.md $(WEBSITE_DOCS)/docs/cross-platform/macios/binding/binding-types-reference.md
cp xamarin-ios-analysis.md $(WEBSITE_DOCS)/ios/troubleshooting/xamarin-ios-analysis.md
cp optimizations.md $(WEBSITE_DOCS)/docs/cross-platform/macios/optimizations.md
diff:
@ -16,9 +13,4 @@ diff:
-diff -u $(WEBSITE_DOCS)/docs/mac/troubleshooting/mmp-errors.md mmp-errors.md
-diff -u $(WEBSITE_DOCS)/docs/cross-platform/macios/binding/objective-c-libraries.md binding_objc_libs.md
-diff -u $(WEBSITE_DOCS)/docs/cross-platform/macios/binding/binding-types-reference.md binding_types_reference_guide.md
-diff -u $(WEBSITE_DOCS)/docs/ios/troubleshooting/xamarin-ios-analysis.md xamarin-ios-analysis.md
-diff -u $(WEBSITE_DOCS)/docs/cross-platform/macios/optimizations.md optimizations.md
xamarin-analysis-doc:
msbuild xamarin-analysis-doc-tool/xamarin-analysis-doc.sln
mono $(XAMARIN_ANALYSIS_DOC)/xamarin-analysis-doc.exe $(XAMARIN_ANALYSIS)/Xamarin.iOS.Analysis.targets

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

@ -1,69 +0,0 @@
using System;
using System.Xml.Linq;
using System.IO;
namespace XamarinAnalysisDoc
{
class MainClass
{
static string analysis_path;
public static int Main (string [] args)
{
if (args.Length < 1) {
Console.WriteLine ("Usage: mono xamarin-analysis-doc.exe /path/to/Xamarin.iOS.Analysis.targets");
return 1;
}
analysis_path = args [0];
if (!File.Exists (analysis_path)) {
Console.WriteLine ($"Cannot find {analysis_path}");
return 1;
}
GenerateAnalysisDoc (analysis_path);
return 0;
}
static void GenerateAnalysisDoc (string path)
{
var section = "---\n";
section += "id: c29b69f5-08e4-4dcc-831e-7fd692ab0886\n";
section += "title: Xamarin.iOS Analysis Rules\n";
section += "dateupdated: " + DateTime.Now.ToString("yyyy-MM-dd") + "\n";
section += "---\n\n";
section += "[//]: # (The original file resides under https://github.com/xamarin/xamarin-macios/tree/main/docs/website/)\n";
section += "[//]: # (This allows all contributors (including external) to submit, using a PR, updates to the documentation that match the tools changes)\n";
section += "[//]: # (Modifications outside of xamarin-macios/main will be lost on future updates)\n\n";
section += "Xamarin.iOS analysis is a set of rules that check your project settings to help you determine if better/more optimized settings are available.\n\n";
section += "Run the analysis rules as often as possible to find possible improvements early on and save development time.\n\n";
section += "To run the rules, in Visual Studio for Mac's menu, select **Project > Run Code Analysis**.\n\n";
section += "> ⚠️ **NOTE:** Xamarin.iOS analysis only runs on your currently selected configuration. We highly recommend running the tool for debug **and** release configurations.\n\n";
var root = XDocument.Load (path);
XNamespace ns = "http://schemas.microsoft.com/developer/msbuild/2003";
foreach (XElement target in root.Descendants (ns + "Target")) {
var nameAttr = target.Attribute ("Name").Value;
var rule = nameAttr.Split ('_');
var ruleID = rule [0];
var ruleName = rule [1];
section += $"### <a name=\"{ruleID}\"/>{ruleID}: {ruleName}\n\n";
foreach (var xpaResult in target.Descendants (ns + "XamarinProjectAnalysisResult").Elements ()) {
if (xpaResult.Name.LocalName != "Category") {
section += "- **" + xpaResult.Name.LocalName + ":** ";
section += xpaResult.Value + "\n";
}
}
section += "\n";
}
File.WriteAllText ("xamarin-ios-analysis.md", section);
}
}
}

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

@ -1,40 +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)' == '' ">x86</Platform>
<ProjectGuid>{D2502AC9-4265-481A-B9A1-57F42EF9CF58}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>XamarinAnalysisDoc</RootNamespace>
<AssemblyName>xamarin-analysis-doc</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="xamarin-analysis-doc.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

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

@ -1,17 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xamarin-analysis-doc", "xamarin-analysis-doc.csproj", "{D2502AC9-4265-481A-B9A1-57F42EF9CF58}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D2502AC9-4265-481A-B9A1-57F42EF9CF58}.Debug|x86.ActiveCfg = Debug|x86
{D2502AC9-4265-481A-B9A1-57F42EF9CF58}.Debug|x86.Build.0 = Debug|x86
{D2502AC9-4265-481A-B9A1-57F42EF9CF58}.Release|x86.ActiveCfg = Release|x86
{D2502AC9-4265-481A-B9A1-57F42EF9CF58}.Release|x86.Build.0 = Release|x86
EndGlobalSection
EndGlobal

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

@ -1,71 +0,0 @@
---
title: "Xamarin.iOS Analysis Rules"
ms.topic: troubleshooting
ms.prod: xamarin
ms.assetid: C29B69F5-08E4-4DCC-831E-7FD692AB0886
ms.technology: xamarin-ios
author: bradumbaugh
ms.author: brumbaug
ms.date: 03/06/2018
---
# Xamarin.iOS analysis rules
Xamarin.iOS analysis is a set of rules that check your project settings to help you determine if better/more optimized settings are available.
Run the analysis rules as often as possible to find possible improvements early on and save development time.
To run the rules, in Visual Studio for Mac's menu, select **Project > Run Code Analysis**.
> [!NOTE]
> Xamarin.iOS analysis only runs on your currently selected configuration. We highly recommend running the tool for debug **and** release configurations.
<a name="XIA0001" />
## XIA0001: DisabledLinkerRule
- **Problem:** The linker is disabled on device for the debug mode.
- **Fix:** You should try to run your code with the linker to avoid any surprises.
To set it up, go to Project > iOS Build > Linker Behavior.
<a name="XIA0002" />
## XIA0002: TestCloudAgentReleaseRule
- **Problem:** App builds that initialize the Test Cloud agent will be rejected by Apple when submitted, as they use private API.
- **Fix:** Add or fix the necessary #if and defines in code.
<a name="XIA0003" />
## XIA0003: IPADebugBuildsRule
- **Problem:** Debug configuration that uses developer signing keys should not generate an IPA as it is only needed for distribution, which now uses the Publishing Wizard.
- **Fix:** Disable IPA build in Project Options for the Debug configuration.
<a name="XIA0004" />
## XIA0004: Missing64BitSupportRule
- **Problem:** The supported architecture for "release | device" isn't 64 bit compatible, missing ARM64. This is a problem as Apple does not accept 32 bits only iOS apps in the AppStore.
- **Fix:** Double click on your iOS project, go to Build > iOS Build and change the supported architectures so it has ARM64.
<a name="XIA0005" />
## XIA0005: Float32Rule
- **Problem:** Not using the float32 option (--aot-options=-O=float32) leads to hefty performance cost, especially on mobile, where double precision math is measurably slower. Note that .NET uses double precision internally, even for float, so enabling this option affects precision and, possibly, compatibility.
- **Fix:** Double click on your iOS project, go to Build > iOS Build and uncheck the "Perform all 32-bit float operations as 64-bit float".
<a name="XIA0006" />
## XIA0006: HttpClientAvoidManaged
- **Problem:** We recommend using the native HttpClient handler instead of the managed one for better performance, smaller executable size, and to easily support the newer standards.
- **Fix:** Double click on your iOS project, go to Build > iOS Build and change the HttpClient implementation to either NSUrlSession (iOS 7+) or CFNetwork to support version preceding iOS 7.
<a name="XIA0007" />
## XIA0007: UseLLVMRule
- **Problem:** For Release|iPhone configuration we recommend enabling the LLVM compiler which generates code that is faster to execute at the expense of build time.
- **Fix:** Double click on your iOS project, go to Build > iOS Build and for Release|iPhone, check the LLVM optimizing compiler option.

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

@ -16,20 +16,23 @@
<Unzip
SourceFiles="@(_NestedBrokerZip)"
DestinationFolder="@(_NestedBrokerZip -> '$(_NestedZipExtractionDir)%(Filename)')"
Condition="'@(_NestedBrokerZip->Count())' != '0'"
/>
<Delete Files="@(_NestedBrokerZip)" />
<Delete Files="@(_NestedBrokerZip)" Condition="'@(_NestedBrokerZip->Count())' != '0'" />
<Unzip
SourceFiles="@(_NestedBuildZip)"
DestinationFolder="@(_NestedBuildZip -> '$(_NestedZipExtractionDir)%(Filename)')"
Condition="'@(_NestedBuildZip->Count())' != '0'"
/>
<Delete Files="@(_NestedBuildZip)" />
<Delete Files="@(_NestedBuildZip)" Condition="'@(_NestedBuildZip->Count())' != '0'" />
<Unzip
SourceFiles="@(_NestediOSAppZip)"
DestinationFolder="@(_NestediOSAppZip -> '$(_NestedZipExtractionDir)%(Filename)')"
Condition="'@(_NestediOSAppZip->Count())' != '0'"
/>
<Delete Files="@(_NestediOSAppZip)" />
<Delete Files="@(_NestediOSAppZip)" Condition="'@(_NestediOSAppZip->Count())' != '0'" />
</Target>
<Target Name="_ZipNestedZips"
@ -38,14 +41,17 @@
<ZipDirectory
SourceDirectory="@(_NestedBrokerZip -> '$(_NestedZipExtractionDir)%(Filename)')"
DestinationFile="@(_NestedBrokerZip)"
Condition="'@(_NestedBrokerZip->Count())' != '0'"
/>
<ZipDirectory
SourceDirectory="@(_NestedBuildZip -> '$(_NestedZipExtractionDir)%(Filename)')"
DestinationFile="@(_NestedBuildZip)"
Condition="'@(_NestedBuildZip->Count())' != '0'"
/>
<ZipDirectory
SourceDirectory="@(_NestediOSAppZip -> '$(_NestedZipExtractionDir)%(Filename)')"
DestinationFile="@(_NestediOSAppZip)"
Condition="'@(_NestediOSAppZip->Count())' != '0'"
/>
<RemoveDir Directories="$(_NestedZipExtractionDir)" />
</Target>

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

@ -755,7 +755,11 @@
<_AssemblyDirsToCreate Include="@(_AssembliesToBeStripped->'%(OutputPath)%(Directory)'->Distinct())"/>
</ItemGroup>
<MakeDir SessionId="$(BuildSessionId)" Condition="'$(IsMacEnabled)' == 'true'" Directories="@(_AssemblyDirsToCreate)" />
<Xamarin.MacDev.Tasks.ILStrip Assemblies="@(_AssembliesToBeStripped)" SessionId="$(BuildSessionId)">
<Xamarin.MacDev.Tasks.ILStrip
Assemblies="@(_AssembliesToBeStripped)"
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true'"
>
<Output TaskParameter="StrippedAssemblies" ItemName="_StrippedAssemblies" />
</Xamarin.MacDev.Tasks.ILStrip>
<ItemGroup>
@ -1303,7 +1307,7 @@
<ReadItemsFromFile
SessionId="$(BuildSessionId)"
File="%(_RidSpecificCodesignItemsPath.Identity)"
Condition="@(_RidSpecificCodesignItemsPath->Count()) &gt; 0"
Condition="@(_RidSpecificCodesignItemsPath->Count()) &gt; 0 And '$(IsMacEnabled)' == 'true'"
>
<Output TaskParameter="Items" ItemName="_RidSpecificCodesignItems" />
</ReadItemsFromFile>

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

@ -1,6 +1,4 @@
namespace Xamarin.Mac.Tasks
{
public class Mmp : MmpTaskBase
{
namespace Xamarin.Mac.Tasks {
public class Mmp : MmpTaskBase {
}
}

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

@ -18,10 +18,8 @@ using Xamarin.MacDev;
using Xamarin.Utils;
using Xamarin.Localization.MSBuild;
namespace Xamarin.Mac.Tasks
{
public abstract class MmpTaskBase : BundlerToolTaskBase
{
namespace Xamarin.Mac.Tasks {
public abstract class MmpTaskBase : BundlerToolTaskBase {
protected override string ToolName {
get { return "mmp"; }
}
@ -62,7 +60,7 @@ namespace Xamarin.Mac.Tasks
if (arch == XamMacArch.Default)
arch = XamMacArch.x86_64;
List <string> allSupportedArchs = new List <string> ();
List<string> allSupportedArchs = new List<string> ();
if (arch.HasFlag (XamMacArch.i386))
allSupportedArchs.Add ("i386");
@ -129,8 +127,7 @@ namespace Xamarin.Mac.Tasks
{
try { // We first try to use the base logic, which shows up nicely in XS.
base.LogEventsFromTextOutput (singleLine, messageImportance);
}
catch { // But when that fails, just output the message to the command line and XS will output it raw
} catch { // But when that fails, just output the message to the command line and XS will output it raw
Log.LogMessage (messageImportance, "{0}", singleLine);
}
}

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

@ -8,11 +8,9 @@
using System;
namespace Xamarin.Mac.Tasks
{
namespace Xamarin.Mac.Tasks {
[Flags]
public enum XamMacArch
{
public enum XamMacArch {
Default = 0,
i386 = 1,
x86_64 = 2,

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

@ -5,43 +5,41 @@ using System.Collections.Generic;
using Microsoft.Build.Framework;
namespace Xamarin.MacDev.Tasks
{
public static class AssetPackUtils
{
namespace Xamarin.MacDev.Tasks {
public static class AssetPackUtils {
const string Base36Alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const int HashEverythingLimit = 96;
static unsafe ulong ComputeHash (string tags)
{
var value = (ulong) tags.Length;
char[] buffer;
char [] buffer;
if (tags.Length > HashEverythingLimit) {
buffer = new char[HashEverythingLimit];
buffer = new char [HashEverythingLimit];
int index = 0;
while (index < 32) {
buffer[index] = tags[index];
buffer [index] = tags [index];
index++;
}
for (int i = (tags.Length >> 1) - 16; i < 32; i++)
buffer[index++] = tags[i];
buffer [index++] = tags [i];
for (int i = tags.Length - 32; i < tags.Length; i++)
buffer[index++] = tags[i];
buffer [index++] = tags [i];
} else {
buffer = tags.ToCharArray ();
}
fixed (char* bufptr = buffer) {
ushort* end4 = ((ushort *) bufptr) + (tags.Length & ~3);
ushort* end = ((ushort *) bufptr) + tags.Length;
ushort* cur = (ushort *) bufptr;
ushort* end4 = ((ushort*) bufptr) + (tags.Length & ~3);
ushort* end = ((ushort*) bufptr) + tags.Length;
ushort* cur = (ushort*) bufptr;
while (cur < end4) {
value = (value * 67503105) + (ulong) (cur[0] * 16974593) + (ulong) (cur[1] * 66049) + (ulong) (cur[2] * 257) + (ulong) cur[3];
value = (value * 67503105) + (ulong) (cur [0] * 16974593) + (ulong) (cur [1] * 66049) + (ulong) (cur [2] * 257) + (ulong) cur [3];
cur += 4;
}
@ -56,24 +54,24 @@ namespace Xamarin.MacDev.Tasks
static string Base36Encode (ulong value)
{
var encoded = new char[13];
var encoded = new char [13];
int index = 12;
do {
encoded[index--] = Base36Alphabet[(int) (value % 36)];
encoded [index--] = Base36Alphabet [(int) (value % 36)];
value /= 36;
} while (value != 0);
while (index >= 0)
encoded[index--] = '0';
encoded [index--] = '0';
return new string (encoded, 0, 13);
}
public static string[] ParseTags (string value)
public static string [] ParseTags (string value)
{
if (string.IsNullOrEmpty (value))
return new string[0];
return new string [0];
return value.Split (new [] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select (tag => tag.Trim ()).ToArray ();
}
@ -96,7 +94,7 @@ namespace Xamarin.MacDev.Tasks
string id;
for (int i = 0; i < tags.Count; i++) {
if (tags[i].IndexOf ('+') != -1) {
if (tags [i].IndexOf ('+') != -1) {
addHash = true;
break;
}

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

@ -7,10 +7,8 @@ using Microsoft.Build.Framework;
using Xamarin.Utils;
namespace Xamarin.MacDev
{
public static class BundleResource
{
namespace Xamarin.MacDev {
public static class BundleResource {
static readonly HashSet<string> illegalDirectoryNames = new HashSet<string> (new [] {
"Resources",
"_CodeSignature",
@ -71,10 +69,9 @@ namespace Xamarin.MacDev
// HACK: This is for Visual Studio iOS projects
if (isVSBuild) {
if (item.GetMetadata("DefiningProjectFullPath") != item.GetMetadata("MSBuildProjectFullPath")) {
return item.GetMetadata("FullPath").Replace(item.GetMetadata ("DefiningProjectDirectory"), string.Empty);
}
else {
if (item.GetMetadata ("DefiningProjectFullPath") != item.GetMetadata ("MSBuildProjectFullPath")) {
return item.GetMetadata ("FullPath").Replace (item.GetMetadata ("DefiningProjectDirectory"), string.Empty);
} else {
return item.ItemSpec;
}
}

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

@ -6,14 +6,12 @@ using System.Collections.Generic;
using Microsoft.Build.Utilities;
using Xamarin.Utils;
namespace Xamarin.MacDev
{
namespace Xamarin.MacDev {
/// <summary>
/// Builds a process argument string.
/// </summary>
public class CommandLineArgumentBuilder
{
static readonly char[] QuoteSpecials = new char[] { ' ', '\\', '\'', '"', ',', ';' };
public class CommandLineArgumentBuilder {
static readonly char [] QuoteSpecials = new char [] { ' ', '\\', '\'', '"', ',', ';' };
readonly HashSet<string> hash = new HashSet<string> ();
readonly StringBuilder builder = new StringBuilder ();
@ -69,7 +67,7 @@ namespace Xamarin.MacDev
/// <summary>
/// Adds multiple arguments without escaping or quoting.
/// </summary>
public void Add (params string[] args)
public void Add (params string [] args)
{
foreach (var a in args)
Add (a);
@ -78,7 +76,7 @@ namespace Xamarin.MacDev
/// <summary>
/// Adds a formatted argument, quoting and escaping as necessary.
/// </summary>
public void AddQuotedFormat (string argumentFormat, params object[] values)
public void AddQuotedFormat (string argumentFormat, params object [] values)
{
AddQuoted (string.Format (argumentFormat, values));
}
@ -94,9 +92,9 @@ namespace Xamarin.MacDev
quoted.Append ("\"");
for (int i = 0; i < text.Length; i++) {
if (text[i] == '\\' || text[i] == '"')
if (text [i] == '\\' || text [i] == '"')
quoted.Append ('\\');
quoted.Append (text[i]);
quoted.Append (text [i]);
}
quoted.Append ("\"");
@ -134,7 +132,7 @@ namespace Xamarin.MacDev
/// <summary>
/// Adds multiple arguments, quoting and escaping each as necessary.
/// </summary>
public void AddQuoted (params string[] args)
public void AddQuoted (params string [] args)
{
foreach (var a in args)
AddQuoted (a);
@ -166,12 +164,12 @@ namespace Xamarin.MacDev
return builder.ToString ();
}
static bool TryParse (string commandline, out string[] argv, out Exception ex)
static bool TryParse (string commandline, out string [] argv, out Exception ex)
{
return StringUtils.TryParseArguments (commandline, out argv, out ex);
}
public static bool TryParse (string commandline, out string[] argv)
public static bool TryParse (string commandline, out string [] argv)
{
Exception ex;
@ -183,9 +181,9 @@ namespace Xamarin.MacDev
return Parse (ToString ());
}
public static string[] Parse (string commandline)
public static string [] Parse (string commandline)
{
string[] argv;
string [] argv;
Exception ex;
if (!TryParse (commandline, out argv, out ex))

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

@ -51,9 +51,9 @@ namespace Mono {
#else
unsafe internal abstract class DataConverter {
// Disables the warning: CLS compliance checking will not be performed on
// `XXXX' because it is not visible from outside this assembly
#pragma warning disable 3019
// Disables the warning: CLS compliance checking will not be performed on
// `XXXX' because it is not visible from outside this assembly
#pragma warning disable 3019
#endif
static DataConverter SwapConv = new SwapConverter ();
static DataConverter CopyConv = new CopyConverter ();
@ -61,18 +61,18 @@ namespace Mono {
public static readonly bool IsLittleEndian = BitConverter.IsLittleEndian;
public abstract double GetDouble (byte [] data, int index);
public abstract float GetFloat (byte [] data, int index);
public abstract long GetInt64 (byte [] data, int index);
public abstract int GetInt32 (byte [] data, int index);
public abstract float GetFloat (byte [] data, int index);
public abstract long GetInt64 (byte [] data, int index);
public abstract int GetInt32 (byte [] data, int index);
public abstract short GetInt16 (byte [] data, int index);
public abstract short GetInt16 (byte [] data, int index);
[CLSCompliant (false)]
public abstract uint GetUInt32 (byte [] data, int index);
[CLSCompliant (false)]
[CLSCompliant (false)]
public abstract uint GetUInt32 (byte [] data, int index);
[CLSCompliant (false)]
public abstract ushort GetUInt16 (byte [] data, int index);
[CLSCompliant (false)]
public abstract ulong GetUInt64 (byte [] data, int index);
[CLSCompliant (false)]
public abstract ulong GetUInt64 (byte [] data, int index);
public abstract void PutBytes (byte [] dest, int destIdx, double value);
public abstract void PutBytes (byte [] dest, int destIdx, float value);
@ -80,66 +80,66 @@ namespace Mono {
public abstract void PutBytes (byte [] dest, int destIdx, long value);
public abstract void PutBytes (byte [] dest, int destIdx, short value);
[CLSCompliant (false)]
[CLSCompliant (false)]
public abstract void PutBytes (byte [] dest, int destIdx, ushort value);
[CLSCompliant (false)]
[CLSCompliant (false)]
public abstract void PutBytes (byte [] dest, int destIdx, uint value);
[CLSCompliant (false)]
[CLSCompliant (false)]
public abstract void PutBytes (byte [] dest, int destIdx, ulong value);
public byte[] GetBytes (double value)
public byte [] GetBytes (double value)
{
byte [] ret = new byte [8];
PutBytes (ret, 0, value);
return ret;
}
public byte[] GetBytes (float value)
public byte [] GetBytes (float value)
{
byte [] ret = new byte [4];
PutBytes (ret, 0, value);
return ret;
}
public byte[] GetBytes (int value)
public byte [] GetBytes (int value)
{
byte [] ret = new byte [4];
PutBytes (ret, 0, value);
return ret;
}
public byte[] GetBytes (long value)
public byte [] GetBytes (long value)
{
byte [] ret = new byte [8];
PutBytes (ret, 0, value);
return ret;
}
public byte[] GetBytes (short value)
public byte [] GetBytes (short value)
{
byte [] ret = new byte [2];
PutBytes (ret, 0, value);
return ret;
}
[CLSCompliant (false)]
public byte[] GetBytes (ushort value)
[CLSCompliant (false)]
public byte [] GetBytes (ushort value)
{
byte [] ret = new byte [2];
PutBytes (ret, 0, value);
return ret;
}
[CLSCompliant (false)]
public byte[] GetBytes (uint value)
[CLSCompliant (false)]
public byte [] GetBytes (uint value)
{
byte [] ret = new byte [4];
PutBytes (ret, 0, value);
return ret;
}
[CLSCompliant (false)]
public byte[] GetBytes (ulong value)
[CLSCompliant (false)]
public byte [] GetBytes (ulong value)
{
byte [] ret = new byte [8];
PutBytes (ret, 0, value);
@ -191,12 +191,12 @@ namespace Mono {
//Console.WriteLine ("Adding {0} bytes to {1} (next={2}", group.Length,
// buffer == null ? "null" : buffer.Length.ToString (), next);
if (buffer == null){
if (buffer == null) {
buffer = group;
next = group.Length;
return;
}
if (align != 0){
if (align != 0) {
if (align == -1)
next = Align (next, group.Length);
else
@ -204,7 +204,7 @@ namespace Mono {
align = 0;
}
if (next + group.Length > buffer.Length){
if (next + group.Length > buffer.Length) {
byte [] nb = new byte [System.Math.Max (next, 16) * 2 + group.Length];
Array.Copy (buffer, nb, buffer.Length);
Array.Copy (group, 0, nb, next, group.Length);
@ -221,7 +221,7 @@ namespace Mono {
if (buffer == null)
return new byte [0];
if (buffer.Length != next){
if (buffer.Length != next) {
byte [] b = new byte [next];
Array.Copy (buffer, b, next);
return b;
@ -248,8 +248,8 @@ namespace Mono {
// f float
// d double
// b byte
// c 1-byte signed character
// C 1-byte unsigned character
// c 1-byte signed character
// C 1-byte unsigned character
// z8 string encoded as UTF8 with 1-byte null terminator
// z6 string encoded as UTF16 with 2-byte null terminator
// z7 string encoded as UTF7 with 1-byte null terminator
@ -277,7 +277,7 @@ namespace Mono {
b.conv = CopyConv;
b.description = description;
for (b.i = 0; b.i < description.Length; ){
for (b.i = 0; b.i < description.Length;) {
object oarg;
if (argn < args.Length)
@ -291,9 +291,9 @@ namespace Mono {
int save = b.i;
if (PackOne (b, oarg)){
if (PackOne (b, oarg)) {
argn++;
if (b.repeat > 0){
if (b.repeat > 0) {
if (--b.repeat > 0)
b.i = save;
else
@ -315,7 +315,7 @@ namespace Mono {
IEnumerator enumerator = args.GetEnumerator ();
bool ok = enumerator.MoveNext ();
for (b.i = 0; b.i < description.Length; ){
for (b.i = 0; b.i < description.Length;) {
object oarg;
if (ok)
@ -328,9 +328,9 @@ namespace Mono {
int save = b.i;
if (PackOne (b, oarg)){
if (PackOne (b, oarg)) {
ok = enumerator.MoveNext ();
if (b.repeat > 0){
if (b.repeat > 0) {
if (--b.repeat > 0)
b.i = save;
else
@ -353,7 +353,7 @@ namespace Mono {
{
int n;
switch (b.description [b.i]){
switch (b.description [b.i]) {
case '^':
b.conv = BigEndian;
return false;
@ -372,7 +372,7 @@ namespace Mono {
b.Add (new byte [] { 0 });
return false;
// Type Conversions
// Type Conversions
case 'i':
b.Add (b.conv.GetBytes (Convert.ToInt32 (oarg)));
break;
@ -417,9 +417,16 @@ namespace Mono {
b.Add (new byte [] { Convert.ToByte (oarg) });
break;
// Repeat acount;
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
// Repeat acount;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
b.repeat = ((short) b.description [b.i]) - ((short) '0');
return false;
@ -430,11 +437,11 @@ namespace Mono {
case '[':
int count = -1, j;
for (j = b.i+1; j < b.description.Length; j++){
for (j = b.i + 1; j < b.description.Length; j++) {
if (b.description [j] == ']')
break;
n = ((short) b.description [j]) - ((short) '0');
if (n >= 0 && n <= 9){
if (n >= 0 && n <= 9) {
if (count == -1)
count = n;
else
@ -447,7 +454,8 @@ namespace Mono {
b.repeat = count;
return false;
case '$': case 'z':
case '$':
case 'z':
bool add_null = b.description [b.i] == 'z';
b.i++;
if (b.i >= b.description.Length)
@ -455,7 +463,7 @@ namespace Mono {
char d = b.description [b.i];
Encoding e;
switch (d){
switch (d) {
case '8':
e = Encoding.UTF8;
n = 1;
@ -492,18 +500,18 @@ namespace Mono {
break;
default:
throw new ArgumentException (String.Format ("invalid format specified `{0}'",
b.description [b.i]));
b.description [b.i]));
}
return true;
}
static bool Prepare (byte [] buffer, ref int idx, int size, ref bool align)
{
if (align){
if (align) {
idx = Align (idx, size);
align = false;
}
if (idx + size > buffer.Length){
if (idx + size > buffer.Length) {
idx = buffer.Length;
return false;
}
@ -518,10 +526,10 @@ namespace Mono {
bool align = false;
int repeat = 0, n;
for (int i = 0; i < description.Length && idx < buffer.Length; ){
for (int i = 0; i < description.Length && idx < buffer.Length;) {
int save = i;
switch (description [i]){
switch (description [i]) {
case '^':
conv = BigEndian;
break;
@ -539,87 +547,95 @@ namespace Mono {
align = true;
break;
// Type Conversions
// Type Conversions
case 'i':
if (Prepare (buffer, ref idx, 4, ref align)){
if (Prepare (buffer, ref idx, 4, ref align)) {
result.Add (conv.GetInt32 (buffer, idx));
idx += 4;
}
break;
case 'I':
if (Prepare (buffer, ref idx, 4, ref align)){
if (Prepare (buffer, ref idx, 4, ref align)) {
result.Add (conv.GetUInt32 (buffer, idx));
idx += 4;
}
break;
case 's':
if (Prepare (buffer, ref idx, 2, ref align)){
if (Prepare (buffer, ref idx, 2, ref align)) {
result.Add (conv.GetInt16 (buffer, idx));
idx += 2;
}
break;
case 'S':
if (Prepare (buffer, ref idx, 2, ref align)){
if (Prepare (buffer, ref idx, 2, ref align)) {
result.Add (conv.GetUInt16 (buffer, idx));
idx += 2;
}
break;
case 'l':
if (Prepare (buffer, ref idx, 8, ref align)){
if (Prepare (buffer, ref idx, 8, ref align)) {
result.Add (conv.GetInt64 (buffer, idx));
idx += 8;
}
break;
case 'L':
if (Prepare (buffer, ref idx, 8, ref align)){
if (Prepare (buffer, ref idx, 8, ref align)) {
result.Add (conv.GetUInt64 (buffer, idx));
idx += 8;
}
break;
case 'f':
if (Prepare (buffer, ref idx, 4, ref align)){
if (Prepare (buffer, ref idx, 4, ref align)) {
result.Add (conv.GetDouble (buffer, idx));
idx += 4;
}
break;
case 'd':
if (Prepare (buffer, ref idx, 8, ref align)){
if (Prepare (buffer, ref idx, 8, ref align)) {
result.Add (conv.GetDouble (buffer, idx));
idx += 8;
}
break;
case 'b':
if (Prepare (buffer, ref idx, 1, ref align)){
if (Prepare (buffer, ref idx, 1, ref align)) {
result.Add (buffer [idx]);
idx++;
}
break;
case 'c': case 'C':
if (Prepare (buffer, ref idx, 1, ref align)){
case 'c':
case 'C':
if (Prepare (buffer, ref idx, 1, ref align)) {
char c;
if (description [i] == 'c')
c = ((char) ((sbyte)buffer [idx]));
c = ((char) ((sbyte) buffer [idx]));
else
c = ((char) ((byte)buffer [idx]));
c = ((char) ((byte) buffer [idx]));
result.Add (c);
idx++;
}
break;
// Repeat acount;
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9':
// Repeat acount;
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
repeat = ((short) description [i]) - ((short) '0');
save = i + 1;
break;
@ -631,11 +647,11 @@ namespace Mono {
case '[':
int count = -1, j;
for (j = i+1; j < description.Length; j++){
for (j = i + 1; j < description.Length; j++) {
if (description [j] == ']')
break;
n = ((short) description [j]) - ((short) '0');
if (n >= 0 && n <= 9){
if (n >= 0 && n <= 9) {
if (count == -1)
count = n;
else
@ -648,21 +664,22 @@ namespace Mono {
repeat = count;
break;
case '$': case 'z':
case '$':
case 'z':
// bool with_null = description [i] == 'z';
i++;
if (i >= description.Length)
throw new ArgumentException ("$ description needs a type specified", "description");
char d = description [i];
Encoding e;
if (align){
if (align) {
idx = Align (idx, 4);
align = false;
}
if (idx >= buffer.Length)
break;
switch (d){
switch (d) {
case '8':
e = Encoding.UTF8;
n = 1;
@ -692,56 +709,56 @@ namespace Mono {
throw new ArgumentException ("Invalid format for $ specifier", "description");
}
int k = idx;
switch (n){
switch (n) {
case 1:
for (; k < buffer.Length && buffer [k] != 0; k++)
;
result.Add (e.GetChars (buffer, idx, k-idx));
result.Add (e.GetChars (buffer, idx, k - idx));
if (k == buffer.Length)
idx = k;
else
idx = k+1;
idx = k + 1;
break;
case 2:
for (; k < buffer.Length; k++){
if (k+1 == buffer.Length){
for (; k < buffer.Length; k++) {
if (k + 1 == buffer.Length) {
k++;
break;
}
if (buffer [k] == 0 && buffer [k+1] == 0)
if (buffer [k] == 0 && buffer [k + 1] == 0)
break;
}
result.Add (e.GetChars (buffer, idx, k-idx));
result.Add (e.GetChars (buffer, idx, k - idx));
if (k == buffer.Length)
idx = k;
else
idx = k+2;
idx = k + 2;
break;
case 4:
for (; k < buffer.Length; k++){
if (k+3 >= buffer.Length){
for (; k < buffer.Length; k++) {
if (k + 3 >= buffer.Length) {
k = buffer.Length;
break;
}
if (buffer[k]==0 && buffer[k+1] == 0 && buffer[k+2] == 0 && buffer[k+3]== 0)
if (buffer [k] == 0 && buffer [k + 1] == 0 && buffer [k + 2] == 0 && buffer [k + 3] == 0)
break;
}
result.Add (e.GetChars (buffer, idx, k-idx));
result.Add (e.GetChars (buffer, idx, k - idx));
if (k == buffer.Length)
idx = k;
else
idx = k+4;
idx = k + 4;
break;
}
break;
default:
throw new ArgumentException (String.Format ("invalid format specified `{0}'",
description [i]));
description [i]));
}
if (repeat > 0){
if (repeat > 0) {
if (--repeat > 0)
i = save;
} else
@ -768,10 +785,10 @@ namespace Mono {
if (index < 0)
throw new ArgumentException ("index");
double ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 8; i++)
b [i] = data [index+i];
b [i] = data [index + i];
return ret;
}
@ -786,10 +803,10 @@ namespace Mono {
throw new ArgumentException ("index");
ulong ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 8; i++)
b [i] = data [index+i];
b [i] = data [index + i];
return ret;
}
@ -804,15 +821,15 @@ namespace Mono {
throw new ArgumentException ("index");
long ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 8; i++)
b [i] = data [index+i];
b [i] = data [index + i];
return ret;
}
public override float GetFloat (byte [] data, int index)
public override float GetFloat (byte [] data, int index)
{
if (data == null)
throw new ArgumentNullException ("data");
@ -822,15 +839,15 @@ namespace Mono {
throw new ArgumentException ("index");
float ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 4; i++)
b [i] = data [index+i];
b [i] = data [index + i];
return ret;
}
public override int GetInt32 (byte [] data, int index)
public override int GetInt32 (byte [] data, int index)
{
if (data == null)
throw new ArgumentNullException ("data");
@ -840,10 +857,10 @@ namespace Mono {
throw new ArgumentException ("index");
int ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 4; i++)
b [i] = data [index+i];
b [i] = data [index + i];
return ret;
}
@ -858,10 +875,10 @@ namespace Mono {
throw new ArgumentException ("index");
uint ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 4; i++)
b [i] = data [index+i];
b [i] = data [index + i];
return ret;
}
@ -876,10 +893,10 @@ namespace Mono {
throw new ArgumentException ("index");
short ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 2; i++)
b [i] = data [index+i];
b [i] = data [index + i];
return ret;
}
@ -894,10 +911,10 @@ namespace Mono {
throw new ArgumentException ("index");
ushort ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 2; i++)
b [i] = data [index+i];
b [i] = data [index + i];
return ret;
}
@ -905,80 +922,80 @@ namespace Mono {
public override void PutBytes (byte [] dest, int destIdx, double value)
{
Check (dest, destIdx, 8);
fixed (byte *target = &dest [destIdx]){
long *source = (long *) &value;
fixed (byte* target = &dest [destIdx]) {
long* source = (long*) &value;
*((long *)target) = *source;
*((long*) target) = *source;
}
}
public override void PutBytes (byte [] dest, int destIdx, float value)
{
Check (dest, destIdx, 4);
fixed (byte *target = &dest [destIdx]){
uint *source = (uint *) &value;
fixed (byte* target = &dest [destIdx]) {
uint* source = (uint*) &value;
*((uint *)target) = *source;
*((uint*) target) = *source;
}
}
public override void PutBytes (byte [] dest, int destIdx, int value)
{
Check (dest, destIdx, 4);
fixed (byte *target = &dest [destIdx]){
uint *source = (uint *) &value;
fixed (byte* target = &dest [destIdx]) {
uint* source = (uint*) &value;
*((uint *)target) = *source;
*((uint*) target) = *source;
}
}
public override void PutBytes (byte [] dest, int destIdx, uint value)
{
Check (dest, destIdx, 4);
fixed (byte *target = &dest [destIdx]){
uint *source = (uint *) &value;
fixed (byte* target = &dest [destIdx]) {
uint* source = (uint*) &value;
*((uint *)target) = *source;
*((uint*) target) = *source;
}
}
public override void PutBytes (byte [] dest, int destIdx, long value)
{
Check (dest, destIdx, 8);
fixed (byte *target = &dest [destIdx]){
long *source = (long *) &value;
fixed (byte* target = &dest [destIdx]) {
long* source = (long*) &value;
*((long*)target) = *source;
*((long*) target) = *source;
}
}
public override void PutBytes (byte [] dest, int destIdx, ulong value)
{
Check (dest, destIdx, 8);
fixed (byte *target = &dest [destIdx]){
ulong *source = (ulong *) &value;
fixed (byte* target = &dest [destIdx]) {
ulong* source = (ulong*) &value;
*((ulong *) target) = *source;
*((ulong*) target) = *source;
}
}
public override void PutBytes (byte [] dest, int destIdx, short value)
{
Check (dest, destIdx, 2);
fixed (byte *target = &dest [destIdx]){
ushort *source = (ushort *) &value;
fixed (byte* target = &dest [destIdx]) {
ushort* source = (ushort*) &value;
*((ushort *)target) = *source;
*((ushort*) target) = *source;
}
}
public override void PutBytes (byte [] dest, int destIdx, ushort value)
{
Check (dest, destIdx, 2);
fixed (byte *target = &dest [destIdx]){
ushort *source = (ushort *) &value;
fixed (byte* target = &dest [destIdx]) {
ushort* source = (ushort*) &value;
*((ushort *)target) = *source;
*((ushort*) target) = *source;
}
}
}
@ -994,10 +1011,10 @@ namespace Mono {
throw new ArgumentException ("index");
double ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 8; i++)
b [7-i] = data [index+i];
b [7 - i] = data [index + i];
return ret;
}
@ -1012,10 +1029,10 @@ namespace Mono {
throw new ArgumentException ("index");
ulong ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 8; i++)
b [7-i] = data [index+i];
b [7 - i] = data [index + i];
return ret;
}
@ -1030,15 +1047,15 @@ namespace Mono {
throw new ArgumentException ("index");
long ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 8; i++)
b [7-i] = data [index+i];
b [7 - i] = data [index + i];
return ret;
}
public override float GetFloat (byte [] data, int index)
public override float GetFloat (byte [] data, int index)
{
if (data == null)
throw new ArgumentNullException ("data");
@ -1048,15 +1065,15 @@ namespace Mono {
throw new ArgumentException ("index");
float ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 4; i++)
b [3-i] = data [index+i];
b [3 - i] = data [index + i];
return ret;
}
public override int GetInt32 (byte [] data, int index)
public override int GetInt32 (byte [] data, int index)
{
if (data == null)
throw new ArgumentNullException ("data");
@ -1066,10 +1083,10 @@ namespace Mono {
throw new ArgumentException ("index");
int ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 4; i++)
b [3-i] = data [index+i];
b [3 - i] = data [index + i];
return ret;
}
@ -1084,10 +1101,10 @@ namespace Mono {
throw new ArgumentException ("index");
uint ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 4; i++)
b [3-i] = data [index+i];
b [3 - i] = data [index + i];
return ret;
}
@ -1102,10 +1119,10 @@ namespace Mono {
throw new ArgumentException ("index");
short ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 2; i++)
b [1-i] = data [index+i];
b [1 - i] = data [index + i];
return ret;
}
@ -1120,10 +1137,10 @@ namespace Mono {
throw new ArgumentException ("index");
ushort ret;
byte *b = (byte *)&ret;
byte* b = (byte*) &ret;
for (int i = 0; i < 2; i++)
b [1-i] = data [index+i];
b [1 - i] = data [index + i];
return ret;
}
@ -1132,11 +1149,11 @@ namespace Mono {
{
Check (dest, destIdx, 8);
fixed (byte *target = &dest [destIdx]){
byte *source = (byte *) &value;
fixed (byte* target = &dest [destIdx]) {
byte* source = (byte*) &value;
for (int i = 0; i < 8; i++)
target [i] = source [7-i];
target [i] = source [7 - i];
}
}
@ -1144,11 +1161,11 @@ namespace Mono {
{
Check (dest, destIdx, 4);
fixed (byte *target = &dest [destIdx]){
byte *source = (byte *) &value;
fixed (byte* target = &dest [destIdx]) {
byte* source = (byte*) &value;
for (int i = 0; i < 4; i++)
target [i] = source [3-i];
target [i] = source [3 - i];
}
}
@ -1156,11 +1173,11 @@ namespace Mono {
{
Check (dest, destIdx, 4);
fixed (byte *target = &dest [destIdx]){
byte *source = (byte *) &value;
fixed (byte* target = &dest [destIdx]) {
byte* source = (byte*) &value;
for (int i = 0; i < 4; i++)
target [i] = source [3-i];
target [i] = source [3 - i];
}
}
@ -1168,11 +1185,11 @@ namespace Mono {
{
Check (dest, destIdx, 4);
fixed (byte *target = &dest [destIdx]){
byte *source = (byte *) &value;
fixed (byte* target = &dest [destIdx]) {
byte* source = (byte*) &value;
for (int i = 0; i < 4; i++)
target [i] = source [3-i];
target [i] = source [3 - i];
}
}
@ -1180,11 +1197,11 @@ namespace Mono {
{
Check (dest, destIdx, 8);
fixed (byte *target = &dest [destIdx]){
byte *source = (byte *) &value;
fixed (byte* target = &dest [destIdx]) {
byte* source = (byte*) &value;
for (int i = 0; i < 8; i++)
target [i] = source [7-i];
target [i] = source [7 - i];
}
}
@ -1192,11 +1209,11 @@ namespace Mono {
{
Check (dest, destIdx, 8);
fixed (byte *target = &dest [destIdx]){
byte *source = (byte *) &value;
fixed (byte* target = &dest [destIdx]) {
byte* source = (byte*) &value;
for (int i = 0; i < 4; i++)
target [i] = source [7-i];
target [i] = source [7 - i];
}
}
@ -1204,11 +1221,11 @@ namespace Mono {
{
Check (dest, destIdx, 2);
fixed (byte *target = &dest [destIdx]){
byte *source = (byte *) &value;
fixed (byte* target = &dest [destIdx]) {
byte* source = (byte*) &value;
for (int i = 0; i < 2; i++)
target [i] = source [1-i];
target [i] = source [1 - i];
}
}
@ -1216,11 +1233,11 @@ namespace Mono {
{
Check (dest, destIdx, 2);
fixed (byte *target = &dest [destIdx]){
byte *source = (byte *) &value;
fixed (byte* target = &dest [destIdx]) {
byte* source = (byte*) &value;
for (int i = 0; i < 2; i++)
target [i] = source [1-i];
target [i] = source [1 - i];
}
}
}

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

@ -1,10 +1,8 @@
using System;
using Microsoft.Build.Utilities;
namespace Microsoft.Build.Tasks
{
public static class TaskExtensions
{
namespace Microsoft.Build.Tasks {
public static class TaskExtensions {
public static bool ShouldExecuteRemotely (this Task task, string sessionId)
=> Environment.OSVersion.Platform == PlatformID.Win32NT && !string.IsNullOrEmpty (sessionId);
}

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

@ -1,17 +1,16 @@
using System;
namespace Xamarin.MacDev.Tasks
{
namespace Xamarin.MacDev.Tasks {
[Flags]
enum LinkTarget {
Simulator = 1,
Simulator = 1,
i386 = Simulator,
ArmV6 = 2,
ArmV7 = 4,
Thumb = 8,
ArmV7s = 16,
Arm64 = 32,
Simulator64 = 64,
ArmV6 = 2,
ArmV7 = 4,
Thumb = 8,
ArmV7s = 16,
Arm64 = 32,
Simulator64 = 64,
x86_64 = Simulator64
}
}

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

@ -21,7 +21,7 @@ namespace Xamarin.MacDev.Tasks {
Frameworks = new HashSet<string> ();
}
public void BuildNativeReferenceFlags (TaskLoggingHelper Log, ITaskItem[] NativeReferences)
public void BuildNativeReferenceFlags (TaskLoggingHelper Log, ITaskItem [] NativeReferences)
{
if (NativeReferences == null)
return;

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

@ -4,10 +4,8 @@ using System.Collections.Generic;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Xamarin.MacDev.Tasks
{
public static class LoggingExtensions
{
namespace Xamarin.MacDev.Tasks {
public static class LoggingExtensions {
const MessageImportance TaskPropertyImportance = MessageImportance.Normal;
internal static readonly string ErrorPrefix;
@ -25,7 +23,7 @@ namespace Xamarin.MacDev.Tasks
}
}
public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, ITaskItem[] items)
public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, ITaskItem [] items)
{
if (items == null) {
log.LogMessage (TaskPropertyImportance, " {0}: <null>", propertyName);
@ -35,7 +33,7 @@ namespace Xamarin.MacDev.Tasks
log.LogMessage (TaskPropertyImportance, " {0}:", propertyName);
for (int i = 0; i < items.Length; i++)
log.LogMessage (TaskPropertyImportance, " {0}", items[i].ItemSpec);
log.LogMessage (TaskPropertyImportance, " {0}", items [i].ItemSpec);
}
public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, ITaskItem item)
@ -46,7 +44,7 @@ namespace Xamarin.MacDev.Tasks
log.LogMessage (TaskPropertyImportance, " {0}: ", propertyName);
}
public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, string[] items)
public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, string [] items)
{
if (items == null) {
log.LogMessage (TaskPropertyImportance, " {0}: <null>", propertyName);
@ -56,7 +54,7 @@ namespace Xamarin.MacDev.Tasks
log.LogMessage (TaskPropertyImportance, " {0}:", propertyName);
for (int i = 0; i < items.Length; i++)
log.LogMessage (TaskPropertyImportance, " {0}", items[i]);
log.LogMessage (TaskPropertyImportance, " {0}", items [i]);
}
public static void LogTaskProperty (this TaskLoggingHelper log, string propertyName, string value)
@ -81,12 +79,12 @@ namespace Xamarin.MacDev.Tasks
/// <param name="errorCode">In the 7xxx range for MSBuild error.</param>
/// <param name="message">The error's message to be displayed in the error pad.</param>
/// <param name="fileName">Path to the known guilty file or null.</param>
public static void LogError (this TaskLoggingHelper log, int errorCode, string fileName, string message, params object[] args)
public static void LogError (this TaskLoggingHelper log, int errorCode, string fileName, string message, params object [] args)
{
log.LogError (null, $"{ErrorPrefix}{errorCode}", null, fileName ?? "MSBuild", 0, 0, 0, 0, message, args);
}
public static void LogWarning (this TaskLoggingHelper log, int errorCode, string fileName, string message, params object[] args)
public static void LogWarning (this TaskLoggingHelper log, int errorCode, string fileName, string message, params object [] args)
{
log.LogWarning (null, $"{ErrorPrefix}{errorCode}", null, fileName ?? "MSBuild", 0, 0, 0, 0, message, args);
}

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

@ -1,9 +1,7 @@
using Xamarin.Messaging.Build.Client;
namespace Microsoft.Build.Tasks
{
public class Copy : CopyBase
{
namespace Microsoft.Build.Tasks {
public class Copy : CopyBase {
public override bool Execute ()
{
if (!this.ShouldExecuteRemotely (SessionId))

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

@ -1,9 +1,7 @@
extern alias Microsoft_Build_Tasks_Core;
namespace Microsoft.Build.Tasks
{
public abstract class CopyBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Copy
{
namespace Microsoft.Build.Tasks {
public abstract class CopyBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Copy {
public string SessionId { get; set; }
}
}

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

@ -1,9 +1,7 @@
using Xamarin.Messaging.Build.Client;
namespace Microsoft.Build.Tasks
{
public class Delete : DeleteBase
{
namespace Microsoft.Build.Tasks {
public class Delete : DeleteBase {
public override bool Execute ()
{
var result = base.Execute ();

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

@ -1,9 +1,7 @@
extern alias Microsoft_Build_Tasks_Core;
namespace Microsoft.Build.Tasks
{
public abstract class DeleteBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Delete
{
namespace Microsoft.Build.Tasks {
public abstract class DeleteBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Delete {
public string SessionId { get; set; }
}
}

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

@ -7,10 +7,8 @@ using Xamarin.Messaging.Build.Client;
using System.Security;
using System.Reactive.Linq;
namespace Microsoft.Build.Tasks
{
public class Exec : ExecBase, ITaskCallback
{
namespace Microsoft.Build.Tasks {
public class Exec : ExecBase, ITaskCallback {
public string ServerPassword { get; set; }
public override bool Execute ()

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

@ -1,9 +1,7 @@
extern alias Microsoft_Build_Tasks_Core;
namespace Microsoft.Build.Tasks
{
public abstract class ExecBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Exec
{
namespace Microsoft.Build.Tasks {
public abstract class ExecBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Exec {
public string SessionId { get; set; }
}
}

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

@ -3,10 +3,8 @@ using System.Linq;
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Microsoft.Build.Tasks
{
public class MakeDir : MakeDirBase, ITaskCallback
{
namespace Microsoft.Build.Tasks {
public class MakeDir : MakeDirBase, ITaskCallback {
public override bool Execute ()
{
var result = base.Execute ();

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

@ -1,9 +1,7 @@
extern alias Microsoft_Build_Tasks_Core;
namespace Microsoft.Build.Tasks
{
public abstract class MakeDirBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.MakeDir
{
namespace Microsoft.Build.Tasks {
public abstract class MakeDirBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.MakeDir {
public string SessionId { get; set; }
}
}

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

@ -3,10 +3,8 @@ using System.Linq;
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Microsoft.Build.Tasks
{
public class Move : MoveTaskBase, ITaskCallback
{
namespace Microsoft.Build.Tasks {
public class Move : MoveTaskBase, ITaskCallback {
public override bool Execute ()
{
if (this.ShouldExecuteRemotely (SessionId))

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

@ -1,9 +1,7 @@
extern alias Microsoft_Build_Tasks_Core;
namespace Microsoft.Build.Tasks
{
public abstract class MoveTaskBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Move
{
namespace Microsoft.Build.Tasks {
public abstract class MoveTaskBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Move {
public string SessionId { get; set; }
}
}

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

@ -1,9 +1,7 @@
using Xamarin.Messaging.Build.Client;
namespace Microsoft.Build.Tasks
{
public class RemoveDir : RemoveDirBase
{
namespace Microsoft.Build.Tasks {
public class RemoveDir : RemoveDirBase {
public bool RemoveAppDir { get; set; }
public override bool Execute ()

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

@ -1,9 +1,7 @@
extern alias Microsoft_Build_Tasks_Core;
namespace Microsoft.Build.Tasks
{
public abstract class RemoveDirBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.RemoveDir
{
namespace Microsoft.Build.Tasks {
public abstract class RemoveDirBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.RemoveDir {
public string SessionId { get; set; }
}
}

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

@ -3,10 +3,8 @@ using System.Linq;
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Microsoft.Build.Tasks
{
public class Touch : TouchBase, ITaskCallback
{
namespace Microsoft.Build.Tasks {
public class Touch : TouchBase, ITaskCallback {
public override bool Execute ()
{
bool result;

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

@ -1,9 +1,7 @@
extern alias Microsoft_Build_Tasks_Core;
namespace Microsoft.Build.Tasks
{
public abstract class TouchBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Touch
{
namespace Microsoft.Build.Tasks {
public abstract class TouchBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.Touch {
public string SessionId { get; set; }
}
}

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

@ -1,9 +1,7 @@
using Xamarin.Messaging.Build.Client;
namespace Microsoft.Build.Tasks
{
public class WriteLinesToFile : WriteLinesToFileBase
{
namespace Microsoft.Build.Tasks {
public class WriteLinesToFile : WriteLinesToFileBase {
public override bool Execute ()
{
if (this.ShouldExecuteRemotely (SessionId))

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

@ -1,9 +1,7 @@
extern alias Microsoft_Build_Tasks_Core;
namespace Microsoft.Build.Tasks
{
public abstract class WriteLinesToFileBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.WriteLinesToFile
{
namespace Microsoft.Build.Tasks {
public abstract class WriteLinesToFileBase : Microsoft_Build_Tasks_Core::Microsoft.Build.Tasks.WriteLinesToFile {
public string SessionId { get; set; }
}
}

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

@ -1,5 +1,4 @@
namespace Xamarin.MacDev.Tasks
{
namespace Xamarin.MacDev.Tasks {
public enum NativeReferenceKind {
Static,
Dynamic,

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

@ -29,10 +29,8 @@ using System.IO;
using Xamarin.Localization.MSBuild;
using Xamarin.Utils;
namespace Xamarin.MacDev.Tasks
{
public static class PlatformFrameworkHelper
{
namespace Xamarin.MacDev.Tasks {
public static class PlatformFrameworkHelper {
public static ApplePlatform GetFramework (string targetFrameworkMoniker)
{
return TargetFramework.Parse (targetFrameworkMoniker).Platform;

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

@ -1,7 +1,5 @@
namespace Xamarin.MacDev.Tasks
{
public static class PlatformUtils
{
namespace Xamarin.MacDev.Tasks {
public static class PlatformUtils {
public static string GetTargetPlatform (string sdkPlatform, bool isWatchApp)
{
switch (sdkPlatform) {

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

@ -2,31 +2,29 @@ using System;
using System.Text;
using System.Collections.Generic;
namespace Xamarin.MacDev
{
public static class StringParserService
{
namespace Xamarin.MacDev {
public static class StringParserService {
public static string Parse (string text, IDictionary<string, string> tags)
{
var builder = new StringBuilder ();
for (int i = 0; i < text.Length; i++) {
if (text[i] != '$' || i + 1 >= text.Length) {
builder.Append (text[i]);
if (text [i] != '$' || i + 1 >= text.Length) {
builder.Append (text [i]);
continue;
}
i++;
if ((text[i] == '(' || text[i] == '{') && i + 2 < text.Length) {
if ((text [i] == '(' || text [i] == '{') && i + 2 < text.Length) {
char open = text [i];
char close = open == '(' ? ')' : '}';
int startIndex = ++i;
while (i < text.Length && text[i] != close)
while (i < text.Length && text [i] != close)
i++;
if (text[i] != close) {
if (text [i] != close) {
builder.Append ('$').Append (open);
i = startIndex - 1;
continue;
@ -41,7 +39,7 @@ namespace Xamarin.MacDev
builder.Append (value);
}
} else {
builder.Append ('$').Append (text[i]);
builder.Append ('$').Append (text [i]);
}
}

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

@ -3,8 +3,7 @@ using Xamarin.MacDev.Tasks;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks {
public class ACTool : ACToolTaskBase, ICancelableTask
{
public class ACTool : ACToolTaskBase, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -10,10 +10,8 @@ using Microsoft.Build.Utilities;
using Xamarin.Localization.MSBuild;
using Xamarin.Utils;
namespace Xamarin.MacDev.Tasks
{
public abstract class ACToolTaskBase : XcodeCompilerToolTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class ACToolTaskBase : XcodeCompilerToolTask {
ITaskItem partialAppManifest;
string outputSpecs;
@ -26,7 +24,7 @@ namespace Xamarin.MacDev.Tasks
public bool EnableOnDemandResources { get; set; }
[Required]
public ITaskItem[] ImageAssets { get; set; }
public ITaskItem [] ImageAssets { get; set; }
public bool IsWatchApp { get; set; }
@ -59,7 +57,7 @@ namespace Xamarin.MacDev.Tasks
}
}
protected override void AppendCommandLineArguments (IDictionary<string, string> environment, CommandLineArgumentBuilder args, ITaskItem[] items)
protected override void AppendCommandLineArguments (IDictionary<string, string> environment, CommandLineArgumentBuilder args, ITaskItem [] items)
{
var assetDirs = new HashSet<string> (items.Select (x => BundleResource.GetVirtualProjectPath (ProjectDir, x, !string.IsNullOrEmpty (SessionId))));
@ -203,7 +201,7 @@ namespace Xamarin.MacDev.Tasks
var specs = new PArray ();
for (int i = 0; i < ImageAssets.Length; i++) {
var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, ImageAssets[i], !string.IsNullOrEmpty (SessionId));
var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, ImageAssets [i], !string.IsNullOrEmpty (SessionId));
// Ignore MacOS .DS_Store files...
if (Path.GetFileName (vpath).Equals (".DS_Store", StringComparison.OrdinalIgnoreCase))
@ -217,11 +215,11 @@ namespace Xamarin.MacDev.Tasks
catalog = Path.GetDirectoryName (catalog);
if (string.IsNullOrEmpty (catalog)) {
Log.LogWarning (null, null, null, ImageAssets[i].ItemSpec, 0, 0, 0, 0, MSBStrings.W0090, ImageAssets[i].ItemSpec);
Log.LogWarning (null, null, null, ImageAssets [i].ItemSpec, 0, 0, 0, 0, MSBStrings.W0090, ImageAssets [i].ItemSpec);
continue;
}
if (ImageAssets[i].GetMetadata ("Link") != null) {
if (ImageAssets [i].GetMetadata ("Link") != null) {
// Note: if any of the files within a catalog are linked, we'll have to clone the *entire* catalog
clones.Add (catalog);
continue;
@ -231,7 +229,7 @@ namespace Xamarin.MacDev.Tasks
if (Path.GetFileName (vpath) != "Contents.json")
continue;
items.Add (ImageAssets[i]);
items.Add (ImageAssets [i]);
}
// clone any *.xcassets dirs that need cloning
@ -244,7 +242,7 @@ namespace Xamarin.MacDev.Tasks
items.Clear ();
for (int i = 0; i < ImageAssets.Length; i++) {
var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, ImageAssets[i], !string.IsNullOrEmpty (SessionId));
var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, ImageAssets [i], !string.IsNullOrEmpty (SessionId));
var clone = false;
ITaskItem item;
@ -253,14 +251,14 @@ namespace Xamarin.MacDev.Tasks
continue;
foreach (var catalog in clones) {
if (vpath.Length > catalog.Length && vpath[catalog.Length] == '/' && vpath.StartsWith (catalog, StringComparison.Ordinal)) {
if (vpath.Length > catalog.Length && vpath [catalog.Length] == '/' && vpath.StartsWith (catalog, StringComparison.Ordinal)) {
clone = true;
break;
}
}
if (clone) {
var src = ImageAssets[i].GetMetadata ("FullPath");
var src = ImageAssets [i].GetMetadata ("FullPath");
if (!File.Exists (src)) {
Log.LogError (null, null, null, src, 0, 0, 0, 0, MSBStrings.E0091, src);
@ -279,14 +277,14 @@ namespace Xamarin.MacDev.Tasks
continue;
item = new TaskItem (dest);
ImageAssets[i].CopyMetadataTo (item);
ImageAssets [i].CopyMetadataTo (item);
item.SetMetadata ("Link", vpath);
} else {
// filter out everything except paths containing a Contents.json file since our main processing loop only cares about these
if (Path.GetFileName (vpath) != "Contents.json")
continue;
item = ImageAssets[i];
item = ImageAssets [i];
}
items.Add (item);
@ -295,8 +293,8 @@ namespace Xamarin.MacDev.Tasks
// Note: `items` contains only the Contents.json files at this point
for (int i = 0; i < items.Count; i++) {
var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, items[i], !string.IsNullOrEmpty (SessionId));
var path = items[i].GetMetadata ("FullPath");
var vpath = BundleResource.GetVirtualProjectPath (ProjectDir, items [i], !string.IsNullOrEmpty (SessionId));
var path = items [i].GetMetadata ("FullPath");
// get the parent (which will typically be .appiconset, .launchimage, .imageset, .iconset, etc)
var catalog = Path.GetDirectoryName (vpath);
@ -316,7 +314,7 @@ namespace Xamarin.MacDev.Tasks
}
if (AppleSdkSettings.XcodeVersion.Major >= 7 && SdkPlatform != "WatchSimulator") {
var text = File.ReadAllText (items[i].ItemSpec);
var text = File.ReadAllText (items [i].ItemSpec);
if (string.IsNullOrEmpty (text))
continue;
@ -335,7 +333,7 @@ namespace Xamarin.MacDev.Tasks
Log.LogError (null, null, null, items [i].ItemSpec, line, col, line, col, "{0}", je.Message);
return false;
} catch (Exception e) {
Log.LogError (null, null, null, items[i].ItemSpec, 0, 0, 0, 0, MSBStrings.E0092, e.Message);
Log.LogError (null, null, null, items [i].ItemSpec, 0, 0, 0, 0, MSBStrings.E0092, e.Message);
return false;
}
@ -369,7 +367,7 @@ namespace Xamarin.MacDev.Tasks
Directory.CreateDirectory (assetDir);
for (int j = 0; j < tagList.Count; j++)
ptags.Add (new PString (tagList[j]));
ptags.Add (new PString (tagList [j]));
assetpack.Add ("bundle-id", new PString (string.Format ("{0}.asset-pack-{1}", BundleIdentifier, hash)));
assetpack.Add ("bundle-path", new PString (Path.GetFullPath (assetDir)));
@ -403,7 +401,7 @@ namespace Xamarin.MacDev.Tasks
try {
var manifestOutput = PDictionary.FromFile (manifest.ItemSpec);
LogWarningsAndErrors (manifestOutput, catalogs[0]);
LogWarningsAndErrors (manifestOutput, catalogs [0]);
bundleResources.AddRange (GetCompiledBundleResources (manifestOutput, intermediateBundleDir));
outputManifests.Add (manifest);

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

@ -1,15 +1,13 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class ALToolUpload : ALToolTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class ALToolUpload : ALToolTaskBase, ICancelableTask {
protected override string ALToolAction => "--upload-app";
public override bool Execute ()
{
if (ShouldExecuteRemotely())
if (ShouldExecuteRemotely ())
return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result;
return base.Execute ();

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

@ -1,10 +1,8 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class ALToolValidate : ALToolTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class ALToolValidate : ALToolTaskBase, ICancelableTask {
protected override string ALToolAction => "--validate-app";
public override bool Execute ()

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

@ -4,10 +4,8 @@ using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class AOTCompile : AOTCompileTaskBase, ITaskCallback, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class AOTCompile : AOTCompileTaskBase, ITaskCallback, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -34,13 +34,13 @@ namespace Xamarin.MacDev.Tasks {
[Required]
public string SdkDevPath { get; set; } = string.Empty;
#region Output
#region Output
[Output]
public ITaskItem[]? AssemblyFiles { get; set; }
public ITaskItem []? AssemblyFiles { get; set; }
[Output]
public ITaskItem[]? FileWrites { get; set; }
#endregion
public ITaskItem []? FileWrites { get; set; }
#endregion
public override bool Execute ()
{

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

@ -8,18 +8,16 @@ using System.Text;
using Xamarin.Utils;
using Xamarin.Localization.MSBuild;
namespace Xamarin.MacDev.Tasks
{
public abstract class ALToolTaskBase : XamarinToolTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class ALToolTaskBase : XamarinToolTask {
string sdkDevPath;
StringBuilder toolOutput;
[Required]
public string Username { get ; set; }
public string Username { get; set; }
[Required]
public string Password { get ; set; }
public string Password { get; set; }
[Required]
public string FilePath { get; set; }
@ -91,10 +89,10 @@ namespace Xamarin.MacDev.Tasks
string GetFileTypeValue ()
{
switch (Platform) {
case ApplePlatform.MacOSX: return "osx";
case ApplePlatform.TVOS: return "appletvos";
case ApplePlatform.iOS: return "ios";
default: throw new NotSupportedException ($"Provided file type '{Platform}' is not supported by altool");
case ApplePlatform.MacOSX: return "osx";
case ApplePlatform.TVOS: return "appletvos";
case ApplePlatform.iOS: return "ios";
default: throw new NotSupportedException ($"Provided file type '{Platform}' is not supported by altool");
}
}

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

@ -3,10 +3,8 @@ using System.Linq;
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class ArTool : ArToolTaskBase, ITaskCallback
{
namespace Xamarin.MacDev.Tasks {
public class ArTool : ArToolTaskBase, ITaskCallback {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -6,17 +6,15 @@ using Microsoft.Build.Utilities;
using Xamarin.MacDev;
namespace Xamarin.MacDev.Tasks
{
public abstract class ArToolTaskBase : XamarinToolTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class ArToolTaskBase : XamarinToolTask {
#region Inputs
[Required]
public ITaskItem Archive { get; set; }
[Required]
public ITaskItem[] Items { get; set; }
public ITaskItem [] Items { get; set; }
#endregion

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

@ -2,10 +2,8 @@ using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
using Xamarin.iOS.Tasks;
namespace Xamarin.MacDev.Tasks
{
public class Archive : ArchiveTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class Archive : ArchiveTaskBase, ICancelableTask {
public override bool Execute ()
{
if (!ShouldExecuteRemotely ())

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

@ -10,10 +10,8 @@ using System.Globalization;
using Xamarin.Localization.MSBuild;
using Xamarin.Utils;
namespace Xamarin.MacDev.Tasks
{
public abstract class ArchiveTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class ArchiveTaskBase : XamarinTask {
protected readonly DateTime Now = DateTime.Now;
#region Inputs

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

@ -12,10 +12,8 @@ using Xamarin.iOS.Tasks;
#nullable enable
namespace Xamarin.MacDev.Tasks
{
public class BTouch : BTouchTaskBase, ITaskCallback
{
namespace Xamarin.MacDev.Tasks {
public class BTouch : BTouchTaskBase, ITaskCallback {
public override bool Execute ()
{
if (!ShouldExecuteRemotely ())
@ -61,7 +59,7 @@ namespace Xamarin.MacDev.Tasks
{
base.Cancel ();
if (!string.IsNullOrEmpty(SessionId))
if (!string.IsNullOrEmpty (SessionId))
BuildConnection.CancelAsync (SessionId, BuildEngine4).Wait ();
}

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

@ -25,9 +25,9 @@ namespace Xamarin.MacDev.Tasks {
public string DotNetCscCompiler { get; set; }
public ITaskItem[] ObjectiveCLibraries { get; set; }
public ITaskItem [] ObjectiveCLibraries { get; set; }
public ITaskItem[] AdditionalLibPaths { get; set; }
public ITaskItem [] AdditionalLibPaths { get; set; }
public bool AllowUnsafeBlocks { get; set; }
@ -35,11 +35,11 @@ namespace Xamarin.MacDev.Tasks {
public string BaseLibDll { get; set; }
[Required]
public ITaskItem[] ApiDefinitions { get; set; }
public ITaskItem [] ApiDefinitions { get; set; }
public string AttributeAssembly { get; set; }
public ITaskItem[] CoreSources { get; set; }
public ITaskItem [] CoreSources { get; set; }
public string DefineConstants { get; set; }
@ -57,7 +57,7 @@ namespace Xamarin.MacDev.Tasks {
public bool NoNFloatUsing { get; set; }
public ITaskItem[] NativeLibraries { get; set; }
public ITaskItem [] NativeLibraries { get; set; }
public string OutputAssembly { get; set; }
@ -66,11 +66,11 @@ namespace Xamarin.MacDev.Tasks {
[Required]
public string ProjectDir { get; set; }
public ITaskItem[] References { get; set; }
public ITaskItem [] References { get; set; }
public ITaskItem[] Resources { get; set; }
public ITaskItem [] Resources { get; set; }
public ITaskItem[] Sources { get; set; }
public ITaskItem [] Sources { get; set; }
[Required]
public string ResponseFilePath { get; set; }
@ -119,9 +119,9 @@ namespace Xamarin.MacDev.Tasks {
{
var cmd = new CommandLineArgumentBuilder ();
#if DEBUG
#if DEBUG
cmd.Add ("/v");
#endif
#endif
cmd.Add ("/nostdlib");
cmd.AddQuotedSwitchIfNotNull ("/baselib:", BaseLibDll);
@ -246,7 +246,7 @@ namespace Xamarin.MacDev.Tasks {
}
for (int i = 0; i < extraArgs.Length; i++) {
var argument = extraArgs[i];
var argument = extraArgs [i];
cmd.Add (StringParserService.Parse (argument, customTags));
}
}
@ -271,7 +271,7 @@ namespace Xamarin.MacDev.Tasks {
if (IsDotNet) {
var customHome = Environment.GetEnvironmentVariable ("DOTNET_CUSTOM_HOME");
if(!string.IsNullOrEmpty(customHome)) {
if (!string.IsNullOrEmpty (customHome)) {
EnvironmentVariables = EnvironmentVariables.CopyAndAdd ($"HOME={customHome}");
}
} else {
@ -280,8 +280,8 @@ namespace Xamarin.MacDev.Tasks {
}
if (!string.IsNullOrEmpty (SessionId) &&
!string.IsNullOrEmpty (GeneratedSourcesDir) &&
!Directory.Exists (GeneratedSourcesDir)) {
!string.IsNullOrEmpty (GeneratedSourcesDir) &&
!Directory.Exists (GeneratedSourcesDir)) {
Directory.CreateDirectory (GeneratedSourcesDir);
}

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

@ -3,10 +3,8 @@ using System.Linq;
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class Codesign : CodesignTaskBase, ITaskCallback, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class Codesign : CodesignTaskBase, ITaskCallback, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -11,10 +11,8 @@ using System.Collections.Generic;
using Xamarin.Localization.MSBuild;
using Xamarin.Utils;
namespace Xamarin.MacDev.Tasks
{
public abstract class CodesignTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CodesignTaskBase : XamarinTask {
const string ToolName = "codesign";
const string MacOSDirName = "MacOS";
const string CodeSignatureDirName = "_CodeSignature";
@ -38,7 +36,7 @@ namespace Xamarin.MacDev.Tasks
public string Keychain { get; set; }
[Required]
public ITaskItem[] Resources { get; set; }
public ITaskItem [] Resources { get; set; }
// Can also be specified per resource using the 'CodesignResourceRules' metadata
public string ResourceRules { get; set; }
@ -72,7 +70,7 @@ namespace Xamarin.MacDev.Tasks
// This output value is not observed anywhere in our targets, but it's required for building on Windows
// to make sure any codesigned files other tasks depend on are copied back to the windows machine.
[Output]
public ITaskItem[] CodesignedFiles { get; set; }
public ITaskItem [] CodesignedFiles { get; set; }
#endregion
@ -99,7 +97,7 @@ namespace Xamarin.MacDev.Tasks
}
// 'sortedItems' is sorted by length of path, longest first.
bool NeedsCodesign (ITaskItem[] sortedItems, int index)
bool NeedsCodesign (ITaskItem [] sortedItems, int index)
{
var item = sortedItems [index];
var stampFile = GetCodesignStampFile (item);
@ -508,10 +506,10 @@ namespace Xamarin.MacDev.Tasks
var executableName = Path.GetFileName (item.ItemSpec);
var manifestPath = Path.Combine (item.ItemSpec, "Info.plist");
if (File.Exists(manifestPath)) {
if (File.Exists (manifestPath)) {
var bundleExecutable = PDictionary.FromFile (manifestPath).GetCFBundleExecutable ();
if (!string.IsNullOrEmpty(bundleExecutable))
if (!string.IsNullOrEmpty (bundleExecutable))
executableName = bundleExecutable;
}

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

@ -1,9 +1,7 @@
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CodesignVerify : CodesignVerifyTaskBase
{
namespace Xamarin.MacDev.Tasks {
public class CodesignVerify : CodesignVerifyTaskBase {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -6,10 +6,8 @@ using Microsoft.Build.Framework;
using Xamarin.Localization.MSBuild;
using Xamarin.Utils;
namespace Xamarin.MacDev.Tasks
{
public abstract class CodesignVerifyTaskBase : XamarinToolTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CodesignVerifyTaskBase : XamarinToolTask {
#region Inputs
[Required]
@ -68,7 +66,7 @@ namespace Xamarin.MacDev.Tasks
public override bool Execute ()
{
EnvironmentVariables = new string[] {
EnvironmentVariables = new string [] {
"CODESIGN_ALLOCATE=" + CodesignAllocate
};

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

@ -2,10 +2,8 @@ using System;
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CollectBundleResources : CollectBundleResourcesTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class CollectBundleResources : CollectBundleResourcesTaskBase, ICancelableTask {
public override bool Execute ()
{
try {

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

@ -6,13 +6,11 @@ using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Xamarin.Localization.MSBuild;
namespace Xamarin.MacDev.Tasks
{
public abstract class CollectBundleResourcesTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CollectBundleResourcesTaskBase : XamarinTask {
#region Inputs
public ITaskItem[] BundleResources { get; set; }
public ITaskItem [] BundleResources { get; set; }
public bool OptimizePropertyLists { get; set; }
@ -29,7 +27,7 @@ namespace Xamarin.MacDev.Tasks
#region Outputs
[Output]
public ITaskItem[] BundleResourcesWithLogicalNames { get; set; }
public ITaskItem [] BundleResourcesWithLogicalNames { get; set; }
#endregion
@ -53,7 +51,7 @@ namespace Xamarin.MacDev.Tasks
if (!string.IsNullOrEmpty (publishFolderType))
continue;
var logicalName = BundleResource.GetLogicalName (ProjectDir, prefixes, item, !string.IsNullOrEmpty(SessionId));
var logicalName = BundleResource.GetLogicalName (ProjectDir, prefixes, item, !string.IsNullOrEmpty (SessionId));
// We need a physical path here, ignore the Link element
var path = item.GetMetadata ("FullPath");
string illegal;

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

@ -6,10 +6,8 @@ using Xamarin.Messaging.Build.Client;
#nullable enable
namespace Xamarin.MacDev.Tasks
{
public class CompileAppManifest : CompileAppManifestTaskBase, ITaskCallback, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class CompileAppManifest : CompileAppManifestTaskBase, ITaskCallback, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -11,10 +11,8 @@ using Xamarin.Utils;
#nullable enable
namespace Xamarin.MacDev.Tasks
{
public abstract class CompileAppManifestTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CompileAppManifestTaskBase : XamarinTask {
#region Inputs
// Single-project property that maps to CFBundleIdentifier for Apple platforms
@ -313,7 +311,7 @@ namespace Xamarin.MacDev.Tasks
}
}
protected void LogAppManifestError (string format, params object[] args)
protected void LogAppManifestError (string format, params object [] args)
{
// Log an error linking to the Info.plist file
if (AppManifest is not null) {
@ -324,7 +322,7 @@ namespace Xamarin.MacDev.Tasks
}
protected void LogAppManifestWarning (string format, params object[] args)
protected void LogAppManifestWarning (string format, params object [] args)
{
// Log a warning linking to the Info.plist file
if (AppManifest is not null) {
@ -342,22 +340,22 @@ namespace Xamarin.MacDev.Tasks
if (string.IsNullOrEmpty (value))
LogAppManifestWarning (MSBStrings.W0106, key);
else
dict[key] = value;
dict [key] = value;
}
public static void MergePartialPlistDictionary (PDictionary plist, PDictionary partial)
{
foreach (var property in partial) {
if (plist.ContainsKey (property.Key)) {
var value = plist[property.Key];
var value = plist [property.Key];
if (value is PDictionary && property.Value is PDictionary) {
MergePartialPlistDictionary ((PDictionary) value, (PDictionary) property.Value);
} else {
plist[property.Key] = property.Value.Clone ();
plist [property.Key] = property.Value.Clone ();
}
} else {
plist[property.Key] = property.Value.Clone ();
plist [property.Key] = property.Value.Clone ();
}
}
}
@ -404,14 +402,14 @@ namespace Xamarin.MacDev.Tasks
string miniOSVersion = "?";
if (MacCatalystSupport.TryGetiOSVersion (Sdks.GetAppleSdk (Platform).GetSdkPath (SdkVersion, false), minimumOSVersion, out var iOSVersion, out var _))
miniOSVersion = iOSVersion?.ToString () ?? "?";
LogAppManifestError (MSBStrings.E7099 /* The UIDeviceFamily value '6' requires macOS 11.0. Please set the 'SupportedOSPlatformVersion' in the project file to at least 14.0 (the Mac Catalyst version equivalent of macOS 11.0). The current value is {0} (equivalent to macOS {1}). */, miniOSVersion, minimumOSVersion);
LogAppManifestError (MSBStrings.E7099 /* The UIDeviceFamily value '6' requires macOS 11.0. Please set the 'SupportedOSPlatformVersion' in the project file to at least 14.0 (the Mac Catalyst version equivalent of macOS 11.0). The current value is {0} (equivalent to macOS {1}). */, miniOSVersion, minimumOSVersion);
}
}
switch (Platform) {
case ApplePlatform.iOS:
var supportsIPhone = (supportedDevices & IPhoneDeviceType.IPhone) != 0
|| supportedDevices == IPhoneDeviceType.NotSet;
|| supportedDevices == IPhoneDeviceType.NotSet;
var supportsIPad = (supportedDevices & IPhoneDeviceType.IPad) != 0;
if (!IsAppExtension) {

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

@ -9,10 +9,8 @@ using Xamarin.Utils;
#nullable enable
namespace Xamarin.MacDev.Tasks
{
public abstract class CompileEntitlementsTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CompileEntitlementsTaskBase : XamarinTask {
bool warnedTeamIdentifierPrefix;
bool warnedAppIdentifierPrefix;
@ -59,7 +57,7 @@ namespace Xamarin.MacDev.Tasks
[Required]
public ITaskItem? CompiledEntitlements { get; set; }
public ITaskItem[] CustomEntitlements { get; set; } = Array.Empty<ITaskItem> ();
public ITaskItem [] CustomEntitlements { get; set; } = Array.Empty<ITaskItem> ();
public bool Debug { get; set; }
@ -164,12 +162,12 @@ namespace Xamarin.MacDev.Tasks
}
if (profile is not null && profile.ApplicationIdentifierPrefix.Count > 0)
AppIdentifierPrefix = profile.ApplicationIdentifierPrefix[0] + ".";
AppIdentifierPrefix = profile.ApplicationIdentifierPrefix [0] + ".";
else
AppIdentifierPrefix = string.Empty;
if (profile is not null && profile.TeamIdentifierPrefix.Count > 0)
TeamIdentifierPrefix = profile.TeamIdentifierPrefix[0] + ".";
TeamIdentifierPrefix = profile.TeamIdentifierPrefix [0] + ".";
else
TeamIdentifierPrefix = AppIdentifierPrefix;
@ -297,7 +295,7 @@ namespace Xamarin.MacDev.Tasks
var arraySeparator = item.GetMetadata ("ArraySeparator");
if (string.IsNullOrEmpty (arraySeparator))
arraySeparator = ";";
var arrayContent = value.Split (new string[] { arraySeparator }, StringSplitOptions.None);
var arrayContent = value.Split (new string [] { arraySeparator }, StringSplitOptions.None);
var parray = new PArray ();
foreach (var element in arrayContent)
parray.Add (new PString (element));
@ -310,13 +308,13 @@ namespace Xamarin.MacDev.Tasks
}
}
static bool AreEqual (byte[] x, byte[] y)
static bool AreEqual (byte [] x, byte [] y)
{
if (x.Length != y.Length)
return false;
for (int i = 0; i < x.Length; i++) {
if (x[i] != y[i])
if (x [i] != y [i])
return false;
}
@ -380,9 +378,9 @@ namespace Xamarin.MacDev.Tasks
var value = item.Value;
if (item.Key == "com.apple.developer.ubiquity-container-identifiers" ||
item.Key == "com.apple.developer.icloud-container-identifiers" ||
item.Key == "com.apple.developer.icloud-container-environment" ||
item.Key == "com.apple.developer.icloud-services") {
item.Key == "com.apple.developer.icloud-container-identifiers" ||
item.Key == "com.apple.developer.icloud-container-environment" ||
item.Key == "com.apple.developer.icloud-services") {
if (profile is null)
Log.LogWarning (null, null, null, Entitlements, 0, 0, 0, 0, MSBStrings.W0110, item.Key);
else if (!profile.Entitlements.ContainsKey (item.Key))
@ -405,7 +403,7 @@ namespace Xamarin.MacDev.Tasks
value = value.Clone ();
if (value is not null)
entitlements[item.Key] = value;
entitlements [item.Key] = value;
}
switch (Platform) {

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

@ -4,17 +4,14 @@ using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CompileNativeCode : CompileNativeCodeTaskBase, ICancelableTask, ITaskCallback
{
namespace Xamarin.MacDev.Tasks {
public class CompileNativeCode : CompileNativeCodeTaskBase, ICancelableTask, ITaskCallback {
public override bool Execute ()
{
if (!ShouldExecuteRemotely ())
return base.Execute ();
foreach (var info in CompileInfo)
{
foreach (var info in CompileInfo) {
var outputFile = info.GetMetadata ("OutputFile");
if (!string.IsNullOrEmpty (outputFile))
@ -31,11 +28,9 @@ namespace Xamarin.MacDev.Tasks
public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied ()
{
if (IncludeDirectories != null) {
foreach (var dir in IncludeDirectories)
{
foreach (var file in Directory.EnumerateFiles(dir.ItemSpec, "*.*", SearchOption.AllDirectories))
{
yield return new TaskItem(file);
foreach (var dir in IncludeDirectories) {
foreach (var file in Directory.EnumerateFiles (dir.ItemSpec, "*.*", SearchOption.AllDirectories)) {
yield return new TaskItem (file);
}
}
}

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

@ -12,11 +12,11 @@ using Xamarin.Utils;
namespace Xamarin.MacDev.Tasks {
public abstract class CompileNativeCodeTaskBase : XamarinTask {
#region Inputs
#region Inputs
[Required]
public ITaskItem [] CompileInfo { get; set; }
public ITaskItem[] IncludeDirectories { get; set; }
public ITaskItem [] IncludeDirectories { get; set; }
[Required]
public string MinimumOSVersion { get; set; }
@ -29,7 +29,7 @@ namespace Xamarin.MacDev.Tasks {
[Required]
public bool SdkIsSimulator { get; set; }
#endregion
#endregion
public override bool Execute ()
{

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

@ -56,7 +56,7 @@ namespace Xamarin.MacDev.Tasks {
// productbuild can do a guess of the targeted architectures if not provided, but the guess
// is very simple : on Catalina and lower, it will suppose it's x86_64 (even with an arm64 slice).
HashSet <string> archStrings = new HashSet <string> (architectures.ToArray ().Select (a => a.ToNativeArchitecture ()));
HashSet<string> archStrings = new HashSet<string> (architectures.ToArray ().Select (a => a.ToNativeArchitecture ()));
if (plist.TryGetValue (ProductDefinitionKeys.Architectures, out PArray archArray)) {
var existingArchs = archArray.ToStringArray ();
if (!archStrings.SetEquals (existingArchs)) {

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

@ -1,10 +1,8 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CompileSceneKitAssets : CompileSceneKitAssetsTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class CompileSceneKitAssets : CompileSceneKitAssetsTaskBase, ICancelableTask {
public override bool Execute ()
{
if (!ShouldExecuteRemotely ())

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

@ -11,10 +11,8 @@ using Xamarin.MacDev;
using Xamarin.Utils;
using Xamarin.Localization.MSBuild;
namespace Xamarin.MacDev.Tasks
{
public abstract class CompileSceneKitAssetsTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CompileSceneKitAssetsTaskBase : XamarinTask {
string toolExe;
#region Inputs
@ -34,7 +32,7 @@ namespace Xamarin.MacDev.Tasks
public string ResourcePrefix { get; set; }
[Required]
public ITaskItem[] SceneKitAssets { get; set; }
public ITaskItem [] SceneKitAssets { get; set; }
[Required]
public string SdkDevPath { get; set; }
@ -60,7 +58,7 @@ namespace Xamarin.MacDev.Tasks
#region Outputs
[Output]
public ITaskItem[] BundleResources { get; set; }
public ITaskItem [] BundleResources { get; set; }
#endregion
@ -138,7 +136,7 @@ namespace Xamarin.MacDev.Tasks
asset.RemoveMetadata ("LogicalName");
var bundleName = BundleResource.GetLogicalName (ProjectDir, prefixes, asset, !string.IsNullOrEmpty(SessionId));
var bundleName = BundleResource.GetLogicalName (ProjectDir, prefixes, asset, !string.IsNullOrEmpty (SessionId));
var output = new TaskItem (Path.Combine (intermediate, bundleName));
if (!modified.Contains (scnassets) && (!File.Exists (output.ItemSpec) || File.GetLastWriteTimeUtc (asset.ItemSpec) > File.GetLastWriteTimeUtc (output.ItemSpec))) {
@ -190,7 +188,7 @@ namespace Xamarin.MacDev.Tasks
var tasks = new List<Task> ();
foreach (var item in items) {
var bundleDir = BundleResource.GetLogicalName (ProjectDir, prefixes, new TaskItem (item), !string.IsNullOrEmpty(SessionId));
var bundleDir = BundleResource.GetLogicalName (ProjectDir, prefixes, new TaskItem (item), !string.IsNullOrEmpty (SessionId));
var output = Path.Combine (intermediate, bundleDir);
tasks.Add (CopySceneKitAssets (item.ItemSpec, output, intermediate));

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

@ -57,7 +57,7 @@ namespace Xamarin.MacDev.Tasks {
}
}
void AddResourceFiles (ITaskItem[]? items)
void AddResourceFiles (ITaskItem []? items)
{
if (items is null || items.Length == 0)
return;
@ -90,7 +90,7 @@ namespace Xamarin.MacDev.Tasks {
var appleFrameworks = new Dictionary<string, List<ITaskItem>> ();
var list = ResolvedFileToPublish.ToList ();
foreach (var item in list.ToArray ()) { // iterate over a copy of the list, because we might modify the original list
// Compute the publish folder type if it's not specified
// Compute the publish folder type if it's not specified
var publishFolderType = ParsePublishFolderType (item);
if (publishFolderType == PublishFolderType.Unset) {
publishFolderType = ComputePublishFolderType (list, item);

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

@ -3,10 +3,8 @@ using System.Linq;
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class ComputeBundleResourceOutputPaths : ComputeBundleResourceOutputPathsTaskBase, ITaskCallback, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class ComputeBundleResourceOutputPaths : ComputeBundleResourceOutputPathsTaskBase, ITaskCallback, ICancelableTask {
public override bool Execute ()
{
if (!ShouldExecuteRemotely ())

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

@ -7,17 +7,15 @@ using Microsoft.Build.Utilities;
using Xamarin.MacDev;
namespace Xamarin.MacDev.Tasks
{
public abstract class ComputeBundleResourceOutputPathsTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class ComputeBundleResourceOutputPathsTaskBase : XamarinTask {
[Required]
public ITaskItem AppResourcesPath { get; set; }
[Required]
public string BundleIdentifier { get; set; }
public ITaskItem[] BundleResources { get; set; }
public ITaskItem [] BundleResources { get; set; }
public bool EnableOnDemandResources { get; set; }
@ -28,7 +26,7 @@ namespace Xamarin.MacDev.Tasks
public string OutputPath { get; set; }
[Output]
public ITaskItem[] BundleResourcesWithOutputPaths { get; set; }
public ITaskItem [] BundleResourcesWithOutputPaths { get; set; }
public override bool Execute ()
{
@ -57,7 +55,7 @@ namespace Xamarin.MacDev.Tasks
var array = new PArray ();
for (int i = 0; i < tags.Count; i++)
array.Add (new PString (tags[i]));
array.Add (new PString (tags [i]));
plist.SetCFBundleIdentifier (BundleIdentifier + ".asset-pack-" + hash);
plist.Add ("Tags", array);

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

@ -49,9 +49,9 @@ namespace Xamarin.MacDev.Tasks {
public ITaskItem [] NativeStripItems { get; set; } = Array.Empty<ITaskItem> ();
[Output]
public ITaskItem[] OutputCodesignItems { get; set; } = Array.Empty<ITaskItem> ();
public ITaskItem [] OutputCodesignItems { get; set; } = Array.Empty<ITaskItem> ();
public ITaskItem[] SkipCodesignItems { get; set; } = Array.Empty<ITaskItem> ();
public ITaskItem [] SkipCodesignItems { get; set; } = Array.Empty<ITaskItem> ();
public override bool Execute ()
{
@ -66,7 +66,7 @@ namespace Xamarin.MacDev.Tasks {
// or a 'CodesignSigningKey' has been provided.
var requireCodeSigning = bundle.GetMetadata ("RequireCodeSigning");
var codesignSigningKey = bundle.GetMetadata ("CodesignSigningKey");
if (!string.Equals (requireCodeSigning, "true") && string.IsNullOrEmpty (codesignSigningKey))
if (!string.Equals (requireCodeSigning, "true") && string.IsNullOrEmpty (codesignSigningKey))
continue;
// Create a new item for the app bundle, and copy any metadata over.
@ -215,7 +215,7 @@ namespace Xamarin.MacDev.Tasks {
var outputPath = Path.GetFullPath (item.ItemSpec); // item.ItemSpec is relative to the project directory
outputPath = PathUtils.ResolveSymbolicLinks (outputPath); // Canonicalize
if (canonicalizedFilesToSkip.Contains (outputPath)) {
if (canonicalizedFilesToSkip.Contains (outputPath)) {
Log.LogMessage (MessageImportance.Low, $"Not signing '{output [i].ItemSpec}' because it's in the list of files that skips signing");
output.RemoveAt (i);
continue;

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

@ -6,8 +6,7 @@ using Microsoft.Build.Framework;
#nullable enable
namespace Xamarin.MacDev.Tasks
{
namespace Xamarin.MacDev.Tasks {
public class ComputeRemoteGeneratorProperties : ComputeRemoteGeneratorPropertiesTaskBase, ITaskCallback, ICancelableTask {
public override bool Execute ()
{

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

@ -1,10 +1,8 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CoreMLCompiler : CoreMLCompilerTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class CoreMLCompiler : CoreMLCompilerTaskBase, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -7,10 +7,8 @@ using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Xamarin.Localization.MSBuild;
namespace Xamarin.MacDev.Tasks
{
public abstract class CoreMLCompilerTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CoreMLCompilerTaskBase : XamarinTask {
string toolExe;
public string ToolName { get { return "coremlc"; } }
@ -23,7 +21,7 @@ namespace Xamarin.MacDev.Tasks
public string IntermediateOutputPath { get; set; }
[Required]
public ITaskItem[] Models { get; set; }
public ITaskItem [] Models { get; set; }
[Required]
public string ProjectDir { get; set; }
@ -49,10 +47,10 @@ namespace Xamarin.MacDev.Tasks
#region Outputs
[Output]
public ITaskItem[] BundleResources { get; set; }
public ITaskItem [] BundleResources { get; set; }
[Output]
public ITaskItem[] PartialAppManifests { get; set; }
public ITaskItem [] PartialAppManifests { get; set; }
#endregion
@ -182,7 +180,7 @@ namespace Xamarin.MacDev.Tasks
output.SetMetadata ("ResourceTags", resourceTags);
var metadata = output.CloneCustomMetadata ();
mapping[outputPath + "/"] = metadata;
mapping [outputPath + "/"] = metadata;
if (FileChanged (model, partialPlist)) {
Directory.CreateDirectory (outputDir);

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

@ -1,10 +1,8 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CreateAssetPackManifest : CreateAssetPackManifestTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class CreateAssetPackManifest : CreateAssetPackManifestTaskBase, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -9,10 +9,8 @@ using Microsoft.Build.Utilities;
using Xamarin.MacDev;
using Xamarin.Localization.MSBuild;
namespace Xamarin.MacDev.Tasks
{
public abstract class CreateAssetPackManifestTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CreateAssetPackManifestTaskBase : XamarinTask {
const double DownloadPriorityInterval = 0.90;
const double TopDownloadPriority = 0.95;
@ -112,7 +110,7 @@ namespace Xamarin.MacDev.Tasks
priority = 1.0f;
} else {
for (int i = 0; i < prefetchOrder.Length; i++) {
if (tag == prefetchOrder[i]) {
if (tag == prefetchOrder [i]) {
var value = GetDownloadPriority (i, prefetchOrder.Length);
priority = double.IsNaN (priority) ? value : Math.Max (priority, value);

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

@ -7,10 +7,8 @@ using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CreateBindingResourcePackage : CreateBindingResourcePackageBase, ITaskCallback, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class CreateBindingResourcePackage : CreateBindingResourcePackageBase, ITaskCallback, ICancelableTask {
public override bool Execute ()
{
if (!ShouldExecuteRemotely ())

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

@ -24,11 +24,11 @@ namespace Xamarin.MacDev.Tasks {
public string IntermediateOutputPath { get; set; }
[Required]
public ITaskItem[] NativeReferences { get; set; }
public ITaskItem [] NativeReferences { get; set; }
// This is a list of files to copy back to Windows
[Output]
public ITaskItem[] PackagedFiles { get; set; }
public ITaskItem [] PackagedFiles { get; set; }
public override bool Execute ()
{
@ -103,7 +103,7 @@ namespace Xamarin.MacDev.Tasks {
return !Log.HasLoggedErrors;
}
static bool ContainsSymlinks (ITaskItem[] items)
static bool ContainsSymlinks (ITaskItem [] items)
{
foreach (var item in items) {
if (PathUtils.IsSymlinkOrContainsSymlinks (item.ItemSpec))
@ -113,11 +113,11 @@ namespace Xamarin.MacDev.Tasks {
return false;
}
string [] NativeReferenceAttributeNames = new string [] { "Kind", "ForceLoad", "SmartLink", "Frameworks", "WeakFrameworks", "LinkerFlags", "NeedsGccExceptionHandling", "IsCxx"};
string [] NativeReferenceAttributeNames = new string [] { "Kind", "ForceLoad", "SmartLink", "Frameworks", "WeakFrameworks", "LinkerFlags", "NeedsGccExceptionHandling", "IsCxx" };
string CreateManifest (string resourcePath)
{
XmlWriterSettings settings = new XmlWriterSettings() {
XmlWriterSettings settings = new XmlWriterSettings () {
OmitXmlDeclaration = true,
Indent = true,
IndentChars = "\t",

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

@ -1,10 +1,8 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CreateDebugConfiguration : CreateDebugConfigurationTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class CreateDebugConfiguration : CreateDebugConfigurationTaskBase, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -8,10 +8,8 @@ using Microsoft.Build.Utilities;
using Xamarin.MacDev.Tasks;
namespace Xamarin.MacDev.Tasks
{
public abstract class CreateDebugConfigurationTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CreateDebugConfigurationTaskBase : XamarinTask {
#region Inputs
[Required]

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

@ -1,10 +1,8 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CreateDebugSettings : CreateDebugSettingsTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class CreateDebugSettings : CreateDebugSettingsTaskBase, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -9,10 +9,8 @@ using Xamarin.MacDev.Tasks;
using Xamarin.MacDev;
using Xamarin.Localization.MSBuild;
namespace Xamarin.MacDev.Tasks
{
public abstract class CreateDebugSettingsTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CreateDebugSettingsTaskBase : XamarinTask {
#region Inputs
[Required]

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

@ -1,10 +1,8 @@
using Microsoft.Build.Tasks;
using Xamarin.MacDev.Tasks;
namespace Xamarin.MacDev.Tasks
{
public class CreateEmbeddedResources : CreateEmbeddedResourcesTaskBase
{
namespace Xamarin.MacDev.Tasks {
public class CreateEmbeddedResources : CreateEmbeddedResourcesTaskBase {
public override bool Execute ()
{
if (this.ShouldExecuteRemotely (SessionId)) {

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

@ -5,29 +5,28 @@ using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Xamarin.MacDev.Tasks {
public abstract class CreateEmbeddedResourcesTaskBase : Task
{
public abstract class CreateEmbeddedResourcesTaskBase : Task {
public string SessionId { get; set; }
[Required]
public ITaskItem[] BundleResources { get; set; }
public ITaskItem [] BundleResources { get; set; }
[Required]
public string Prefix { get; set; }
[Output]
public ITaskItem[] EmbeddedResources { get; set; }
public ITaskItem [] EmbeddedResources { get; set; }
static string EscapeMangledResource (string name)
{
var mangled = new StringBuilder ();
for (int i = 0; i < name.Length; i++) {
switch (name[i]) {
switch (name [i]) {
case '\\': mangled.Append ("_b"); break;
case '/': mangled.Append ("_f"); break;
case '_': mangled.Append ("__"); break;
default: mangled.Append (name[i]); break;
default: mangled.Append (name [i]); break;
}
}
@ -36,10 +35,10 @@ namespace Xamarin.MacDev.Tasks {
public override bool Execute ()
{
EmbeddedResources = new ITaskItem[BundleResources.Length];
EmbeddedResources = new ITaskItem [BundleResources.Length];
for (int i = 0; i < BundleResources.Length; i++) {
var bundleResource = BundleResources[i];
var bundleResource = BundleResources [i];
// clone the item
var embeddedResource = new TaskItem (bundleResource.ItemSpec);
@ -50,7 +49,7 @@ namespace Xamarin.MacDev.Tasks {
embeddedResource.SetMetadata ("LogicalName", logicalName);
// add it to the output connection
EmbeddedResources[i] = embeddedResource;
EmbeddedResources [i] = embeddedResource;
}
return true;

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

@ -1,6 +1,4 @@
namespace Xamarin.MacDev.Tasks
{
public class CreateInstallerPackage : CreateInstallerPackageTaskBase
{
namespace Xamarin.MacDev.Tasks {
public class CreateInstallerPackage : CreateInstallerPackageTaskBase {
}
}

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

@ -11,10 +11,8 @@ using System.Security.Cryptography.X509Certificates;
using Xamarin.MacDev;
using Xamarin.Localization.MSBuild;
namespace Xamarin.MacDev.Tasks
{
public abstract class CreateInstallerPackageTaskBase : XamarinToolTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class CreateInstallerPackageTaskBase : XamarinToolTask {
#region Inputs
[Required]
public string OutputDirectory { get; set; }
@ -35,14 +33,14 @@ namespace Xamarin.MacDev.Tasks
public ITaskItem MainAssembly { get; set; }
[Required] // Should we even look at the PackageSigningKey?
// It has a default value when this is false, so we can't just switch off it being null
// It has a default value when this is false, so we can't just switch off it being null
public bool EnablePackageSigning { get; set; }
public string ProductDefinition { get; set; }
public string PackageSigningKey { get; set; }
public string PackagingExtraArgs { get ; set; }
public string PackagingExtraArgs { get; set; }
// both input and output
[Output]
@ -68,8 +66,7 @@ namespace Xamarin.MacDev.Tasks
return plist.GetCFBundleShortVersionString ();
}
protected override string ToolName
{
protected override string ToolName {
get { return "productbuild"; }
}
@ -89,7 +86,7 @@ namespace Xamarin.MacDev.Tasks
var args = new CommandLineArgumentBuilder ();
if (!string.IsNullOrEmpty(ProductDefinition)) {
if (!string.IsNullOrEmpty (ProductDefinition)) {
args.Add ("--product");
args.AddQuoted (Path.GetFullPath (ProductDefinition));
}
@ -129,7 +126,7 @@ namespace Xamarin.MacDev.Tasks
{
var target = this.MainAssembly.ItemSpec;
string[] argv = CommandLineArgumentBuilder.Parse (extraArgs);
string [] argv = CommandLineArgumentBuilder.Parse (extraArgs);
var customTags = new Dictionary<string, string> (StringComparer.OrdinalIgnoreCase) {
{ "projectdir", Path.GetDirectoryName (this.ProjectPath) },
// Apparently msbuild doesn't propagate the solution path, so we can't get it. - MTouchTaskBase.cs
@ -142,7 +139,7 @@ namespace Xamarin.MacDev.Tasks
};
for (int i = 0; i < argv.Length; i++)
args.AddQuoted (StringParserService.Parse (argv[i], customTags));
args.AddQuoted (StringParserService.Parse (argv [i], customTags));
}
string GetPackageSigningCertificateCommonName ()

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

@ -1,10 +1,8 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class CreatePkgInfo : CreatePkgInfoTaskBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class CreatePkgInfo : CreatePkgInfoTaskBase, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -4,11 +4,9 @@ using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Xamarin.MacDev.Tasks
{
public abstract class CreatePkgInfoTaskBase : XamarinTask
{
static readonly byte[] PkgInfoData = { 0X41, 0X50, 0X50, 0X4C, 0x3f, 0x3f, 0x3f, 0x3f };
namespace Xamarin.MacDev.Tasks {
public abstract class CreatePkgInfoTaskBase : XamarinTask {
static readonly byte [] PkgInfoData = { 0X41, 0X50, 0X50, 0X4C, 0x3f, 0x3f, 0x3f, 0x3f };
#region Inputs
[Required]

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

@ -7,10 +7,8 @@ using Xamarin.Messaging.Build.Client;
#nullable enable
namespace Xamarin.MacDev.Tasks
{
public class DSymUtil : DSymUtilTaskBase, ITaskCallback
{
namespace Xamarin.MacDev.Tasks {
public class DSymUtil : DSymUtilTaskBase, ITaskCallback {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -8,10 +8,8 @@ using Microsoft.Build.Utilities;
#nullable enable
namespace Xamarin.MacDev.Tasks
{
public abstract class DSymUtilTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class DSymUtilTaskBase : XamarinTask {
#region Inputs
// This can also be specified as metadata on the Executable item (as 'DSymDir')
@ -27,7 +25,7 @@ namespace Xamarin.MacDev.Tasks
// This property is required for XVS to work properly, even though it's not used for anything in the targets.
[Output]
public ITaskItem[] DsymContentFiles { get; set; } = Array.Empty<ITaskItem> ();
public ITaskItem [] DsymContentFiles { get; set; } = Array.Empty<ITaskItem> ();
#endregion

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

@ -1,10 +1,8 @@
using Microsoft.Build.Framework;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class DetectDebugNetworkConfiguration : DetectDebugNetworkConfigurationBase, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class DetectDebugNetworkConfiguration : DetectDebugNetworkConfigurationBase, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -12,10 +12,8 @@ using Xamarin.MacDev.Tasks;
using Xamarin.MacDev;
using Xamarin.Localization.MSBuild;
namespace Xamarin.MacDev.Tasks
{
public abstract class DetectDebugNetworkConfigurationBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class DetectDebugNetworkConfigurationBase : XamarinTask {
#region Inputs
[Required]

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

@ -5,10 +5,8 @@ using Microsoft.Build.Utilities;
using Xamarin.MacDev.Tasks;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class DetectSigningIdentity : DetectSigningIdentityTaskBase, ITaskCallback, ICancelableTask
{
namespace Xamarin.MacDev.Tasks {
public class DetectSigningIdentity : DetectSigningIdentityTaskBase, ITaskCallback, ICancelableTask {
public override bool Execute ()
{
if (ShouldExecuteRemotely ())

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

@ -11,10 +11,8 @@ using Xamarin.Localization.MSBuild;
using SecKeychain = Xamarin.MacDev.Keychain;
namespace Xamarin.MacDev.Tasks
{
public abstract class DetectSigningIdentityTaskBase : XamarinTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class DetectSigningIdentityTaskBase : XamarinTask {
const string AutomaticProvision = "Automatic";
const string AutomaticAdHocProvision = "Automatic:AdHoc";
const string AutomaticAppStoreProvision = "Automatic:AppStore";
@ -198,8 +196,7 @@ namespace Xamarin.MacDev.Tasks
}
}
class CodeSignIdentity
{
class CodeSignIdentity {
public X509Certificate2 SigningKey { get; set; }
public MobileProvision Profile { get; set; }
public string BundleId { get; set; }
@ -247,7 +244,7 @@ namespace Xamarin.MacDev.Tasks
}
return ConstructValidAppId (
provision.ApplicationIdentifierPrefix[0] + "." + bundleId,
provision.ApplicationIdentifierPrefix [0] + "." + bundleId,
((PString) provision.Entitlements [ApplicationIdentifierKey]).Value,
out matchLength
);
@ -291,17 +288,17 @@ namespace Xamarin.MacDev.Tasks
Log.LogMessage (MessageImportance.High, " App Id: {0}", DetectedAppId);
}
static bool MatchesAny (string name, string[] names)
static bool MatchesAny (string name, string [] names)
{
for (int i = 0; i < names.Length; i++) {
if (name == names[i])
if (name == names [i])
return true;
}
return false;
}
static bool StartsWithAny (string name, string[] prefixes)
static bool StartsWithAny (string name, string [] prefixes)
{
foreach (var prefix in prefixes) {
if (name.StartsWith (prefix, StringComparison.Ordinal))
@ -311,7 +308,7 @@ namespace Xamarin.MacDev.Tasks
return false;
}
bool TryGetSigningCertificates (SecKeychain keychain, out IList<X509Certificate2> certs, string[] prefixes, bool allowZeroCerts)
bool TryGetSigningCertificates (SecKeychain keychain, out IList<X509Certificate2> certs, string [] prefixes, bool allowZeroCerts)
{
var now = DateTime.Now;
@ -400,8 +397,7 @@ namespace Xamarin.MacDev.Tasks
}
}
class SigningIdentityComparer : IComparer<CodeSignIdentity>
{
class SigningIdentityComparer : IComparer<CodeSignIdentity> {
public int Compare (CodeSignIdentity x, CodeSignIdentity y)
{
// reverse sort by provisioning profile creation date
@ -445,12 +441,15 @@ namespace Xamarin.MacDev.Tasks
List<CodeSignIdentity> pairs;
if (certs.Count > 0) {
pairs = (from p in profiles from c in certs where p.DeveloperCertificates.Any (d => {
var rv = d.Thumbprint == c.Thumbprint;
if (!rv)
Log.LogMessage (MessageImportance.Low, MSBStrings.M0132, d.Thumbprint, c.Thumbprint);
return rv;
}) select new CodeSignIdentity { SigningKey = c, Profile = p }).ToList ();
pairs = (from p in profiles
from c in certs
where p.DeveloperCertificates.Any (d => {
var rv = d.Thumbprint == c.Thumbprint;
if (!rv)
Log.LogMessage (MessageImportance.Low, MSBStrings.M0132, d.Thumbprint, c.Thumbprint);
return rv;
})
select new CodeSignIdentity { SigningKey = c, Profile = p }).ToList ();
if (pairs.Count == 0) {
Log.LogError (MSBStrings.E0133, PlatformName, AppBundleName);
@ -510,14 +509,14 @@ namespace Xamarin.MacDev.Tasks
matches.Sort (new SigningIdentityComparer ());
for (int i = 0; i < matches.Count; i++) {
Log.LogMessage (MessageImportance.Normal, "{0,3}. Provisioning Profile: \"{1}\" ({2})", i + 1, matches[i].Profile.Name, matches[i].Profile.Uuid);
Log.LogMessage (MessageImportance.Normal, "{0,3}. Provisioning Profile: \"{1}\" ({2})", i + 1, matches [i].Profile.Name, matches [i].Profile.Uuid);
if (matches[i].SigningKey != null)
Log.LogMessage (MessageImportance.Normal, "{0} Signing Identity: \"{1}\"", spaces, SecKeychain.GetCertificateCommonName (matches[i].SigningKey));
if (matches [i].SigningKey != null)
Log.LogMessage (MessageImportance.Normal, "{0} Signing Identity: \"{1}\"", spaces, SecKeychain.GetCertificateCommonName (matches [i].SigningKey));
}
}
return matches[0];
return matches [0];
}
public override bool Execute ()
@ -609,7 +608,7 @@ namespace Xamarin.MacDev.Tasks
DetectedProvisioningProfile = identity.Profile.Uuid;
DetectedDistributionType = identity.Profile.DistributionType.ToString ();
} else {
certs = new X509Certificate2[0];
certs = new X509Certificate2 [0];
if ((profiles = GetProvisioningProfiles (platform, type, identity, certs)) == null)
return false;
@ -667,12 +666,12 @@ namespace Xamarin.MacDev.Tasks
for (int i = 0; i < certs.Count; i++) {
Log.LogMessage (MessageImportance.Normal, "{0,3}. Signing Identity: {1} ({2})", i + 1,
SecKeychain.GetCertificateCommonName (certs[i]), certs[i].Thumbprint);
SecKeychain.GetCertificateCommonName (certs [i]), certs [i].Thumbprint);
}
}
codesignCommonName = SecKeychain.GetCertificateCommonName (certs[0]);
DetectedCodeSigningKey = certs[0].Thumbprint;
codesignCommonName = SecKeychain.GetCertificateCommonName (certs [0]);
DetectedCodeSigningKey = certs [0].Thumbprint;
ReportDetectedCodesignInfo ();

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

@ -5,10 +5,8 @@ using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Xamarin.Messaging.Build.Client;
namespace Xamarin.MacDev.Tasks
{
public class Ditto : DittoTaskBase, ITaskCallback
{
namespace Xamarin.MacDev.Tasks {
public class Ditto : DittoTaskBase, ITaskCallback {
public override bool Execute ()
{
if (ShouldExecuteRemotely ()) {
@ -32,7 +30,7 @@ namespace Xamarin.MacDev.Tasks
public IEnumerable<ITaskItem> GetAdditionalItemsToBeCopied ()
{
if (!Directory.Exists(Source.ItemSpec))
if (!Directory.Exists (Source.ItemSpec))
return Enumerable.Empty<ITaskItem> ();
if (!CopyFromWindows)
@ -41,7 +39,7 @@ namespace Xamarin.MacDev.Tasks
// TaskRunner doesn't know how to copy directories to Mac but `ditto` can take directories (and that's why we use ditto often).
// If Source is a directory path, let's add each file within it as an TaskItem, as TaskRunner knows how to copy files to Mac.
return Directory.GetFiles (Source.ItemSpec, "*", SearchOption.AllDirectories)
.Select(f => new TaskItem(f));
.Select (f => new TaskItem (f));
}
public bool ShouldCopyToBuildServer (ITaskItem item) => true;

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

@ -7,10 +7,8 @@ using System.IO;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace Xamarin.MacDev.Tasks
{
public abstract class DittoTaskBase : XamarinToolTask
{
namespace Xamarin.MacDev.Tasks {
public abstract class DittoTaskBase : XamarinToolTask {
#region Inputs
public string? AdditionalArguments { get; set; }

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше