-
Notifications
You must be signed in to change notification settings - Fork 63
[build] Fix 'BuildVersionInfo_g_cs' build target. #881
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The commit 3e6a623 added a new target 'BuildVersionInfo_g_cs' which is responsible for generating the `BuildVersionInfo_g_cs` in the `$(IntermediateOutputPath)`. However it turns out the `$(IntermediateOutputPath)` has not been created when the target is run, so we end up with the following error. ``` /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: The "GenerateVersionFile" task failed unexpectedly. [/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop-MonoAndroid.csproj] /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path "/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release-monoandroid10/Java.Interop.AssemblyInfo.g.cs". [/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop-MonoAndroid.csproj] /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x00164] in <85ce94efa4ba468a921bc3ed4ecd0dbe>:0 [/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop-MonoAndroid.csproj] /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) [0x00000] in <85ce94efa4ba468a921bc3ed4ecd0dbe>:0 [/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop-MonoAndroid.csproj] /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions) [/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop-MonoAndroid.csproj] /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) [0x00055] in <85ce94efa4ba468a921bc3ed4ecd0dbe>:0 [/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop-MonoAndroid.csproj] /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.StreamWriter..ctor (System.String path) [0x00008] in <85ce94efa4ba468a921bc3ed4ecd0dbe>:0 [/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop-MonoAndroid.csproj] /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string) [/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop-MonoAndroid.csproj] /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.File.WriteAllText (System.String path, System.String contents) [0x00026] in <85ce94efa4ba468a921bc3ed4ecd0dbe>:0 [/mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop-MonoAndroid.csproj] /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at Java.Interop.BootstrapTasks.GenerateVersionFile.Execute () [0x00042] in /mnt/vss/_work/1/s/xamarin-android/external/Java.Interop/build-tools/Java.Interop.BootstrapTasks/Java.Interop.BootstrapTasks/GenerateVersionFile.cs:23 ``` So lets create the directory before we try to create the file.
fe34b76 to
876d11d
Compare
jpobst
approved these changes
Sep 14, 2021
jpobst
pushed a commit
that referenced
this pull request
Sep 30, 2021
Commit 3e6a623 added a new target 'BuildVersionInfo_g_cs', which is responsible for generating the file `$(IntermediateOutputPath)$(AssemblyName).AssemblyInfo.g.cs)`. Unfortunately, it turns out that`$(IntermediateOutputPath)` has not been created when the target is run, so we error out: …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: The "GenerateVersionFile" task failed unexpectedly. …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: System.IO.DirectoryNotFoundException: Could not find a part of the path "…/external/Java.Interop/src/Java.Interop/obj/Release-monoandroid10/Java.Interop.AssemblyInfo.g.cs". …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.IO.FileOptions options) …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare,int,System.IO.FileOptions) …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.StreamWriter..ctor (System.String path, System.Boolean append, System.Text.Encoding encoding, System.Int32 bufferSize) …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.StreamWriter..ctor (System.String path) …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at (wrapper remoting-invoke-with-check) System.IO.StreamWriter..ctor(string) …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at System.IO.File.WriteAllText (System.String path, System.String contents) …/Java.Interop/src/Java.Interop/Directory.Build.targets(44,5): error MSB4018: at Java.Interop.BootstrapTasks.GenerateVersionFile.Execute () Ensure that `$(IntermediateOutputPath)` exists by moving the `BuildVersionInfo_g_cs` target to run *after* the `BuildJniEnvironment_g_cs` target, which creates `$(IntermediateOutputPath)`. Additionally, update the Condition which sets `$(JIBuildingForNetCoreApp)` so that `$(JIBuildingForNetCoreApp)` is *not* when `$(TargetFramework)` starts with `monoandroid`. This avoids the error: error MSB3073: The command "$HOME/android-toolchain/dotnet/dotnet "…/Java.Interop/bin/BuildDebug-monoandroid10/jnienv-gen.dll" Java.Interop/JniEnvironment.g.cs obj/Debug-monoandroid10/jni.c" exited with code 1
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The commit 3e6a623 added a new target 'BuildVersionInfo_g_cs' which is
responsible for generating the
BuildVersionInfo_g_csin the$(IntermediateOutputPath).However it turns out the
$(IntermediateOutputPath)has not been created when the target isrun, so we end up with the following error.
So lets create the directory before we try to create the file.
Added a check for the
monoandroidTargetFramework as it was causing the following build error on Xamarin.Android