Skip to content

[Xamarin.Android.Build.Tasks] Preserve @(AndroidEnvironment) #729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 10, 2017

Conversation

jonpryor
Copy link
Contributor

@jonpryor jonpryor commented Aug 9, 2017

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=58673

The @(AndroidEnvironment) Build action is supposed to be usable on
Library projects. When used within a Library project, the
@(AndroidEnvironment) files are embedded into the assembly, and
during the App project build they are extracted and merged into the
environment file within the .apk.

Unfortunately, this behavior was potentially broken in commit
8688832, as if the Library assembly also contains the
__AndroidLibraryProjects__.zip embedded resource (e.g. the Library
project has a @(AndroidResource) Build action), the extraction of
the __AndroidLibraryProjects__.zip resource will inadvertently
remove the previously extracted @(AndroidEnvironment) files.

Oops.

Alter the paths provided to Files.ExtractAll() -- which was
directly responsible for deleting the environment files -- so that it
won't delete the environment files.

Update the tests/locales on-device unit tests to make use of a
Library-provided @(AndroidEnvironment), and add a unit test which
reads the environment variable and asserts that the environment
variable has the expected value.

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=58673

The `@(AndroidEnvironment)` Build action is *supposed to be* usable on
Library projects. When used within a Library project, the
`@(AndroidEnvironment)` files are embedded into the assembly, and
during the App project build they are extracted and merged into the
`environment` file within the `.apk`.

Unfortunately, this behavior was potentially broken in commit
8688832, as if the Library assembly also contains the
`__AndroidLibraryProjects__.zip` embedded resource (e.g. the Library
project has a `@(AndroidResource)` Build action), the extraction of
the `__AndroidLibraryProjects__.zip` resource will inadvertently
remove the previously extracted `@(AndroidEnvironment)` files.

Oops.

Alter the paths provided to `Files.ExtractAll()` -- which was
directly responsible for deleting the environment files -- so that it
won't delete the environment files.

Update the `tests/locales` on-device unit tests to make use of a
Library-provided `@(AndroidEnvironment)`, and add a unit test which
reads the environment variable and asserts that the environment
variable has the expected value.
updated |= Files.ExtractAll (zip, outDirForDll, modifyCallback: (entryFullName) => {
return entryFullName.Replace ("library_project_imports", ImportsDirectory);
updated |= Files.ExtractAll (zip, importsDir, modifyCallback: (entryFullName) => {
return entryFullName.Replace ("library_project_imports/", "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we prefer "" over string.Empty ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignore that last comment

@dellis1972
Copy link
Contributor

something weird on the build machine...all the calls to a cross-* exe are failing..

: error XA3001: System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.ComponentModel.Win32Exception: ApplicationName='/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android/Darwin/cross-arm', CommandLine='--aot=outfile=/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/SequencePointChecks/obj/Release/aot/armeabi-v7a/libaot-Mono.Android.dll.so,asmwriter,mtriple=armv7-linux-gnueabi,tool-prefix=/Users/builder/android-toolchain/ndk/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-,ld-flags=,llvm-path=/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android/Darwin,temp-path=/Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/SequencePointChecks/obj/Release/aot/armeabi-v7a/Mono.Android.dll /Users/builder/jenkins/workspace/xamarin-android-pr-builder/xamarin-android/bin/TestDebug/temp/SequencePointChecks/obj/Release/android/assets/shrunk/Mono.Android.dll', CurrentDirectory='', Native error= Cannot find the specified file
at System.Diagnostics.Process.StartWithCreateProcess (System.Diagnostics.ProcessStartInfo startInfo) [0x002dc] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/System/System.Diagnostics/Process.cs:768
at System.Diagnostics.Process.Start () [0x0003a] in /Users/builder/data/lanes/5263/mono-mac-sdk/external/bockbuild/builds/mono-x64/mcs/class/referencesource/System/services/monitoring/system/diagnosticts/Process.cs:2005

@dellis1972
Copy link
Contributor

does not seem to be related to the PR..

@dellis1972
Copy link
Contributor

Gonna kick off the build again.. The old build (for reference) is at [1].

[1] https://jenkins.mono-project.com/job/xamarin-android-pr-builder/1320/

@dellis1972
Copy link
Contributor

build

1 similar comment
@jonpryor
Copy link
Contributor Author

build

@jonpryor jonpryor merged commit ea6b9b4 into dotnet:master Aug 10, 2017
jonpryor added a commit that referenced this pull request Aug 10, 2017
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=58673

The `@(AndroidEnvironment)` Build action is *supposed to be* usable on
Library projects. When used within a Library project, the
`@(AndroidEnvironment)` files are embedded into the assembly, and
during the App project build they are extracted and merged into the
`environment` file within the `.apk`.

Unfortunately, this behavior was potentially broken in commit
8688832, as if the Library assembly also contains the
`__AndroidLibraryProjects__.zip` embedded resource (e.g. the Library
project has a `@(AndroidResource)` Build action), the extraction of
the `__AndroidLibraryProjects__.zip` resource will inadvertently
remove the previously extracted `@(AndroidEnvironment)` files.

Oops.

Alter the paths provided to `Files.ExtractAll()` -- which was
directly responsible for deleting the environment files -- so that it
won't delete the environment files.

Update the `tests/locales` on-device unit tests to make use of a
Library-provided `@(AndroidEnvironment)`, and add a unit test which
reads the environment variable and asserts that the environment
variable has the expected value.
jonpryor pushed a commit that referenced this pull request Oct 20, 2020
Fixes: dotnet/java-interop#461
Fixes: dotnet/java-interop#682
Fixes: dotnet/java-interop#717
Fixes: dotnet/java-interop#719
Fixes: dotnet/java-interop#728

Changes: dotnet/java-interop@ac914ce...b991bb8

  * dotnet/java-interop@b991bb86: [generator] Revert change to use auto-properties in EventArgs classes (#736)
  * dotnet/java-interop@ee50d89b: Bump to xamarin/xamarin-android-tools/master@f2af06f2 (#733)
  * dotnet/java-interop@a0b895c1: [build] Suppress NuGet warnings (#730)
  * dotnet/java-interop@8b1b0507: [generator] Fix parsing of complex generic types (#729)
  * dotnet/java-interop@ee7afeed: [generator] Prevent generating duplicate EventArgs classes (#726)
  * dotnet/java-interop@1f21f38c: [generator] Use GC.KeepAlive for reference type method parameters. (#725)
  * dotnet/java-interop@5136ef98: [Xamarin.Android.Tools.Bytecode] Hide Kotlin nested types inside (#723)
  * dotnet/java-interop@53d60513: [jnimarshalmethod-gen] Fix registration on Windows (#721)
  * dotnet/java-interop@5a834d42: [jnimarshalmethod-gen] Avoid creating AppDomains (#720)
  * dotnet/java-interop@a76edb8c: [Xamarin.Android.Tools.ApiXmlAdjuster] Find app.android.IntentService (#718)
  * dotnet/java-interop@6cde0877: [Java.Interop] Emit a reference assembly for Java.Interop.dll (#716)
  * dotnet/java-interop@b858dc59: [generator] Provide line/col numbers for api.xml warnings (#715)
  * dotnet/java-interop@9be92a04: [ci] Don't kick off CI for documentation only changes. (#712)
  * dotnet/java-interop@03c22722: [jnimarshalmethod-gen] Fix type resolution crash (#706)
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 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.

3 participants