Different PUB_CACHE directory for each flutter project - flutter

Currently, the location of flutter packages are located by PUB_CACHE environment variable. Is there a way to change the flutter package directory to the local folder (like node_module for npm) for each different project?

Related

How to move a c++ library to Flutter executable using cmake on windows?

I'm trying to write a c++ library to extend some features for my flutter project using dart ffi. I use Cmake as the build tool for c++. On Android this works really well, because I don't need the full path to the library. But if I build my app on Windows the dll file isn't in the same directory as the executable and I have to use some weird relative paths. I also want to have the debug and release files in the corresponding directories.
I have added in the CMakeLists.txt in the windows directory my library as a subdirectory. In the CMakeLists.txt of my library I tried to use set(CMAKE_LIBRARY_OUTPUT_DIRECTORY $<Target_file_dir:${BINARY_NAME}> and get_property(bin_dir TARGET ${BINARY_NAME} PROPERTY LOCATION). It seems linke cmake ignores the output directory property. Is there another way to get the Flutter runtime directory, even if I use my Flutter project as a package for another project? I wouldn't be a problem, if I just run a .bat file to move all the dlls after build.

Unity how to fix local tarball file path as relative path

I'm working on Unity with other people and there was a package installation problem while sharing the project. The package could be installed through url in the past, but it no longer supports url and only tgz files can be downloaded.
There was no problem installing the package, but a package installation error occurred when the project was run on another computer after sharing the project.
Looking at the error code, it was a problem with the path of the installed package. I included the tgz file in the project folder that I share and modified the absolute path of the package-lock.json file as the relative path. (Because each computer has a different project installation path.)
However, the modified path of the package-lock was changed back to the absolute path after the project was executed, so it was thought that the project could not be collaborated with this method.
What I'm curious about is that
Why does the path of the package-lock.json file change to the absolute path after executing unity?
Is there any other good way to share the package after installing it in the same situation as mine?

Creating a NuGet package for UWP library containing custom Templated Control

I have a UWP class library for Windows 10 which contains a custom templated control, VisualControl. The default template is defined in the Themes\Generic.xaml file.
Here is the directory structure I have created for the NuGet package which targets x86, x64 and ARM.
When I creat a NuGet package with these files, add it to my test application and add the VisualControl to the XAML file, the default theme is not applied to the VisualControl.
Am I packaging the file in an incorrect way? How do I ensure that the default template defined in the Generic.xaml file is picked up and applied to the Control.
Also, are the following files required in the NuGet package? If yes, where should they be placed?
Generic.xbf
TestVisualControl.pri
TestVisualControl.xr.xml
Found out the solution.
The Generic.xbf file should be placed in the Themes folder along with Generic.xaml.
The TestVisualControl.xr.xml file should be placed in a folder named TestVisualControl. This folder should be placed inside uap10.0 folder of each platform.
The TestVisualControl.pri should be placed inside the uap10.0 folder of each platform.
Here is what the final folder structure should look like
Creating a NuGet package with this folder structure would ensure that the style defined in the Generic.xaml file is loaded.

Creating folder with contents in project root

I developed a tool that besides DLL requires a strong named folder with 2 files in solution. Using NuGet GUI I created the folder and populated with files, but when I install package, the only DLL created but folder with 2 files are not. How can that be fixed?
NuGet has a set of conventions that define certain folders inside the NuGet package that will result in different actions being taken when the package is installed or uninstalled.
In order for folders to be created inside the project, when the NuGet package is installed, the folders need to be inside a Content directory. If you look at the jQuery package, it has a Content\Scripts folder with files inside it. This Scripts folder will be created inside your project, along with its files, when you install the jQuery NuGet package.
\Content
\Scripts
\jquery-2.1.0.js

Copy tools from nuget package to bin folder

I have some automated tests that are using Selenium WebDriver. Tests should run on Chrome so I need to have ChromeDriver.exe. I am using NuGet to download the libraries and found that the ChromeDriver could be downloaded as a package too (http://www.nuget.org/packages/WebDriver.ChromeDriver).
However, this package contains only ChromeDriver.exe in the Tools folder. I need to copy this file into the bin folder because tests need to find it. Is there some way to do the copy in a generic way (without specific paths), because in the folder where the ChromeDriver.exe is unpacked from package contains version number so I would need to change the paths when the new version will be used. Also I would need to do similar thing with the NUnit.Runner package.
You could probably use a post-build event. Then inside the event use copy/xcopy and move it into the bin folder after the project has successfully built.