Skip to content

Commit

Permalink
try this
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Oct 24, 2024
1 parent 8071087 commit 8f05381
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ Copyright (C) 2016 Xamarin. All rights reserved.
Inputs="@(_AndroidResourceDest);@(LibraryResourceDirectories->'%(StampFile)')"
Outputs="$(_GenerateResourceCaseMapFile)"
>
<ItemGroup>
<!-- Only use the aar files if we have not extracted the data -->
<_LocalAarFiles Include="@(AndroidAarLibrary)" Condition=" '@(LibraryResourceDirectories->Count())' == '0' " />
</ItemGroup>
<!-- Generate a ResourceMap file for the project and its resources -->
<GenerateResourceCaseMap
AdditionalResourceDirectories="@(LibraryResourceDirectories)"
AarLibraries="@(AndroidAarLibrary)"
AarLibraries="@(_LocalAarFiles)"
OutputFile="$(_GenerateResourceCaseMapFile)"
ProjectDir="$(ProjectDir)"
ResourceDirectory="$(MonoAndroidResDirIntermediate)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public override bool RunTask ()
continue;
if (entry.FullName != resmap)
continue;
Log.LogDebugMessage ($"Found: {entry.FullName}");
using var ms = new MemoryStream();
entry.Extract (ms);
ms.Position = 0;
Expand All @@ -94,6 +95,8 @@ public override bool RunTask ()
string [] tok = line.Split (';');
AddRename (tok [1].Replace ('/', Path.DirectorySeparatorChar), tok [0].Replace ('/', Path.DirectorySeparatorChar));
}
// no need to read the rest of the files we found the one we want
break;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ public void IncrementalDesignTimeBuild ()
Assert.IsTrue (b.Build (proj, parameters: DesignerParameters), $"{b.Target} should have succeeded.");

// Change a layout, DTB
proj.LayoutMain = proj.LayoutMain.Replace ("@string/hello", "hello");
proj.LayoutMain = proj.LayoutMain.Replace ("</LinearLayout>", "<Button android:id=\"foo\" android:text=\"hello\" /></LinearLayout>");
proj.Touch ("Resources\\layout\\Main.axml");
Assert.IsTrue (b.DesignTimeBuild (proj, target: "UpdateGeneratedFiles"), "DTB should have succeeded.");

var resourcepathscache = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "designtime", "libraryprojectimports.cache");
FileAssert.Exists (resourcepathscache);
var doc = XDocument.Load (resourcepathscache);
Assert.AreEqual (54, doc.Root.Element ("Jars").Elements ("Jar").Count (), "libraryprojectimports.cache did not contain expected jar files");
var rTxtFile = Path.Combine (Root, b.ProjectDirectory, proj.IntermediateOutputPath, "designtime", "R.txt");
FileAssert.Exists (rTxtFile);
var doc = File.ReadAllText (rTxtFile);
StringAssert.Contains ("foo", doc, "R.tct did not contain expected id of foo");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.CodeDom;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -332,8 +333,8 @@ void ProcessStyleable (XmlReader reader, Dictionary<string, ICollection<R>> reso
fields.Add (r);
}
}
if (field.Type != RType.Array)
return;
//if (field.Type != RType.Array)
// return;
arrayMapping.Add (field, fields.ToArray ());

field.Ids = new int [attribs.Count];
Expand Down

0 comments on commit 8f05381

Please sign in to comment.