Skip to content

Commit 8399219

Browse files
committed
Remove Instant Run Support
1 parent 14b70ac commit 8399219

File tree

10 files changed

+10
-156
lines changed

10 files changed

+10
-156
lines changed

.external

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
xamarin/monodroid:main@9ca6d9f64fce11f04d668ece50ada36de1d7efce
1+
xamarin/monodroid:rminstantrun@a59662b944fe04b90ddb3131f8f704314bab5bb0

Documentation/docs-mobile/building-apps/build-properties.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,8 @@ Support for Fast Deploying resources and assets via that system was
549549
removed in commit [f0d565fe](https://github.com/xamarin/xamarin-android/commit/f0d565fe4833f16df31378c77bbb492ffd2904b9). This was becuase it required the use of
550550
deprecated API's to work.
551551

552+
**Support for this feature was removed in .NET 9
553+
552554
**Experimental**.
553555

554556
## AndroidFragmentType

build-tools/automation/azure-pipelines.yaml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -220,16 +220,6 @@ extends:
220220
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Xamarin.Android.JcwGen_Tests-Signed.apk
221221
artifactFolder: $(DotNetTargetFramework)-Default
222222

223-
- template: /build-tools/automation/yaml-templates/apk-instrumentation.yaml@self
224-
parameters:
225-
configuration: $(XA.Build.Configuration)
226-
testName: Xamarin.Android.JcwGen_Tests_FastDev
227-
project: tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/Xamarin.Android.JcwGen-Tests.csproj
228-
testResultsFiles: TestResult-Xamarin.Android.JcwGen_Tests-$(XA.Build.Configuration).xml
229-
artifactSource: bin/Test$(XA.Build.Configuration)/$(DotNetTargetFramework)-android/Xamarin.Android.JcwGen_Tests-Signed.apk
230-
artifactFolder: $(DotNetTargetFramework)-FastDev_Assemblies_Dexes
231-
extraBuildArgs: /p:AndroidFastDeploymentType=Assemblies:Dexes
232-
233223
- template: /build-tools/automation/yaml-templates/run-nunit-tests.yaml@self
234224
parameters:
235225
testRunTitle: Xamarin.Android.Tools.Aidl-Tests - macOS

src/Xamarin.Android.Build.Tasks/Tasks/ProcessAssemblies.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static bool IsFromAKnownRuntimePack (ITaskItem assembly)
142142
static ITaskItem? GetOrCreateSymbolItem (Dictionary<string, ITaskItem> symbols, ITaskItem assembly)
143143
{
144144
var symbolPath = Path.ChangeExtension (assembly.ItemSpec, ".pdb");
145-
if (!symbols.TryGetValue (symbolPath, out var symbol)) {
145+
if (!symbols.TryGetValue (symbolPath, out var symbol) || !string.IsNullOrEmpty (symbol.GetMetadata ("DestinationSubDirectory"))) {
146146
// Sometimes .pdb files are not included in @(ResolvedFileToPublish), so add them if they exist
147147
if (File.Exists (symbolPath)) {
148148
symbols [symbolPath] = symbol = new TaskItem (symbolPath);

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildWithLibraryTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ public void LibraryProjectsShouldSkipGetPrimaryCpuAbi ()
601601
var proj = new XamarinAndroidLibraryProject ();
602602
using (var b = CreateDllBuilder (Path.Combine ("temp", TestName))) {
603603
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
604-
Assert.IsTrue (b.Output.IsTargetSkipped (target), $"`{target}` should be skipped!");
604+
Assert.IsTrue (b.Output.IsTargetSkipped (target, defaultIfNotUsed: true), $"`{target}` should be skipped!");
605605
}
606606
}
607607

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/KnownProperties.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public static class KnownProperties
3232
public const string OutputPath = "OutputPath";
3333
public const string IntermediateOutputPath = "IntermediateOutputPath";
3434
public const string OutputType = "OutputType";
35-
public const string AndroidFastDeploymentType = "AndroidFastDeploymentType";
3635
public const string AndroidClassParser = "AndroidClassParser";
3736
public const string _AndroidAllowDeltaInstall = "_AndroidAllowDeltaInstall";
3837
public const string Nullable = "Nullable";

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.ProjectTools/Android/XamarinAndroidApplicationProject.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ public string LinkTool {
129129
set { SetProperty (KnownProperties.AndroidLinkTool, value); }
130130
}
131131

132-
public string AndroidFastDeploymentType {
133-
get { return GetProperty (KnownProperties.AndroidFastDeploymentType); }
134-
set { SetProperty (KnownProperties.AndroidFastDeploymentType, value); }
135-
}
136-
137132
public bool UseJackAndJill {
138133
get { return string.Equals (GetProperty (KnownProperties.UseJackAndJill), "True", StringComparison.OrdinalIgnoreCase); }
139134
set { SetProperty (KnownProperties.UseJackAndJill, value.ToString ()); }

tests/MSBuildDeviceIntegration/Tests/DebuggingTest.cs

Lines changed: 2 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -137,37 +137,16 @@ public void ClassLibraryMainLauncherRuns ([Values (true, false)] bool preloadAss
137137
static object [] DebuggerCustomAppTestCases = new object [] {
138138
new object[] {
139139
/* embedAssemblies */ true,
140-
/* fastDevType */ "Assemblies",
141140
/* activityStarts */ true,
142141
/* packageFormat */ "apk",
143142
},
144143
new object[] {
145144
/* embedAssemblies */ false,
146-
/* fastDevType */ "Assemblies",
147145
/* activityStarts */ true,
148146
/* packageFormat */ "apk",
149147
},
150148
new object[] {
151149
/* embedAssemblies */ true,
152-
/* fastDevType */ "Assemblies:Dexes",
153-
/* activityStarts */ true,
154-
/* packageFormat */ "apk",
155-
},
156-
new object[] {
157-
/* embedAssemblies */ false,
158-
/* fastDevType */ "Assemblies:Dexes",
159-
/* activityStarts */ false,
160-
/* packageFormat */ "apk",
161-
},
162-
new object[] {
163-
/* embedAssemblies */ true,
164-
/* fastDevType */ "Assemblies",
165-
/* activityStarts */ true,
166-
/* packageFormat */ "aab",
167-
},
168-
new object[] {
169-
/* embedAssemblies */ true,
170-
/* fastDevType */ "Assemblies:Dexes",
171150
/* activityStarts */ true,
172151
/* packageFormat */ "aab",
173152
},
@@ -177,7 +156,7 @@ public void ClassLibraryMainLauncherRuns ([Values (true, false)] bool preloadAss
177156
[Test, Category ("Debugger")]
178157
[TestCaseSource (nameof (DebuggerCustomAppTestCases))]
179158
[Retry(5)]
180-
public void CustomApplicationRunsWithDebuggerAndBreaks (bool embedAssemblies, string fastDevType, bool activityStarts, string packageFormat)
159+
public void CustomApplicationRunsWithDebuggerAndBreaks (bool embedAssemblies, bool activityStarts, string packageFormat)
181160
{
182161
AssertCommercialBuild ();
183162
SwitchUser ();
@@ -190,7 +169,6 @@ public void CustomApplicationRunsWithDebuggerAndBreaks (bool embedAssemblies, st
190169

191170
var proj = new XamarinAndroidApplicationProject () {
192171
IsRelease = false,
193-
AndroidFastDeploymentType = fastDevType,
194172
};
195173
proj.SetAndroidSupportedAbis (DeviceAbi);
196174
proj.SetProperty ("EmbedAssembliesIntoApk", embedAssemblies.ToString ());
@@ -299,79 +277,55 @@ public override void OnCreate ()
299277
static object [] DebuggerTestCases = new object [] {
300278
new object[] {
301279
/* embedAssemblies */ true,
302-
/* fastDevType */ "Assemblies",
303280
/* allowDeltaInstall */ false,
304281
/* user */ null,
305282
/* packageFormat */ "apk",
306283
/* useLatestSdk */ true,
307284
},
308285
new object[] {
309286
/* embedAssemblies */ true,
310-
/* fastDevType */ "Assemblies",
311287
/* allowDeltaInstall */ false,
312288
/* user */ null,
313289
/* packageFormat */ "apk",
314290
/* useLatestSdk */ false,
315291
},
316292
new object[] {
317293
/* embedAssemblies */ false,
318-
/* fastDevType */ "Assemblies",
319-
/* allowDeltaInstall */ false,
320-
/* user */ null,
321-
/* packageFormat */ "apk",
322-
/* useLatestSdk */ true,
323-
},
324-
new object[] {
325-
/* embedAssemblies */ false,
326-
/* fastDevType */ "Assemblies",
327-
/* allowDeltaInstall */ true,
328-
/* user */ null,
329-
/* packageFormat */ "apk",
330-
/* useLatestSdk */ true,
331-
},
332-
new object[] {
333-
/* embedAssemblies */ false,
334-
/* fastDevType */ "Assemblies:Dexes",
335294
/* allowDeltaInstall */ false,
336295
/* user */ null,
337296
/* packageFormat */ "apk",
338297
/* useLatestSdk */ true,
339298
},
340299
new object[] {
341300
/* embedAssemblies */ false,
342-
/* fastDevType */ "Assemblies:Dexes",
343301
/* allowDeltaInstall */ true,
344302
/* user */ null,
345303
/* packageFormat */ "apk",
346304
/* useLatestSdk */ true,
347305
},
348306
new object[] {
349307
/* embedAssemblies */ true,
350-
/* fastDevType */ "Assemblies",
351308
/* allowDeltaInstall */ false,
352309
/* user */ DeviceTest.GuestUserName,
353310
/* packageFormat */ "apk",
354311
/* useLatestSdk */ true,
355312
},
356313
new object[] {
357314
/* embedAssemblies */ false,
358-
/* fastDevType */ "Assemblies",
359315
/* allowDeltaInstall */ false,
360316
/* user */ DeviceTest.GuestUserName,
361317
/* packageFormat */ "apk",
362318
/* useLatestSdk */ true,
363319
},
364320
new object[] {
365321
/* embedAssemblies */ true,
366-
/* fastDevType */ "Assemblies",
367322
/* allowDeltaInstall */ false,
368323
/* user */ null,
369324
/* packageFormat */ "aab",
370325
/* useLatestSdk */ true,
371326
},
372327
new object[] {
373328
/* embedAssemblies */ true,
374-
/* fastDevType */ "Assemblies",
375329
/* allowDeltaInstall */ false,
376330
/* user */ DeviceTest.GuestUserName,
377331
/* packageFormat */ "aab",
@@ -383,7 +337,7 @@ public override void OnCreate ()
383337
[Test, Category ("Debugger"), Category ("WearOS")]
384338
[TestCaseSource (nameof(DebuggerTestCases))]
385339
[Retry (5)]
386-
public void ApplicationRunsWithDebuggerAndBreaks (bool embedAssemblies, string fastDevType, bool allowDeltaInstall, string username, string packageFormat, bool useLatestSdk)
340+
public void ApplicationRunsWithDebuggerAndBreaks (bool embedAssemblies, bool allowDeltaInstall, string username, string packageFormat, bool useLatestSdk)
387341
{
388342
AssertCommercialBuild ();
389343
SwitchUser ();
@@ -424,7 +378,6 @@ public Foo ()
424378
ProjectName = "App",
425379
IsRelease = false,
426380
EmbedAssembliesIntoApk = embedAssemblies,
427-
AndroidFastDeploymentType = fastDevType
428381
};
429382
if (!useLatestSdk) {
430383
lib.TargetFramework = "net8.0-android";

tests/MSBuildDeviceIntegration/Tests/InstantRunTest.cs

Lines changed: 2 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,19 @@ public void InstantRunSimpleBuild ()
1616
AssertCommercialBuild ();
1717

1818
var proj = new XamarinFormsAndroidApplicationProject {
19-
AndroidFastDeploymentType = "Assemblies:Dexes",
2019
};
2120
var b = CreateApkBuilder (Path.Combine ("temp", TestName));
2221
Assert.IsTrue (b.Clean (proj), "Clean should have succeeded.");
2322
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
2423

25-
var manifest = b.Output.GetIntermediaryAsText (BuildOutputFiles.AndroidManifest);
26-
Assert.IsTrue (File.Exists (b.Output.GetIntermediaryPath ("android/bin/dex/mono.android.dex")), "there should be mono.android.dex in the intermediaries.");
27-
2824
using (var apk = ((AndroidApplicationBuildOutput) b.Output).OpenApk ()) {
2925
var dexFile = Path.GetTempFileName ();
3026
File.WriteAllBytes (dexFile, apk.GetRaw (ApkContents.ClassesDex));
3127
try {
3228
string className = "Lcom/xamarin/forms/platform/android/FormsViewGroup;";
33-
Assert.IsFalse (DexUtils.ContainsClass (className, dexFile, AndroidSdkPath), $"`{dexFile}` should *not* include `{className}`!");
29+
Assert.IsTrue (DexUtils.ContainsClass (className, dexFile, AndroidSdkPath), $"`{dexFile}` should include `{className}`!");
3430
className = "Lmono/MonoRuntimeProvider;";
35-
Assert.IsFalse (DexUtils.ContainsClass (className, dexFile, AndroidSdkPath), $"`{dexFile}` should include `{className}`!");
31+
Assert.IsTrue (DexUtils.ContainsClass (className, dexFile, AndroidSdkPath), $"`{dexFile}` should include `{className}`!");
3632
className = "Lmono/MonoPackageManager;";
3733
Assert.IsTrue (DexUtils.ContainsClass (className, dexFile, AndroidSdkPath), $"`{dexFile}` should include `{className}`!");
3834
} finally {
@@ -49,7 +45,6 @@ public void TargetsSkipped ([Values(false, true)] bool useManagedResourceGenerat
4945
AssertCommercialBuild ();
5046

5147
var proj = new XamarinAndroidApplicationProject () {
52-
AndroidFastDeploymentType = "Assemblies:Dexes",
5348
};
5449
proj.SetProperty ("AndroidUseManagedDesignTimeResourceGenerator", useManagedResourceGenerator.ToString ());
5550
proj.SetProperty ("AndroidUseDesignerAssembly", "False");
@@ -124,7 +119,6 @@ public void SimpleInstallAndUninstall ()
124119
AssertCommercialBuild ();
125120

126121
var proj = new XamarinAndroidApplicationProject {
127-
AndroidFastDeploymentType = "Assemblies:Dexes",
128122
};
129123
proj.SetDefaultTargetDevice ();
130124
var b = CreateApkBuilder (Path.Combine ("temp", TestName));
@@ -139,7 +133,6 @@ public void SkipFastDevAlreadyInstalledFile ()
139133
AssertCommercialBuild ();
140134

141135
var proj = new XamarinAndroidApplicationProject {
142-
AndroidFastDeploymentType = "Assemblies:Dexes",
143136
};
144137
proj.SetDefaultTargetDevice ();
145138
proj.PackageReferences.Add (KnownPackages.AndroidXAppCompat);
@@ -182,7 +175,6 @@ public void SkipFastDevAlreadyInstalledResources (Package [] packages, string ba
182175
AssertCommercialBuild ();
183176

184177
var proj = new XamarinAndroidApplicationProject () {
185-
AndroidFastDeploymentType = "Assemblies:Dexes",
186178
};
187179
proj.SetDefaultTargetDevice ();
188180
foreach (var pkg in packages)
@@ -211,7 +203,6 @@ public void InstantRunResourceChange ()
211203
AssertCommercialBuild ();
212204

213205
var proj = new XamarinAndroidApplicationProject () {
214-
AndroidFastDeploymentType = "Assemblies:Dexes",
215206
};
216207
proj.SetDefaultTargetDevice ();
217208
using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
@@ -236,76 +227,12 @@ public void InstantRunResourceChange ()
236227
}
237228
}
238229

239-
[Test]
240-
public void InstantRunFastDevTypemaps ()
241-
{
242-
AssertCommercialBuild ();
243-
244-
var proj = new XamarinAndroidApplicationProject () {
245-
AndroidFastDeploymentType = "Assemblies:Dexes",
246-
};
247-
proj.SetDefaultTargetDevice ();
248-
using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
249-
Assert.IsTrue (b.Install (proj), "packaging should have succeeded. 0");
250-
var apk = Path.Combine (Root, b.ProjectDirectory,
251-
proj.OutputPath, $"{proj.PackageName}-Signed.apk");
252-
Assert.IsNull (ZipHelper.ReadFileFromZip (apk, "Mono.Android.typemap"), $"Mono.Android.typemap should NOT be in {apk}.");
253-
var logLines = b.LastBuildOutput;
254-
Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_BuildApkFastDev\" completely.") ||
255-
l.Contains ("Target _BuildApkFastDev needs to be built")),
256-
"Apk should have been built");
257-
Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_Upload\" completely")), "_Upload target should have run");
258-
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("Mono.Android.typemap")), "Mono.Android.typemap should have been uploaded");
259-
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("typemap.index")), "typemap.index should have been uploaded");
260-
}
261-
}
262-
263-
[Test]
264-
public void InstantRunNativeLibrary ()
265-
{
266-
AssertCommercialBuild ();
267-
268-
var nativeLib = new AndroidItem.AndroidNativeLibrary ($"foo\\{DeviceAbi}\\libtest.so") {
269-
BinaryContent = () => new byte [10],
270-
MetadataValues = $"Link=libs\\{DeviceAbi}\\libtest.so",
271-
};
272-
var proj = new XamarinAndroidApplicationProject () {
273-
AndroidFastDeploymentType = "Assemblies:Dexes",
274-
OtherBuildItems = {
275-
nativeLib,
276-
},
277-
};
278-
//NOTE: in .NET 6 by default an x86_64 emulator would fall back to x86 if we don't set this.
279-
proj.SetAndroidSupportedAbis (DeviceAbi);
280-
proj.SetDefaultTargetDevice ();
281-
using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
282-
Assert.IsTrue (b.Install (proj), "install should have succeeded. 0");
283-
var logLines = b.LastBuildOutput;
284-
Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_BuildApkFastDev\" completely.") ||
285-
l.Contains ("Target _BuildApkFastDev needs to be built")),
286-
"Apk should have been built");
287-
Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_Upload\" completely")), "_Upload target should have run");
288-
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("libtest.so")), "libtest.so should have been uploaded");
289-
290-
nativeLib.BinaryContent = () => new byte [20];
291-
nativeLib.Timestamp = DateTime.UtcNow.AddSeconds(1);
292-
Assert.IsTrue (b.Install (proj, doNotCleanupOnUpdate: true, saveProject: false), "install should have succeeded. 1");
293-
logLines = b.LastBuildOutput;
294-
Assert.IsFalse (logLines.Any (l => l.Contains ("Building target \"_BuildApkFastDev\" completely.") ||
295-
l.Contains ("Target _BuildApkFastDev needs to be built")),
296-
"Apk should not have been built");
297-
Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_Upload\" completely")), "_Upload target should have run");
298-
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("libtest.so")), "libtest.so should have been uploaded");
299-
}
300-
}
301-
302230
[Test]
303231
public void InstantRunFastDevDexes ([Values (false, true)] bool useEmbeddedDex)
304232
{
305233
AssertCommercialBuild ();
306234

307235
var proj = new XamarinAndroidApplicationProject () {
308-
AndroidFastDeploymentType = "Assemblies:Dexes",
309236
};
310237
proj.SetDefaultTargetDevice ();
311238
proj.AndroidManifest = proj.AndroidManifest.Replace ("<application ", $"<application android:useEmbeddedDex=\"{useEmbeddedDex.ToString ().ToLowerInvariant ()}\" ");
@@ -316,7 +243,6 @@ public void InstantRunFastDevDexes ([Values (false, true)] bool useEmbeddedDex)
316243
l.Contains ("Target _BuildApkFastDev needs to be built")),
317244
"Apk should have been built");
318245
Assert.IsTrue (logLines.Any (l => l.Contains ("Building target \"_Upload\" completely")), "_Upload target should have run");
319-
Assert.IsTrue (logLines.Any (l => l.Contains ("NotifySync CopyFile") && l.Contains ("classes.dex")), "classes.dex should have been uploaded");
320246
ClearAdbLogcat ();
321247
RunProjectAndAssert (proj, b);
322248
Assert.True (WaitForActivityToStart (proj.PackageName, "MainActivity",

0 commit comments

Comments
 (0)