using variables in bazel WORKSPACE script - bazel

I'm using a bazel WORKSPACE file that is shared among several users. Each user needs to use his respective home directory path inside the WORKSPACE file.
android_ndk_repository(
name = "androidndk",
path = "/home/some_specific_username/Android/Sdk/ndk-bundle/21.3.6528147",
)
Is there a way to replace some_specific_username by a variable? Something like
android_ndk_repository(
name = "androidndk",
path = "/home/$USER/Android/Sdk/ndk-bundle/21.3.6528147",
)
which would be whatever the current bash value of "$USER" is

android_ndk_repository will read the ANDROID_NDK_HOME environment variable if path is not set, so you can remove path and have each user set that environment variable. See https://docs.bazel.build/versions/main/be/android.html#android_ndk_repository.path

Related

WIN: Setting a path to the executable - creating a new Environmental Variable vs. using $PATH

I am currently working on a script that uses an executable to perform certain tasks. In order for the script to find the executable file it needs to know the directory on the Windows where the executable resides. So I decided to store the path to the executable into an Environmental Variable and read out it from the script.
So I have 2 options on how to store the info into the environmetnal variables:
Either create my own Environmental Variable $MY_ENV_VAR and assign the path to the executable to it.
Or add the path to the executable directly to the existing $PATH variable of the Windows OS and let the script search through the paths listed in the $PATH to find the executable.
I would like to get to know what are the pros and cons of both approaches and what is the best pratice.
I guess runtime-wise and script-implementation-wise the 1st solution is a faster and simpler one.
However, the script ought to be used by the different users and I would like to go for a more user intuitive / user friendly solution.

Need Help understanding how PATH works with Windows 7

I am trying to add to the PATH via the Environment Variable settings windows for python.exe.
I have read the instructions using SetX from the March 3, 2012 discussion about this issue and am worried I will make a mess of my machine, so want to stick with the GUI process.
The directory path is C:\Users\Paul\AppData\Local\Programs\Python\Python37\python.exe.
That is a copy from the addition I made in the System Variables section of the Environment Variables window.
I have labelled the Variable Name as "Python", no quotation marks.
I have checked the path, and it looks good to me, and have rebooted the computer. But I still get the
'python.exe' is not recognized as an internal or external command, operable program or batch file.' error in every directory expect if I am specifically in the Python37 directory.
Any idea what I am doing wrong?
The path environment variable contains one or more paths, separated by semicolons. When you try to execute a command in cmd.exe it checks each path listed in the path variable in order of first to last until it finds the executable or runs out of paths to check.
You can experiment without making permanent changes to your system first. Run cmd.exe and type
set path=%path%;C:\Users\Paul\AppData\Local\Programs\Python\Python37
Running python.exe should now work in any directory in this cmd.exe window.
Unlike other environment variables, path is special and is a merged value from the system and user variables. Since you installed python just for yourself you might as well just use a user variable.
In the system properties where you edit environment variables, if there is no path user variable, create one and set it to C:\Users\Paul\AppData\Local\Programs\Python\Python37 or if it already exists, append ;C:\Users\Paul\AppData\Local\Programs\Python\Python37.
In newer versions of Windows 10 the UI is different and you don't have to add the semicolon because it lets you edit them as separate entries.

Not able to set ENV LUA_PATH No such file or directory

I am working on open source LUA project. It has some modules and submodules. I am trying to set LUA_PATH env. But it always fails with error.
bash: ./user_modules/shared_testcases/?.lua: No such file or directory
Command I used is:
set LUA_PATH /usr/local/share/lua/5.2/?.lua;./user_modules/shared_testcases/?.lua
You need to quote the path:
set LUA_PATH '/usr/local/share/lua/5.2/?.lua;./user_modules/shared_testcases/?.lua'
Otherwise, as you have seen, the shell tries to expand the ?
in the path.

How to set ANT path in Windows 10?

I am not able to set ANT path in Windows 10.
Right click of PC-->Properties-->Advance system setting-->Advance-->Env variable. Clicked on new on variable
Variable name: ANT_HOME
Variable value: C:\Windows\apache-ant-1.10.
Clicked on system variable name set the
path C:\Windows\apache-ant-1.10.1\bin
checked in cmd prompt using ANT
I am getting ANT is not recognized as an internal or external command. I tried with system variable and system path too and in the env path too I have provided path till bin i.e C:\Windows\apache-ant-1.10.1\bin
still not able to install it.

Javac is not being recognized even after setting the class path variable

My problem is that I have set the bin path in Class path variables. After that
Command Prompt is recognizing "java" command but "javac" program is still not being recognized.
Make sure you are pointing to the "bin" directory of the jdk and NOT jre. Also, as Juned answered, you need to open a new command line after you update the environment variable in "PATH"
Assuming you have set the jdk/bin folder path to your system PATH variable.
Just make sure you re-open the command line because an open command line does refresh itself with the new environment params.
After adding jdk/bin to your PATH, simply launch a new command prompt and type javac, java magic should start happening.
Adding C:\Program Files\Java\jdk1.8.0_121\bin to Path environmental variable should be done. But you shouldn't insert any space between the previous ; and the path of bin folder:
Path: c:\some name\.....\; C:\Program Files\Java\jdk1.8.0_121\bin ==>WRONG
Path: c:\some name\.....\;C:\Program Files\Java\jdk1.8.0_121\bin ==>OK

Resources