* [msbuild] Fixed PathUtils.AbsoluteToRelative() logic
Don't require the 'absolute' path argument to be a FullPath.
The code already calls Path.GetFullPath() on the 'absolute'
path anyway.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=53176
* Fixed ResolveSymbolicLinks() to return the input path if realpath() fails
Fixes bug #52758 (https://bugzilla.xamarin.com/show_bug.cgi?id=52758)
For appex the MainAssembly path should be absolute, since mtouch will generate a build-arguments.txt file that then will be used to build the extension in the same mtouch process than the container app. Due to this, if the path stored is relative mtouch won't be able to find the assembly.
Log this as an error even if the log file does not exist and/or
is parseable.
Previously, it was possible that if the log file didn't exist
or it was perfectly validly formatted, we would never log that
error code and so it's possible that we wouldn't log *any*
error at all (e.g. empty log file).
Fixes bug #52982: [iOS]Metal samples fail to build with Xcode8.3
(https://bugzilla.xamarin.com/show_bug.cgi?id=52982)
Basically with Xcode8 Apple stopped using an intermediary step to generate the
default.metallib. This was what our `_ForgeMetal` target was doing, generate a `default.metal-ar`
file which was used as input for `_TemperMetal` and then generate the default.metallib.
Instead with Xcode8 you can just give Shaders.air directly to the metallib tool.
The fix in this commit is made in such a way that it still supports Xcode7.
if !Xcode8 then don't change anything.
if Xcode8+ then have `_ForgedMetal` output equal `@(_SmeltedMetal)` (basically skip the _ForgeMetal target).
Xamarin.Mac binding projects would show this error:
> /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Mac/Xamarin.Mac.ObjcBinding.CSharp.targets: error : Unknown target framework identifier: Xamarin.Mac.
while at the same time not actually failing the build (so nothing broke,
making it harder to notice).
The error is printed in BTouchTaskBase, which was previously only used for
Xamarin.iOS. Now we're using it for both Xamarin.iOS and Xamarin.Mac (in which
case it's subclassed), so make sure to not validate the
TargetFrameworkIdentifier according to only valid TargetFrameworkIdentifiers
for Xamarin.iOS.
This is accomplished by adding a new virtual overload to validate (and get the
right /target-framework argument for the generator), and override that method
in Xamarin.Mac's BTouch subclass.
Some of the Clean steps need the _ComputeTargetArchitectures
target to run before they can properly do their thing because
they depend on DeviceSpecific paths.
Also added logic to rm -rf extension *.dSYM and framework *.dSYM
dirs in the container app bin dir (which fails on xbuild due to
a bug in xbuild... yay!)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=53007
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=52745
Added a new CodesignNativeLibraries task that scans for
and then codesigns each *.dylib and *.metallib in the
app bundle (minus those in the PlugIns and Watch dirs).
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=52860
When the ImageAssets contain an item that doesn't live within
a *.xcassets directory, index into ImageAssets[] rather than
items[] which hasn't been populated yet.
Also fixed the tagsList for-loop to use tagsList.Count instead
for correctness (even though tags.Count and tagsList.Count
should always be identical).
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=52851
The problem here is that the .DS_Store file was included in
the .csproj file but did not exist on disk, so when we went
to clone that file into the obj/ dir before running actool
on it, File.Copy() would fail because the file did not
actually exist.
Since these files are worthless anyway, we can safely ignore
them.
Also added logic to verify that files exist before copying
them in order to report a better error than an exception
stack trace.
- Update comments on XM45.targets file
- Remove unnecessary AssemblySearchPaths hack causing issues using nugets with same name as Facades
- Note: MSBuild with XM 4.5 is still broken for now
This cuts down another group of conditional compilation sections, paving the
way for an IKVM-based generator.
This makes it required to pass --target-framework for to generator executables
(previously only required for Xamarin.Mac/Unified to distinguish between the
different Xamarin.Mac/Unified variants), but it should be invisible to users
since we'll automatically pass the correct --target-framework argument from
the corresponding scripts (btouch/btv/bwatch/bmac) and the MSBuild targets.
This will only break somebody who is executing the managed executables
directly, but nobody should do that in the first place (it's not a supported
scenario).
Generated diff: https://gist.github.com/rolfbjarne/1674be6625632446dba774a305951981
Mono's fork of msbuild uses a `$(_DebugFileExt)` property to specify
the debug file extension (.pdb/.mdb) to use. It defaults to .pdb. So,
with XI/XM, .mdb files don't get copied to the output folder.
We also add a `$(FscDebugFileExt)` property, which allows our default of
`.mdb` to be overridden.
But the `$(_DebugFileExt)` support is not in upstream msbuild yet. So,
we can't ask the F# upstream to add it. Hence, this is being added to
our FSharp target files. Once, all this is upstream, we can remove the
overrides from our files.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=51148
If the user makes changes to an App Extension or Watch app,
then those bundles would change within the main app bundle
but the main app bundle would not get re-codesigned because
it was not properly considering those files as inputs in the
_CodesignAppBundle target.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=52165
Originally, the IpaPackagePath would default to something
like:
bin/Debug/iPhone/MyProjectName $(DateTime)/MyProjectName.ipa
It was recently changed to not have the timestamp, but I
seem to have forgotten to do away with the subdirectory
completely. In other words, w/o this fix, we'd get:
bin/Debug/iPhone/MyProjectName/MyProjectName.ipa
When what we *really* want is:
bin/Debug/iPhone/MyProjectName.ipa
Several dependency targets were not being properly run because the Condition
expressions on e.g. the _CodesignAppExtensions target depended on variables
that were empty until the dependencies set them. But dependencies are only
executed if the parent target's Conditions were met.
Also changed the _CodesignVerify target to use the _ResolvedAppExtensions
variable instead of the _AppExtensionCodesignProperties variable. This means
that the _CodesignVerify target no longer depends on the
_ReadCodesignAppExtensionProperties target being executed and thus makes it
less likely that bugs like that will slip by in the future.
[msbuild] Refactor the IBTool task to be cleaner and more efficient
Besides making the IBTool task cleaner and easier to understand,
a side-effect of this refactor was also to optimize the collecting
of the compiled outputs because we now only need to scan the
obj/ibtool directory once to collect each of the outputs.
Target _UnpackLibraryResources:
Task "UnpackLibraryResources"
Using task UnpackLibraryResources from Xamarin.MacDev.Tasks.UnpackLibraryResources, Xamarin.MacDev.Tasks, Version=1.0.6128.15885, Culture=neutral, PublicKeyToken=null
UnpackLibraryResources Task
Prefix: monotouch
IntermediateOutputPath: obj/iPhone/Debug/
NoOverwrite:
obj/iPhone/Debug/ibtool-link/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib
obj/iPhone/Debug/ibtool-link/LaunchScreen.storyboardc/Info.plist
obj/iPhone/Debug/ibtool-link/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib
obj/iPhone/Debug/ibtool-link/Main.storyboardc/BYZ-38-t0r-view-8bC-Xf-vdC.nib
obj/iPhone/Debug/ibtool-link/Main.storyboardc/Info.plist
obj/iPhone/Debug/ibtool-link/Main.storyboardc/UIViewController-BYZ-38-t0r.nib
ReferencedLibraries:
/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.dll
/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Xml.dll
/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Core.dll
/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Xamarin.iOS.dll
/Users/poupou/Downloads/LinkingTest-2/RMSDKWrapper/bin/Debug//RMSDKWrapper.dll
/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS//mscorlib.dll
/Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS//mscorlib.dll
Skipping framework assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.dll
Skipping framework assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Xml.dll
Skipping framework assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/System.Core.dll
Skipping framework assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/Xamarin.iOS.dll
Inspecting assembly: /Users/poupou/Downloads/LinkingTest-2/RMSDKWrapper/bin/Debug//RMSDKWrapper.dll
Inspecting assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS//mscorlib.dll
Inspecting assembly: /Users/poupou/git/xamarin/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS//mscorlib.dll
Done executing task "UnpackLibraryResources"
Done building target "_UnpackLibraryResources" in project "/Users/poupou/Downloads/LinkingTest-2/LinkingTest/LinkingTest.csproj".
The above log excerpt shows two issues:
1. mscorlib.dll is needlessly inspected as it's **not** considered a
"framework" assembly.
The current check was checking *how* it was resolved and not *where*
it was resolved to. The later is the most important as it's possible
for other assemblies to have direct paths references and we do not
want to process them.
This is fixed by comparing each assembly path with the (now) provided
`TargetFrameworkDirectory`
2. mscorlib.dll is inspected twice
That's because it's present two times in the task's input. That issue
is upstream (not sure why) of the current task but it makes #1 twice
as costly. The fix for #1 indirectly fix that too.
Future
------
It's worth investigating to move that logic into `mtouch`. The later must
already load all assemblies and is in charge of removing other embedded
data (e.g. native code from bindings) from the assemblies (so they are not
shipped both inside and outside the .dll in the final .app). This makes
this task seems extraneous work.
Considering that my current test case, `RMSDKWrapper.dll`, is 1.3GB in
size it's easy to see that the extra load (which has nothing to be
extracted wrt resources*) is quite visible in build time.
> 3268.201 ms UnpackLibraryResources 1 calls
* it has for bindings but that's already handled by mtouch
The `strip` command was already doing this, but `ar` and `dsymutil`
were using /usr/bin versions (which might not exist, depending on
the Xcode installation).
* [msbuild] Don't use a timestamped directory for the IPA
After discussion with Mikayla Hutchinson and Madhuri Gummalla,
this naming convention is annoying to customers so just put
the *.ipa in the bin directory. This also has the added
benefit that the *.ipa will be cleaned up with /t:Clean
* [msbuild] Fixed wildcard expansion for deleting the *.ipa file
* [msbuild] Add the zipped *.ipa file to the FileWrites item group
* [msbuild] s/TaskProperty/TaskParameter/
* [msbuild] Make sure to use the *actual* filename generated by ibtool
The problem is that since the Mac file system is case-insensitive,
File.Exists() will match "file~ipad.nib" even if the actual name
is "file~iPad.nib", so the only way to get the *actual* file name
is to scan the directory and do manual matching.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=44811
* Check that the dir exists before allocating other local variables
* [msbuild] Fixed the Inputs for the _CodesignAppBundle target
The Inputs need to include the Info.plist, embedded.mobileprovision,
and the native libs/frameworks since those files also get included
in the _CodeSignature/CodeResources.
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=50791
* [msbuild] Added unit test to make sure _CodesignAppBundle logic works
Once @rolfkvinge finishes implementing support in mtouch
for code-sharing between main app and app extensions, the
mtouch command will need to run *after* the app extensions
have been copied into the app bundle.
This is a fixup to the PR in issue #1350.
We really only want to delay codesigning of the App Extension
*bundle*, but want to codesign any native libs and frameworks
as usual.
* [msbuild] Delay running dsymutil and strip on App Extensions
We want to run dsymutil and strip on App Extensions
from the main app bundle targets so that mtouch can
generate a shared Mono.framework in the main app bundle.
* [msbuild] Updated Archive to copy appex dsyms from the correct location
* [msbuild] Delay codesigning of App Extensions
Instead of codesigning App Extensions as part of the
App Extension build, we now codesign them as part of
the Codesign target of the main app project.
* [msbuild] Use an ItemGroup to define _AppExtensionCodesignProperties
By using an ItemGroup, we save all of the metadata
even if the values are null/empty. Using CreateItem,
any metadata property with a null or empty value
was not being saved in the .items file.
* [msbuild] Take advantage of %(_AppExtensionCodesignProperties.Identity)
...instead of having to use
%(_AppExtensionCodesignProperties.Filename)%(_AppExtensionCodesignProperties.Extension)
* [msbuild] Don't rewrite embedded.mobileprovision or archived-expanded-entitlements.xcent
This patch prevents those 2 files from being rewritten in
cases where the contents would not change from what was
already there previously.
This is a partial fix for https://bugzilla.xamarin.com/show_bug.cgi?id=49097
* [msbuild] Re-enabled the RebuildExecutable_NoModifications unit test
With the fixes to EmbedProvisioningProfile and CompileEntitlements,
this unit test now passes.
Fixes the Mac EmbedProvisionProfile task to not load every
single provisioning profile from disk in order to find the
requested provisioning profile.
Drops the need for wrappers around the use of MobileProvisionIndex
since it turns out that MobileProvisionIndex.GetMobileProvision()
already does the File.Exists() on name + ".mobileprovision" to
avoid needing to scan the index of provisioning profiles.
Fixed the EmbedMobileProvision task to use the same strategy for looking up provisioning profiles as the DetectSigningIdentity task.
This can be considered a follow-up patch to https://bugzilla.xamarin.com/show_bug.cgi?id=25499 and commit 146e7b3962 in that it is needed if/when the .csproj file references the provisioning profile based on the Name instead of the UUID, but also stands on its own as a performance optimization (MobileProvisionIndex lookups are significantly faster than loading each and every provisioning profile and then using LINQ to match against the UUID).