Skip to content

Commit

Permalink
[mono-runtimes] Build required mono runtimes.
Browse files Browse the repository at this point in the history
Add a new build-tools/mono-runtimes project to build the required Mono
runtimes for Xamarin.Android app execution on Android devices.

Xamarin.Android 6.0 ("cycle 6") includes Mono runtimes compiled for
five architectures:

  * armeabi (armv5)
  * armeabi-v7a (armv7)
  * arm64-v8a (aarch64)
  * x86
  * x86_64

An additional "host" architecture is also built to build the
"monodroid" profile assemblies such as mscorlib.dll.

In the interest of expediency and not requiring that *six* different
runtimes be built -- which can greatly increase build times and
storage requirements -- the initial xamarin-android open-source build
will only build the armeabi-v7a (armv7) and "host" architectures.

Additionally, the <UnzipDirectoryChildren/> task needed to be altered
to use unzip(1) on OS X instead of using
System.IO.Compression.ZipFile, because the ZipFile implementation
included with Mono 4.4 doesn't respect file attributes such as the +x,
causing all files to be extracted as 644 (rw-r--r--), resulting
in an NDK toolchain which wouldn't work. To resolve this issue,
execution on OS X and Linux now uses unzip(1).

~~ Adding new architectures ~~

To build Mono for a new architecture, edit
build-tools/mono-runtimes/mono-runtimes.projitems and add a new
@(_MonoRuntime) entry for the desired architecture.

TODO: Figure out if there's a reasonable way to "opt-in" or "opt-out"
of CPU architectures so that it isn't an "all or nothing" prospect.
  • Loading branch information
jonpryor committed Apr 20, 2016
1 parent 6fd330d commit 38dbfca
Show file tree
Hide file tree
Showing 11 changed files with 258 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/mono"]
path = external/mono
url = [email protected]:mono/mono.git
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ MSBUILD = xbuild /p:Configuration=$(CONFIGURATION)
all:
$(MSBUILD)

prepare:
nuget restore
git submodule update --init --recursive

clean:
$(MSBUILD) /t:Clean
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,36 @@ URL to download files from is controlled by the `$(AndroidUri)` property.
At this point in time, building Xamarin.Android is only supported on OS X.
We will work to improve this.

To build Xamarin.Android, load `Xamarin.Android.sln` into Xamarin Studio 6
and Build the project.
To build Xamarin.Android, first prepare the project:

make prepare

This will perform `git submodule update`, and any other pre-build tasks
that need to be performed.

Then, you may do one of the following:

1. Run make:

make

2. Load `Xamarin.Android.sln` into Xamarin Studio and Build the project.

# Build Output Directory Structure

There are two configurations, `Debug` and `Release`, controlled by the
`$(Configuration)` MSBuild property.

The `bin\Build$(Configuration)` directory, e.g. `bin\BuildDebug`, contains
artifacts needed for *building* the repository. They should not be needed
for later execution.

The `bin\$(Configuration)` directory, e.g. `bin\Debug`, contains
*redistributable* artifacts, such as tooling and runtimes. This directory
acts as a *local installation prefix*, in which the directory structure
mirrors that of the OS X Xamarin.Android.framework directory structure:

* `bin\$(Configuration)\lib\xbuild\Xamarin\Android`: MSBuild-related support
files and required runtimes used by the MSBuild tooling.
* `bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid`: Xamarin.Android
profile assemblies and facade assemblies.
7 changes: 7 additions & 0 deletions Xamarin.Android.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "android-toolchain", "build-
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Android.Tools.BootstrapTasks", "src\Xamarin.Android.Tools.BootstrapTasks\Xamarin.Android.Tools.BootstrapTasks.csproj", "{E8492EFB-D14A-4F32-AA28-88848322ECEA}"
EndProject
Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "mono-runtimes", "build-tools\mono-runtimes\mono-runtimes.mdproj", "{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|AnyCPU = Debug|AnyCPU
Expand All @@ -21,10 +23,15 @@ Global
{E8492EFB-D14A-4F32-AA28-88848322ECEA}.Release|AnyCPU.Build.0 = Release|AnyCPU
{E8492EFB-D14A-4F32-AA28-88848322ECEA}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{E8492EFB-D14A-4F32-AA28-88848322ECEA}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}.Debug|AnyCPU.ActiveCfg = Debug|Any CPU
{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}.Debug|AnyCPU.Build.0 = Debug|Any CPU
{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}.Release|AnyCPU.ActiveCfg = Release|Any CPU
{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}.Release|AnyCPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{8FF78EB6-6FC8-46A7-8A15-EBBA9045C5FA} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
{E8492EFB-D14A-4F32-AA28-88848322ECEA} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2} = {E351F97D-EA4F-4E7F-AAA0-8EBB1F2A4A62}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
Expand Down
2 changes: 2 additions & 0 deletions build-tools/android-toolchain/android-toolchain.targets
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@
<MakeDir Directories="$(AndroidToolchainDirectory)\sdk;$(AndroidToolchainDirectory)\ndk" />

<UnzipDirectoryChildren
HostOS="$(HostOS)"
SourceFiles="@(AndroidSdkItem->'$(AndroidToolchainCacheDirectory)\%(Identity)')"
DestinationFolder="$(AndroidToolchainDirectory)\sdk"
/>
<UnzipDirectoryChildren
HostOS="$(HostOS)"
SourceFiles="@(AndroidNdkItem->'$(AndroidToolchainCacheDirectory)\%(Identity)')"
DestinationFolder="$(AndroidToolchainDirectory)\ndk"
/>
Expand Down
34 changes: 34 additions & 0 deletions build-tools/mono-runtimes/mono-runtimes.mdproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ItemType>GenericProject</ItemType>
<ProjectGuid>{C03E6CF1-7460-4CDC-A4AB-292BBC0F61F2}</ProjectGuid>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\..\bin\Debug</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\..\bin\Release</OutputPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<BuildDependsOn>
ResolveReferences;
_Autogen;
_ConfigureRuntimes;
_BuildRuntimes;
_InstallRuntimes;
_InstallBcl;
</BuildDependsOn>
</PropertyGroup>
<Import Project="mono-runtimes.targets" />
<ItemGroup>
<ProjectReference Include="..\android-toolchain\android-toolchain.mdproj">
<Project>{8FF78EB6-6FC8-46A7-8A15-EBBA9045C5FA}</Project>
<Name>android-toolchain</Name>
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
</Project>
40 changes: 40 additions & 0 deletions build-tools/mono-runtimes/mono-runtimes.projitems
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<_MonoRuntime Include="armeabi-v7a">
<Ar>$(_ArmAr)</Ar>
<As>$(_ArmAs)</As>
<Cc>$(_ArmCc)</Cc>
<Cpp>$(_ArmCpp) $(_ArmCppFlags)</Cpp>
<CFlags>$(_ArmCFlags) -mtune=cortex-a8 -march=armv7-a -mfpu=vfp -mfloat-abi=softfp $(_TargetCFlags)</CFlags>
<Cxx>$(_ArmCxx)</Cxx>
<CxxFlags>$(_ArmCxxFlags) -mtune=cortex-a8 -march=armv7-a -mfpu=vfp -mfloat-abi=softfp $(_TargetCxxFlags) </CxxFlags>
<CxxCpp>$(_ArmCxxCpp) $(_ArmCppFlags)</CxxCpp>
<Ld>$(_ArmLd)</Ld>
<LdFlags>$(_ArmLdFlags)</LdFlags>
<RanLib>$(_ArmRanLib)</RanLib>
<Strip>$(_ArmStrip)</Strip>
<ConfigureFlags>--host=armv5-linux-androideabi $(_TargetConfigureFlags)</ConfigureFlags>
<OutputRuntime>libmonosgen-2.0.so</OutputRuntime>
<OutputProfiler>libmono-profiler-log.so</OutputProfiler>
<OutputMonoPosixHelper>libMonoPosixHelper.so</OutputMonoPosixHelper>
</_MonoRuntime>
<_MonoRuntime Include="host">
<Ar>ar</Ar>
<As>as</As>
<Cc>clang</Cc>
<CFlags>$(_CommonCFlags) -mmacosx-version-min=10.9</CFlags>
<Cxx>clang++</Cxx>
<CxxCpp>cpp</CxxCpp>
<CxxFlags></CxxFlags>
<Ld>ld</Ld>
<LdFlags></LdFlags>
<RanLib>ranlib</RanLib>
<Strip>strip -S</Strip>
<ConfigureFlags>--enable-maintainer-mode --without-ikvm-native --with-monodroid --with-mcs-docs=no --disable-mono-debugger --with-profile2=no --with-profile4=no --with-profile4_5=yes --disable-boehm --enable-nls=no --disable-iconv</ConfigureFlags>
<OutputRuntime>libmonosgen-2.0.dylib</OutputRuntime>
<OutputProfiler>libmono-profiler-log.dylib</OutputProfiler>
<OutputMonoPosixHelper>libMonoPosixHelper.dylib</OutputMonoPosixHelper>
</_MonoRuntime>
</ItemGroup>
</Project>
27 changes: 27 additions & 0 deletions build-tools/mono-runtimes/mono-runtimes.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_CommonCFlags Condition=" '$(Configuration)' == 'Debug' ">-ggdb3 -O0 -fno-omit-frame-pointer</_CommonCFlags>
<_CommonCFlags Condition=" '$(Configuration)' == 'Release' ">-g -O2</_CommonCFlags>
<_CommonConfigureFlags>--without-ikvm-native --enable-maintainer-mode --with-profile2=no --with-profile4=no --with-profile4_5=no --with-monodroid --enable-nls=no --with-sigaltstack=yes --with-tls=pthread mono_cv_uscore=yes</_CommonConfigureFlags>
<_TargetConfigureFlags>$(_CommonConfigureFlags) --enable-minimal=ssa,portability,attach,verifier,full_messages,sgen_remset,sgen_marksweep_par,sgen_marksweep_fixed,sgen_marksweep_fixed_par,sgen_copying,logging,security,shared_handles --disable-mcs-build --disable-executables</_TargetConfigureFlags>
<_SecurityCFlags>-Wl,-z,now -Wl,-z,relro -Wl,-z,noexecstack -fstack-protector</_SecurityCFlags>
<_TargetCFlags>$(_SecurityCFlags) -DMONODROID=1</_TargetCFlags>
<_TargetCxxFlags>$(_SecurityCFlags) -DMONODROID=1</_TargetCxxFlags>
<_TargetLdFlags>-ldl -lm -llog -lc -lgcc</_TargetLdFlags>
<_ArmNdkPlatformPath>$(AndroidToolchainDirectory)\ndk\platforms\android-4</_ArmNdkPlatformPath>
<_ArmAr>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-ar</_ArmAr>
<_ArmAs>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-as</_ArmAs>
<_ArmCc>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-clang</_ArmCc>
<_ArmCFlags>$(_CommonCFlags) -D__POSIX_VISIBLE=201002 -DSK_RELEASE -DNDEBUG -UDEBUG -fpic</_ArmCFlags>
<_ArmCpp>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-cpp</_ArmCpp>
<_ArmCppFlags>-I$(_ArmNdkPlatformPath)\arch-arm\usr\include\</_ArmCppFlags>
<_ArmCxx>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-clang++</_ArmCxx>
<_ArmCxxFlags>-I$(_ArmNdkPlatformPath)\arch-arm\usr\include\</_ArmCxxFlags>
<_ArmCxxCpp>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-cpp</_ArmCxxCpp>
<_ArmLd>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-ld</_ArmLd>
<_ArmLdFlags>$(_TargetLdFlags) -Wl,--fix-cortex-a8 -Wl,-rpath-link=$(_ArmNdkPlatformPath)\arch-arm\usr\lib,-dynamic-linker=/system/bin/linker -L$(_ArmNdkPlatformPath)\arch-arm\usr\lib</_ArmLdFlags>
<_ArmRanLib>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-ranlib</_ArmRanLib>
<_ArmStrip>$(AndroidToolchainDirectory)\toolchains\arm-linux-androideabi-clang\bin\arm-linux-androideabi-strip</_ArmStrip>
</PropertyGroup>
</Project>
92 changes: 92 additions & 0 deletions build-tools/mono-runtimes/mono-runtimes.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\Configuration.props" />
<Import Project="mono-runtimes.props" />
<Import Project="mono-runtimes.projitems" />
<PropertyGroup>
<_MonoPath>..\..\external\mono</_MonoPath>
</PropertyGroup>
<Target Name="_Autogen"
Inputs="$(_MonoPath)\autogen.sh"
Outputs="$(_MonoPath)\configure">
<Exec
Command="NOCONFIGURE=1 ./autogen.sh"
WorkingDirectory="$(_MonoPath)"
/>
</Target>
<Target Name="_ConfigureRuntimes"
Inputs="$(_MonoPath)\configure"
Outputs="@(_MonoRuntime->'obj\%(Identity)\.stamp')">
<MakeDir Directories="@(_MonoRuntime->'obj\%(Identity)')" />
<Exec
Command="..\..\$(_MonoPath)\configure LDFLAGS=&quot;%(_MonoRuntime.LdFlags)&quot; CFLAGS=&quot;%(_MonoRuntime.CFlags)&quot; CXXFLAGS=&quot;%(_MonoRuntime.CxxFlags)&quot; CC=&quot;%(_MonoRuntime.Cc)&quot; CXX=&quot;%(_MonoRuntime.Cxx)&quot; CPP=&quot;%(_MonoRuntime.Cpp)&quot; CXXCPP=&quot;%(_MonoRuntime.CxxCpp)&quot; LD=&quot;%(_MonoRuntime.Ld)&quot; AR=&quot;%(_MonoRuntime.Ar)&quot; AS=&quot;%(_MonoRuntime.As)&quot; RANLIB=&quot;%(_MonoRuntime.RanLib)&quot; STRIP=&quot;%(_MonoRuntime.Strip)&quot; --cache-file=..\%(_MonoRuntime.Identity).config.cache %(_MonoRuntime.ConfigureFlags)"
WorkingDirectory="@(_MonoRuntime->'obj\%(Identity)')"
/>
<Touch
Files="@(_MonoRuntime->'obj\%(Identity)\.stamp')"
AlwaysCreate="True"
/>
</Target>
<Target Name="_BuildRuntimes"
Inputs="@(_MonoRuntime->'obj\%(Identity)\.stamp')"
Outputs="@(_MonoRuntime->'obj\%(Identity)\mono\mini\.libs\%(OutputRuntime)');@(_MonoRuntime->'obj\%(Identity)\mono\profiler\.libs\%(OutputProfiler)');@(_MonoRuntime->'obj\%(Identity)\support\.libs\%(OutputMonoPosixHelper)')">
<Exec
Command="make $(MAKEFLAGS) # %(_MonoRuntime.Identity)"
WorkingDirectory="@(_MonoRuntime->'obj\%(Identity)')"
/>
</Target>
<Target Name="_InstallRuntimes"
Inputs="@(_MonoRuntime->'obj\%(Identity)\mono\mini\.libs\%(OutputRuntime)');@(_MonoRuntime->'obj\%(Identity)\mono\profiler\.libs\%(OutputProfiler)');@(_MonoRuntime->'obj\%(Identity)\support\.libs\%(OutputMonoPosixHelper)')"
Outputs="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)');@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputProfiler)');@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputMonoPosixHelper)')">
<MakeDir Directories="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)')" />
<Copy
SourceFiles="@(_MonoRuntime->'obj\%(Identity)\mono\mini\.libs\%(OutputRuntime)')"
DestinationFiles="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)')"
/>
<Touch
Files="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)')"
/>
<Copy
SourceFiles="@(_MonoRuntime->'obj\%(Identity)\mono\mini\.libs\%(OutputRuntime)')"
DestinationFiles="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)-unstripped')"
/>
<Exec
Command="%(_MonoRuntime.Strip) &quot;@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputRuntime)')&quot;"
/>
<Copy
SourceFiles="@(_MonoRuntime->'obj\%(Identity)\mono\profiler\.libs\%(OutputProfiler)')"
DestinationFiles="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputProfiler)')"
/>
<Touch
Files="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputProfiler)')"
/>
<Copy
SourceFiles="@(_MonoRuntime->'obj\%(Identity)\support\.libs\%(OutputMonoPosixHelper)')"
DestinationFiles="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputMonoPosixHelper)')"
/>
<Touch
Files="@(_MonoRuntime->'$(OutputPath)\lib\xbuild\Xamarin\Android\lib\%(Identity)\%(OutputMonoPosixHelper)')"
/>
</Target>
<Target Name="_InstallBcl"
Inputs="$(_MonoPath)\mcs\class\lib\monodroid\mscorlib.dll"
Outputs="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0\mscorlib.dll">
<MakeDir Directories="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0" />
<MakeDir Directories="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0\Facades" />
<ItemGroup>
<_Assemblies Include="$(_MonoPath)\mcs\class\lib\monodroid\*.dll" />
<_Facades Include="$(_MonoPath)\mcs\class\lib\monodroid\Facades\*.dll" />
</ItemGroup>
<Copy
SourceFiles="@(_Assemblies)"
DestinationFolder="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0"
/>
<Copy
SourceFiles="@(_Facades)"
DestinationFolder="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0\Facades"
/>
<Touch
Files="$(OutputPath)\lib\xbuild-frameworks\MonoAndroid\v1.0\mscorlib.dll"
/>
</Target>
</Project>
1 change: 1 addition & 0 deletions external/mono
Submodule mono added at 7b4a58
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Text;
Expand All @@ -23,6 +24,8 @@ public UnzipDirectoryChildren ()

public string EntryNameEncoding { get; set; }

public string HostOS { get; set; }

[Required]
public ITaskItem DestinationFolder { get; set; }

Expand Down Expand Up @@ -64,7 +67,6 @@ public override bool Execute ()
var enc = encoding;
var destFolder = DestinationFolder.ItemSpec;
tasks [i] = TTask.Run (() => ExtractFile (td, sourceFile, relativeDestDir, destFolder, enc));
tasks [i].Wait ();
}

TTask.WaitAll (tasks);
Expand All @@ -86,7 +88,18 @@ async TTask ExtractFile (string tempDir, string sourceFile, string relativeDestD

relativeDestDir = relativeDestDir?.Replace ('\\', Path.DirectorySeparatorChar);

ZipFile.ExtractToDirectory (sourceFile, nestedTemp, encoding);
if (string.Equals (HostOS, "Windows", StringComparison.OrdinalIgnoreCase)) {
ZipFile.ExtractToDirectory (sourceFile, nestedTemp, encoding);
}
else {
var start = new ProcessStartInfo ("unzip", $"\"{sourceFile}\" -d \"{nestedTemp}\"") {
CreateNoWindow = true,
UseShellExecute = false,
};
Log.LogMessage (MessageImportance.Low, $"unzip \"{sourceFile}\" -d \"{nestedTemp}\"");
var p = Process.Start (start);
p.WaitForExit ();
}

foreach (var dir in Directory.EnumerateDirectories (nestedTemp, "*")) {
foreach (var fse in Directory.EnumerateFileSystemEntries (dir)) {
Expand Down

0 comments on commit 38dbfca

Please sign in to comment.