Specify .gradle taskArtifacts directory - android-studio

Using Android Studio:
To keep my source directories small, for google drive backup etc, I found how to specify a global gradle build directory outside my project directories here:
Gradle global build directory
Is it possible also to put the rather large .gradle/.../taskArtifacts directory outside the project directory.

Set --gradle-cache-dir when invoking gradle from the command line.

Related

How to set RubyMine's default working directory to the executing .rb program's subdirectory?

In RubyMine, I have a project with many subfolders, each of which contains:
One or more standalone single-file executable Ruby programs (.rb files);
An input text file.
In older versions of RubyMine, when running one of the standalone executable programs (via Cmd+Shift+R on my Mac), the default folder in which RubyMine would look for the input file would be the same directory as the .rb file currently being executed -- which worked great.
The code used to read the file is something like:
data = File.readlines('input.txt')
However, after recently updating RubyMine to v2022.3.1, the behavior has changed, such that RubyMines now seems to be looking in the project's root directory for the file, instead of the same subdirectory as the .rb file currently being run. This produces the error:
in `readlines': No such file or directory # rb_sysopen - input.txt (Errno::ENOENT)
To correct this, I've been going into Run (menu) > Edit Configurations; and in the Edit Configurations dialog, in the configuration that RubyMine auto-created for the current executable file, changing the Working Directory value from the default of the project's root directory, to the subfolder of the current .rb file.
However, this above workaround is annoying, since I need to do it once each for every individual one of the many individual .rb executable files in my project.
My question: How can I configure my project and/or RubyMine itself to go back to the older behavior of defaulting a given .rb file to use its own directory as the default Working Directory, instead of the project's root directory?
(This question and/or its solution might also apply to other JetBrains IDEs such as IntelliJ, since they all seem to work similarly.)
The previous behaviour has been changed with https://youtrack.jetbrains.com/issue/RUBY-29236. So now yes, the logic is the following:
in case of no Ruby module, project's root will be used
in case of Rails, its home folder
otherwise the module's root
There is no option to change it in RubyMine but you can configure the configuration template using some variable there as Working directory.

How to hide .gitignore files while committing in Android Studio

Currently i am using Android Studio version 2.2.
Once we add configuration file into .gitignore file of project root directory and then make any changes to ignore files, Still it shows these changed file while committing.
So how can we avoid these files from showing up while committing.
I have tried removing ignore files file from Setting->Version Control->Ignore Files , And restarted the Studio.But is doesn't work.
I have tried to removing previously cached file from git rm -r --cached .
And then re-added the gitignore files and added the project again.
But still all the git ignore file shows while committing and leads to problem by mistakenly selecting them.
Anyone who have faced this please guide to remove these git ignore file while committing in Android Studio.
Have tired this but didn't get any help.
You need to remove (or "ignore") these files from version control.
One option is:
Close Android Studio;
Remove the files that you need to remove from vcs (probably something like rm -rf .idea/);
Commit your changes;
Make sure that all files that you want are on your .gitignore;
Reopen Android Studio;
Now he will create all files that he needs to execute, such as .idea folder, but you don't need to worry because now they are out of version control.

no clean option in android studio

I found no option for clean project in build in android studio. what is reason for that? or is there different way to clean the project in android studio
Make sure you are looking a the correct directory. I also thought clean was missing when I looked under the root directory. Turns out it see example is located under the :app directory.
Open the Gradle side panel on the right. Select app->Tasks->build->clean
This problem can occur when you import the root directory rather than the project file. If you imported the file, make sure you select the correct file:

Geb Testing - project folder structure contains lot of files ending as closure.class

I am new to geb testing. We have two project folders. One of them is a subset of others. During last few days, whenever I check the status of the subset project folder using git shell, lot of closure.class files are showing as changed. But I am changing only the groovy files. I am not sure why this is happening? previously I haven't seen anything like this.
Also lot of class files are showing as untracked files.
The file name look like this.
xxx$_$spock_feature_7_29_closure6.class
We are using IntelliJ IDE.
There are lots of files, I mean class files generated when you try to build using gradlew. As Peter had suggested already, create a .gitignore file and add anything you want to ignore, for instance:
*.log
build
.gradle
.DS_Store
*.ipr
*.iml
*.iws
out
*.pem
gradle.properties
and run the gradlew clean command. You will not see those anymore. Cheers!

How to set the working directory for MS Test projects

how can I set the working directory for MS Tests projects, like I can do it for normal application projects? My Component that is tested need to access some config files that are also used by other applications. So far I have to copy these files the bin/debug folder of my test project, as these files are expected to be in the working directory.
Is it possible to set a working directory for test projects?
For those who use Visual Studio 2012, if you set the output directory of the test project under Properties|Build|OutputPath then that will become the working directory when you run the tests from Visual Studio (since it is using Vstest.console.exe). If you don't want to have your test dlls, etc output to the same directory as your other files and you don't want to have the other files as content in your test project (as suggested by Schaliasos) then you can set the path on startup in a method that has the [AssemblyInitialize] attribute. You do this by assigning System.Environment.CurrentDirectory as usual. You will probably want to have the working directory as a setting or read from a configuration file.
Edit
As pointed out by Rohit.Net, when you choose Run All Tests the default path would be under TestResults. The same applies when using a runsettings file. The output folder will be the default working directory when you are not using DeploymentItems and: -
You right click the test(s) in Visual Studio and choose to run / debug, or
You run from the command line using vstest.console.exe.
The working directory for test projects is created at the time you start running your tests.
If you run them locally this is created in a folder TestResults inside your project folder. If you run them in remote machines a different folder is created in each test agent in the following path:
C:\Users{userRunsTheTest}\AppData\Local\VSEQT\QTAgent\{GuidForThisRun}
In order your files to be deployed in these folder and have access to them you have to:
Set the Copy to Output Directory = Copy Always
In the test that needs these files set them as DeploymentItems.
Acarlon's suggestion does not work when you select Run All tests from Test Explorer in Visual Studio 2012.
The default path you would get is something like ...\TestResults\Deploy_<YourName>2014-01-13 14_48_20\Out folder.
Because of this there may be possibility that your DB would not be accessible when entity would try to open connection for running entity related Test.
In my case I am using SQL CE which is set as resource file and always compiled and gets itself dropped into the Bin/Debug/Resource folder.

Resources