-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
A property set in a target before CallTarget isn't set at the called target #1006
Comments
This has been a limitation for a while as far as I know |
…tion Context: https://github.com/xamarin/XamarinAndroidXMigration Fixes: dotnet#4068 Developers have been reporting an error when using AndroidX.Migration: The "CopyGeneratedJavaResourceClasses" task was not given a value for the required parameter "SourceTopDirectory". It is reported another build fixes the issue, and it "randomly" happens on incremental builds. The error seems to indicate either `$(AaptTemporaryDirectory)` or `$(ResgenTemporaryDirectory)` are blank? But it only happens when using the AndroidX.Migration NuGet package. From a user's build log: Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files. Which would indicate in the case of AndroidX.Migration: * `_PrepareCreateBaseApk` was skipped. * `_AndroidXJetifyManifest` was injected, it came along and modified `$(IntermediateOutputPath)android\AndroidManifest.xml`. * `_CreateBaseApk` ran (with updated inputs), and `$(AaptTemporaryDirectory)` is blank! I could reproduce the problem in a test: * Build a project with AndroidX.Migration * Change C# code (a non-Java.Lang.Object class) * Build the project again Reviewing the MSBuild targets: `_PrepareCreateBaseApk` and `_CreateBaseApk`. They define a property that is passed between two targets. The following sets of targets have nearly identical `Input`/`Output`: * `_PrepareCreateBaseApk` and `_CreateBaseApk` * `_PrepareUpdateAndroidResgen` and `_UpdateAndroidResgen` This was done to workaround a long-lived bug in MSBuild: dotnet/msbuild#1006 A fix that doesn't seem break anything is to just run `_PrepareCreateBaseApk` *after* `$(AfterGenerateAndroidManifest)`. So if something triggers `_CreateBaseApk`, `_PrepareCreateBaseApk` will always run as well. I wrote a test for this scenario, and updated the AndroidX NuGets in our tests to use the RC now.
…tion Context: https://github.com/xamarin/XamarinAndroidXMigration Fixes: dotnet#4068 Developers have been reporting an error when using AndroidX.Migration: The "CopyGeneratedJavaResourceClasses" task was not given a value for the required parameter "SourceTopDirectory". It is reported another build fixes the issue, and it "randomly" happens on incremental builds. The error seems to indicate either `$(AaptTemporaryDirectory)` or `$(ResgenTemporaryDirectory)` are blank? But it only happens when using the AndroidX.Migration NuGet package. From a user's build log: Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files. Which would indicate in the case of AndroidX.Migration: * `_PrepareCreateBaseApk` was skipped. * `_AndroidXJetifyManifest` was injected, it came along and modified `$(IntermediateOutputPath)android\AndroidManifest.xml`. * `_CreateBaseApk` ran (with updated inputs), and `$(AaptTemporaryDirectory)` is blank! I could reproduce the problem in a test: * Build a project with AndroidX.Migration * Change C# code (a non-Java.Lang.Object class) * Build the project again Reviewing the MSBuild targets: `_PrepareCreateBaseApk` and `_CreateBaseApk`. They define a property that is passed between two targets. The following sets of targets have nearly identical `Input`/`Output`: * `_PrepareCreateBaseApk` and `_CreateBaseApk` * `_PrepareUpdateAndroidResgen` and `_UpdateAndroidResgen` This was done to workaround a long-lived bug in MSBuild: dotnet/msbuild#1006 A fix that doesn't seem break anything is to just run `_PrepareCreateBaseApk` *after* `$(AfterGenerateAndroidManifest)`. So if something triggers `_CreateBaseApk`, `_PrepareCreateBaseApk` will always run as well. I wrote a test for this scenario, and updated the AndroidX NuGets in our tests to use the RC now.
…tion (#4151) Context: https://github.com/xamarin/XamarinAndroidXMigration Fixes: #4068 Developers have been reporting an error when using AndroidX.Migration: The "CopyGeneratedJavaResourceClasses" task was not given a value for the required parameter "SourceTopDirectory". It is reported another build fixes the issue, and it "randomly" happens on incremental builds. The error seems to indicate either `$(AaptTemporaryDirectory)` or `$(ResgenTemporaryDirectory)` are blank? But it only happens when using the AndroidX.Migration NuGet package. From a user's build log: Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files. Which would indicate in the case of AndroidX.Migration: * `_PrepareCreateBaseApk` was skipped. * `_AndroidXJetifyManifest` was injected, it came along and modified `$(IntermediateOutputPath)android\AndroidManifest.xml`. * `_CreateBaseApk` ran (with updated inputs), and `$(AaptTemporaryDirectory)` is blank! I could reproduce the problem in a test: * Build a project with AndroidX.Migration * Change C# code (a non-Java.Lang.Object class) * Build the project again Reviewing the MSBuild targets: `_PrepareCreateBaseApk` and `_CreateBaseApk`. They define a property that is passed between two targets. The following sets of targets have nearly identical `Input`/`Output`: * `_PrepareCreateBaseApk` and `_CreateBaseApk` * `_PrepareUpdateAndroidResgen` and `_UpdateAndroidResgen` This was done to workaround a long-lived bug in MSBuild: dotnet/msbuild#1006 A fix that doesn't seem break anything is to just run `_PrepareCreateBaseApk` *after* `$(AfterGenerateAndroidManifest)`. So if something triggers `_CreateBaseApk`, `_PrepareCreateBaseApk` will always run as well. I wrote a test for this scenario, and updated the AndroidX NuGets in our tests to use the RC now.
…tion (#4151) Context: https://github.com/xamarin/XamarinAndroidXMigration Fixes: #4068 Developers have been reporting an error when using AndroidX.Migration: The "CopyGeneratedJavaResourceClasses" task was not given a value for the required parameter "SourceTopDirectory". It is reported another build fixes the issue, and it "randomly" happens on incremental builds. The error seems to indicate either `$(AaptTemporaryDirectory)` or `$(ResgenTemporaryDirectory)` are blank? But it only happens when using the AndroidX.Migration NuGet package. From a user's build log: Skipping target "_PrepareCreateBaseApk" because all output files are up-to-date with respect to the input files. Which would indicate in the case of AndroidX.Migration: * `_PrepareCreateBaseApk` was skipped. * `_AndroidXJetifyManifest` was injected, it came along and modified `$(IntermediateOutputPath)android\AndroidManifest.xml`. * `_CreateBaseApk` ran (with updated inputs), and `$(AaptTemporaryDirectory)` is blank! I could reproduce the problem in a test: * Build a project with AndroidX.Migration * Change C# code (a non-Java.Lang.Object class) * Build the project again Reviewing the MSBuild targets: `_PrepareCreateBaseApk` and `_CreateBaseApk`. They define a property that is passed between two targets. The following sets of targets have nearly identical `Input`/`Output`: * `_PrepareCreateBaseApk` and `_CreateBaseApk` * `_PrepareUpdateAndroidResgen` and `_UpdateAndroidResgen` This was done to workaround a long-lived bug in MSBuild: dotnet/msbuild#1006 A fix that doesn't seem break anything is to just run `_PrepareCreateBaseApk` *after* `$(AfterGenerateAndroidManifest)`. So if something triggers `_CreateBaseApk`, `_PrepareCreateBaseApk` will always run as well. I wrote a test for this scenario, and updated the AndroidX NuGets in our tests to use the RC now.
..... Please...... fix... this... for the love of everything sane. I have also run into this same scenario with items defined in item groups. I was trying to define an item group within one target and then execute a second target with a condition: @(Item->Count())>0. Count was never greater than zero even though the items were defined in the previous target. Please fix for both properties & item / groups. Also, while we are at it... please let me pass actual parameters into targets instead of having to define global property groups to pass parameters into targets |
Example:
That's surprising! It certainly seems to have been set correctly (and a diag log indicates that too), but it's not available in the other target.
This was pointed out by @rohit21agrawal over IM.
The text was updated successfully, but these errors were encountered: