Skip to content

Building from Source

Building from Source

If you plan to contribute a Pull Request to P then you need to build the source code and run the tests.

Prerequisites

Make sure you have followed the steps in the installation guide to install P dependencies.


Building the P Project

Clone the P repo and run the build script:

cd Bld
./build.sh
cd Bld
./build.ps1

Running the Tests

Build and run the test regressions for the P Compiler. Make sure you are in the root directory of the cloned repo that has the P.sln:

dotnet build --configuration Release
dotnet test --configuration Release

Using a Local Build

P is distributed as a dotnet tool. To test changes locally:

  1. Uninstall the existing global tool:
    dotnet tool uninstall --global P
    
  2. Navigate to the command-line project:
    cd Src/PCompiler/PCommandLine
    
  3. Pack a local build:
    dotnet pack PCommandLine.csproj --configuration Release --output ./publish \
        -p:PackAsTool=true \
        -p:ToolCommandName=P \
        -p:Version=<pick a version>
    
  4. Install from the local package:
    dotnet tool install P --global --add-source ./publish