Skip to content

Commit

Permalink
refactor(snap): Update command and metadata sourcing (edgexfoundry#162)
Browse files Browse the repository at this point in the history
- Inline CLIs flags
- Remove unused packages
- Remove external metadata sourcing

Signed-off-by: Mengyi Wang <[email protected]>
  • Loading branch information
MonicaisHer authored Mar 17, 2023
1 parent 3870cf6 commit 0370fe2
Showing 1 changed file with 17 additions and 32 deletions.
49 changes: 17 additions & 32 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: edgex-app-rfid-llrp-inventory
base: core20
adopt-info: metadata
license: Apache-2.0
summary: EdgeX RFID LLRP Inventory Application Service
description: Refer to https://snapcraft.io/edgex-app-rfid-llrp-inventory
adopt-info: app-rfid-llrp-inventory

architectures:
- build-on: arm64
Expand Down Expand Up @@ -35,14 +37,11 @@ plugs:

apps:
app-rfid-llrp-inventory:
command: bin/app-rfid-llrp-inventory $CONFIG_PRO_ARG $CONF_ARG $REGISTRY_ARG
command: bin/app-rfid-llrp-inventory --configDir $SNAP_DATA/config/app-rfid-llrp-inventory/res --configProvider --registry
command-chain:
- bin/source-env-file.sh
daemon: simple
environment:
CONFIG_PRO_ARG: "-cp=consul://localhost:8500"
CONF_ARG: "--configDir=$SNAP_DATA/config/app-rfid-llrp-inventory/res"
REGISTRY_ARG: "--registry"
SECRETSTORE_TOKENFILE: $SNAP_DATA/app-rfid-llrp-inventory/secrets-token.json
install-mode: disable
plugs: [network, network-bind]
Expand All @@ -55,24 +54,32 @@ parts:
- go/1.20/stable
override-build: |
cd $SNAPCRAFT_PART_SRC
make build
install -DT ./helper-go $SNAPCRAFT_PART_INSTALL/bin/helper-go
app-rfid-llrp-inventory:
after: [metadata]
source: .
plugin: make
build-packages: [gcc, git, libzmq3-dev, pkg-config]
build-packages: [git]
build-snaps:
- go/1.20/stable
stage-packages: [libzmq5]
override-build: |
cd $SNAPCRAFT_PART_SRC
# the version is needed for the build
cat ./VERSION
if git describe ; then
VERSION=$(git describe --tags --abbrev=0 | sed 's/v//')
else
VERSION="0.0.0"
fi
# set the version of the snap
snapcraftctl set-version $VERSION
# write version to file for the build
echo $VERSION > VERSION
make tidy
make build
install -DT "./app-rfid-llrp-inventory" "$SNAPCRAFT_PART_INSTALL/bin/app-rfid-llrp-inventory"
Expand All @@ -92,25 +99,3 @@ parts:
organize:
source-env-file.sh: bin/source-env-file.sh

metadata:
plugin: nil
source: https://github.com/canonical/edgex-snap-metadata.git
source-branch: appstream
source-depth: 1
override-build: |
# install the icon at the default internal path
install -DT edgex-snap-icon.png \
$SNAPCRAFT_PART_INSTALL/meta/gui/icon.png
# change to this project's repo to get the version
cd $SNAPCRAFT_PROJECT_DIR
if git describe ; then
VERSION=$(git describe --tags --abbrev=0 | sed 's/v//')
else
VERSION="0.0.0"
fi
# write version to file for the build
echo $VERSION > ./VERSION
# set the version of this snap
snapcraftctl set-version $VERSION
parse-info: [edgex-app-rfid-llrp-inventory.metainfo.xml]

0 comments on commit 0370fe2

Please sign in to comment.