Skip to content

Commit b5d6f8f

Browse files
committed
MAUI project with non-ASCII project name cannot release to my Android phone
1 parent da2ac33 commit b5d6f8f

File tree

2 files changed

+99
-2
lines changed

2 files changed

+99
-2
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,26 @@ public void BuildBasicApplicationReleaseProfiledAotWithoutDefaultProfile ()
110110
StringAssertEx.DoesNotContainRegex (@$"Using profile data file.*{filename}\.aotprofile", b.LastBuildOutput, "Should not use default AOT profile", RegexOptions.IgnoreCase);
111111
}
112112

113+
[Test]
114+
[Category ("SmokeTests")]
115+
[TestCase ("テスト", false)]
116+
[TestCase ("随机生成器", false)]
117+
[TestCase ("テスト", true)]
118+
[TestCase ("随机生成器", true)]
119+
public void BuildAotApplicationWithSpecialCharactersInProject (string testName, bool aot)
120+
{
121+
var rootPath = Path.Combine (Root, "temp", TestName);
122+
var proj = new XamarinAndroidApplicationProject () {
123+
ProjectName = testName,
124+
IsRelease = true,
125+
AotAssemblies = aot,
126+
};
127+
proj.SetAndroidSupportedAbis ("armeabi-v7a", "arm64-v8a", "x86", "x86_64");
128+
using (var builder = CreateApkBuilder (Path.Combine (rootPath, proj.ProjectName))){
129+
Assert.IsTrue (builder.Build (proj), "Build should have succeeded.");
130+
}
131+
}
132+
113133
static object [] AotChecks () => new object [] {
114134
new object[] {
115135
/* supportedAbis */ "arm64-v8a",

tests/MSBuildDeviceIntegration/Tests/InstallAndRunTests.cs

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,89 @@ public void MonoSymbolicateAndroidStackTrace ()
206206
}) ;
207207
}
208208

209+
static object [] AotChecks () => new object [] {
210+
new object[] {
211+
/* aotAssemblies */ true,
212+
/* enableLLVM */ false,
213+
/* usesAssemblyBlobs */ false,
214+
/* testName*/ "テスト",
215+
},
216+
new object[] {
217+
/* aotAssemblies */ false,
218+
/* enableLLVM */ true,
219+
/* usesAssemblyBlobs */ true,
220+
/* testName*/ "テスト",
221+
},
222+
new object[] {
223+
/* aotAssemblies */ true,
224+
/* enableLLVM */ false,
225+
/* usesAssemblyBlobs */ true,
226+
/* testName*/ "テスト",
227+
},
228+
new object[] {
229+
/* aotAssemblies */ false,
230+
/* enableLLVM */ true,
231+
/* usesAssemblyBlobs */ false,
232+
/* testName*/ "テスト",
233+
},
234+
new object[] {
235+
/* aotAssemblies */ false,
236+
/* enableLLVM */ false,
237+
/* usesAssemblyBlobs */ false,
238+
/* testName*/ "随机生成器",
239+
},
240+
new object[] {
241+
/* aotAssemblies */ true,
242+
/* enableLLVM */ true,
243+
/* usesAssemblyBlobs */ true,
244+
/* testName*/ "随机生成器",
245+
},
246+
new object[] {
247+
/* aotAssemblies */ false,
248+
/* enableLLVM */ false,
249+
/* usesAssemblyBlobs */ true,
250+
/* testName*/ "随机生成器",
251+
},
252+
new object[] {
253+
/* aotAssemblies */ true,
254+
/* enableLLVM */ true,
255+
/* usesAssemblyBlobs */ false,
256+
/* testName*/ "随机生成器",
257+
},
258+
};
259+
209260
[Test]
210261
[Category ("UsesDevice")]
211-
public void SmokeTestBuildAndRunWithSpecialCharacters ()
262+
[TestCaseSource (nameof (AotChecks))]
263+
public void SmokeTestNativeBuildAndRunWithSpecialCharacters (bool aotAssemblies, bool enableLLVM, bool usesAssemblyBlobs, string testName)
212264
{
213-
var testName = "テスト";
265+
AssertHasDevices ();
214266

267+
var rootPath = Path.Combine (Root, "temp", TestName);
268+
var proj = new XamarinAndroidApplicationProject () {
269+
ProjectName = testName,
270+
AotAssemblies = aotAssemblies,
271+
IsRelease = true,
272+
};
273+
proj.SetProperty ("EnableLLVM", enableLLVM.ToString ());
274+
proj.SetProperty ("AndroidUseAssemblyStore", usesAssemblyBlobs.ToString ());
275+
proj.SetAndroidSupportedAbis ("armeabi-v7a", "x86", "x86_64");
276+
proj.SetDefaultTargetDevice ();
277+
using (var builder = CreateApkBuilder (Path.Combine (rootPath, proj.ProjectName))){
278+
Assert.IsTrue (builder.Install (proj), "Install should have succeeded.");
279+
Assert.IsTrue (builder.RunTarget (proj, "_Run", doNotCleanupOnUpdate: true), "Project should have run.");
280+
var timeoutInSeconds = 120;
281+
Assert.IsTrue (WaitForActivityToStart (proj.PackageName, "MainActivity",
282+
Path.Combine (Root, builder.ProjectDirectory, "startup-logcat.log"), timeoutInSeconds));
283+
}
284+
}
285+
286+
[Test]
287+
[Category ("UsesDevice")]
288+
[TestCase ("テスト")]
289+
[TestCase ("随机生成器")]
290+
public void SmokeTestBuildAndRunWithSpecialCharacters (string testName)
291+
{
215292
var rootPath = Path.Combine (Root, "temp", TestName);
216293
var proj = new XamarinFormsAndroidApplicationProject () {
217294
ProjectName = testName,

0 commit comments

Comments
 (0)