Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
ported netcode.io.host to go #2 (#7)
Browse files Browse the repository at this point in the history
* ported netcode.io.host to go

* Update build scripts to build Go helper

* Update README

* Update README again

* Remove .DS_Store

* Remove demo server from build
  • Loading branch information
mreinstein authored and hach-que committed Mar 20, 2018
1 parent e7f661f commit 0d08501
Show file tree
Hide file tree
Showing 31 changed files with 720 additions and 1,292 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ netcode.io.wininstall/package.zip
netcode.io.demoserver/.kube/
netcode.io.wininstall/.vs/
/browser/webext-selfdist/*.js

/netcode.io.host/netcode.io.host.exe
/netcode.io.host/netcode.io.host
8 changes: 0 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@ stage('Build') {
node('windows') {
checkout scm
powershell '.\\build\\Build-Win32.ps1'
stash includes: 'netcode.io.demoserver/**', name: 'demoserver'
archiveArtifacts 'output/**'
}
}
stage('Build Docker') {
node('linux-docker') {
unstash 'demoserver'
sh 'cd netcode.io.demoserver && docker build . -t redpointgames/netcode-demo-server:latest'
sh 'docker push redpointgames/netcode-demo-server:latest'
}
}
20 changes: 19 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,25 @@ The easiest way to install netcode.io is to visit [the demo website](https://net

For this to work, it requires the installation of both a browser extension and a native application helper which performs the actual netcode.io communication. The extension uses the native messaging APIs provided in browsers in order to make netcode.io available via the helper.

To try this out in your browser, you'll first need to build the `netcode.io.host.sln` solution in Visual Studio, then run `Install-Windows.ps1` in Powershell, which will install the netcode.io helper into the Windows registry.
To try this out in your browser, first build the netcode.io.host helper:

#### 1. Get dependencies
```bash
go get github.com/wirepair/netcode
```

#### 2. Platform specific build instructions

* `go build` - for the current OS
* `env GOOS=windows GOARCH=amd64 go build` - to build for Windows (linux-style to set environment variables)
* `env GOOS=linux GOARCH=amd64 go build` - to build for Linux (linux-style to set environment variables)
* `env GOOS=darwin GOARCH=amd64 go build` - to build for Mac (linux-style to set environment variables)

#### 3. Install (run this from the command-line)

`./netcode.io.host`

This should run with no errors, and install itself as a native messaging extension.

After this is done, add the `browser\webext` directory as an unpacked extension.

Expand Down
50 changes: 24 additions & 26 deletions build/Build-Win32.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ cd $PSScriptRoot\..
$root = Get-Location

if (Test-Path $root\output) {
rm -Recurse -Force $root\output
Remove-Item -Recurse -Force $root\output
}
mkdir $root\output

Expand All @@ -26,32 +26,30 @@ function ZipFiles( $zipfilename, $sourcedir )
$zipfilename, $compressionLevel, $false)
}

echo "Creating Web Extension ZIP (standard)..."
Write-Output "Creating Web Extension ZIP (standard)..."
ZipFiles -zipfilename $root\output\WebExtension.zip -sourcedir $root\browser\webext

echo "Creating Web Extension ZIP (self-dist)..."
cp -Force $root\browser\webext\hostmsg.js $root\browser\webext-selfdist\
cp -Force $root\browser\webext\netcode.js $root\browser\webext-selfdist\
cp -Force $root\browser\webext\netcodecs.js $root\browser\webext-selfdist\
Write-Output "Creating Web Extension ZIP (self-dist)..."
Copy-Item -Force $root\browser\webext\hostmsg.js $root\browser\webext-selfdist\
Copy-Item -Force $root\browser\webext\netcode.js $root\browser\webext-selfdist\
Copy-Item -Force $root\browser\webext\netcodecs.js $root\browser\webext-selfdist\
ZipFiles -zipfilename $root\output\WebExtension-SelfDist.zip -sourcedir $root\browser\webext-selfdist

echo "Building netcode.io helper..."
if (Test-Path $root\netcode.io.host\bin\Release) {
rm -Recurse -Force $root\netcode.io.host\bin\Release
}
if (Test-Path "C:\NuGet\nuget.exe") {
& "C:\NuGet\nuget.exe" restore
}
& "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /m /p:Configuration=Release netcode.io.host.sln
cp $root\browser\hostapp\manifest.windows.relative.chrome.json $root\netcode.io.host\bin\Release\manifest.windows.relative.chrome.json
cp $root\browser\hostapp\manifest.windows.relative.firefox.json $root\netcode.io.host\bin\Release\manifest.windows.relative.firefox.json

echo "Packaging netcode.io helper..."
if (Test-Path $root\netcode.io.wininstall\package.zip) {
rm -Force $root\netcode.io.wininstall\package.zip
}
ZipFiles -zipfilename $root\netcode.io.wininstall\package.zip -sourcedir $root\netcode.io.host\bin\Release

echo "Building netcode.io Windows installer..."
& "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /m /p:Configuration=Release netcode.io.wininstall\netcode.io.wininstall.csproj
cp netcode.io.wininstall\bin\Release\netcode.io.wininstall.exe output\NetcodeInstaller.exe
Write-Output "Building netcode.io helper / installers..."
Push-Location netcode.io.host
try {
go get github.com/wirepair/netcode
go get golang.org/x/sys/windows/registry
$env:GOARCH="amd64"
$env:GOOS="windows"
go build
Move-Item -Force netcode.io.host.exe ..\output\NetcodeInstaller-Windows.exe
$env:GOOS="darwin"
go build
Move-Item -Force netcode.io.host ..\output\NetcodeInstaller-macOS
$env:GOOS="linux"
go build
Move-Item -Force netcode.io.host ..\output\NetcodeInstaller-Linux
} finally {
Pop-Location
}
1 change: 1 addition & 0 deletions netcode.io.host/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
netcode.io.host
6 changes: 0 additions & 6 deletions netcode.io.host/App.config

This file was deleted.

Loading

0 comments on commit 0d08501

Please sign in to comment.