From f3be0de916cec2c0061fba4a6fbac2f47fbc5a61 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Thu, 14 Jul 2022 19:57:16 -0400 Subject: [PATCH] [Xamarin.Android.Tools.Bytecode-Tests] Fix BuildClasses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `BuildClasses` target runs on every rebuild: % dotnet build … Build succeeded. "…/Java.Interop/Java.Interop.sln" (default target) (1:2) -> "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj" (default target) (16:14) -> "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj" (Build target) (16:15) -> (BuildClasses target) -> EXEC : warning : [options] bootstrap class path not set in conjunction with -source 8 […/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj] "…/Java.Interop/Java.Interop.sln" (default target) (1:2) -> "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj" (default target) (16:14) -> "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj" (Build target) (16:16) -> EXEC : warning : [options] bootstrap class path not set in conjunction with -source 8 […/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj] "…/Java.Interop/Java.Interop.sln" (default target) (1:2) -> "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj" (default target) (16:14) -> "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj" (Build target) (16:15) -> EXEC : warning : [options] bootstrap class path not set in conjunction with -source 8 […/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj] "…/Java.Interop/Java.Interop.sln" (default target) (1:2) -> "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj" (default target) (16:14) -> "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj" (Build target) (16:16) -> EXEC : warning : [options] bootstrap class path not set in conjunction with -source 8 […/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj] 4 Warning(s) 0 Error(s) % dotnet build # same as above; EXEC warnings from `BuildClasses` target % dotnet build # ad infinitum The cause for the warnings -- and the repetitive `BuildClasses` target execution -- is that the `@(_BuildClassOutputs)` item group is wrong; from the Dignostic build log: Target "BuildClasses: (TargetId:301)" in file "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.targets" from project "…/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj" (target "BeforeCompile" depends on it): Building target "BuildClasses" completely. Output file "obj//Debug-net7.0/classes/Collection.class" does not exist. `obj/Debug-net7.0/classes/Collection.class` doesn't exist because it will *never* exist; the file created is *actually* `obj/Debug-net7.0/classes/java/util/Collection.class`. Note the "missing" `java/util` in the path. The cause of the missing `java/util` is that `@(_BuildClassOutputs)` uses `%(RecursiveDir)`, which only expands `**` wildcards, while `Collection.java` comes from: Note the *lack* of `**`. Consequently, `%(RecursiveDir)` expanded as the empty string, which is why `java/util` was "lost". Fix this by introducing wildcards: This fixes the repetitive `BuildClasses` execution: % dotnet build … EXEC : warning : [options] bootstrap class path not set in conjunction with -source 8 […/Java.Interop/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj] % dotnet build % no `EXEC : warning` message --- .../Xamarin.Android.Tools.Bytecode-Tests.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.targets b/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.targets index 651460d43..3783e3a2a 100644 --- a/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.targets +++ b/tests/Xamarin.Android.Tools.Bytecode-Tests/Xamarin.Android.Tools.Bytecode-Tests.targets @@ -1,7 +1,7 @@ - +