* Add non-global symbol stripping in AppleAppBuilder task.
* Strip symbols when measuring SOD via build-appbundle make target
TARGET?=iossimulator
DEPLOY_AND_RUN?=true
APP_SANDBOX?=false
+STRIP_DEBUG_SYMBOLS?=false # only used when measuring SOD via build-appbundle make target
#If DIAGNOSTIC_PORTS is enabled, RUNTIME_COMPONENTS must also be enabled.
#If RUNTIME_COMPONENTS is enabled, DIAGNOSTIC_PORTS is optional.
build-appbundle: clean appbuilder
$(DOTNET) publish -c $(MONO_CONFIG) /p:TargetOS=$(TARGET) /p:TargetArchitecture=$(MONO_ARCH) \
'/p:DeployAndRun="$(DEPLOY_AND_RUN)"' \
+ /p:StripDebugSymbols=$(STRIP_DEBUG_SYMBOLS) \
/p:UseLLVM=$(USE_LLVM) /p:ForceAOT=$(AOT) /bl \
run-catalyst:
<RuntimeIdentifier>$(TargetOS)-$(TargetArchitecture)</RuntimeIdentifier>
<DefineConstants Condition="'$(ArchiveTests)' == 'true'">$(DefineConstants);CI_TEST</DefineConstants>
<AppName>HelloiOS</AppName>
+ <StripDebugSymbols Condition="'$(StripDebugSymbols)' == ''">false</StripDebugSymbols>
</PropertyGroup>
<PropertyGroup>
RuntimeComponents="$(RuntimeComponents)"
EnableAppSandbox="$(EnableAppSandbox)"
DiagnosticPorts="$(DiagnosticPorts)"
+ StripSymbolTable="$(StripDebugSymbols)"
AppDir="$(MSBuildThisFileDirectory)$(PublishDir)">
<Output TaskParameter="AppBundlePath" PropertyName="AppBundlePath" />
<Output TaskParameter="XcodeProjectPath" PropertyName="XcodeProjectPath" />
/// </summary>
public bool EnableAppSandbox { get; set; }
+ /// Strip local symbols and debug information, and extract it in XcodeProjectPath directory
+ /// </summary>
+ public bool StripSymbolTable { get; set; }
+
public override bool Execute()
{
bool isDevice = (TargetOS == TargetNames.iOS || TargetOS == TargetNames.tvOS);
}
else
{
- AppBundlePath = generator.BuildAppBundle(XcodeProjectPath, Optimized, DevTeamProvisioning);
+ AppBundlePath = generator.BuildAppBundle(XcodeProjectPath, Optimized, StripSymbolTable, DevTeamProvisioning);
}
}
}
/// </summary>
public string? DestinationFolder { get; set; }
+ /// Strip local symbols and debug information, and extract it in XcodeProjectPath directory
+ /// </summary>
+ public bool StripSymbolTable { get; set; }
+
public override bool Execute()
{
- new Xcode(Log, TargetOS, Arch).BuildAppBundle(XcodeProjectPath, Optimized, DevTeamProvisioning, DestinationFolder);
+ new Xcode(Log, TargetOS, Arch).BuildAppBundle(XcodeProjectPath, Optimized, StripSymbolTable, DevTeamProvisioning, DestinationFolder);
return true;
}
}
public string BuildAppBundle(
- string xcodePrjPath, bool optimized, string? devTeamProvisioning = null, string? destination = null)
+ string xcodePrjPath, bool optimized, bool stripSymbolTable, string? devTeamProvisioning = null, string? destination = null)
{
string sdk = "";
var args = new StringBuilder();
appPath = newAppPath;
}
+ if (stripSymbolTable)
+ {
+ string filename = Path.GetFileNameWithoutExtension(appPath);
+ Utils.RunProcess(Logger, "dsymutil", $"{appPath}/{filename} -o {Path.GetDirectoryName(xcodePrjPath)}/{filename}.dSYM", workingDir: Path.GetDirectoryName(appPath));
+ Utils.RunProcess(Logger, "strip", $"-no_code_signature_warning -x {appPath}/{filename}", workingDir: Path.GetDirectoryName(appPath));
+ }
+
long appSize = new DirectoryInfo(appPath)
.EnumerateFiles("*", SearchOption.AllDirectories)
.Sum(file => file.Length);