-
Notifications
You must be signed in to change notification settings - Fork 511
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
Xamarin.Mac Extension Support #44
Changes from 1 commit
f2e5611
ff88fb4
5cc36be
8d96e0b
82ff4f4
63759fc
afd6526
cdd6cff
af9747e
48e9447
41c87c2
305cf1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; } | ||
|
@@ -163,8 +165,10 @@ protected override string GenerateCommandLineCommands () | |
args.AddQuoted ("/assembly:" + Path.GetFullPath (asm)); | ||
} | ||
|
||
if (!string.IsNullOrEmpty (ApplicationAssembly)) | ||
args.AddQuoted (Path.GetFullPath (ApplicationAssembly)); | ||
if (!string.IsNullOrEmpty(ApplicationAssembly)) | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code style. You forgot the space between IsNullOrEmpty and the ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The opening brace also goes on the same line as the if. |
||
args.AddQuoted(Path.GetFullPath(ApplicationAssembly + (IsAppExtension ? ".dll" : ".exe"))); | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same, style issue. |
||
if (!string.IsNullOrWhiteSpace (ExtraArguments)) | ||
args.Add (ExtraArguments); | ||
|
@@ -173,6 +177,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); | ||
|
@@ -190,7 +197,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); | ||
|
@@ -210,6 +217,7 @@ public override bool Execute () | |
Log.LogTaskProperty ("AppManifest", AppManifest); | ||
Log.LogTaskProperty ("SdkVersion", SdkVersion); | ||
Log.LogTaskProperty ("NativeReferences", NativeReferences); | ||
Log.LogTaskProperty ("IsAppExtension", IsAppExtension); | ||
|
||
return base.Execute (); | ||
} | ||
|
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> | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small question, is this going to be used by VS? I'm wondering about when these two conditions are not met. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently there's no support to build mac projects in VS, only in XS on a mac |
||
<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> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!-- | ||
*********************************************************************************************** | ||
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> | ||
<IsAppExtension>True</IsAppExtension> | ||
<IsAppExtension Condition="'$(IsAppExtension)' == ''">True</IsAppExtension> | ||
</PropertyGroup> | ||
|
||
<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.props" | ||
Condition="Exists('$(MSBuildThisFileDirectory)$(MSBuildThisFileName).After.props')"/> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<!-- | ||
*********************************************************************************************** | ||
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="_GenerateBundleName;$(BuildDependsOn)" Outputs="$(_AppExtensionBundlePath)" /> | ||
<Target Name="Rebuild" Condition="'$(_InvalidConfigurationWarning)' != 'true'" DependsOnTargets="_GenerateBundleName;$(RebuildDependsOn)" Outputs="$(_AppExtensionBundlePath)" /> | ||
|
||
<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> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if an assembly has more than one dot?
I ran into something similar for iOS, and added the same check, but it turned out lots of people have assemblies with more than one dot, so it became problematic. After some investigation it turned out that the problem wasn't more than one dot, but executables that ended with
.app
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this was part of the code I copied over from iOS (when I first looked at extensions last may). I'll update it to check for the .app instead like iOS is doing now