Skip to content

Commit c43c162

Browse files
committed
MAUI project with non-ASCII project name cannot release to my Android phone
1 parent 43dc9ba commit c43c162

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
@@ -205,12 +205,89 @@ public void MonoSymbolicateAndroidStackTrace ()
205205
}) ;
206206
}
207207

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

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

0 commit comments

Comments
 (0)