SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Tools and Files

Reply
 
Thread Tools Display Modes
Old 29/05/2020, 04:28 AM   #1
Sasino97
High-roller
 
Sasino97's Avatar
 
Join Date: Dec 2010
Location: Tampa, FL
Posts: 1,418
Reputation: 139
Default Pawn Make - A very simple yet powerful build tool

PawnMake
A very simple yet powerful build tool

I'm releasing PawnMake, a build tool I initially made for my personal use.

Download
Releases
Source

Description
A very simple yet powerful command line tool which can be used to build Pawn scripts in the form of a project, using a json-based configuration file.

It needs the pawn compiler (in PATH or in the same directory). Currently only working on Windows, being built on .NET Framework 4.7.1, but can be very easily ported to .NET Core, most likely with no changes to the code at all, and it would run on Linux and MacOSX.

Usage
Code:
PawnMake <filename.json> [options]
Currently the only option available is -r, which means that after building, the programs defined in the Run array should be called.

Example input
Example build.json file
Code:
{
    "ProjectName" : "Roleplay",
    "BuildFolders" : [
        {
            "SourceFolder" : "src\\gamemodes",
            "OutputFolder" : "bin\\gamemodes"
        },
        {
            "SourceFolder" : "src\\filterscripts",
            "OutputFolder" : "bin\\filterscripts"
        },
        {
            "SourceFolder" : "src\\npcmodes",
            "OutputFolder" : "bin\\npcmodes"
        }
    ],

    "IncludeFolders" : [
        "C:\\pawncc\\include",
        "src\\include"
    ],

    "Files" : [
        "RP.pwn",
        "RP_Admin.pwn",
        "RP_Clothes.pwn",
        "RP_Dealers.pwn",
        "RP_Friendship.pwn",
        "RP_Drugs.pwn",
        "RP_Houses.pwn",
        "RP_Phone.pwn",
        "RP_NPC_Intro1.pwn"
    ],

    "Args" : "-O1 -;+ -(+ -w239 -w214",

    "Run" : [
        "bin\\samp-server.exe",
        "bin\\debug.exe"
    ]
}
ProjectName: the displayed project name.

BuildFolders: every BuildFolder entry contains a source and an output folder, which defines that files found in the source folder should be compiled to the output folder. I personally prefer to keep the source separate from the binaries, but if you prefer the default SA-MP server folder structure, you would use the same name for both the source and output settings.

IncludeFolders: defines the folders where the compiler should search for include files.

Files: the list of source code file names, without directory and with the extension.

Args: any additional args you wish to pass to the compiler. For example, pass -w239 to disable warning 239.

Run: the executable files to run after completion, only if the -r arg is passed to the program.

Example output
Code:
------ Build started - Project: Roleplay ------
* Compiling src\gamemodes\RP.pwn -> bin\gamemodes\RP.amx
    src\gamemodes\RP.pwn(271) : warning 204: symbol is assigned a value that is never used: "mapandreasAddress"
    Pawn compiler 3.10.10                       Copyright (c) 1997-2006, ITB CompuPhase


    1 Warning.

* Compiling src\filterscripts\RP_Admin.pwn -> bin\filterscripts\RP_Admin.amx
* Compiling src\filterscripts\RP_Clothes.pwn -> bin\filterscripts\RP_Clothes.amx
    src\filterscripts\RP_Clothes.pwn(475) : error 017: undefined symbol "tmpScore"
    src\filterscripts\RP_Clothes.pwn(475) : warning 215: expression has no effect
    Pawn compiler 3.10.10                       Copyright (c) 1997-2006, ITB CompuPhase


    1 Error.

* Skipping src\filterscripts\RP_Dealers.pwn
* Skipping src\filterscripts\RP_Friendship.pwn
* Skipping src\filterscripts\RP_Drugs.pwn
* Skipping src\filterscripts\RP_Houses.pwn
* Skipping src\filterscripts\RP_Phone.pwn
* Skipping src\npcmodes\RP_NPC_Intro1.pwn
========== Build: 2 succeeded, 1 failed, 6 skipped ==========
If no errors or warnings were encountered, the pawncc output is ignored, otherwise it is shown after the corresponding line. If a file has been skipped it means that it had no changes since the last build (the .amx file is more recent than the source file).


Configuring VSCode
VSCode can be configure to build the script via this program in the tasks.json file. To open this file, simply go to the folder of your project and locate the .vscode folder, or more simply by clicking Task->Configure Tasks in the VSCode menu.

The following is an example tasks.json:

Code:
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Build",
            "type": "shell",
            "command": "PawnMake.exe",
            "args": [ "${workspaceRoot}\\build.json" ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "Build and Run",
            "type": "shell",
            "command": "PawnMake.exe",
            "args": [ "${workspaceRoot}\\build.json", "-r" ],
            "group": {
                "kind": "test",
                "isDefault": true
            }
        }
    ]
}
__________________
Sasino97 is offline   Reply With Quote
Old 29/05/2020, 10:23 AM   #2
bestspinner
Little Clucker
 
Join Date: May 2020
Location: Singapore
Posts: 3
Reputation: 0
Default Re: Pawn Make - A very simple yet powerful build tool

Wow, thanks man. Nice job!
bestspinner is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
There is a tool to build racing? MarllonGTA Scripting Help 1 03/08/2016 11:54 PM
[Tool/Web/Other] Simple isup tool Abagail Tools and Files 9 19/01/2015 03:04 PM
Need someone for to build simple filterscript. howtodo Scripting Help 7 11/03/2014 08:55 PM
[FilterScript] Simple Handobject Tool iggy1 Filterscripts 9 12/11/2010 02:30 PM


All times are GMT. The time now is 11:28 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.