SA-MP Forums Archive
[Tutorial] Setting up a pawn development environment on OSX with IntelliJ - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Setting up a pawn development environment on OSX with IntelliJ (/showthread.php?tid=585907)



Setting up a pawn development environment on OSX with IntelliJ - Mandrakke - 17.08.2015

First of all, this is a very specific tutorial, focused on people who use to work on OSX with IntelliJ. This tutorial does not exclude the fact you'll have to install a Windows VM on OSX, since pawn compiler sa-mp uses only works on Windows.

Requirements
- Parallels or VirtualBox. Download it at: http://www.parallels.com/br/products/desktop/
- A working Windows VM (XP, Vista, 7 or 10) built in Parallels, Wine or similar with network shared with OSX. (my parallels version: 10.2.2. In this tutorial I'm using a Windows 7 VM with Parallels Tools installed.
- IntelliJ IDEA (mine is 13.1.4). Downloat Community Edition at: https://www.jetbrains.com/idea/download/
- MobaSSH installed on Windows. Download Home Edition at: http://mobassh.mobatek.net/download.html

Windows VM installation on Parallels
- Open Parallels and press command + N.
- Select Modern.IE as the new Virtual Machine. https://www.dropbox.com/s/u2v331tlb6...36.29.png?dl=0
- Keep clicking in "Continue" until you reach a window asking you to select the version of the system you want. Select "IE 11 in Windows 7". https://www.dropbox.com/s/cakcnre7nd...37.14.png?dl=0
- Download and install.

Windows VM installation on VirtualBox
- Download Modern.IE 11 on Windows 7 at http://dev.modern.ie/tools/vms/mac/
- On VirtualBox, go to File > Import Appliance and import the appliance you downloaded.

Parallels network configuration
Create two network configurations configured as the images below:
https://www.dropbox.com/s/ms0pac4wc2...21.58.png?dl=0
https://www.dropbox.com/s/79ksqy51sj...23.49.png?dl=0

VirtualBox network configuration
- First you need to create a new host-only network on VirtualBox, so open VirtualBox and press the shortcut Command + comma (Settings), then go to Network > Host-only network and click the icon "New" on the right panel. https://www.dropbox.com/s/14wj6fpyp8...56.52.png?dl=0
- After creating vboxnet0, edit it with the following configuration:

https://www.dropbox.com/s/hzunha3fv4...33.48.png?dl=0
https://www.dropbox.com/s/zit9u53okv...34.03.png?dl=0

Windows Network Configuration
After installing and launching Windows, go to "Control Panel" > "Network and Sharing Center" > "Change Adapter Settings" > "Local area connection" > "Edit" > "Internet Protocol Version 4 (IPv4)" and configure it as the image below to configure Windows network to use static IP address.

https://www.dropbox.com/s/7pybkgmb8c...04.06.png?dl=0

MobaSSH
On the Windows VM, download and install MobaSSH (http://mobassh.mobatek.net/download.html)

IntelliJ IDEA Deployment configuration
On IntelliJ, configure the deployment as the images below:
https://www.dropbox.com/s/1d1hw8o4yp...13.34.png?dl=0
https://www.dropbox.com/s/4w2o3uuuis...17.08.png?dl=0

Check the option "automatic upload"
https://www.dropbox.com/s/lvpe4y5o0v...18.20.png?dl=0

On deployment options, check the option "Upload external changes" and remove ".git" and ".svn" from the excluded items by name.
https://www.dropbox.com/s/2daom83x2h...19.43.png?dl=0

Setting up IntelliJ IDEA custom external tool to compile the pawn script
Create a new External Tool with the following configuration
https://www.dropbox.com/s/letyfefide...22.36.png?dl=0

Change "Program" and "Working directory" paths. You'll also need to create a file called pawncompiler.sh on "Program" directory with the following content:

Code:
#!/bin/sh
regex="\/([a-zA-Z]+)$"
[[ $1 =~ $regex ]]
dirpath=${BASH_REMATCH[1]}
echo "$dirpath $1 $2 $3"
ssh-add ~/.ssh/id_winvm
ssh yourrootusername@127.168.0.27 "cd /drives/c/BRZ/$dirpath/pawno; ./pawncc.exe -i ../$2/$3; exit"
Create a shortcut to your new external tool:
https://www.dropbox.com/s/x83hbizj9u...28.27.png?dl=0

In this example I created the shortcut Command + \, but you can also configure IntelliJ to call the Pawn Compiler tool when you save the file (Command + S).

And finally, the result: (click on the ******* link to view it better)


https://www.youtube.com/watch?v=_4CEfHDYU9M

Pros Cons

The tutorial can be incomplete, maybe I miss one step or another.. let me know if you follow this tutorial and couldn't start scripting on OSX!


Re: Setting up a pawn development environment on OSX with IntelliJ - maddinat0r - 18.08.2015

You actually can compile PAWN scripts natively on OS X. You just have to compile Zeex' modified PAWN compiler.


Re: Setting up a pawn development environment on OSX with IntelliJ - blackwolf4278 - 21.11.2016

Hi. The image URL don't work, could you please upload the images again or write the image content? Like the settings for Intellij, Windows network and etc.

Thanks.