Skip to content

Commit 7f342f7

Browse files
committed
2021.2 Patch 1 release
1 parent c15bd89 commit 7f342f7

226 files changed

Lines changed: 14981 additions & 15319 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.p4ignore

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.p4config
2+
*.sln.DotSettings.user
3+
4+
# build directories
5+
cmake-build-*/
6+
cmakebuild/
7+
bin/
8+
build/
9+
out/
10+
obj/
11+
p4bridge-unit-test/p4bridge/
12+
p4bridgeStressTest/p4bridge/
13+
14+
# p4api locations
15+
p4api/
16+
p4api_*/
17+
18+
# cmake
19+
CMakeCache.txt
20+
CMakeFiles
21+
CMakeUserPresets.json
22+
cmake_install.cmake
23+
install_manifest.txt
24+
*.cmake
25+
26+
# osx
27+
.DS_Store
28+
29+
Makefile
30+
*.cbp
31+
*.user
32+
33+
# testing
34+
*.TestSession
35+
36+
# visual studio
37+
.vs/*/
38+
39+
# jetbrains
40+
.idea/**/workspace.xml
41+
.idea/**/usage.statistics.xml
42+
.idea/**/tasks.xml
43+
.idea/**/shelf
44+
.idea/**/dictionaries
45+
.idea/**/contentModel.xml
46+
*.iws
47+
48+
# vscode
49+
.vscode/*
50+
!.vscode/settings.json
51+
!.vscode/tasks.json
52+
!.vscode/launch.json
53+
!.vscode/extensions.json
54+
**/.history
55+
56+
# vi
57+
*.swp

BUILD.md

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Build instructions for P4API.NET
2+
3+
These are Build instructions for P4API.net and its required DLL and various test utilities
4+
5+
## The .NET Core (6.0) cross-platform port
6+
7+
With the 2021.2 release, `P4API.NET` has been extended to support .NET CORE and to be cross-platform on three Target OS's (Windows, Linux, OSX)
8+
9+
P4API.NET consists of a DLL written in C++ which contains the Perforce C++ API, which is wrapped by a layer of C# code which exports the .NET interface.
10+
11+
The bridge code is dependent on P4API release 21.2 or above.
12+
13+
Within this directory are several subprojects. p4bridge, p4bridge-unit-test, p4bridgeStressTest, p4api.net and p4api.net-unit-test
14+
15+
## Getting to know your solutions
16+
17+
### p4apicore.net.sln
18+
19+
[p4apicore.net.sln](p4apicore.net.sln) - This solution includes projects [p4api.net.csproj](./p4api.net/p4api.net.csproj) and [p4api.net-unit-test.csproj](./p4api.net-unit-test/p4api.net-unit-test.csproj).
20+
Both of the projects target frameworks .NET Framework 4.6.2, .Net Core 6.0 and .NET Standard 2.0.
21+
> It only includes the C# portions of the project.
22+
> It can be built using the `dotnet build p4apicore.net.sln` command.
23+
This solution can be opened by the "dotnet" executable on any supported platform, or by VS2019+ on windows only.
24+
This is the primary solution to be used for building and/or debugging P4API.NET and its unit tests.
25+
26+
### Sample Applications
27+
28+
Sample Console Applications for .NET 6.0 are provided here:
29+
[consoleApps/ControlCTest.sln](consoleApps/ControlCTest.sln) and [consoleApps/P4DotNetConsole.sln](consoleApps/P4DotNetConsole.sln)
30+
31+
Sample Applications for .NET framework are provided here:
32+
[examples/examples.sln](examples/examples.sln)
33+
34+
### What about VS Code?
35+
36+
The workspace file [p4apinet.code-workspace](./p4apinet.code-workspace) opens the P4API.NET C# source tree for the assembly and its Unit Tests.
37+
This workspace has not been customized for C# and cannot be used to build the distribution on any platform.
38+
39+
The workspace file [p4bridge.code-workspace](./p4bridge.code-workspace) shows the P4BRIDGE C++ source tree and the source for the p4bridge-unit-test.
40+
This workspace has not been customized for C++ and CMake and cannot be used to build the distribution on any platform.
41+
42+
Enhancing these workspaces to actually do builds is an exercise for the reader ;)
43+
44+
## Setting up the C++ build environment
45+
46+
C++ is used for the *p4bridge*, *p4bridge-unit-test* and *p4bridgeStressTest* projects, which are all in subdirectories of the p4api.net top-level directory. All C++ builds use Cmake.
47+
48+
### Updating cmake
49+
50+
The *p4bridge*, *p4bridge-unit-test* and *p4bridgeStressTest* projects require cmake 3.20 or better, (for CMake Profile support).
51+
52+
The default installation of cmake on ubuntu will require updating.
53+
to update to the latest version on ubuntu, follow package updating instructions here: [CMake APT repository](https://apt.kitware.com)
54+
55+
### Getting the P4API and openssl 1.1.1 libraries
56+
57+
We've included some sample setup scripts for copying the P4API and openssl libraries into their expected source subdirectories. They are found in the root p4api.net directory.
58+
look for *setuplibrary.bat*, *setuplibrary_linux.sh* and *setuplibrary_osx.sh*
59+
60+
These scripts are just examples, they represent what I had to do to get my environment to work correctly, they will need to be edited to work in your environment.
61+
62+
The library directories must be in place before building the *p4bridge* project.
63+
64+
## Getting to know your subprojects
65+
66+
### Building the **p4bridge DLL**
67+
68+
The p4bridge DLL is required by `P4API.NET` and is a C++ project built by cmake.
69+
70+
The same p4bridge DLL will work in both .NET Core and .NET Framework Assemblies.
71+
72+
The source and build instructions for the bridge DLL is in the *p4bridge* subdirectory.
73+
74+
[P4Bridge.md](p4bridge/P4Bridge.md)
75+
76+
### Building and running the **Bridge-Unit-Test**
77+
78+
The bridge-unit-test is a C++ project which provides a test suite for the p4bridge.
79+
The source, build and configuration instructions for these tests is in the *p4bridge-unit-test* subdirectory.
80+
81+
[BridgeUnitTest.md](p4bridge-unit-test/BridgeUnitTest.md)
82+
83+
### Building and running the **p4bridgeStressTest**
84+
85+
The p4bridgeStressTest is a C++ project which provides a performance test for the p4bridge. The source and instructions for this test is in the p4bridgeStressTest subdirectory.
86+
87+
[p4bridgeStressTest.md](p4bridgeStressTest/p4bridgeStressTest.md)
88+
89+
### Building `P4API.NET`
90+
91+
**IMPORTANT!** - The C++ bridge must have already been built before building P4API.NET.
92+
93+
Make sure you have an updated .NET 6.0 SDK (or better) installed for your platform.
94+
download from here: [Microsoft .NET Downloads](https://dotnet.microsoft.com/download)
95+
96+
in the p4api.net root folder run
97+
`dotnet build p4apicore.net.sln`
98+
99+
This will create The .NET DLL in `p4api.net\bin\Debug\net60\p4api.net.dll`, `p4api.net\bin\Debug\net462\p4api.net.dll`, `p4api.net\bin\Debug\netstandard2.0\p4api.net.dll`
100+
And the Unit test in `\p4api.net-unit-test\bin\Debug\net60\p4api.net-unit-test.dll`, `\p4api.net-unit-test\bin\Debug\net462\p4api.net-unit-test.dll`, `\p4api.net-unit-test\bin\Debug\netstandard2.0\p4api.net-unit-test.dll`
101+
It will also copy the p4bridge.dll from the appropriate place in the ../p4bridge output into the default output directory.
102+
103+
On Windows, you can specify a specific Configuration and Platform with parameters:
104+
`dotnet build p4apicore.net.sln -c Release -p:Platform=x86`
105+
106+
On Windows, if no Platform is specified the default is 'x64'.
107+
On Windows, If no Configuration is specified the default is 'Debug'.
108+
109+
As part of the P4API.NET project build, the (previously build) p4bridge DLLs are copied
110+
into proper runtime locations.
111+
112+
### Running `P4API.NET Unit Test`
113+
114+
* Using the **dotnet** command, in the *p4api.net* root folder run:
115+
`dotnet test p4apicore.net.sln`
116+
117+
> Filter on the dotnet framework to run upon
118+
>> `dotnet test p4apicore.net.sln -f net60`
119+
>
120+
> Filter on the specific test to run
121+
>> `dotnet test p4apicore.net.sln -f net60 --filter TestName`
122+
123+
124+
* **Visual Studio 2019** can be used to debug the .NET unit tests if you are running in Windows.
125+
Open p4apicore.net.sln, then use the Test Explorer Window to run and manage the tests.
126+
One unique feature of the VS2019 debugger is that it makes it possible to debug both .NET C# and the P4BRIDGE C++ in the same session.
127+
128+
* **JetBrains Rider** can also be used to debug the .NET unit tests on all platforms, just open p4apicore.net.sln and the Unit Tests will show up in the Unit Test Explorer window.
129+
Unfortunately, you cannot debug through the C++ code using Rider.
130+
131+
### Creating a nuGet package
132+
133+
1. This only works on WINDOWS with DOTNET CORE so far.
134+
2. Build the four varieties of p4bridge first
135+
3. `dotnet pack p4apicore.net.sln`
136+
137+
This will create an Assembly DLL in *.\bin\p4api.net\bin\Debug\net6.0\p4api.net.dll*
138+
and a nuget package in:
139+
*p4api.net\bin\Debug\p4api.net.VERSION.nupkg*
140+
141+
### Deploy the nuget package for testing
142+
143+
Deploy this package to a local test repository with:
144+
`nuget add c:\dev\p4dotnetdev\p4api.net\p4api.net\bin\Debug\p4api.net.2021.2.xxx.yyyy.nupkg -Source C:\dev\local-nuget`
145+
146+
### List packages in the local test repository
147+
148+
`nuget list -Source c:\dev\local-nuget -PreRelease p4api.net`
149+
returns: *2021.2.xxx.yyyy*

CMakeLists.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
cmake_minimum_required(VERSION 3.19)
2+
3+
set(CMAKE_VERBOSE_MAKEFILE ON) # extra noise from cmake
4+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
5+
set(CMAKE_COLOR_MAKEFILE ON)
6+
7+
# top level cmake file for P4API.NET
8+
project(P4ApiNet DESCRIPTION "p4api.net project" LANGUAGES CSharp CPP)
9+
10+
message( NOTICE "Platform: ${CMAKE_SYSTEM_NAME}" ) # 'Windows' 'Linux' 'Darwin'
11+
message( NOTICE "Version: ${P4ApiNet_VERSION}" )
12+
message( NOTICE "Build Type: ${CMAKE_BUILD_TYPE}" )
13+
14+
if (WIN32)
15+
set(CMAKE_SHARED_LIBRARY_PREFIX "")
16+
endif()
17+
18+
add_subdirectory(p4bridge)
19+
add_subdirectory(p4bridge-unit-test)
20+
add_subdirectory(p4bridgeStressTest)
21+
add_subdirectory(p4api.net)
22+
add_subdirectory(p4api.net-unit-test)
23+
24+
add_custom_target(bridgetests)
25+
add_dependencies(bridgetests p4bridge-unit-test p4bridgeStressTest)
26+
27+
add_custom_target(tests)
28+
add_dependencies(tests p4api.net-unit-test)
29+
set(P4APINET_SOURCES )
30+
31+
add_executable(P4ApiNet ${P4APINET_SOURCES})
32+

LICENSE.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@ Copyright (c) 2022, Perforce Software, Inc. All rights reserved.
33
Redistribution and use in source and binary forms, with or without
44
modification, are permitted provided that the following conditions are met:
55

6+
7+
68
1. Redistributions of source code must retain the above copyright notice, this
79
list of conditions and the following disclaimer.
810

11+
12+
913
2. Redistributions in binary form must reproduce the above copyright notice,
1014
this list of conditions and the following disclaimer in the documentation
1115
and/or other materials provided with the distribution.
1216

17+
18+
1319
3. Neither the name of the copyright holder nor the names of its contributors
1420
may be used to endorse or promote products derived from this software without
1521
specific prior written permission.
1622

23+
24+
1725
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1826
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1927
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
[![Support](https://img.shields.io/badge/Support-Official-green.svg)](mailto:support@perforce.com)
22

33
# p4api.net
4-
P4API.NET is a wrapper for the P4 C++ API in C#.
4+
5+
P4API.NET is a wrapper for the Helix Core C/C++ API to be used in C# and other .NET languages.
6+
7+
[BUILD.md](BUILD.md)
8+
[P4Bridge.md](p4bridge/P4Bridge.md)
9+
[BridgeUnitTest.md](p4bridge-unit-test/BridgeUnitTest.md)

0 commit comments

Comments
 (0)