Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1912,7 +1912,6 @@
<!-- When we're building a universal app, we need to collect the list of user frameworks we need to run dsymutil on -->
<Target Name="_CollectRidSpecificUserFrameworksWithoutDebugSymbols">
<ReadItemsFromFile
SessionId="$(BuildSessionId)"
File="%(_RidSpecificUserFrameworksWithoutDebugSymbolsPath.Identity)"
Condition="Exists('%(_RidSpecificUserFrameworksWithoutDebugSymbolsPath.Identity)')"
>
Expand All @@ -1933,9 +1932,8 @@

<!-- Read the stored list of files to sign if we're an outer build of a multi-rid build -->
<ReadItemsFromFile
SessionId="$(BuildSessionId)"
File="%(_RidSpecificCodesignItemsPath.Identity)"
Condition="@(_RidSpecificCodesignItemsPath->Count()) &gt; 0 And '$(IsMacEnabled)' == 'true'"
Condition="@(_RidSpecificCodesignItemsPath->Count()) &gt; 0"
>
<Output TaskParameter="Items" ItemName="_RidSpecificCodesignItems" />
</ReadItemsFromFile>
Expand Down Expand Up @@ -2245,8 +2243,7 @@

<!-- Write a list of files to sign if we're not an outer build of a multi-rid build -->
<WriteItemsToFile
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' And '$(_CodesignItemsPath)' != ''"
Condition="'$(_CodesignItemsPath)' != ''"
Items="@(_CreateDumpExecutableToSign)"
ItemName="_CodesignItems"
File="$(_CodesignItemsPath)"
Expand Down
13 changes: 1 addition & 12 deletions msbuild/Xamarin.MacDev.Tasks/Tasks/WriteItemsToFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
using Microsoft.Build.Tasks;
using System.Xml.Linq;

using Xamarin.Messaging.Build.Client;

namespace Xamarin.MacDev.Tasks {
public class WriteItemsToFile : XamarinTask, ICancelableTask {
public class WriteItemsToFile : XamarinTask {
static readonly XNamespace XmlNs = XNamespace.Get ("http://schemas.microsoft.com/developer/msbuild/2003");

static readonly XName ProjectElementName = XmlNs + "Project";
Expand All @@ -36,9 +34,6 @@ public class WriteItemsToFile : XamarinTask, ICancelableTask {

public override bool Execute ()
{
if (ShouldExecuteRemotely ())
return new TaskRunner (SessionId, BuildEngine4).RunAsync (this).Result;

Write (this, File?.ItemSpec, Items, ItemName, Overwrite, IncludeMetadata);
return true;
}
Expand Down Expand Up @@ -83,11 +78,5 @@ static IEnumerable<XElement> CreateMetadataFromItem (ITaskItem item, bool includ

return Enumerable.Empty<XElement> ();
}

public void Cancel ()
{
if (ShouldExecuteRemotely ())
BuildConnection.CancelAsync (BuildEngine4).Wait ();
}
}
}
11 changes: 0 additions & 11 deletions msbuild/Xamarin.Shared/Xamarin.Mac.AppExtension.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,6 @@ Copyright (C) 2013-2014 Xamarin. All rights reserved.

<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets')"/>

<!-- Override GetTargetPath, Build, and Rebuild -->
<Target Name="GetBundleTargetPath" DependsOnTargets="_GenerateBundleName;$(GetTargetPathDependsOn)" Outputs="@(_AppExtensionBundlePath)" />
<Target Name="Build" Condition="'$(_InvalidConfigurationWarning)' != 'true'" DependsOnTargets="_EnabledLocalSigning;_GenerateBundleName;$(BuildDependsOn)" Outputs="$(_AppExtensionBundlePath)" />
<Target Name="Rebuild" Condition="'$(_InvalidConfigurationWarning)' != 'true'" DependsOnTargets="_EnabledLocalSigning;_GenerateBundleName;$(RebuildDependsOn)" Outputs="$(_AppExtensionBundlePath)" />

<Target Name="_EnabledLocalSigning" DependsOnTargets="_DetectSigningIdentity">
<PropertyGroup>
<CodesignEntitlements Condition="'$(CodesignEntitlements)' == ''">Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
</Target>

<Target Name="CreateIpa"/>

Expand Down
17 changes: 9 additions & 8 deletions msbuild/Xamarin.Shared/Xamarin.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.

<Target Name="_DetectBuildType">
<PropertyGroup>
<IsRemoteBuild Condition="'$(BundleOriginalResources)' == 'true' And '$(OutputType)' != 'Exe' And '$(BuildBindingProjectLocally)' != 'false'">False</IsRemoteBuild>
<IsRemoteBuild Condition="'$(BundleOriginalResources)' == 'true' And '$(_CanOutputAppBundle)' != 'true' And '$(BuildBindingProjectLocally)' != 'false'">False</IsRemoteBuild>
</PropertyGroup>
</Target>

Expand Down Expand Up @@ -2529,8 +2529,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
>

<WriteItemsToFile
Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
Items="@(_CodesignBundle)"
ItemName="_CodesignBundle"
File="$(DeviceSpecificOutputPath)codesign-bundle.items"
Expand All @@ -2539,8 +2537,6 @@ Copyright (C) 2018 Microsoft. All rights reserved.
/>

<WriteItemsToFile
Condition="'$(IsMacEnabled)' == 'true'"
SessionId="$(BuildSessionId)"
Items="@(_CodesignItems)"
ItemName="_CodesignItems"
File="$(DeviceSpecificOutputPath)codesign.items"
Expand Down Expand Up @@ -2670,6 +2666,10 @@ Copyright (C) 2018 Microsoft. All rights reserved.

<!-- App extensions -->

<Target Name="GetAppExtensionBundlePath" DependsOnTargets="_GenerateBundleName;$(GetTargetPathDependsOn)" Outputs="@(_AppExtensionBundlePath)" />

<Target Name="BuildAndGetAppExtensionBundlePath" DependsOnTargets="Build" Outputs="@(_AppExtensionBundlePath)" />

<Target Name="_AssignAppExtensionConfiguration" Condition="'@(_AppExtensionReference)' != ''">
<!-- assign configs if building a solution file -->
<AssignProjectConfiguration
Expand Down Expand Up @@ -2717,10 +2717,10 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<_BuildReferencedExtensionProjects Condition="'$(BuildingInsideVisualStudio)' != 'true'">true</_BuildReferencedExtensionProjects>
</PropertyGroup>

<!-- If the referenced projects have already been built, then just get the target paths -->
<!-- If the referenced projects have already been built, then just get the app extensions' bundle paths -->
<MSBuild
Projects="@(_AppExtensionReferenceWithConfigurationExistent)"
Targets="GetBundleTargetPath"
Targets="GetAppExtensionBundlePath"
Properties="%(_AppExtensionReferenceWithConfigurationExistent.SetConfiguration); %(_AppExtensionReferenceWithConfigurationExistent.SetPlatform)"
Condition="'@(_AppExtensionReferenceWithConfigurationExistent)' != '' and '$(_BuildReferencedExtensionProjects)' != 'true'">

Expand All @@ -2730,6 +2730,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
<!-- Build the referenced project if required -->
<MSBuild
Projects="@(_AppExtensionReferenceWithConfigurationExistent)"
Targets="BuildAndGetAppExtensionBundlePath"
Properties="%(_AppExtensionReferenceWithConfigurationExistent.SetConfiguration); %(_AppExtensionReferenceWithConfigurationExistent.SetPlatform)"
Condition="'@(_AppExtensionReferenceWithConfigurationExistent)' != '' and '$(_BuildReferencedExtensionProjects)' == 'true' ">

Expand Down Expand Up @@ -2996,7 +2997,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
>

<WriteItemsToFile
Condition="'$(IsMacEnabled)' == 'true' And '$(_PostProcessingItemPath)' != ''"
Condition="'$(_PostProcessingItemPath)' != ''"
Items="@(_PostProcessingItem)"
ItemName="_PostProcessingItem"
File="$(_PostProcessingItemPath)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ Copyright (C) 2014-2016 Xamarin. All rights reserved.
<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets')"/>

<!-- Override GetTargetPath, Build, and Rebuild -->
<Target Name="GetBundleTargetPath" DependsOnTargets="_GenerateBundleName;$(GetTargetPathDependsOn)" Outputs="@(_AppExtensionBundlePath)" />
<Target Name="Build" Condition="'$(_InvalidConfigurationWarning)' != 'true'" DependsOnTargets="_GenerateBundleName;$(BuildDependsOn)" Outputs="@(_AppExtensionBundlePath)" />
<Target Name="Rebuild" Condition="'$(_InvalidConfigurationWarning)' != 'true'" DependsOnTargets="_GenerateBundleName;$(RebuildDependsOn)" Outputs="@(_AppExtensionBundlePath)" />

<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.targets"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.targets')"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ Copyright (C) 2014-2016 Xamarin. All rights reserved.

<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets')"/>

<!-- Override GetTargetPath, Build, and Rebuild -->
<Target Name="GetBundleTargetPath" DependsOnTargets="_GenerateBundleName;$(GetTargetPathDependsOn)" Outputs="@(_AppExtensionBundlePath)" />
<Target Name="Build" Condition="'$(_InvalidConfigurationWarning)' != 'true'" DependsOnTargets="_GenerateBundleName;$(BuildDependsOn)" Outputs="@(_AppExtensionBundlePath)" />
<Target Name="Rebuild" Condition="'$(_InvalidConfigurationWarning)' != 'true'" DependsOnTargets="_GenerateBundleName;$(RebuildDependsOn)" Outputs="@(_AppExtensionBundlePath)" />

<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.targets"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.targets')"/>
Expand Down
2 changes: 1 addition & 1 deletion msbuild/Xamarin.Shared/Xamarin.iOS.Common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
<!-- If the referenced projects have already been built, then just get the target paths -->
<MSBuild
Projects="@(_WatchAppReferenceWithConfigurationExistent)"
Targets="GetBundleTargetPath"
Targets="GetAppExtensionBundlePath"
Properties="%(_WatchAppReferenceWithConfigurationExistent.SetConfiguration); %(_WatchAppReferenceWithConfigurationExistent.SetPlatform)"
Condition="'@(_WatchAppReferenceWithConfigurationExistent)' != '' and '$(_BuildReferencedExtensionProjects)' != 'true'">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<Target Name="EvaluateRemoteBuild">
<PropertyGroup>
<IsRemoteBuild>True</IsRemoteBuild>
<IsRemoteBuild Condition="'$(BundleOriginalResources)' == 'true' And '$(OutputType)' != 'Exe' And '$(BuildBindingProjectLocally)' != 'false'">False</IsRemoteBuild>
<IsRemoteBuild Condition="'$(BundleOriginalResources)' == 'true' And '$(_CanOutputAppBundle)' != 'true' And '$(BuildBindingProjectLocally)' != 'false'">False</IsRemoteBuild>
</PropertyGroup>
</Target>

Expand Down
15 changes: 14 additions & 1 deletion tests/dotnet/UnitTests/ProjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1849,6 +1849,19 @@ public void KillEverything ()
[TestCase (ApplePlatform.MacOSX, "osx-x64;osx-arm64", true)]
// [TestCase ("MacCatalyst", "")] - No extension support yet
public void BuildProjectsWithExtensions (ApplePlatform platform, string runtimeIdentifier, bool isNativeAot)
{
BuildProjectsWithExtensionsImpl (platform, runtimeIdentifier, isNativeAot);
}

[TestCase (ApplePlatform.iOS, "ios-arm64", false)]
[Category ("RemoteWindows")]
public void BuildProjectsWithExtensionsOnRemoteWindows (ApplePlatform platform, string runtimeIdentifier, bool isNativeAot)
{
Configuration.IgnoreIfNotOnWindows ();
BuildProjectsWithExtensionsImpl (platform, runtimeIdentifier, isNativeAot, AddRemoteProperties ());
}

void BuildProjectsWithExtensionsImpl (ApplePlatform platform, string runtimeIdentifier, bool isNativeAot, Dictionary<string, string>? properties = null)
{
Configuration.IgnoreIfIgnoredPlatform (platform);
var consumingProjectDir = GetProjectPath ("ExtensionConsumer", runtimeIdentifier, platform, out var appPath);
Expand All @@ -1857,7 +1870,7 @@ public void BuildProjectsWithExtensions (ApplePlatform platform, string runtimeI
Clean (extensionProjectDir);
Clean (consumingProjectDir);

var properties = GetDefaultProperties (runtimeIdentifier);
properties = GetDefaultProperties (runtimeIdentifier, extraProperties: properties);

if (isNativeAot) {
properties ["PublishAot"] = "true";
Expand Down
Loading