[msbuild] Only include *.dylibs from the app bundle for codesigning (i.e. not from child PlugIns) (#725)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=43890
This commit is contained in:
Родитель
7698a0ba72
Коммит
ee8eac1237
|
@ -8,6 +8,7 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
|
@ -25,6 +26,9 @@ namespace Xamarin.Mac.Tasks
|
|||
|
||||
public string SessionId { get; set; }
|
||||
|
||||
[Required]
|
||||
public string AppBundleDir { get; set; }
|
||||
|
||||
[Required]
|
||||
public string FrameworkRoot { get; set; }
|
||||
|
||||
|
@ -73,6 +77,9 @@ namespace Xamarin.Mac.Tasks
|
|||
|
||||
public string IntermediateOutputPath { get; set; }
|
||||
|
||||
[Output]
|
||||
public ITaskItem[] NativeLibraries { get; set; }
|
||||
|
||||
protected override string GenerateFullPathToTool ()
|
||||
{
|
||||
return Path.Combine (FrameworkRoot, "bin", "mmp");
|
||||
|
@ -203,6 +210,7 @@ namespace Xamarin.Mac.Tasks
|
|||
public override bool Execute ()
|
||||
{
|
||||
Log.LogTaskName ("Mmp");
|
||||
Log.LogTaskProperty ("AppBundleDir", AppBundleDir);
|
||||
Log.LogTaskProperty ("ApplicationAssembly", ApplicationAssembly + (IsAppExtension ? ".dll" : ".exe"));
|
||||
Log.LogTaskProperty ("ApplicationName", ApplicationName);
|
||||
Log.LogTaskProperty ("Architecture", Architecture);
|
||||
|
@ -226,7 +234,24 @@ namespace Xamarin.Mac.Tasks
|
|||
Log.LogTaskProperty ("NativeReferences", NativeReferences);
|
||||
Log.LogTaskProperty ("IsAppExtension", IsAppExtension);
|
||||
|
||||
return base.Execute ();
|
||||
if (!base.Execute ())
|
||||
return false;
|
||||
|
||||
try {
|
||||
var nativeLibrariesPath = Directory.EnumerateFiles (Path.Combine (AppBundleDir, "Contents", "MonoBundle"), "*.dylib", SearchOption.AllDirectories);
|
||||
var nativeLibraryItems = new List<ITaskItem> ();
|
||||
|
||||
foreach (var nativeLibrary in nativeLibrariesPath) {
|
||||
nativeLibraryItems.Add (new TaskItem (nativeLibrary));
|
||||
}
|
||||
|
||||
NativeLibraries = nativeLibraryItems.ToArray ();
|
||||
} catch (Exception ex) {
|
||||
Log.LogError (null, null, null, AppManifest.ItemSpec, 0, 0, 0, 0, "Could not get native libraries: {0}", ex.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
return !Log.HasLoggedErrors;
|
||||
}
|
||||
|
||||
protected override void LogEventsFromTextOutput (string singleLine, MessageImportance messageImportance)
|
||||
|
|
|
@ -200,13 +200,7 @@ Copyright (C) 2014 Xamarin. All rights reserved.
|
|||
</_CollectBundleResourcesDependsOn>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="_CollectNativeLibraries" DependsOnTargets="_CompileToNative;_CopyContentToBundle">
|
||||
<ItemGroup>
|
||||
<_NativeLibrary Include="$(_AppBundlePath)**\*.dylib" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="_CodesignNativeLibraries" Condition="'$(EnableCodeSigning)'" DependsOnTargets="_DetectSigningIdentity;_CollectNativeLibraries">
|
||||
<Target Name="_CodesignNativeLibraries" Condition="'$(EnableCodeSigning)'" DependsOnTargets="_DetectSigningIdentity">
|
||||
<Codesign
|
||||
SessionId="$(BuildSessionId)"
|
||||
ToolExe="$(CodesignExe)"
|
||||
|
@ -503,6 +497,7 @@ Copyright (C) 2014 Xamarin. All rights reserved.
|
|||
Condition="'$(IsMacEnabled)' == 'true'"
|
||||
SessionId="$(BuildSessionId)"
|
||||
FrameworkRoot="$(XamarinMacFrameworkRoot)"
|
||||
AppBundleDir="$(AppBundleDir)"
|
||||
OutputPath="$(OutputPath)"
|
||||
ApplicationName="$(_AppBundleName)"
|
||||
ApplicationAssembly="$(OutputPath)$(AssemblyName)"
|
||||
|
@ -524,8 +519,9 @@ Copyright (C) 2014 Xamarin. All rights reserved.
|
|||
IntermediateOutputPath="$(IntermediateOutputPath)mmp-cache"
|
||||
AppManifest="$(_AppManifest)"
|
||||
SdkVersion="$(MacOSXSdkVersion)"
|
||||
IsAppExtension="$(IsAppExtension)"
|
||||
/>
|
||||
IsAppExtension="$(IsAppExtension)">
|
||||
<Output TaskParameter="NativeLibraries" ItemName="_NativeLibrary" />
|
||||
</Mmp>
|
||||
</Target>
|
||||
|
||||
<Target Name="_CollectColladaAssets">
|
||||
|
|
Загрузка…
Ссылка в новой задаче