Skip to content

Conversation

@harry-cpp
Copy link
Contributor

The xabuild script is really only useful if you want to compile XA project without installing XA into system, if you are already installing it into system, calling xbuild/msbuild works just fine.

@monojenkins
Copy link

Hello! I'm the build bot for the Mono project.

I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done. Additional trigger words are available here.

Contributors can ignore this message.

2 similar comments
@monojenkins
Copy link

Hello! I'm the build bot for the Mono project.

I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done. Additional trigger words are available here.

Contributors can ignore this message.

@monojenkins
Copy link

Hello! I'm the build bot for the Mono project.

I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done. Additional trigger words are available here.

Contributors can ignore this message.

@dnfclas
Copy link

dnfclas commented Aug 18, 2017

@cra0zy,
Thanks for having already signed the Contribution License Agreement. Your agreement was validated by .NET Foundation. We will now review your pull request.
Thanks,
.NET Foundation Pull Request Bot

@jonpryor
Copy link
Contributor

jonpryor commented Aug 18, 2017

if you are already installing it into system, calling xbuild/msbuild works just fine.

Therein lines the problem/question: xbuild/msbuild only works if you run:

make install prefix=/usr

For any other $(prefix) value, this analysis is (probably) incorrect.

That doesn't directly answer what should be done. Arguably, PR #253 should take this logic to heart and not install /usr/bin/xabuild. However, what should be done in this PR?

My current gut feeling -- without too much additional thought -- is that if $(prefix)/bin/mono exists, then xabuild should not be installed. Otherwise, it should be installed.

@harry-cpp
Copy link
Contributor Author

My question then is why would you want to install it in a directory where xbuild/msbuild will not pick it up?

@jonpryor
Copy link
Contributor

My question then is why would you want to install it in a directory where xbuild/msbuild will not pick it up?

Side-by-side installs. There Can Be Only One installation into an msbuild/xbuild-accessible location (unless you have multiple mono installs...). xabuild will set things up to force an in-$PATH xbuild/msbuild to use the paths of the installation associated with xabuild.

For example:

$ make install prefix=/tmp/testing
$ xbuild samples/HelloWorld/HelloWorld.csproj
# will fail; `$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets` doesn't exist

$ /tmp/testing/bin/xabuild samples/HelloWorld/HelloWorld.csproj
# should work

@harry-cpp
Copy link
Contributor Author

True, but they could just call xbuild with few extra arguments if they need to. xabuild is just a wrapper for xbuild that I don't think should get installed in the system.

How about adding an extra argument that allows you to switch installing xabuild if you want to?

@jonpryor
Copy link
Contributor

they could just call xbuild with few extra arguments if they need to.

Extra arguments are extra complexity, in terms of documentation.

Then again, I want to argue for more magic...which requires more documentation. Hm...

What I'm thinking is, instead of removing:

cp tools/scripts/xabuild "$(prefix)/bin/xabuild"

Change it to:

if [ ! -e "$(prefix)/bin/mono" ] ; then \
  cp tools/scripts/xabuild "$(prefix)/bin/xabuild"
fi

This would allow make install prefix=/usr to not create /usr/bin/xabuild, but other prefixes would install it.

@harry-cpp
Copy link
Contributor Author

Yea, I got what you requested, I was asking if adding an additional argument variable would have been better.... anyway done :|

@jonpryor jonpryor merged commit 6ae4b6b into dotnet:master Aug 18, 2017
@harry-cpp harry-cpp deleted the linstall branch August 18, 2017 22:46
@borgdylan
Copy link

borgdylan commented Aug 20, 2017

My active mono install is in usr/local. That would break my install. xabuild is quite a useful wrapper and allows XA to change defaults and certain installation details without breaking already existing projects. The more useful action would have been to reject this PR entirely. It would be an extra hassle to keep setting environment variables to the android sdk as well as set the extensions path, which the script already does.

@harry-cpp
Copy link
Contributor Author

It would be an extra hassle to keep setting environment variables to the android sdk as well as set the extensions path, which the script already does.

There is a way of auto setting XA environmental variables for msbuild/xbuild, create file "~/.config/xbuild/monodroid-config.xml" with the following contents:

<?xml version="1.0" encoding="utf-8"?>
<monodroid>
	<android-sdk path="/path/to/your/Android/Sdk" />
  
	<!-- Only needs specifying in case one of them is not found in default location -->
	<!-- android-ndk path="" -->
	<!-- java-sdk path="" -->
</monodroid>

@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.

5 participants