Jump to content


P4V Custom tools creation on Mac

Custom tools

  • Please log in to reply
5 replies to this topic

#1 Bhargav

Bhargav

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts

Posted 02 June 2020 - 02:18 PM

Hi All,

I would like to create custom tools for mac, can any one help me with simple example?

Below example shows how to create for Linux and Windows.

https://forums.perfo...s-as-arguments/

Thanks.

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1130 posts

Posted 02 June 2020 - 03:44 PM

It works the exact same way on Mac as it does on the other platforms, so you should be able to follow those same examples.  What exactly do you want the tool to do?

#3 Bhargav

Bhargav

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts

Posted 03 June 2020 - 02:18 PM

I'm trying to setup custom tool to create workspace with some default options based on the selected stream.

From the p4 documentation  
On a Mac, custom tools are not launched from a shell by default. For tools that must recognize P4CONFIG settings, create a script that launches a shell before invoking the tool, or define P4CONFIG globally (for example, in /etc/profile, /etc/profile.local, or /etc/csh.login). To spawn a shell using Bourne shell, issue the #!/bin/sh command. For the C shell, issue the #!/bin/tcsh command.

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1130 posts

Posted 03 June 2020 - 02:30 PM

All you need to do is write a script that creates the client according to whatever logic you have in mind (in whatever language you want, it doesn't matter), and then put the script in the "Command" section of the custom tool definition.  The caveats about the shell probably don't matter because if you need to parse out the stream spec to come up with your client options I doubt you're doing this as a shell one-liner anyway.  :)

#5 Bhargav

Bhargav

    Advanced Member

  • Members
  • PipPipPip
  • 64 posts

Posted 03 June 2020 - 03:06 PM

Thank you. I Have already done this for linux and windows. Unfortunately at the moment,  I do not have Mac to test this. So I'm trying to see if there is any special attention required for Mac, as it says in documentation.

Thanks again.

#6 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1130 posts

Posted 03 June 2020 - 03:25 PM

As long as the tool you've written for Linux and Windows is something that'll run on a Mac, it should work the same.

Re: the note on P4CONFIG, I'd think as long as you use "p4 set" for your client settings it should be fine since that's already stored in a specific file by default (.p4env) rather than in shell environment variables.





Also tagged with one or more of these keywords: Custom tools

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users