Commit Graph

50 Commits

Author SHA1 Message Date
paul chipchase
aaec7fabd1 Allow the P4VUtils 'Virtualize and Submit' command to use precompiled binaries is they are available.
#rb Sebastian.Nordgren
#rnx
#jira UE-152958
#preflight 629717b72c618ddc669143d7

- Instead of just building the UnrealVirtualizationTool we will now check to see if there is a precompiled version we can use.
-- If the user has rebuilt the editor locally, then we will ignore any precompiled version of UnrealVirtualizationTool and rebuild that aswell incase there are code changes that it needs to pick up.
- To tell if an exe is locally built or a precompiled binary we check for a .version OR .target file (this can vary depending how a program is set up) then look for the JSON property 'IsPromotedBuild ' which when none zero means that the binary is probably prebuilt.
-- This isn't very robust and I am not happy with it, but we don't seem to have an official way to determine a precompiled binary. When we do get an offical way to do it I will update the command.

[CL 20448604 by paul chipchase in ue5-main branch]
2022-06-01 03:52:14 -04:00
paul chipchase
5afd605ecf Allow the P4VUtils 'Virtualize and Submit' command to work on multiple changelists at the same time.
#rb Sebastian.Nordgren
#jira UE-154011
#rnx
#preflight 6294a6eb380652524ebcc4a7

- If we use uppercase %C in P4V to pass the changelist number then we will get a list of all changelists that the user has selected rather than launching the command once per changelist which is what happens when the lower case %c is used
-- Due to the use of UBT, we can run into problems if the user tries to submit multiple changelists and they are processed in different processes. Even if we fixed the command to only run UBT one process at a time, running many versions of the submit tool will create many more perforce connections which we'd like to avoid, so having all of the changelists run through one instance is still prefered.
- Processing a changelist has been moved to a new method, ::ProcessChangelist which is pretty much the same code as we had in  ::Execute.
-- Rather than connecting to perforce for each changelist, this code has been kept in ::Execute and is only run once, the connection is then passed to ::ProcessChangelist.
- Logging has been improved to show when the tool is exiting, either from failure or success. The p4v terminal does not do a good job informating the user when the process has finished running so hopefully this will help.
- A small extension to ILogger has been added, ::NewLine which writes an empty line to the logger.
- This was the simplest way to add support to multiple changelists. We process each one by itself until we run out of changelists or we reach an error. However it is likely that packages in multiple changelists would be in the same project or at least use the same engine installation, so we could remove some overhead by parsing all changelists, gathering the packages, virtualizating those packages then submitting the changelists afterwards.
-- This would be a great approach for the average user as they will likely be submitting relatively small changelists (< 100 files) but would be a terrible approach if the entire project was being virtualized where the total number of packages being submitting could be in the 100k-million range. So we'd probably want a "process changelists separatly" mode even if we did make the optimized version.
-- Looking into adding a combined changelist mode will be added as an optimization task.
- Added a new preprocessor define 'UE_DEBUG_DISABLE_SUBMITS' that when enabled will cause the command to only pretend to submit the target changelist(s) this is intended for use in development to avoid submitting changelists over and over when testing the non-submission portion of the command.
-- Note that it is defined inside of a DEBUG check, so even if it is accidently submitted enabled, it will not be published.

[CL 20429873 by paul chipchase in ue5-main branch]
2022-05-30 07:34:53 -04:00
paul chipchase
d545d66b9a Rework the logic for finding the project associated with each package file to match the native code, including changes found in CL 20346906)
#rb trivial
#rnx
#preflight 628ccca9fc217779d4361cb5

- The native code changes we are trying to match from CL 20346906, fix a problem when parsing a package path containing more than one content directory.
- The method now takes an ILogger so that we can record problems found.
- Even though we don't use the .uplugin file, we now match the native code and look for it first, rather than looking for the /plugins/ directory immediately. This should reduce any differences between the two code paths.

[CL 20346914 by paul chipchase in ue5-main branch]
2022-05-24 08:51:08 -04:00
paul chipchase
64efab556e Fix more compilation warnings in P4VUtils.
#rb Sebastian.Nordgren
#rnx
#preflight 628c85f58673efbf3c0a5e3f

- Added checks when parsing xml to make sure that expected nodes/lists were found and are not null.
- Response was assigned as null, but nothing was checking for this. The initial value has been changed to an empty string which wioll invoke the user cancelling the operation as the default behaviour.
- StreamReader.ReadToEnd is a blocking call in an async method. Replaced with await StreamReader.ReadToEndAsync.

[CL 20346208 by paul chipchase in ue5-main branch]
2022-05-24 07:14:12 -04:00
paul chipchase
9fca28ee71 Fix some warnings introduced in the recent upgrade to .NET 6
#rb Sebastian.Nordgren
#rnx
#preflight 628b910a573a7de2c4249502

- Handle Path.GetDirectoryName and Directory.GetParent potentially returning null

[CL 20344754 by paul chipchase in ue5-main branch]
2022-05-24 02:29:04 -04:00
paul chipchase
0e85c4730c Fix P4Utils to compile with the changes to the logging API in CL 20245803
#rb Ben.Marsh
#rnx
#preflight 628b8e06693c5e1de2797dd6

[CL 20326531 by paul chipchase in ue5-main branch]
2022-05-23 09:49:24 -04:00
Josh Adams
6f60e61383 - Some p4vutils code changes to match the already checked ion binaries
#rb trivial
#preflight skip

[CL 20248689 by Josh Adams in ue5-main branch]
2022-05-17 15:02:27 -04:00
Josh Adams
bcb77edc06 - Fixing up some P4VUtils paths in the installers
- Split up the binaries between platform since there are #if's due to WinForms
#rb trivial
#preflight skip

[CL 20247967 by Josh Adams in ue5-main branch]
2022-05-17 14:26:37 -04:00
Josh Adams
a6c5a6ccd9 - Updated p4vutils to dotnet6, so we can use OperatingSystem nicely
- Will compile on Mac and Linux now
- Mac replaced the WinForms functionality with AppleScript
- Linux will compile be have reduced functionality
- Fixed up paths for p4v settings and dotnet location
- Added binaries and installer scripts for all 3 platforms - won't need UGS to install, will copy to user-library location (may need some adustment on Linux, will address after)
#rb will.damon
#preflight skip

[CL 20244727 by Josh Adams in ue5-main branch]
2022-05-17 12:00:08 -04:00
paul chipchase
bee76532da The VA tool will now give the user an error if they attempt to submit an empty changelist or a changelist containing a shelved file.
#rb Sebastian.Nordgren
#rnx
#jira UE-151464
#preflight 627a4c60fc07e0a9b4eefda9

### No files
- When submitting a change list with no workspace files (either empty changelist or only shelved files) our internal C# api does not return any errors.
- To get around this for now ::FindPackagesInChangelist can be changed to return null if we detect that there are no files to submit.
- I am following up with the original author to try and find out if the submit behavior in our API is intended or not.

### Shelved files
- Attempting to submit a valid changelist that has shelved files will eventually fail when we try to finally submit the changelist.
- This means that the tool will check all of the packages for virtualization first, before eventually failing on the submit.
- Most users will alt tab out of p4v during the submit and we cannot do anything fancy with the error reporting (like make the task bar icon flash etc) so might not notice that the submit failed for some time.
- So it makes sense for us to check for shelved files, before we kick off the virtualization process and if the changelist does have shelved files we can error out and the user should see it before they alt tab away.

[CL 20120836 by paul chipchase in ue5-main branch]
2022-05-10 07:37:37 -04:00
paul chipchase
32ce8db205 Small improvements to the P4VUtil Submit&Virtualize command logging
#rb trivial
#rnx
#preflight 627a14806a20515edc79c799

- Only display the p4 submit error messages, doo not include the perforce generic code as it can be confusing to the end user.
- If a submit fails, print a line to the log once the virtualization tags have been removed from the original changelist description. Previously the last message the user would see ended in "..." which implied that the process was still running.

[CL 20119794 by paul chipchase in ue5-main branch]
2022-05-10 03:51:07 -04:00
paul chipchase
75f8217ced Allow the P4VUtils submit command to deal correctly with changelists containing no package files.
#rb Per.Larsson
#jira UE-143675
#rnx
#preflight 6274f6118b2af58d6e5e44a1

- The c# p4 api seems to have problems when calling p4 where, with no valid files so make sure that we early out before calling that.
- Only run the virtualization process if we have package files, no point trying to virtualize anything else.
-- If the changelist does not contain any packages then we just submit the change list, we don't need to stamp it or display logging info about how 0 packages are in 0 projects etc.
- Moved the code that submits the changelist to it's own method.

[CL 20073750 by paul chipchase in ue5-main branch]
2022-05-06 06:45:36 -04:00
paul chipchase
b69cc572f5 Clean up the logging for the P4VUtils Submit and Virtualize command
#rb trivial
#rnx
#preflight 626baeec5c220f34acdb8128

[CL 19976351 by paul chipchase in ue5-main branch]
2022-04-29 05:36:44 -04:00
paul chipchase
67d867a6a1 Fix the "UE Submit -> Virtualize and Submit" command to work when no engine is registered but could still be found via the directory hierarchy
#rb Sebastian.Nordgren
#rnx
#jira UE-143675
#preflight skip

### Misc
- Failing to find an associated engine for a project will now cause an error message to be logged and cause the changelist not to be submitted rather than allowing the process to continue.
- We now pass the logger into the methods in the DesktopPlatformBase region, rather than using a dummy logger (this was always the intent and something I missed fixing up before the original submit)

### Bug Fix
- Instead of finding the engine identifier and then finding the engine root (which mirrors native code) a new method has been added ::GetEngineIdentifierForProject which just returns the engine root directory which is all we are interested in.
- The main failing with the previous approach is that the engine association is not always registered in the system registry. I suspect that an engine install taken from p4 will only register if it is used to create a new project, meaning that the average developer will not have this info avaliable. ::GetEngineIdentifierForProject takes this into account and tries to find the engine via the directory structure before we look in the registry.
- ::GetEngineIdentifierForProject no longer tries to find the engine identifier if it could not be found in the project path and so does not properly match the native version of the method. To match the original it would need to register the engine if found, in which case the virtualization system (when run via the editor) should probably take steps to register the engine as well. This should be done as it's own work item to make sure it is tested properly.

[CL 19805425 by paul chipchase in ue5-main branch]
2022-04-19 04:40:21 -04:00
paul chipchase
73e85f5e17 Extend P4VUtils with a new command that allows the user to submit&virtualize package files (for projects with asset virtualization enabled)
#rb Ben.Marsh
#rnx
#jira UE-143675
#preflight skip

### P4VUtils
- Add a new submenu "UESubmit" for commands related to the submission of files and changelists
-At the moment the submenu only has a single command SubmitAndVirtualizeCommand

### SubmitAndVirtualizeCommand
- This command is used to run the asset virtualization process over all of the files in a changelist before submitting it using the following logic:
-- Find all package files in a changelist
-- Sort the files by project
-- Find the engine installation associated with each project
-- Build and run the stand alone virtualization tool (if needed) and pass it the packages for the project
-- If the virtualization process succeeeded for all projects we can submit the original changelist, other wise print errors to the p4v terminal.
- In most cases all of the packages in a changelist will be under a single project, but the command should be able to cope with many packages from many different projects using many different engine installations.
- Note that unlike a normal submit, virtualizing a package can change it on disk (by removing the payload data) which means we will probably run into problems where a running instance of the editor has access locks on the file and they cannot be edited. At the moment this command and the stand alone tool will just error, there is no tool<->editor communication protocol set up to request that the editor release the package file. This will be addressed as a future work item.
- This is the first pass of the command, there are a number of non-essential todo comments left in the code that will be addressed based on feedback from the end users.

[CL 19752487 by paul chipchase in ue5-main branch]
2022-04-14 04:26:33 -04:00
Josh Adams
83fb2b68f8 - Fix P4VUtils to compile with latest EpicGames.Core
#rb paul.chipchase
#jira none
#preflight skip

[CL 19739667 by Josh Adams in ue5-main branch]
2022-04-13 10:27:29 -04:00
Ben Marsh
b900bab8d1 P4VUtils: Fix compile errors after recent changes to EpicGames.Perforce library.
#preflight none
#fyi Andrew.Firth

[CL 18643289 by Ben Marsh in ue5-main branch]
2022-01-18 13:28:42 -05:00
Ben Marsh
1f185de5a4 Combine interface for creating native and external Perforce client connections.
- PerforceEnvironment class now allows querying the state of Perforce environment variables in a client agnostic way. (Supports system environment variables on Mac/Linux, and registry on Win32. Also reads settings from any P4ENVIRO file, and P4CONFIG files when initialized with a directory.)
- Connection settings are now stored in a PerforceSettings object, with a read-only IPerforceSettings interface. Both clients can be initialized through the same parameter block.
- A connection can be created using the PerforceConnection.CreateAsync() method. Specifying the IPerforceSettings.PreferNativeClient will create a NativePerforceConnection implementation where possible.

[CL 18464429 by Ben Marsh in ue5-main branch]
2021-12-14 21:31:40 -05:00
Ben Marsh
78ca05b4ce P4VUtils: Enable static analysis.
[CL 18449401 by Ben Marsh in ue5-main branch]
2021-12-13 17:09:39 -05:00
Maxime Mercier
1a49c53b87 New perforce tools
Data tools:
* Convert data to local writable -> Convert All data in changelist or all selected data files to local writable

Unshelving tools:
* Unshelve to current revision -> Remembers revision all files you are about to unshelve and if the revision is older, will sync to saved revision
* Unshelve and make data writable -> Unshelve changelist but for data will make them writable locally

#jira none
#review-17681604
#rb Andy.Firth Brandon.Dawson
#preflight skip

#robomerge 5.0
#robomerge FnMain

[CL 18039467 by Maxime Mercier in ue5-main branch]
2021-11-03 15:49:48 -04:00
andrew firth
a13ce99b3a [P4VUtils] - fix up FileSpecList usage when null is being passed in.
#review-17397028 @Ben.Marsh (post)

[CL 17397042 by andrew firth in ue5-main branch]
2021-09-01 22:55:09 -04:00
andrew firth
130a3f286a [P4VUtils] - improve messaging around preflight command when files remain checked out
#review @andrew.grant
#rb andrew.grant

[CL 17396499 by andrew firth in ue5-main branch]
2021-09-01 22:16:36 -04:00
andrew firth
f7aa3e000f [P4VUtils] - improving preflight warning message
#rb trivial

[CL 17243661 by andrew firth in ue5-main branch]
2021-08-20 00:00:34 -04:00
andrew firth
a6cc905abd [P4VUtils] - preflightandsubmit now provides options if the CL still has files within it.
#review-17243624 @ben.marsh (posthumous)
#rb ben.marsh

[CL 17243631 by andrew firth in ue5-main branch]
2021-08-19 23:56:21 -04:00
andrew firth
7bbcaddab3 [P4VUtils] - remove review triggers and stop preflight/snapshot from triggering secondary swarm reviews
#review-17131028 @ben.marsh
#rb ben.marsh

[CL 17210787 by andrew firth in ue5-main branch]
2021-08-17 23:30:19 -04:00