Don Newton | a6f5505 | 2020-01-09 10:38:45 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | <<COMMENT |
| 3 | Copyright 2019 the original author or authors. |
| 4 | |
| 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | you may not use this file except in compliance with the License. |
| 7 | You may obtain a copy of the License at |
| 8 | |
| 9 | http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | |
| 11 | Unless required by applicable law or agreed to in writing, software |
| 12 | distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | See the License for the specific language governing permissions and |
| 15 | limitations under the License. |
| 16 | COMMENT |
| 17 | if [ -z output ] |
| 18 | then |
| 19 | rm output |
| 20 | fi |
Don Newton | ac0455d | 2020-01-23 11:52:26 -0500 | [diff] [blame] | 21 | set GO111MODULE=on |
| 22 | go build -mod=vendor -o /build/ofagent \ |
| 23 | -ldflags \ |
| 24 | "-X github.com/opencord/voltha-lib-go/v2/pkg/version.version=$org_label_schema_version \ |
| 25 | -X github.com/opencord/voltha-lib-go/v2/pkg/version.vcsRef=$org_label_schema_vcs_ref \ |
| 26 | -X github.com/opencord/voltha-lib-go/v2/pkg/version.vcsDirty=$org_opencord_vcs_dirty \ |
| 27 | -X github.com/opencord/voltha-lib-go/v2/pkg/version.goVersion=$(go version 2>&1 | sed -E 's/.*go([0-9]+\.[0-9]+\.[0-9]+).*/\1/g') \ |
| 28 | -X github.com/opencord/voltha-lib-go/v2/pkg/version.os=$(go env GOHOSTOS) \ |
| 29 | -X github.com/opencord/voltha-lib-go/v2/pkg/version.arch=$(go env GOHOSTARCH) \ |
| 30 | -X github.com/opencord/voltha-lib-go/v2/pkg/version.buildTime=$org_label_schema_build_date" \ |
| 31 | ./cmd/ofagent |
| 32 | |
| 33 | #go build ./cmd/ofagent -mod=vendor -o build/ofagent-go |
Don Newton | a6f5505 | 2020-01-09 10:38:45 -0500 | [diff] [blame] | 34 | |
| 35 | if [ "$1" = "debug" ] |
| 36 | then |
| 37 | echo DEBUGGING |
| 38 | ./build/ofagent-go -memprofile=debugmem -cpuprofile=debugcpu -debug -ofaddress=localhost openflowPort=6653 -volthaAddress=localhost -volthaPort=50057 2>&1 |tee output |
| 39 | else |
| 40 | echo NOT DEBUGGING |
| 41 | ./build/ofagent-go -ofaddress=localhost openflowPort=6653 -volthaAddress=localhost -volthaPort=50057 -memprofile=mem -cpuprofile=cpu 2>&1 |tee output |
| 42 | fi |
| 43 | |