Skip to content

Conversation

@jonathanpeppers
Copy link
Member

Fixes: #1135
Context: #1068

When making changes in #1068, I added a unit test that builds an
application with both spaces and parentheses in its path. However, this
was not enough to test everything; the test also needed an
AndroidJavaLibrary build item with spaces and parentheses in its name!

Changes:

  • Made a Hello (World).jar file, that has a single class in it
  • Added the jar file as a AndroidJavaLibrary, in
    the BuildApplicationWithSpacesInPath test
  • Reverted Proguard.cs and CreateMultiDexMainDexClassList.cs from
    what I did in [Xamarin.Android.Build.Tasks] fix for proguard enclosing char on windows #1068 -- Dean tried to warn me
  • Move the (!META-INF/MANIFEST.MF) filter expression outside the
    single quotes
  • For the -injars expression to work on both macOS and Windows,
    I had to enclose the entire expression in double-quotes

PR #1068 was a good attempt at trying to cleanup the code, but I could
not get the manifest filter to work along with a path including a
parentheses.

Fixes: dotnet#1135
Context: dotnet#1068

When making changes in dotnet#1068, I added a unit test that builds an
application with both spaces and parentheses in its path. However, this
was not enough to test everything; the test also needed an
`AndroidJavaLibrary` build item with spaces and parentheses in its name!

Changes:
- Made a `Hello (World).jar` file, that has a single class in it
- Added the jar file as a `AndroidJavaLibrary`, in
the `BuildApplicationWithSpacesInPath` test
- Reverted `Proguard.cs` and `CreateMultiDexMainDexClassList.cs` from
what I did in dotnet#1068 -- Dean tried to warn me
- Move the `(!META-INF/MANIFEST.MF)` filter expression outside the
single quotes
- For the `-injars` expression to work on *both* macOS and Windows,
I had to enclose the entire expression in double-quotes

PR dotnet#1068 was a good attempt at trying to cleanup the code, but I could
not get the manifest filter to work along with a path including a
parentheses.
@jonathanpeppers
Copy link
Member Author

I manually triggered a Windows PR build (I figured out how to properly do that).

@jonpryor jonpryor merged commit d1bc533 into dotnet:master Dec 22, 2017
jonpryor pushed a commit that referenced this pull request Dec 23, 2017
…th (#1137)

Fixes: #1135
Context: commit 2c2d47c

When making changes in 2c2d47c, I added a unit test that builds an
application with both spaces and parentheses in its path. However,
this was not enough to test everything; the test also needed an
`@(AndroidJavaLibrary)` build item with spaces and parentheses in
its name!

Changes:

  - Made a `Hello (World).jar` file, that has a single class in it
  - Added the jar file as a `AndroidJavaLibrary`, in
    the `BuildApplicationWithSpacesInPath` test
  - Reverted `Proguard.cs` and `CreateMultiDexMainDexClassList.cs` from
    what I did in 2c2d47c -- Dean tried to warn me
  - Move the `(!META-INF/MANIFEST.MF)` filter expression outside the
    single quotes
  - For the `-injars` expression to work on *both* macOS and Windows,
    I had to enclose the entire expression in double-quotes

2c2d47c was a good attempt at trying to cleanup the code, but I
could not get the manifest filter to work along with a path including
a parentheses.
@jonathanpeppers jonathanpeppers deleted the fix-proguard-1135 branch June 12, 2019 13:15
jonpryor pushed a commit that referenced this pull request Dec 9, 2020
Context: #5331

Changes: xamarin/monodroid@0eef889...27736a7

  * xamarin/monodroid@27736a7ff: [tools/msbuild] Fix App Bundle deployment (#1142)
  * xamarin/monodroid@f38dbc7ab: [tools/msbuild] use @(_AndroidMSBuildAllProjects) (#1140)
  * xamarin/monodroid@cfa21d57b: [tools/msbuild] Fix some issues with FastDev (#1139)
  * xamarin/monodroid@3ba648386: [tools/msbuild] Add missing parameter to BuildAppBundle. (#1138)
  * xamarin/monodroid@5bb29971b: [tools/msbuild] Add Multi User Support for Debugging. (#1135)
  * xamarin/monodroid@156abf47c: [tools/msbuild] default $(_AndroidAllowDeltaInstall) to false (#1137)
  * xamarin/monodroid@fbc961218: [build] Pass EnableCompression to BuildApk (#1094)

Add support for running multi-user unit tests on device.  It makes
use of various adb commands to create test users and remove them.

Create a guest user with name `{name}`:

	adb shell pm create-user --guest {name}

Remove a guest user with the specified user id `{userId}`:

	adb shell pm remove-user --guest {userId}

Note that user creation takes a "name", while deletion takes an id.
To obtain the mapping, use:

	$ adb shell pm list users
	Users:
		UserInfo{0:Owner:c13} running
		UserInfo{10:guest1:414}

The userId is the number *between* the `{` and the `:` and user name.
The userId for `Owner` is 0, while the userId for `guest1` is 10.

We can then use a `Regex` to pull out the required `userId` for a
specific user.

To switch a device to use user `{userId}`:

	adb shell am switch-user {userId}

Emulators seem to create the main user with the name "Owner", so that
should be the default name we use for the main user.  In the unit
tests if we cannot find a user named "Owner" when looking for "Owner"
we will default to a `userId` of `0`.  User ID 0 always means the
default user.  This is to handle the case where we are testing locally
on devices where the main user is not called "Owner".
@github-actions github-actions bot locked and limited conversation to collaborators Feb 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Encountering new path escaping issues when using multidex/proguard on Windows

2 participants