Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mac] Extension support work. TodayExtension runs, FinderSync templa… #76

Closed
wants to merge 2 commits into from
Closed
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
10 changes: 7 additions & 3 deletions msbuild/Xamarin.Mac.Tasks/Tasks/CompileAppManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public override bool Execute ()
Log.LogTaskProperty ("Architecture", Architecture);
Log.LogTaskProperty ("AssemblyName", AssemblyName);
Log.LogTaskProperty ("BundleIdentifier", BundleIdentifier);
Log.LogTaskProperty ("IsAppExtension", IsAppExtension);
Log.LogTaskProperty ("PartialAppManifests", PartialAppManifests);

try {
Expand All @@ -38,12 +39,15 @@ public override bool Execute ()
return false;
}

plist[ManifestKeys.CFBundleExecutable] = new PString (AssemblyName);

plist.SetIfNotPresent (ManifestKeys.CFBundleIdentifier, BundleIdentifier);
plist.SetIfNotPresent (ManifestKeys.CFBundleInfoDictionaryVersion, "6.0");
plist.SetIfNotPresent ("MonoBundleExecutable", AssemblyName + ".exe");
if (!IsAppExtension)
plist.SetIfNotPresent ("MonoBundleExecutable", AssemblyName + ".exe");
plist.SetIfNotPresent (ManifestKeys.CFBundleExecutable, AssemblyName);
plist.SetIfNotPresent (ManifestKeys.CFBundleName, AppBundleName);
plist.SetIfNotPresent (ManifestKeys.CFBundlePackageType, "APPL");
plist.SetIfNotPresent (ManifestKeys.CFBundlePackageType, IsAppExtension ? "XPC!" : "APPL");
plist.SetIfNotPresent (ManifestKeys.CFBundleSignature, "????");
plist.SetIfNotPresent (ManifestKeys.CFBundleVersion, "1.0");

Expand All @@ -56,4 +60,4 @@ public override bool Execute ()
return !Log.HasLoggedErrors;
}
}
}
}
13 changes: 10 additions & 3 deletions msbuild/Xamarin.Mac.Tasks/Tasks/Mmp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ protected override string ToolName {
[Required]
public string SdkVersion { get; set; }

public bool IsAppExtension { get; set; }

public bool UseXamMacFullFramework { get; set; }

public string ApplicationName { get; set; }
Expand Down Expand Up @@ -163,8 +165,9 @@ protected override string GenerateCommandLineCommands ()
args.AddQuoted ("/assembly:" + Path.GetFullPath (asm));
}

if (!string.IsNullOrEmpty (ApplicationAssembly))
args.AddQuoted (Path.GetFullPath (ApplicationAssembly));
if (!string.IsNullOrEmpty (ApplicationAssembly)) {
args.AddQuoted (Path.GetFullPath (ApplicationAssembly + (IsAppExtension ? ".dll" : ".exe")));
}

if (!string.IsNullOrWhiteSpace (ExtraArguments))
args.Add (ExtraArguments);
Expand All @@ -173,6 +176,9 @@ protected override string GenerateCommandLineCommands ()
foreach (var nr in NativeReferences)
args.AddQuoted ("/native-reference:" + Path.GetFullPath (nr));
}

if (IsAppExtension)
args.AddQuoted ("/extension");

args.Add ("/sdkroot");
args.AddQuoted (SdkRoot);
Expand All @@ -190,7 +196,7 @@ protected override string GenerateCommandLineCommands ()
public override bool Execute ()
{
Log.LogTaskName ("Mmp");
Log.LogTaskProperty ("ApplicationAssembly", ApplicationAssembly);
Log.LogTaskProperty ("ApplicationAssembly", ApplicationAssembly + (IsAppExtension ? ".dll" : ".exe"));
Log.LogTaskProperty ("ApplicationName", ApplicationName);
Log.LogTaskProperty ("Architecture", Architecture);
Log.LogTaskProperty ("Debug", Debug);
Expand All @@ -210,6 +216,7 @@ public override bool Execute ()
Log.LogTaskProperty ("AppManifest", AppManifest);
Log.LogTaskProperty ("SdkVersion", SdkVersion);
Log.LogTaskProperty ("NativeReferences", NativeReferences);
Log.LogTaskProperty ("IsAppExtension", IsAppExtension);

return base.Execute ();
}
Expand Down
36 changes: 36 additions & 0 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.AppExtension.CSharp.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!--
***********************************************************************************************
Xamarin.Mac.AppExtension.CSharp.targets

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.

This file imports the version- and platform-specific targets for the project importing
this file. This file also defines targets to produce an error if the specified targets
file does not exist, but the project is built anyway (command-line or IDE build).

Copyright (C) 2014 Xamarin. All rights reserved.
***********************************************************************************************
-->
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).Before.targets')"/>

<PropertyGroup>
<!-- Version/fx properties -->
<TargetFrameworkVersion Condition="'$(TargetFrameworkIdentifier)' == '' And '$(TargetFrameworkVersion)' ==''">v4.5</TargetFrameworkVersion>
<!-- work around a bug in the Mono Microsoft.CSharp.Targets that defaults the compiler to gmcs -->
<!-- this is fixed in mono/master (2014-03-05), but we'll keep this workaround here for a while -->
<CscToolPath Condition="'$(OS)' == 'Unix'">/Library/Frameworks/Mono.framework/Commands</CscToolPath>
<CscToolExe Condition="'$(OS)' == 'Unix'">mcs</CscToolExe>

<DefineConstants>__UNIFIED__;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="Xamarin.Mac.AppExtension.Common.targets" />

<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.targets"
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.targets')"/>
</Project>
30 changes: 30 additions & 0 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.AppExtension.Common.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--
***********************************************************************************************
Xamarin.Mac.AppExtension.Common.props

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.

This file defines default properties for OS X App Extension projects.

Copyright (C) 2013-2014 Xamarin. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

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

<!-- This is used to determine whether Xamarin.Mac.AppExtension.Common.targets needs to import
Xamarin.Mac.AppExtension.Common.props itself, or whether it has been imported previously,
e.g. by the project itself. -->
<PropertyGroup>
<_XamarinAppExtensionCommonPropsHasBeenImported>true</_XamarinAppExtensionCommonPropsHasBeenImported>
</PropertyGroup>

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

</Project>
67 changes: 67 additions & 0 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.AppExtension.Common.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<!--
***********************************************************************************************
Xamarin.Mac.AppExtension.Common.targets

WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.

This file imports the version- and platform-specific targets for the project importing
this file. This file also defines targets to produce an error if the specified targets
file does not exist, but the project is built anyway (command-line or IDE build).

Copyright (C) 2013-2014 Xamarin. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<IsAppExtension>True</IsAppExtension>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)Xamarin.Mac.Common.targets" />

<Import Project="$(MSBuildThisFileDirectory)Xamarin.Mac.AppExtension.Common.props"
Condition="'$(_XamarinAppExtensionCommonPropsHasBeenImported)' != 'true'" />

<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>
<EnableCodeSigning Condition="'$(EnableCodeSigning)' != 'true'">true</EnableCodeSigning>
<_CodeSigningKey Condition="'$(_CodeSigningKey)' == ''">-</_CodeSigningKey>
<CodeSignEntitlements Condition="'$(CodeSignEntitlements)' == ''">Entitlements.plist</CodeSignEntitlements>
</PropertyGroup>
</Target>

<Target Name="_GenerateBundleName" DependsOnTargets="_DetectSigningIdentity">
<PropertyGroup>
<AppBundleDir Condition="'$(AppBundleDir)' == ''">$(OutputPath)$(DeviceSpecificOutputPath)$(_AppBundleName).appex</AppBundleDir>
<_AppBundlePath>$(AppBundleDir)\</_AppBundlePath>

<_AppResourcesPath>$(_AppBundlePath)Contents\Resources\</_AppResourcesPath>

<!-- needed for GetTargetPath/Build/Rebuild task outputs -->
<_AppExtensionBundlePath>$(MSBuildProjectDirectory)\$(AppBundleDir)</_AppExtensionBundlePath>
</PropertyGroup>
<ItemGroup>
<_AppExtensionBundlePath Include="$(MSBuildProjectDirectory)\$(AppBundleDir)">
<!-- We need this metadata to fix the source in VS -->
<BuildSessionId>$(BuildSessionId)</BuildSessionId>
<BuildServerPath>..\..\$(BuildAppName)\$(BuildSessionId)\$(AppBundleDir)</BuildServerPath>
</_AppExtensionBundlePath>
</ItemGroup>
</Target>

<Target Name="CreateIpa"/>

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

</Project>
1 change: 1 addition & 0 deletions msbuild/Xamarin.Mac.Tasks/Xamarin.Mac.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Copyright (C) 2013-2014 Xamarin. All rights reserved.
<XamMacArch Condition="'$(XamMacArch)' == ''">x86_64</XamMacArch>
<MonoMacResourcePrefix Condition="'$(MonoMacResourcePrefix)' == ''">Resources</MonoMacResourcePrefix>
<XamMacResourcePrefix Condition="'$(XamMacResourcePrefix)' == ''">$(MonoMacResourcePrefix)</XamMacResourcePrefix>
<IsAppExtension Condition="'$(IsAppExtension)' == ''">False</IsAppExtension>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.props"
Expand Down
Loading