Flutter compile modifying too many files - flutter

After a simple debug, so many files are modified.
This is the print before debug:
This is the print after debug:
It happens in both platforms (iOS and Android).

The build folder is refreshed everytime you compile your app so all the changes that happen within it are shown here.
You can add a .gitignore to your build folder so these files won't be included in git. You generally don't need to back up/commit this folder as it will be created/refreshed every time you compile the app.
You can either add the whole folder to the main gitignore file or just use the command $ touch .gitignore inside your build folder with * as the content of the file.
If you're using VSCode I would recommend the GitLens extension which let's you (among other things) directly ignore a folder within VSCode.

Related

Unable to get xcode project to index appropriate directories

So I had to delete my project and then reclone it from my repository, but when I clone down the project and I open it, other files from some time ago show in there, how is this possible?
Example this is the cloned directory:
But when I open the project, it shows this project structure:
Also it produces the following error when attempting to build the project:
Build input file cannot be found: '/Users/Development/Projects/MapGlider/Application/Utilities/Extensions.swift'. Did you forget to declare this file as an output of a script phase or custom build rule which produces it?
All help will be appreciated!
The structure of the project as you see it in Xcode is a combination of file system + information about your project in YourProject.xcodeproj/project.pbxproj file. So you have a mismatch between file system and that file, which is typically a result of inaccurate checkin (for example some changes were done directly in file system, and the project was not updated), or a bad merge (developer A did everything right, developer B, or even the same developer on a different branch, overrode those changes incorrectly).
So what you need to do is to fix those errors one by one.
Note: the steps below assume the project is in your control. If you are using some script or tool to generate the project, you will have to address those issues via that tool or script instead.
First, fix the project structure:
Make sure Inspectors on the right side in Xcode are open. Choose File inspector tab
Focus on a folder inside Xcode, and check Name, Location and Full Path of the folder. Especially notice the Full Path, if it's incorrect, change it to a correct one. Here's the example how. Repeat for all folders and files you want to have in the project
Delete all folders and files you don't want to have in the project from Xcode. For example you can delete Extensions which appears as a file in your project, while it's actually a folder. Typically while deleting you should be able to delete them from file system as well if it exists, but if not, you can double check in file system and delete files / folders from there as well.
Add folders and files missing from the project if needed. Follow Add existing files and folders to a project section in the linked page.
Once you cleaned up the project, you need to review / fix all your project targets:
To fix the Project targets
Try to build each target. If it succeeds, most likely everything is resolved (although watch out for runtime errors for resource files - so you may need to test your app to ensure nothing is missing too).
If building a target fails, you will need to see why. For example
if file is missing from the target, but you already added it to the Xcode project, you can add it to the target (see this page).
if file is missing from the target and is not visible in Xcode, go back to step 4 of the previous procedure and add those files to Xcode project, and then add them to the target
if a file is nowhere to find and is not needed, you can delete it from target. If it was needed, then... well, you have a problem and need to locate your missing code in your source repo or rewrite it.

How to open vscode on a large directory of files

I have a project that has hundreds of .c .h and .cpp files. I'd like to start using vscode with this project; however, I need to be able to tell vscode what files to actually include in the project (because depending on the build, many files are not included). Is there a way to force a file list into vscode without using the GUI/Add-File mechanism?

Should the .gradle folder be added to version control?

Gradle creates a folder called .gradle. Should I track it with my version control (i.e. git)?
More importantly, why / why not?
Should I track the .gradle directory?
No. It can safely be ignored.
Why should I ignore it?
It's purely for caching information, you don't want it in your repo because:
it can get big and be full of binary files
there can be machine specific data in there
there's a lot of churn in there (you'd be constantly committing changes to files in there)
everything in there can be completely re-generated whenever it is needed anyway
It's basically a temp directory that Gradle is dropping in the middle of your source code (why Gradle thinks that's an appropriate thing to do is a different question).
You can tell the "cache directory" nature of the directory by the name of the switch that lets you change where it goes: "--project-cache-dir".
Though I hate having binary files in my source tree, I usually just end up adding the directory to my ignore file because somewhere along the line I'll forget to use the switch from some command line or from my IDE or something and then end up having to deal with the directory anyway.
How do I ignore it?
Git users can add a line with just .gradle to the .gitgnore file and Git will ignore all files in any directory with that name.
Mercurial users will want to look up the .hgignore file.
For other version control systems, refer to the documentation - they all have a feature to support this.
The .gradle folder contains different calculated information about your gradle build (e.g. cached outputs/input information). You definitely shouldn't check that folder into your version control system.
I was new to Gradle and thought that the .gradle folder will contain generic information such as dependency mappings, etc and uploaded it on version control. I then tried setting up a new machine with a different OS flavor and Java version using code from the version control including the .gradle folder and ran into errors. Turned out that the .gradle folder contains machine specific information and is used for caching on local.
Do not include the .gradle folder in version control and try setting up a new machine with the code, the gradle daemon will do the rest.
You don't need to keep the .gradle folder.
Because once you execute gradle build command again, you can make almost the same .gradle folder again.
But when you use the gradle.setting file under .gradle you might need to move it to root folder of the project.
when we start the gradle it create the .gradle folder inside your home directory. It consist of native (information about your system) and caches. Caches further consist of plugins and all other jars dependencies.
When we build the the project first time at that time it download dependencies and plugins and cheched them here. next time when we need them it, it get from here. even when we need them in eclipse to compile the code (=>gradle eclipse), its dependencies are added from cache
As it will keep updating and adding when you run gradle. so i guess we do not added it to version control.

Problem with SVN in iPhone?

I am using Smart SVN for committed my code to server. I have faced some problem, some of the classes are there in my project work copy and the server also. When i open that project file and i missed some classes and images in the xcode file. But all the files are in the project work copy, when opened that file some files are missing only in Xcode. After that, i have to drag those missing my file from my local copy to Xcode file, then it works fine. In the server all files are there, but i donno why it is not coming to Xcode folder.
#pugal : Always update your project before start working on the last commit , so that you can identify changes , then if any files missing , add & then commit them .
Better try to use xcode.inbuilt SCM to track all progress in your project itself or use command line tools in terminal if you interested .
The thing is, Xcode doesnt show all the files that are in the folder! they have to be inside xcode too! in the main project file there is some XML that XCode use to control those files! so if you have any file just in the folder xcode wont display it! You always have to drag and drop to it! However after u project is with all files inside you just have to commit your project file and should be fine afterwards!
Check if your project file is also committed and updated.
You and your teammates should always commit your project file after you added some files into your project.

Resources check

hey I am frequently uploading my XCode iPhone projects to an svn repository to be build on another machine.
My problem is that when I add resources to my project sometimes I forget to add the resource as relative to the project.
I know one answer is to be more careful (not easy when your tired!) but if there was a way to run a script to check my resource paths are relative when I build and warn me if they are not it would be a great time saver for me.
How would I go about doing this?
Thanks
Chris
You can select all the files in your project and set the Path Type for all of them in one go. While this isn't a script this does save a lot of time over doing the files individually
I think the best approach to script this would be to look in the .xcodeproj file - the file paths are listed in there. If your project is called MyProject you need to open (either by using Show Package Contents in Finder or just the usual cd in Terminal) the MyProject.xcodeproj directory.
In here you'll find a file called project.pbxproj - open this in a editor that won't mess up your formatting and have a peek around the file. If you search for one of your files in the project you should be able to see how Xcode stores references to the project files.
Look for a section named /* Begin PBXFileReference section */. In here all your files are listed, along with where they are relative to the project, e.g.:
... path = Classes/MyClass.h; sourceTree = SOURCE_ROOT
If you can parse this file you should be able to acheive what you want - but remember to back up the file, otherwise you might corrupt your project.
How would it be if you instead write a script that asks the SCM if anything in the project is not committed? For example, think of this scenario
Project Root
Codex
Project.xcodeproj
…
Design
anImage.png
where anImage.png being outside of Codex, where the Xcode project sits (its path starts with a ../). A strong .pbxproj parser would have to support all the variants in which Xcode references files to know exactly if there are stray files.
OTOH, the SCM knows where everything is all the time (you mentioned up-ping to a SVN server), so why not ask it instead.
We have a Ruby script that prints a warning in Xcode’s Build Log if anything in the project is not committed.