Closed bdovaz closed 7 months ago
@FejZa what do you think? I'm willing to create a PR but I'd like to know which one you're leaning towards.
Thanks.
Hey @bdovaz,
If anything I'd lean towards
Why do you think this is an issue at all? Unity creates a "Logs" folder by default for every project when it is opened the first time. This is where Unity also saves logs for asset import, package updates etc. See this screenshot:
This logs folder is usually in gitignore then. Don't really see an issue with the build task dropping its logs in this folder as well.
Maybe I have not explained well.
As you mention, Unity creates a Logs
folder relative to the project, that is, {ProjectPath}/Logs
.
In your case, you do it in the repository root because you use the Build.Repository.LocalPath
variable.
Example for Unity CMD:
Maybe the problem is that you take for granted that in the root of a repository is going to be directly the Unity project but in many cases it is not like that, in our case for example, we follow the Monorepo
pattern so in the same repository we have many more things than the Unity project.
In fact, this is even more complicated if you do multi-checkout
:
In this case, that Logs
folder that it generates is left out of the repository checkout. Example:
C:\agent_work\1\s\repo1 C:\agent_work\1\s\repo2 C:\agent_work\1\s\Logs
Precisely because of these cases the .gitignore file does not act as you think.
Ok, got it. I was in fact not aware that I simply used 'Build.Repository.LocalPath' here without adding the relative project path as well. This is a bug.
I guess we can go for your second option then. The temporary agent directory should be fine for this.
PR created
@FejZa currently, it is generated in a /Logs folder in the repository root.
It would make sense to generate it in a another path so that it is not so intrusive (i.e. does not generate a file in the working copy of the repository).
There are 2 decisions to make:
The second one is simpler because as the tasks expose output variables with the log paths, if you only depend on that which is logical, there is no breaking change.
The only breaking change can be created if you don't use the ouput variable and "trust" that there is always a /Logs path in the repository root.