Skip to content

Commit b19f06a

Browse files
authored
Merge pull request #87 from tmathmeyer/master
Cleaned up the build script
2 parents f3da424 + 89031c1 commit b19f06a

File tree

4 files changed

+65
-35
lines changed

4 files changed

+65
-35
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ conf.json
77
*.exe
88
build/
99
npm-debug.log
10+
ui/package-lock.json
11+
build/

Makefile

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,49 @@
11
# Build tool for Factorio Server Manager
2-
#
32

43
NODE_ENV:=production
54

6-
build:
7-
# make sure this project is located within GOPATH, I.E. $GOPATH/src/factorio-server-manager
8-
9-
# Build Linux release
10-
mkdir build
11-
GOOS=linux GOARCH=amd64 go build -o factorio-server-manager/factorio-server-manager factorio-server-manager/src
12-
# ui/node_modules/webpack/bin/webpack.js ui/webpack.config.js app/bundle.js --progress --profile --colors
13-
cp -r app/ factorio-server-manager/
14-
cp conf.json.example factorio-server-manager/conf.json
15-
zip -r build/factorio-server-manager-linux-x64.zip factorio-server-manager
16-
rm -rf factorio-server-manager
17-
# Build Windows release
18-
GOOS=windows GOARCH=386 go build -o factorio-server-manager/factorio-server-manager.exe factorio-server-manager/src
19-
cp -r app/ factorio-server-manager/
20-
cp conf.json.example factorio-server-manager/conf.json
21-
zip -r build/factorio-server-manager-windows.zip factorio-server-manager
22-
rm -rf factorio-server-manager
23-
24-
dev:
25-
mkdir dev
26-
GOOS=linux GOARCH=amd64 go build -o factorio-server-linux/factorio-server-manager factorio-server-manager/src
27-
cp -r app/ dev/
28-
cp conf.json.example dev/conf.json
29-
mv factorio-server-linux/factorio-server-manager dev/factorio-server-manager
5+
#TODO add support for a mac build maybe?
6+
UNAME := $(shell uname)
7+
ifeq ($(UNAME), Linux)
8+
release := build/factorio-server-manager-linux.zip
9+
else
10+
release := build/factorio-server-manager-windows.zip
11+
endif
12+
13+
build: $(release)
14+
15+
$(shell mkdir -p build)
16+
build/factorio-server-manager-%.zip: app/bundle.js factorio-server-manager-%
17+
@echo "Packaging Build - $@"
18+
@cp -r app/ factorio-server-manager/
19+
@cp conf.json.example factorio-server-manager/conf.json
20+
@zip -r $@ factorio-server-manager > /dev/null
21+
@rm -r factorio-server-manager
22+
23+
app/bundle.js:
24+
@echo "Building Frontend"
25+
@cd ui && npm install && npm run build
26+
27+
factorio-server-manager-linux: godeps
28+
@echo "Building Backend - Linux"
29+
@GOPATH="${GOPATH}:${PDW}"
30+
@mkdir -p factorio-server-manager
31+
@GOOS=linux GOARCH=amd64 go build -o factorio-server-manager/factorio-server-manager ./src
32+
33+
factorio-server-manager-windows: godeps
34+
@echo "Building Backend - Windows"
35+
@GOPATH="${GOPATH}:${PDW}"
36+
@mkdir -p factorio-server-manager
37+
@GOOS=windows GOARCH=386 go build -o factorio-server-manager/factorio-server-manager.exe ./src
38+
39+
godeps:
40+
@echo "Installing Packages"
41+
@cat gopkglist | xargs go get
42+
43+
gen_release: build/factorio-server-manager-linux.zip build/factorio-server-manager-windows.zip
44+
@echo "Done"
45+
46+
clean:
47+
@echo "Cleaning"
48+
@rm -r build/
49+
@rm app/bundle.js

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,23 @@ All api actions are accessible with the /api route. The frontend is accessible
8787
+ Go 1.6
8888
+ NodeJS 4.2.6
8989

90-
#### Building the Go backend
91-
Go Application which manages the Factorio server.
92-
93-
API requests for managing the Factorio server are sent to /api.
90+
#### Building Releases
91+
Creates a release zip for windows and linux: (this will install the dependencies listed in gopkgdeps)
92+
```
93+
git clone https://github.com/MajorMJR/factorio-server-manager.git
94+
cd factorio-server-manager
95+
make gen_release
96+
```
9497

95-
The frontend code is served by a HTTP file server running on /.
98+
#### Building a Testing Binary:
9699
```
97100
git clone https://github.com/MajorMJR/factorio-server-manager.git
98101
cd factorio-server-manager
99-
make build
102+
make
103+
./factorio-server-manager/factorio-server-manager
100104
```
101105

102-
#### Building the React frontend
106+
#### Building the React Frontend alone
103107
Frontend is built using React and the AdminLTE CSS framework. See app/dist/ for AdminLTE included files and license.
104108

105109
The root of the UI application is served at app/index.html. Run the npm build script and the Go application during development to get live rebuilding of the UI code.
@@ -108,9 +112,7 @@ All necessary CSS and Javascript files are included for running the UI.
108112

109113
Transpiled bundle.js application is output to app/bundle.js, 'npm run build' script starts webpack to build the React application for development.
110114
```
111-
cd ui/
112-
npm install
113-
npm run build
115+
make app/bundle.js
114116
```
115117

116118
### Building for Windows

gopkglist

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
github.com/apexskier/httpauth
2+
github.com/go-ini/ini
3+
github.com/gorilla/mux
4+
github.com/gorilla/websocket
5+
github.com/hpcloud/tail
6+
github.com/majormjr/rcon

0 commit comments

Comments
 (0)