Skip to content

Commit

Permalink
Revert "[build] Download correct mono archive URL (#2366)"
Browse files Browse the repository at this point in the history
This reverts commit c2f6f46.
  • Loading branch information
luhenry committed Nov 5, 2018
1 parent 13b093c commit 3a4720e
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 155 deletions.
6 changes: 6 additions & 0 deletions src/mono-runtimes/ProfileAssemblies.projitems
Original file line number Diff line number Diff line change
Expand Up @@ -263,5 +263,11 @@
<MonoTestAssembly Include="monodroid_System.Xml.Linq_test.dll">
<SourcePath>System.Xml.Linq</SourcePath>
</MonoTestAssembly>
<MonoTestAssembly Include="System.Runtime.CompilerServices.Unsafe.dll">
<!-- This is referenced by monodroid_corlib_xunit-test.dll -->
<SourcePath>System.Runtime.CompilerServices.Unsafe</SourcePath>
<TestType>reference</TestType>
</MonoTestAssembly>
<MonoTestRunner Include="nunitlite.dll" />
</ItemGroup>
</Project>
87 changes: 55 additions & 32 deletions src/mono-runtimes/mono-runtimes.targets
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<MonoDocCopyItem Include="monodoc.dll.config" />
</ItemGroup>
<UsingTask AssemblyFile="$(_SourceTopDir)\bin\Build$(Configuration)\Xamarin.Android.Tools.BootstrapTasks.dll" TaskName="Xamarin.Android.Tools.BootstrapTasks.GetNugetPackageBasePath" />
<UsingTask AssemblyFile="$(_SourceTopDir)\bin\Build$(Configuration)\Xamarin.Android.Tools.BootstrapTasks.dll" TaskName="Xamarin.Android.Tools.BootstrapTasks.UnzipDirectoryChildren" />
<ItemGroup>
<_MonoDocCopyItems Include="@(MonoDocCopyItem->'$(_MonoProfileToolsDir)\%(Identity)')" />
</ItemGroup>
Expand Down Expand Up @@ -67,8 +66,16 @@
<_BclAssembly Include="@(MonoProfileAssembly)" />
<_BclExcludeDebugSymbols Include="System.Windows.dll" />
<_BclExcludeDebugSymbols Include="System.Xml.Serialization.dll" />
<_BclTestAssemblyDestination Include="@(MonoTestAssembly->'$(XAInstallPrefix)\..\..\bcl-tests\%(Identity)')" />
<_BclTestAssemblyDestination
Include="@(MonoTestAssembly->'$(XAInstallPrefix)\..\..\bcl-tests\%(Filename).pdb')"
Exclude="$(XAInstallPrefix)\..\..\bcl-tests\System.Runtime.CompilerServices.Unsafe.pdb"
/>
<_BclTestAssemblyDestination Include="@(MonoTestRunner->'$(XAInstallPrefix)\..\..\bcl-tests\%(Identity)')" />
<_BclTestAssemblyDestination Include="@(MonoTestRunner->'$(XAInstallPrefix)\..\..\bcl-tests\%(Filename).pdb')" />
</ItemGroup>
<ItemGroup>
<_BclTestOutput Include="@(_BclTestAssemblyDestination)" />
<_BclTestOutput Include="$(XAInstallPrefix)\..\..\bcl-tests\bcl-tests.zip" />
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -169,7 +176,7 @@
<Output TaskParameter="CommitHash" PropertyName="_MonoGitCommitHash" />
</GitCommitHash>
<PropertyGroup>
<_MonoArchiveName>android-$(_MonoSdksConfiguration)-$(HostOS)-$(_MonoGitCommitHash)</_MonoArchiveName>
<_MonoArchiveName>android-$(_MonoSdksConfiguration)-$(_MonoGitCommitHash)-$(HostOS)</_MonoArchiveName>
</PropertyGroup>
</Target>

Expand Down Expand Up @@ -250,13 +257,13 @@
Include="@(_MonoRuntime->'$(_MSBuildDir)\lib\%(Identity)\%(OutputMonoPosixHelperFilename).d.%(NativeLibraryExtension)')"
/>
<_RuntimeEglibHeaderSource
Include="@(_MonoRuntime->'$(MonoSourceFullPath)\sdks\out\android-%(Identity)-$(_MonoSdksConfiguration)\share\mono-2.0\mono\eglib\eglib-config.h')"
Include="@(_MonoRuntime->'$(MonoSourceFullPath)\sdks\builds\android-%(Identity)-$(_MonoSdksConfiguration)\mono\eglib\eglib-config.h')"
/>
<_RuntimeEglibHeaderOutput
Include="@(_MonoRuntime->'$(_OutputIncludeDir)%(Identity)\eglib\eglib-config.h')"
/>
<_MonoConstsSource
Include="$(MonoSourceFullPath)\sdks\out\android-bcl\monodroid\Consts.cs"
Include="$(MonoSourceFullPath)\mcs\build\common\Consts.cs"
/>
<_MonoConstsOutput
Include="$(_OutputIncludeDir)Consts.cs"
Expand All @@ -266,26 +273,23 @@

<Target Name="_DownloadArchive"
DependsOnTargets="_GetMonoGitCommitHash"
Inputs="$(AndroidToolchainCacheDirectory)\$(_MonoArchiveName).zip"
Outputs="$(MonoSourceFullPath)\sdks\out\.stamp-$(_MonoArchiveName)-download"
Condition=" !Exists('$(MonoSourceFullPath)\sdks\out\.stamp-$(_MonoArchiveName)-build') And '$(DisableDownloadArchive)' == '' " >
Condition=" !Exists('$(MonoSourceFullPath)\sdks\out\.stamp-$(_MonoArchiveName)-build') And !Exists('$(MonoSourceFullPath)\sdks\out\.stamp-$(_MonoArchiveName)-download') " >
<MakeDir
Directories="$(MonoSourceFullPath)\sdks\out"
/>
<DownloadUri
SourceUris="https://xamjenkinsartifact.azureedge.net/mono-sdks/$(_MonoArchiveName).zip"
DestinationFiles="$(AndroidToolchainCacheDirectory)\$(_MonoArchiveName).zip"
SourceUris="https://xamjenkinsartifact.blob.core.windows.net/mono-sdks/$(_MonoArchiveName).tar.gz"
DestinationFiles="$(AndroidToolchainCacheDirectory)\$(_MonoArchiveName).tar.gz"
ContinueOnError="True"
/>
<UnzipDirectoryChildren
Condition=" Exists('$(AndroidToolchainCacheDirectory)\$(_MonoArchiveName).zip') "
HostOS="$(HostOS)"
SourceFiles="$(AndroidToolchainCacheDirectory)\$(_MonoArchiveName).zip"
DestinationFolder="$(MonoSourceFullPath)\sdks\out"
NoSubdirectory="True"
<Exec
Condition=" Exists('$(AndroidToolchainCacheDirectory)\$(_MonoArchiveName).tar.gz') "
Command="tar -xvf $(AndroidToolchainCacheDirectory)\$(_MonoArchiveName).tar.gz"
IgnoreStandardErrorWarningFormat="True"
WorkingDirectory="$(MonoSourceFullPath)\sdks\out"
/>
<Touch
Condition=" Exists('$(AndroidToolchainCacheDirectory)\$(_MonoArchiveName).zip') "
Condition=" Exists('$(AndroidToolchainCacheDirectory)\$(_MonoArchiveName).tar.gz') "
Files="$(MonoSourceFullPath)\sdks\out\.stamp-$(_MonoArchiveName)-download"
AlwaysCreate="True"
/>
Expand All @@ -310,32 +314,51 @@
<Target Name="_InstallRuntimes"
DependsOnTargets="_GetRuntimesOutputItems"
Inputs="@(_RuntimeSource);@(_RuntimeBinarySource);@(_CrossRuntimeBinarySource);@(_ProfilerSource);@(_MonoPosixHelperSource);@(_RuntimeEglibHeaderSource);@(_MonoBtlsSource)"
Outputs="@(_InstallRuntimeOutput);@(_InstallRuntimeBinaryOutput);@(_InstallCrossRuntimeBinaryOutput);@(_InstallProfilerOutput);@(_InstallMonoPosixHelperOutput);@(_RuntimeEglibHeaderOutput);do-not-cache">
Outputs="@(_InstallRuntimeOutput);@(_InstallRuntimeBinaryOutput);@(_InstallCrossRuntimeBinaryOutput);@(_InstallProfilerOutput);@(_InstallMonoPosixHelperOutput);@(_RuntimeEglibHeaderOutput)">
<ItemGroup>
<_BclTest Include="$(_MonoProfileDir)\tests\**\*" />
<!-- This is referenced by monodroid_corlib_xunit-test.dll -->
<_BclTest Include="$(_MonoProfileDir)\System.Runtime.CompilerServices.Unsafe.dll" />
<_BclTestAssemblyReference Include="@(MonoTestAssembly)" Condition="'%(MonoTestAssembly.TestType)' == 'reference'" />
<_BclTestAssembly Include="@(MonoTestAssembly)" Condition="'%(MonoTestAssembly.TestType)' == '' Or '%(MonoTestAssembly.TestType)' == 'xunit' " />
<_BclTestAssemblySource Include="@(_BclTestAssemblyReference->'$(_MonoProfileDir)\%(Identity)')" />
<_BclTestAssemblySource Include="@(_BclTestAssemblyReference->'$(_MonoProfileDir)\%(Filename).pdb')" Condition="Exists('@(_BclTestAssemblyReference->'$(_MonoProfileDir)\%(Filename).pdb')')" />
<_BclTestAssemblySource Include="@(_BclTestAssembly->'$(_MonoProfileDir)\tests\%(Identity)')" />
<_BclTestAssemblySource Include="@(_BclTestAssembly->'$(_MonoProfileDir)\tests\%(Filename).pdb')" />
<_BclTestAssemblySource Include="@(MonoTestRunner->'$(_MonoProfileDir)\%(Identity)')" />
<_BclTestAssemblySource Include="@(MonoTestRunner->'$(_MonoProfileDir)\%(Filename).pdb')" />
</ItemGroup>
<Copy
SourceFiles="@(_BclTest)"
DestinationFiles="@(_BclTest->'$(XAInstallPrefix)..\..\bcl-tests\%(RecursiveDir)%(Filename)%(Extension)')"
SourceFiles="@(_BclTestAssemblySource)"
DestinationFolder="$(XAInstallPrefix)\..\..\bcl-tests"
/>
<Touch
Files="@(_BclTestAssemblySource->'$(XAInstallPrefix)\..\..\bcl-tests\%(Filename)%(Extension)')"
/>
<Touch Files="@(_BclTest->'$(XAInstallPrefix)..\..\bcl-tests\%(RecursiveDir)%(Filename)%(Extension)')" />
<ItemGroup>
<_BclTestContent Include="$(MonoSourceFullPath)\mcs\class\%(MonoTestAssembly.SourcePath)\Test\**\*" Condition=" '%(MonoTestAssembly.SourcePath)' != '' " />
<_BclTestContent Remove="$(MonoSourceFullPath)\mcs\class\%(MonoTestAssembly.SourcePath)\Test\**\*.cs" Condition=" '%(MonoTestAssembly.SourcePath)' != '' " />
<_BclTestContent Remove="$(MonoSourceFullPath)\mcs\class\%(MonoTestAssembly.SourcePath)\Test\**\.gitattributes" Condition=" '%(MonoTestAssembly.SourcePath)' != '' " />
<_BclTestContent Include="$(MonoSourceFullPath)\mcs\class\%(MonoTestAssembly.SourcePath)\Test\**\*.*" />
<_BclTestContent Remove="$(MonoSourceFullPath)\mcs\class\%(MonoTestAssembly.SourcePath)\Test\**\*.cs" />
<_BclTestContent Remove="$(MonoSourceFullPath)\mcs\class\%(MonoTestAssembly.SourcePath)\Test\**\.gitattributes" />
<_BclTestContentDest Include="@(_BclTestContent->'$(XAInstallPrefix)\..\..\bcl-tests\Test\%(RecursiveDir)%(Filename)%(Extension)')" />
</ItemGroup>
<ItemGroup>
<_ZipTestContent Include="$(MonoSourceFullPath)\mcs\class\System.IO.Compression.FileSystem\foo\**\*.*" />
<_ZipTestContentDest Include="@(_ZipTestContent->'$(XAInstallPrefix)\..\..\bcl-tests\foo\%(RecursiveDir)%(Filename)%(Extension)')" />
<_BclTestContent Include="@(_ZipTestContent)" />
<_BclTestContentDest Include="@(_ZipTestContentDest)" />
</ItemGroup>
<Copy
SourceFiles="@(_BclTestContent)"
DestinationFiles="@(_BclTestContent->'$(XAInstallPrefix)..\..\bcl-tests\Test\%(RecursiveDir)%(Filename)%(Extension)')"
DestinationFiles="@(_BclTestContentDest)"
/>
<Exec
Condition="!Exists('$(XAInstallPrefix)\..\..\bcl-tests\Test\test.db')"
Command="sqlite3 &quot;$(XAInstallPrefix)\..\..\bcl-tests\Test\test.db&quot; &lt; &quot;$(MonoSourceFullPath)\mcs\class\Mono.Data.Sqlite\Test\test.sql&quot;"
/>
<Touch Files="@(_BclTestContent->'$(XAInstallPrefix)..\..\bcl-tests\Test\%(RecursiveDir)%(Filename)%(Extension)')" />
<Exec
Command="zip -r bcl-tests.zip ."
WorkingDirectory="$(XAInstallPrefix)..\..\bcl-tests"
WorkingDirectory="$(XAInstallPrefix)\..\..\bcl-tests"
/>
<Touch
Files="$(XAInstallPrefix)\..\..\bcl-tests\bcl-tests.zip"
/>
<Touch Files="$(XAInstallPrefix)..\..\bcl-tests\bcl-tests.zip" />

<MakeDir
Directories="$(_MSBuildDir)\lib\%(_MonoRuntime.Identity)"
Expand Down Expand Up @@ -592,8 +615,8 @@
/>

<ItemGroup>
<_StampFiles Include="$(MonoSourceFullPath)\sdks\out\.stamp-android-$(_MonoSdksConfiguration)-$(HostOS)-*-build"/>
<_StampFiles Include="$(MonoSourceFullPath)\sdks\out\.stamp-android-$(_MonoSdksConfiguration)-$(HostOS)-*-download"/>
<_StampFiles Include="$(MonoSourceFullPath)\sdks\out\.stamp-android-$(_MonoSdksConfiguration)-*-$(HostOS)-build"/>
<_StampFiles Include="$(MonoSourceFullPath)\sdks\out\.stamp-android-$(_MonoSdksConfiguration)-*-$(HostOS)-download"/>
</ItemGroup>
<Delete Files="@(_StampFiles)" />
</Target>
Expand Down
36 changes: 7 additions & 29 deletions tests/BCL-Tests/Xamarin.Android.Bcl-Tests/NUnitInstrumentation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

using Android.App;
using Android.Runtime;
using Android.Util;

using Xamarin.Android.UnitTests;
using Xamarin.Android.UnitTests.NUnit;

Expand Down Expand Up @@ -37,6 +35,7 @@ public NUnitInstrumentation ()

void CommonInit ()
{
TestAssembliesGlobPattern = "*_test.dll";
string cacheDir = Path.Combine (Application.Context.CacheDir.AbsolutePath, DefaultLogTag);
using (var files = typeof (NUnitInstrumentation).Assembly.GetManifestResourceStream ("bcl-tests.zip")) {
ExtractAssemblies (cacheDir, files);
Expand Down Expand Up @@ -74,34 +73,13 @@ protected override void ConfigureFilters(NUnitTestRunner runner)

protected override IList<TestAssemblyInfo> GetTestAssemblies()
{
var ret = new List<TestAssemblyInfo> ();

using (var stream = typeof (NUnitInstrumentation).Assembly.GetManifestResourceStream ("nunit-assemblies.txt"))
using (var reader = new StreamReader (stream)) {
string line;
while ((line = reader.ReadLine ()) != null) {
string file = Path.Combine (TestsDirectory, line);

try {
Log.Info (LogTag, $"Adding test assembly: {file}");

Assembly asm = LoadTestAssembly (file);
if (asm == null)
continue;

// We store full path since Assembly.Location is not reliable on Android - it may hold a relative
// path or no path at all
ret.Add (new TestAssemblyInfo (asm, file));
} catch (Exception e) {
throw new InvalidOperationException ($"Unable to load test assembly: {file}", e);
}
}
}
IList<TestAssemblyInfo> ret = base.GetTestAssemblies();

{
Assembly asm = typeof (BclTests.HttpClientTest).Assembly;
ret.Add (new TestAssemblyInfo (asm, asm.Location ?? String.Empty));
}
if (ret == null)
ret = new List<TestAssemblyInfo> ();

Assembly asm = typeof (BclTests.HttpClientTest).Assembly;
ret.Add (new TestAssemblyInfo (asm, asm.Location ?? String.Empty));

return ret;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.Text;

using Android.App;
using Android.Runtime;
using Android.Util;

using Xamarin.Android.UnitTests;
using Xamarin.Android.UnitTests.XUnit;

namespace xUnitTestRunner
Expand Down Expand Up @@ -37,12 +34,11 @@ public XUnitInstrumentation ()

void CommonInit ()
{
TestAssembliesGlobPattern = "*_xunit-test.dll";
string cacheDir = Path.Combine (Application.Context.CacheDir.AbsolutePath, DefaultLogTag);
using (var files = typeof (XUnitInstrumentation).Assembly.GetManifestResourceStream ("bcl-tests.zip")) {
ExtractAssemblies (cacheDir, files);
}

TestsDirectory = cacheDir;
}

protected override void ConfigureFilters (XUnitTestRunner runner)
Expand Down Expand Up @@ -83,34 +79,5 @@ protected override void ConfigureFilters (XUnitTestRunner runner)

runner.SetFilters (filters);
}

protected override IList<TestAssemblyInfo> GetTestAssemblies()
{
var ret = new List<TestAssemblyInfo> ();

using (var stream = typeof (XUnitInstrumentation).Assembly.GetManifestResourceStream ("xunit-assemblies.txt"))
using (var reader = new StreamReader (stream)) {
string line;
while ((line = reader.ReadLine ()) != null) {
string file = Path.Combine (TestsDirectory, line);

try {
Log.Info (LogTag, $"Adding test assembly: {file}");

Assembly asm = LoadTestAssembly (file);
if (asm == null)
continue;

// We store full path since Assembly.Location is not reliable on Android - it may hold a relative
// path or no path at all
ret.Add (new TestAssemblyInfo (asm, file));
} catch (Exception e) {
throw new InvalidOperationException ($"Unable to load test assembly: {file}", e);
}
}
}

return ret;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,6 @@
<None Include="Properties\AndroidManifest.xml" />
<None Include="Assets\AboutAssets.txt" />
<None Include="packages.config" />
<EmbeddedResource Include="xunit-assemblies.txt">
<LogicalName>xunit-assemblies.txt</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="nunit-assemblies.txt">
<LogicalName>nunit-assemblies.txt</LogicalName>
</EmbeddedResource>
<EmbeddedResource Include="xunit-excluded-tests.txt">
<LogicalName>xunit-excluded-tests.txt</LogicalName>
</EmbeddedResource>
Expand Down
Loading

0 comments on commit 3a4720e

Please sign in to comment.