Closed novabyte closed 8 years ago
Do you also have the "normal" mono runtime installed, without using macports or brew or fink? Because it seems you also have it installed in /usr/local/lib.
Just tested this particular case and indeed, seems it's better to parse the contents of the xbuild file to detect the root of the current xbuild.
Hi @timotei. Thanks for getting back to me.
I installed the standard Mono runtime using brew install mono
with Homebrew. I also have Unity Editor installed as well as Xamarin. It may be that another installation is being used to look up the path to the Mono runtime.
@timotei Is there some way I can override the XBuildResolver
and supply my own implementation with the plugin?
Sorry @novabyte, was pretty busy and couldn't look at it. I'll do it after 13th of September if not solved by then :)
With regards to the resolver, the msbuild plugin has the resolver property which you can set to an implementation of IExecutableResolver.
@timotei Perfect. I'll work around it with my own implementation of IExecutableResolver
. :smile:
If you feel that you can contribute it back (and is general enough), feel free to open a Pull Request ;)
@timotei If I get some time I'll generalise the IExecutableResolver
for xbuild
and submit a PR but right now I've completely hacked the project together to move forwards quickly with:
class CustomXBuildResolver implements IExecutableResolver {
ProcessBuilder executeDotNet(File exe) {
return new ProcessBuilder("mono", exe.toString());
}
void setupExecutable(Msbuild msbuild) {
msbuild.executable = "xbuild";
msbuild.msbuildDir = "/usr/local/bin"; // hardcode path
}
}
It is of course no use at all in the general case.
First problem is that on Mac OS X we can't "associate" .exe files to the mono runtime, like we can on Linux. Also for some reason the test is failing but it wasn't at the time I implemented the support.
@novabyte Could you maybe check my pr https://github.com/Ullink/gradle-msbuild-plugin/pull/47 here?
@timotei Sure. I'll take a look tomorrow morning - I'm away from the laptop atm. :smiley:
@novabyte Any update?
Hi @timotei Sorry I've not gotten back to you sooner. Things have been very busy (as always). Everything works very well; I tested with the latest 2.11 release. No more need for my workaround. :smiley:
I think I've stumbled upon a resolution error with the
XBuildResolver
code. I have Mono installed on OSX via Homebrew:If I use
which
I can see:xbuild
is a "POSIX shell script text executable". The file itself looks like:At the moment with my simple test project I get the following output when run with
--info
level:I believe the problem is that the plugin is trying to invoke
xbuild.exe
directly on OSX which does not work without being called by the Mono runtime. I think the plugin should use thexbuild
POSIX script to execute a build.