Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
In order for this to build, I had to bring in some other changes from:

dotnet#5544
  • Loading branch information
jonathanpeppers committed Jan 26, 2021
1 parent 3864496 commit c291663
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .external
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
xamarin/monodroid:master@ad19471b8478f9f8028c9a3517ad3ca7bca5fb4a
xamarin/monodroid:fastdeploy-targetpath@86a51cf8b3915eecad6d8a0b22202121c0db6fa9
mono/mono:2020-02@5e9cb6d1c1de430965312927d5aed7fcb27bfa73
1 change: 1 addition & 0 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@
<LibZipSharpVersion>1.0.20</LibZipSharpVersion>
<MonoCecilVersion>0.11.2</MonoCecilVersion>
<NuGetApiPackageVersion>5.4.0</NuGetApiPackageVersion>
<LZ4PackageVersion>1.1.11</LZ4PackageVersion>
</PropertyGroup>
<PropertyGroup>
<MingwCommandPrefix32>i686-w64-mingw32</MingwCommandPrefix32>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
<PackageReference Include="System.Runtime" Version="4.3.1" />
<PackageReference Include="System.Runtime.InteropServices" Version="4.3.0" />
<PackageReference Include="XliffTasks" Version="1.0.0-beta.20420.1" PrivateAssets="all" />
<PackageReference Include="K4os.Compression.LZ4" Version="1.1.11" />
<PackageReference Include="K4os.Compression.LZ4" Version="$(LZ4PackageVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
33 changes: 24 additions & 9 deletions tests/MSBuildDeviceIntegration/Tests/InstallTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,20 @@ public void LocalizedAssemblies_ShouldBeFastDeployed ()
AssertCommercialBuild ();
AssertHasDevices ();

var proj = new XamarinAndroidApplicationProject {
var path = Path.Combine ("temp", TestName);
var lib = new XamarinAndroidLibraryProject {
ProjectName = "Localization",
OtherBuildItems = {
new BuildItem ("EmbeddedResource", "Bar.resx") {
TextContent = () => InlineData.ResxWithContents ("<data name=\"CancelButton\"><value>Cancel</value></data>")
},
new BuildItem ("EmbeddedResource", "Bar.es.resx") {
TextContent = () => InlineData.ResxWithContents ("<data name=\"CancelButton\"><value>Cancelar</value></data>")
}
}
};

var app = new XamarinAndroidApplicationProject {
EmbedAssembliesIntoApk = false,
OtherBuildItems = {
new BuildItem ("EmbeddedResource", "Foo.resx") {
Expand All @@ -451,24 +464,26 @@ public void LocalizedAssemblies_ShouldBeFastDeployed ()
}
}
};
app.References.Add (new BuildItem.ProjectReference ($"..\\{lib.ProjectName}\\{lib.ProjectName}.csproj", lib.ProjectName, lib.ProjectGuid));

using (var builder = CreateApkBuilder ()) {
Assert.IsTrue (builder.Install (proj), "Install should have succeeded.");
var projectOutputPath = Path.Combine (Root, builder.ProjectDirectory, proj.OutputPath);
using (var libBuilder = CreateDllBuilder (Path.Combine (path, lib.ProjectName)))
using (var appBuilder = CreateApkBuilder (Path.Combine (path, app.ProjectName))) {
Assert.IsTrue (libBuilder.Build (lib), "Library Build should have succeeded.");
Assert.IsTrue (appBuilder.Install (app), "App Install should have succeeded.");
var projectOutputPath = Path.Combine (Root, appBuilder.ProjectDirectory, app.OutputPath);
var resourceFilesFromDisk = Directory.EnumerateFiles (projectOutputPath, "*.resources.dll", SearchOption.AllDirectories)
.Select (r => r = r.Replace (projectOutputPath, string.Empty).Replace ("\\", "/"));

var overrideContents = string.Empty;
foreach (var dir in GetOverrideDirectoryPaths (proj.PackageName)) {
overrideContents += RunAdbCommand ($"shell run-as {proj.PackageName} find {dir}");
foreach (var dir in GetOverrideDirectoryPaths (app.PackageName)) {
overrideContents += RunAdbCommand ($"shell run-as {app.PackageName} find {dir}");
}
builder.BuildLogFile = "uninstall.log";
builder.Uninstall (proj);
Assert.IsTrue (resourceFilesFromDisk.Any (), $"Unable to find any localized assemblies in {resourceFilesFromDisk}");
foreach (var res in resourceFilesFromDisk) {
StringAssert.Contains (res, overrideContents, $"{res} did not exist in the .__override__ directory.\nFound:{overrideContents}");
}

appBuilder.BuildLogFile = "uninstall.log";
appBuilder.Uninstall (app);
}
}

Expand Down

0 comments on commit c291663

Please sign in to comment.