Skip to content

Commit

Permalink
Add more file checks
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Jan 16, 2024
1 parent c5d9a06 commit 7a2d771
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Copyright (C) 2011-2012 Xamarin. All rights reserved.
<!-- Assets build properties -->
<PropertyGroup>
<MonoAndroidAssetsDirIntermediate>$(IntermediateOutputPath)assets\</MonoAndroidAssetsDirIntermediate>
<MonoAndroidAssetPacksDirIntermediate>$(IntermediateOutputPath)assetpacks\packs</MonoAndroidAssetPacksDirIntermediate>
<MonoAndroidAssetPacksDirIntermediate>$(IntermediateOutputPath)assetpacks</MonoAndroidAssetPacksDirIntermediate>
<MonoAndroidAssetsPrefix Condition="'$(MonoAndroidAssetsPrefix)' == ''">Assets</MonoAndroidAssetsPrefix>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public void BuildApplicationWithAssetPack ([Values (true, false)] bool isRelease
// Check the final aab has the required feature files in it.
var aab = Path.Combine (Root, appBuilder.ProjectDirectory,
app.OutputPath, $"{app.PackageName}.aab");
var asset3File = Path.Combine (Root, path, app.ProjectName,
app.IntermediateOutputPath, "assetpacks", "assetpack1", "assets", "asset3.txt");
using (var zip = ZipHelper.OpenZip (aab)) {
Assert.IsTrue (zip.ContainsEntry ("base/assets/asset1.txt"), "aab should contain base/assets/asset1.txt");
Assert.IsFalse (zip.ContainsEntry ("base/assets/asset2.txt"), "aab should not contain base/assets/asset2.txt");
Expand All @@ -67,14 +69,18 @@ public void BuildApplicationWithAssetPack ([Values (true, false)] bool isRelease
appBuilder.Output.AssertTargetIsSkipped ("_CreateAssetPackManifests");
appBuilder.Output.AssertTargetIsSkipped ("_BuildAssetPacks");
appBuilder.Output.AssertTargetIsSkipped ("_GenerateAndroidAssetsDir");
FileAssert.Exists (asset3File, $"file {asset3File} should exist.");
asset3.TextContent = () => "Asset3 Updated";
asset3.Timestamp = DateTime.UtcNow.AddSeconds(1);
Assert.IsTrue (appBuilder.Build (app, doNotCleanupOnUpdate: true, saveProject: false), $"{app.ProjectName} should succeed");
appBuilder.Output.AssertTargetIsNotSkipped ("_CreateAssetPackManifests");
appBuilder.Output.AssertTargetIsNotSkipped ("_BuildAssetPacks");
appBuilder.Output.AssertTargetIsNotSkipped ("_GenerateAndroidAssetsDir");
FileAssert.Exists (asset3File, $"file {asset3File} should exist.");
Assert.AreEqual (asset3.TextContent (), File.ReadAllText (asset3File), $"Contents of {asset3File} should have been updated.");
app.OtherBuildItems.Remove (asset3);
Assert.IsTrue (appBuilder.Build (app, doNotCleanupOnUpdate: true), $"{app.ProjectName} should succeed");
FileAssert.DoesNotExist (asset3File, $"file {asset3File} should not exist.");
using (var zip = ZipHelper.OpenZip (aab)) {
Assert.IsTrue (zip.ContainsEntry ("base/assets/asset1.txt"), "aab should contain base/assets/asset1.txt");
Assert.IsFalse (zip.ContainsEntry ("base/assets/asset2.txt"), "aab should not contain base/assets/asset2.txt");
Expand Down

0 comments on commit 7a2d771

Please sign in to comment.