Skip to content

Commit f0d565f

Browse files
authored
[Xamarin.Android.Build.Tasks] Remove Fast Dev of AndroidResources (#4829)
Changes: xamarin/monodroid@6e43a20...5784a74 * xamarin/monodroid@5784a7461: [msbuild] Remove Remove Fast Dev of AndroidResources (#1099) * xamarin/monodroid@82bea9c6b: [tests] update and consolidate NUnit packages (#1103) Our current enhanced fast deployment system makes use of grey-listed API's which are going to be removed in a future version of Android. Removes support for fast deploying the `packaged_ressources` file to the `.__override__` directory. Also remove the resource patching support from the debug runtime.
1 parent a944a89 commit f0d565f

File tree

9 files changed

+51
-801
lines changed

9 files changed

+51
-801
lines changed

.external

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
xamarin/monodroid:master@82bea9c6b963cb855a6e01775084182ab45cf9ac
1+
xamarin/monodroid:master@5784a746112babd9ef801e0a6bc3fe2694bdf64c
22
mono/mono:2020-02@83105ba22461455f4343d6bb14976eba8b0b3f39

build-tools/installers/create-installers.targets

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@
397397
<_MSBuildFiles Include="$(MSBuildSrcDir)\lib\x86_64\installer" />
398398
<_MSBuildFiles Include="$(MSBuildSrcDir)\protobuf-net.dll" />
399399
<_MSBuildFiles Include="$(MSBuildSrcDir)\System.Collections.Immutable.dll" />
400-
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Android.Tools.ResourceProcessors.dll" />
401400
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.AndroidTools.dll" />
402401
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.AndroidTools.pdb" />
403402
<_MSBuildFiles Include="$(MSBuildSrcDir)\Xamarin.Installer.AndroidSDK.dll" />

src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ internal class ManifestDocument
3737
static XNamespace androidToolsNs = AndroidXmlToolsNamespace;
3838

3939
XDocument doc;
40-
40+
4141
XName attName;
4242

4343
XElement app;
@@ -76,7 +76,7 @@ internal class ManifestDocument
7676
{ "action", "android.intent.action.MAIN" },
7777
{ "category", "android.intent.category.LAUNCHER" },
7878
};
79-
79+
8080
public string PackageName { get; set; }
8181
public string ApplicationName { get; set; }
8282
public string [] Placeholders { get; set; }
@@ -223,7 +223,7 @@ void ReorderActivityAliases (TaskLoggingHelper log, XElement app)
223223
}
224224
}
225225
}
226-
226+
227227
public IList<string> Merge (TaskLoggingHelper log, TypeDefinitionCache cache, List<TypeDefinition> subclasses, string applicationClass, bool embed, string bundledWearApplicationName, IEnumerable<string> mergedManifestDocuments)
228228
{
229229
string applicationName = ApplicationName;
@@ -232,26 +232,26 @@ public IList<string> Merge (TaskLoggingHelper log, TypeDefinitionCache cache, Li
232232

233233
if (manifest == null || manifest.Name != "manifest")
234234
throw new Exception ("Root element must be 'manifest'");
235-
235+
236236
var manifest_package = (string) manifest.Attribute ("package");
237237

238238
if (!string.IsNullOrWhiteSpace (manifest_package))
239239
PackageName = manifest_package;
240-
240+
241241
manifest.SetAttributeValue (XNamespace.Xmlns + "android", "http://schemas.android.com/apk/res/android");
242242
if (manifest.Attribute (androidNs + "versionCode") == null)
243243
manifest.SetAttributeValue (androidNs + "versionCode", "1");
244244
if (manifest.Attribute (androidNs + "versionName") == null)
245245
manifest.SetAttributeValue (androidNs + "versionName", "1.0");
246-
246+
247247
app = CreateApplicationElement (manifest, applicationClass, subclasses, cache);
248-
248+
249249
if (app.Attribute (androidNs + "label") == null && applicationName != null)
250250
app.SetAttributeValue (androidNs + "label", applicationName);
251251

252252
var existingTypes = new HashSet<string> (
253253
app.Descendants ().Select (a => (string) a.Attribute (attName)).Where (v => v != null));
254-
254+
255255
if (!string.IsNullOrEmpty (bundledWearApplicationName)) {
256256
if (!app.Elements ("meta-data").Any (e => e.Attributes (androidNs + "name").Any (a => a.Value == bundledWearApplicationName)))
257257
app.Add (new XElement ("meta-data", new XAttribute (androidNs + "name", "com.google.android.wearable.beta.app"), new XAttribute (androidNs + "resource", "@xml/wearable_app_desc")));
@@ -359,18 +359,14 @@ public IList<string> Merge (TaskLoggingHelper log, TypeDefinitionCache cache, Li
359359

360360
if (!PackageName.Contains ('.'))
361361
throw new InvalidOperationException ("/manifest/@package attribute MUST contain a period ('.').");
362-
362+
363363
manifest.SetAttributeValue ("package", PackageName);
364364

365365
if (MultiDex)
366366
app.Add (CreateMonoRuntimeProvider ("mono.android.MultiDexLoader", null, initOrder: --AppInitOrder));
367367

368368
var providerNames = AddMonoRuntimeProviders (app);
369369

370-
if (Debug && !embed && InstantRunEnabled) {
371-
if (int.TryParse (SdkVersion, out int apiLevel) && apiLevel >= 19)
372-
app.Add (CreateMonoRuntimeProvider ("mono.android.ResourcePatcher", null, initOrder: --AppInitOrder));
373-
}
374370
if (Debug) {
375371
app.Add (new XComment ("suppress ExportedReceiver"));
376372
app.Add (new XElement ("receiver",
@@ -482,7 +478,7 @@ void RemoveDuplicateElements ()
482478
var duplicates = ResolveDuplicates (doc.Elements ());
483479
foreach (var duplicate in duplicates)
484480
duplicate.Remove ();
485-
481+
486482
}
487483

488484
void RemoveNodes ()
@@ -526,15 +522,15 @@ XElement CreateApplicationElement (XElement manifest, string applicationClass, L
526522
{
527523
var application = manifest.Descendants ("application").FirstOrDefault ();
528524

529-
List<ApplicationAttribute> assemblyAttr =
525+
List<ApplicationAttribute> assemblyAttr =
530526
Assemblies.Select (path => ApplicationAttribute.FromCustomAttributeProvider (Resolver.GetAssembly (path)))
531527
.Where (attr => attr != null)
532528
.ToList ();
533-
List<MetaDataAttribute> metadata =
529+
List<MetaDataAttribute> metadata =
534530
Assemblies.SelectMany (path => MetaDataAttribute.FromCustomAttributeProvider (Resolver.GetAssembly (path)))
535531
.Where (attr => attr != null)
536532
.ToList ();
537-
var usesLibraryAttr =
533+
var usesLibraryAttr =
538534
Assemblies.SelectMany (path => UsesLibraryAttribute.FromCustomAttributeProvider (Resolver.GetAssembly (path)))
539535
.Where (attr => attr != null);
540536
var usesConfigurationAttr =
@@ -556,7 +552,7 @@ XElement CreateApplicationElement (XElement manifest, string applicationClass, L
556552

557553
typeAttr.Add (aa);
558554
metadata.AddRange (MetaDataAttribute.FromCustomAttributeProvider (t));
559-
555+
560556
typeUsesLibraryAttr.AddRange (UsesLibraryAttribute.FromCustomAttributeProvider (t));
561557
}
562558

@@ -596,13 +592,13 @@ XElement CreateApplicationElement (XElement manifest, string applicationClass, L
596592

597593
if (needManifestAdd)
598594
manifest.Add (application);
599-
595+
600596
AddUsesLibraries (application, usesLibraryAttrs);
601597
AddUsesConfigurations (application, usesConfigurationattrs);
602598

603599
if (applicationClass != null && application.Attribute (androidNs + "name") == null)
604600
application.Add (new XAttribute (androidNs + "name", applicationClass));
605-
601+
606602
if (application.Attribute (androidNs + "allowBackup") == null)
607603
application.Add (new XAttribute (androidNs + "allowBackup", "true"));
608604

@@ -661,7 +657,7 @@ XElement CreateMonoRuntimeProvider (string name, string processName, int initOrd
661657

662658
bool IsMainLauncher (XElement intentFilter)
663659
{
664-
return LauncherIntentElements.All (entry =>
660+
return LauncherIntentElements.All (entry =>
665661
intentFilter.Elements (entry.Key).Any (e => ((string) e.Attribute (attName) == entry.Value)));
666662
}
667663

@@ -690,9 +686,9 @@ XElement ActivityFromTypeDefinition (TypeDefinition type, string name, int targe
690686
if (name.StartsWith ("_"))
691687
throw new InvalidActivityNameException (string.Format ("Activity name '{0}' is invalid, because activity namespaces may not begin with an underscore.", type.FullName));
692688

693-
return ToElement (type, name,
694-
ActivityAttribute.FromTypeDefinition,
695-
aa => aa.ToElement (Resolver, PackageName, targetSdkVersion),
689+
return ToElement (type, name,
690+
ActivityAttribute.FromTypeDefinition,
691+
aa => aa.ToElement (Resolver, PackageName, targetSdkVersion),
696692
(aa, element) => {
697693
if (aa.MainLauncher)
698694
AddLauncherIntentElements (element);
@@ -704,7 +700,7 @@ XElement ActivityFromTypeDefinition (TypeDefinition type, string name, int targe
704700

705701
XElement InstrumentationFromTypeDefinition (TypeDefinition type, string name, int targetSdkVersion)
706702
{
707-
return ToElement (type, name,
703+
return ToElement (type, name,
708704
t => InstrumentationAttribute.FromCustomAttributeProvider (t).FirstOrDefault (),
709705
ia => {
710706
if (ia.TargetPackage == null)
@@ -788,7 +784,7 @@ public void AddFastDeployPermissions ()
788784

789785
void AddPermissions (XElement application)
790786
{
791-
var assemblyAttrs =
787+
var assemblyAttrs =
792788
Assemblies.SelectMany (path => PermissionAttribute.FromCustomAttributeProvider (Resolver.GetAssembly (path)));
793789
// Add unique permissions to the manifest
794790
foreach (var pa in assemblyAttrs.Distinct (new PermissionAttribute.PermissionAttributeComparer ()))
@@ -798,7 +794,7 @@ void AddPermissions (XElement application)
798794

799795
void AddPermissionGroups (XElement application)
800796
{
801-
var assemblyAttrs =
797+
var assemblyAttrs =
802798
Assemblies.SelectMany (path => PermissionGroupAttribute.FromCustomAttributeProvider (Resolver.GetAssembly (path)));
803799

804800
// Add unique permissionGroups to the manifest
@@ -871,7 +867,7 @@ void AddUsesFeatures (XElement application)
871867
application.AddBeforeSelf (feature.ToElement (PackageName));
872868
}
873869
}
874-
870+
875871
}
876872
}
877873

@@ -890,7 +886,7 @@ void AddSupportsGLTextures (XElement application)
890886

891887
void AddInstrumentations (XElement manifest, IList<TypeDefinition> subclasses, int targetSdkVersion, TypeDefinitionCache cache)
892888
{
893-
var assemblyAttrs =
889+
var assemblyAttrs =
894890
Assemblies.SelectMany (path => InstrumentationAttribute.FromCustomAttributeProvider (Resolver.GetAssembly (path)));
895891

896892
// Add instrumentation to the manifest
@@ -900,7 +896,7 @@ void AddInstrumentations (XElement manifest, IList<TypeDefinition> subclasses, i
900896
if (!manifest.Descendants ("instrumentation").Any (x => (string) x.Attribute (attName) == ia.Name))
901897
manifest.Add (ia.ToElement (PackageName));
902898
}
903-
899+
904900
foreach (var type in subclasses)
905901
if (type.IsSubclassOf ("Android.App.Instrumentation", cache)) {
906902
var xe = InstrumentationFromTypeDefinition (type, JavaNativeTypeManager.ToJniName (type).Replace ('/', '.'), targetSdkVersion);

src/java-runtime/java-runtime.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<OutputDex>$(OutputPath)java_runtime.dex</OutputDex>
1818
<IntermediateRuntimeOutputPath>$(IntermediateOutputPath)release</IntermediateRuntimeOutputPath>
1919
<IntermediateRuntimeClassesTxt>$(IntermediateOutputPath)release.txt</IntermediateRuntimeClassesTxt>
20-
<RemoveItems>java\mono\android\debug\MultiDexLoader.java;java\mono\android\MonkeyPatcher.java;java\mono\android\ResourcePatcher.java;java\mono\android\Seppuku.java;java\mono\android\debug\BuildConfig.java</RemoveItems>
20+
<RemoveItems>java\mono\android\debug\MultiDexLoader.java;java\mono\android\Seppuku.java;java\mono\android\debug\BuildConfig.java</RemoveItems>
2121
</_RuntimeOutput>
2222
<_RuntimeOutput Include="$(OutputPath)java_runtime_fastdev.jar">
2323
<OutputJar>$(OutputPath)java_runtime_fastdev.jar</OutputJar>

0 commit comments

Comments
 (0)