Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ server.pid

# JetBrains IDEs files
.idea/

# macOS file information
**.DS_Store

# Object files
***.o
10 changes: 6 additions & 4 deletions .yamato/osx-build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: Mac - Build & Test VCS plugins
agent:
type: Unity::VM::osx
image: desktop/unity-macos-10.15-xcode-12.2:stable
flavor: b1.large
image: build-system/unity-macos-13-arm64-unity:v2.4499056
flavor: b1.xlarge
model: M1

commands:
# Build PerforcePlugin and TestServer
- perl build.pl

# Perforce CLI and server
- chmod +x PerforceBinaries/OSX/p4 PerforceBinaries/OSX/p4d
- chmod +x PerforceBinaries/OSX/arm64/p4 PerforceBinaries/OSX/arm64/p4d
- chmod +x PerforceBinaries/OSX/x86_64/p4 PerforceBinaries/OSX/x86_64/p4d

# Run Perforce integration tests with the TestServer
- perl build.pl -test

artifacts:
builds:
paths:
- "Build/OSXx64/PerforcePlugin"
- "Build/OSX/PerforcePlugin"
6 changes: 3 additions & 3 deletions .yamato/zipVCSPlugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ agent:
interpreter: powershell
commands:
- mkdir linux64
- mkdir OSXx64
- mkdir OSX
- mkdir Win32
- Copy-Item Build/linux64/* linux64 -Recurse
- Copy-Item Build/OSXx64/* OSXx64 -Recurse
- Copy-Item Build/OSX/* OSX -Recurse
- Copy-Item Build/Win32/* Win32 -Recurse

artifacts:
builds:
paths:
- "linux64/**"
- "OSXx64/**"
- "OSX/**"
- "Win32/**"

dependencies:
Expand Down
4 changes: 2 additions & 2 deletions Makefile.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GTK3_INCLUDE = -I/usr/include/gtk-3.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-
GTK3_LIBRARIES = -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

CFLAGS += -O3 -g -fPIC -fexceptions -fvisibility=hidden -DLINUX
CXXFLAGS += $(CFLAGS) -fpermissive -Wno-deprecated-declarations $(GTK3_INCLUDE) $(P4PLUGIN_INCLUDE)
CXXFLAGS += $(CFLAGS) -fpermissive -Wno-deprecated-declarations $(GTK3_INCLUDE) $(P4PLUGIN_INCLUDE_OLD)
LDFLAGS += -g -pthread
LIBRARIES += -lstdc++ -lrt $(GTK3_LIBRARIES)
PLATFORM = linux64
Expand Down Expand Up @@ -45,7 +45,7 @@ Test/Source/%.o : Test/Source/%.cpp $(TESTSERVER_INCLS)
$(CXX) $(CXXFLAGS) $(TESTSERVER_INCLUDE) -c $< -o $@

P4Plugin/Source/%.o : P4Plugin/Source/%.cpp $(COMMON_INCLS) $(P4PLUGIN_INCLS)
$(CXX) $(CXXFLAGS) $(P4PLUGIN_INCLUDE) -D_LINUX -c $< -o $@
$(CXX) $(CXXFLAGS) $(P4PLUGIN_INCLUDE_OLD) -D_LINUX -c $< -o $@

$(TESTSERVER_TARGET): $(COMMON_MODULES) $(TESTSERVER_MODULES)
$(CXX) -g $(LDFLAGS) -o $@ $^
Expand Down
21 changes: 15 additions & 6 deletions Makefile.osx
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
include Makefile.srcs

CC = gcc
CXX = g++
CC = clang
CXX = clang
AR = ar

CXXFLAGS = -O2 -arch x86_64 -mmacosx-version-min=10.11
LDFLAGS = -arch x86_64 -lstdc++ -mmacosx-version-min=10.11
PLATFORM = OSXx64
ifeq ($(BUILD_TARGET),P4PluginX64)
PLATFORM = OSXx64
CXXFLAGS = -O2 -arch x86_64 -mmacosx-version-min=10.11
LDFLAGS = -L./P4Plugin/Source/p4api/lib/osx64 -L./P4Plugin/Source/openssl/lib/osx64 -arch x86_64 -lstdc++ -mmacosx-version-min=10.11
else
PLATFORM = OSXarm64
CXXFLAGS = -O2 -arch arm64 -mmacosx-version-min=12.0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to check on one thing, we may have raised the min spec for the editor in 6.3+ to macOS 13.0. If that is true then we should change the arg to all the -mmacosx-version-min flags to 13.0. I'm checking and I'll get back to you here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But please note that we have always backported the plugin to all active Unity streams until now.
Even if in this case I would gladly discard 2021.3 xLTS and 2022.3 xLTS, it would be really important to backport this down to Unity 6.0 LTS

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, just saw this comment now. In that case keep the min spec as is, except for the ones I changed to 12.0, I added suggestions to put that back to 11.0.

LDFLAGS = -L./P4Plugin/Source/p4api/lib/osxarm64 -L./P4Plugin/Source/openssl/lib/osxarm64 -arch arm64 -lstdc++ -mmacosx-version-min=12.0
endif

COMMON_MODULES = $(COMMON_SRCS:.c=.o)
COMMON_MODULES := $(COMMON_MODULES:.cpp=.o)
Expand Down Expand Up @@ -53,7 +59,10 @@ $(TESTSERVER_TARGET): $(COMMON_MODULES) $(TESTSERVER_MODULES)
$(CXX) -g $(LDFLAGS) -o $@ $^

$(P4PLUGIN_TARGET): $(COMMON_MODULES) $(P4PLUGIN_MODULES)
$(CXX) $(LDFLAGS) -o $@ -framework Cocoa -framework Security $^ -L./P4Plugin/Source/p4api/lib/osx64 -L./P4Plugin/Source/openssl/lib/osx64 $(P4PLUGIN_LINK)
$(CXX) $(LDFLAGS) -o $@ -framework Cocoa -framework Security $^ $(P4PLUGIN_LINK)

clean-objs:
rm -f $(COMMON_MODULES) $(P4PLUGIN_MODULES) $(TESTSERVER_MODULES)

clean:
rm -f Build/*.* $(COMMON_MODULES) $(P4PLUGIN_MODULES) $(TESTSERVER_MODULES)
3 changes: 3 additions & 0 deletions Makefile.srcs
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,6 @@ P4PLUGIN_INCLS = ./P4Plugin/Source/P4Command.h \

P4PLUGIN_LINK = -lclient -lrpc -lsupp -lp4api -lp4script -lp4script_curl -lp4script_sqlite -lp4script_c -lssl -lcrypto
P4PLUGIN_INCLUDE = -I./Common -I./P4Plugin/Source/p4api/include/p4 -I./P4Plugin/Source

# Temporarily use the old include_r21.2 for Linux build until we can find the time to update it to the newest API and validate it fully
P4PLUGIN_INCLUDE_OLD = -I./Common -I./P4Plugin/Source/p4api/include_r21.2/p4 -I./P4Plugin/Source
4 changes: 2 additions & 2 deletions P4Plugin/P4Plugin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NODEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;
_SCL_SECURE_NO_DEPRECATE
;_SECURE_SCL=0;WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\Common;$(ProjectDir)Source\;$(ProjectDir)Source\p4api\include\P4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Common;$(ProjectDir)Source\;$(ProjectDir)Source\p4api\include_r21.2\P4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
Expand All @@ -170,7 +170,7 @@ _SCL_SECURE_NO_DEPRECATE
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NODEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;
_SCL_SECURE_NO_DEPRECATE
;_SECURE_SCL=0;WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..\Common;$(ProjectDir)Source\;$(ProjectDir)Source\p4api\include\P4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ProjectDir)..\Common;$(ProjectDir)Source\;$(ProjectDir)Source\p4api\include_r21.2\P4;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
Expand Down
1 change: 1 addition & 0 deletions P4Plugin/Source/P4PluginVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
// 2021.3.38f1, 2023.2.19f1, 6000.0.0b14
// 1.3.0 2025/07/29 P4 API 2021.2 for Perforce Cloud
// 1.4.0 build with Visual Studio 2022 and Windows 10 SDK for long path names
// add support for macOS arm64 using P4 API 2024.1 (for macOS only)

#define PERFORCE_PLUGIN_VERSION "1.4.0"
4 changes: 2 additions & 2 deletions P4Plugin/Source/openssl/lib/osx64/libcrypto.a
Git LFS file not shown
4 changes: 2 additions & 2 deletions P4Plugin/Source/openssl/lib/osx64/libssl.a
Git LFS file not shown
3 changes: 3 additions & 0 deletions P4Plugin/Source/openssl/lib/osxarm64/libcrypto.a
Git LFS file not shown
3 changes: 3 additions & 0 deletions P4Plugin/Source/openssl/lib/osxarm64/libssl.a
Git LFS file not shown
6 changes: 4 additions & 2 deletions P4Plugin/Source/p4api/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
Document the links from where the P4 C++ API (include files and static libraries) where downloaded:

https://filehost.perforce.com/perforce/r21.2/ p4api-2021.2.2536545
https://filehost.perforce.com/perforce/r24.1/ p4api-2024.1.2805613

Notes: see also download_perforce_binaries.ps1

# linux64
- https://filehost.perforce.com/perforce/r21.2/bin.linux26x86_64/p4api-glibc2.3-openssl1.0.2.tgz

# osx64
- https://filehost.perforce.com/perforce/r21.2/bin.macosx105x86_64/p4api-openssl1.0.2.tgz
# osx
- https://filehost.perforce.com/perforce/r24.1/bin.macosx105x86_64/p4api-openssl3.tgz
- https://filehost.perforce.com/perforce/r24.1/bin.macosx12arm64/p4api-openssl3.tgz

# Win32
- https://filehost.perforce.com/perforce/r21.2/bin.ntx86/p4api_vs2019_static_openssl1.0.2.zip
Expand Down
4 changes: 3 additions & 1 deletion P4Plugin/Source/p4api/include/p4/clientapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ class ClientApi : public StrDict {
const StrArray *GetConfigs();
const StrPtr &GetBuild();
const StrPtr &GetVersion();
Error * GetTransError();

Enviro * GetEnviro();
Ignore * GetIgnore();
Expand All @@ -270,7 +271,7 @@ class ClientApi : public StrDict {
bool ExtensionsEnabled();
void SetExtension( ClientScript* cs, Error* e,
const bool callerOwns = false );

void EnableDebugHooks();
public:
// The old interface, where ui was held from the start

Expand All @@ -288,6 +289,7 @@ class ClientApi : public StrDict {

StrPtr *VGetVar( const StrPtr &var );
void VSetVar( const StrPtr &var, const StrPtr &val );
int VGetCount();

private:
Client *client; // wrapped up RPC
Expand Down
2 changes: 2 additions & 0 deletions P4Plugin/Source/p4api/include/p4/clientprog.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define CPU_FILES 2
#define CPU_KBYTES 3
#define CPU_MBYTES 4
#define CPU_DELTAS 5

class ClientProgress
{
Expand Down Expand Up @@ -49,5 +50,6 @@ class ClientProgressText : public ClientProgress
int backup;
StrBuf desc;
bool done;
int units;

};
14 changes: 10 additions & 4 deletions P4Plugin/Source/p4api/include/p4/clientscript.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@

# ifdef HAS_EXTENSIONS

// This enum represents the result of a client-side Extension function.

enum class ClientScriptAction
{
UNKNOWN,
FAIL,
PASS,
REPLACE
UNKNOWN, // Script misbehaving / crashed / etc.
FAIL, // Script says 'no'.
PASS, // Script says 'ok'.
REPLACE, // Script does something instead of what would happen.
PRE_DEBUG, // Non-functional divider between normal user-facing
// scripts and internal debug code.
ABORT, // Tell the caller to abort or otherwise exit immediately.
EARLY_RETURN // Tell the caller to return control to its parent func.
};

class ClientScript
Expand Down
9 changes: 9 additions & 0 deletions P4Plugin/Source/p4api/include/p4/clientuser.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ class ClientTransfer;
class ClientSSO;
class ClientApi;

# ifdef HAS_CPP11
# include <mutex>
# endif

class ClientUser {

public:
Expand Down Expand Up @@ -163,6 +167,9 @@ class ClientUser {

virtual void Finished() {}

void SetVarList( StrDict *l );
void SetEnviro( Enviro *env );

StrDict *varList; // (cheesy) access to RPC buffer
Enviro *enviro; // (cheesy) access to Client's env

Expand Down Expand Up @@ -210,6 +217,8 @@ class ClientUser {
int quiet; // OutputInfo does nothing.
int autoLogin; // Can this implementation autoprompt

void* setterGuard; // Setter mutex when built with C++11+

protected:
int outputCharset; // P4CHARSET for output
StrBuf editFile;
Expand Down
43 changes: 24 additions & 19 deletions P4Plugin/Source/p4api/include/p4/datetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class DateTime {
DateTime( const char *date, Error *e ) { Set( date, e ); }

void Set( const char *date, Error *e );
void Set( const int date ) { wholeDay = 0; tval = (time_t)date; }
void Set( const P4INT64 date ) { wholeDay = 0; tval = (time_t)date; }
void SetNow() { Set( (int)Now() ); }

int Compare( const DateTime &t2 ) const {
return (int)(tval - t2.tval); };
P4INT64 Compare( const DateTime &t2 ) const {
return (tval - t2.tval); };

void Fmt( char *buf ) const;
void FmtDay( char *buf ) const;
Expand All @@ -38,31 +38,34 @@ class DateTime {
void FmtElapsed( char *buf, const DateTime &t2 );
void FmtUnifiedDiff( char *buf ) const;
void FmtISO8601( char *buf ) const;
void FmtISO8601Min( char *buf ) const;

void SetRFC5322( const char *date, Error *e );
void FmtRFC5322( char *buf ) const;

void SetGit( const StrPtr &gitDate, Error *e );
void FmtGit( StrBuf &buf ) const;

int Value() const { return (int)tval; }
int Tomorrow() const { return (int)tval + 24*60*60; }
P4INT64 Value() const { return tval; }
P4INT64 Tomorrow() const { return tval + 24*60*60; }
int IsWholeDay() const { return wholeDay; }

static int Never() { return 0; }
static int Forever() { return 2147483647; }
static P4INT64 Never() { return 0; }

// for stat() and utime() conversion

static time_t Localize( time_t centralTime );
static time_t Centralize( time_t localTime );
int TzOffset( int *isdst = 0 ) const;
static P4INT64 Localize( time_t centralTime );
static P4INT64 Centralize( time_t localTime );
P4INT64 TzOffset( int *isdst = 0 ) const;

protected:
time_t Now();
P4INT64 Now();

private:
time_t tval;
P4INT64 tval;
int wholeDay;

int ParseOffset( const char *s, const char *odate, Error *e );
P4INT64 ParseOffset( const char *s, const char *odate, Error *e );
};

class DateTimeNow : public DateTime {
Expand All @@ -84,7 +87,7 @@ class DateTimeHighPrecision
public:

// Orthodox Canonical Form (OCF) methods (we don't need a dtor)
DateTimeHighPrecision(time_t secs = 0, int nsecs = 0)
DateTimeHighPrecision(P4INT64 secs = 0, int nsecs = 0)
: seconds( secs ), nanos( nsecs ) { }

DateTimeHighPrecision(const DateTimeHighPrecision &rhs)
Expand Down Expand Up @@ -125,9 +128,10 @@ class DateTimeHighPrecision

void Now();
void Fmt( char *buf ) const;
void FmtISO8601( char *buf ) const;

time_t Seconds() const;
int Nanos() const;
P4INT64 Seconds() const;
P4INT64 Nanos() const;

bool IsZero() const { return seconds == 0 && nanos == 0; }

Expand All @@ -138,11 +142,12 @@ class DateTimeHighPrecision
// return < 0, = 0, or > 0 if *this < rhs, *this == rhs, or *this > rhs, respectively
int Compare( const DateTimeHighPrecision &rhs ) const;

private:

P4INT64 ToNanos() const;
P4INT64 ToMs() const;

private:

time_t seconds; // Since 1/1/1970, natch
P4INT64 seconds; // Since 1/1/1970, natch
int nanos;
} ;

Loading