Skip to content

automate plugin packaging #23

Description

@justme-1968

i just found your repository yesterday and had a quick qo on a plugin for my home automation project. i really like writing a stremdeck plugin in swift, but after the first trials i got very annoyed with the manual packaging of the resulting plugin.

i first thought of using a package plugin for a post build step, but this is currently not possible. only pre build and build plugins currently.

then i just had a very quick and dirty go at a post-build step for the build scheme. unfortunately this seems to be also quite limited for packages, but with some brute force i got it to work.

maybe this is also useful for others...

prerequisites:

  • a Tools directory on the same level as the plugin's Sources with the DistributionTool binary and the following createPlugin.sh script which should be executable
  • a Resources directory, also on the same level as Sources, with everything else required for the finished plugin like Icons/..., previews/... and language json files

then add the script to a post-build phases of the relevant build schemes.

all this can be under source control

the script will create a plugin directory, assemble all the parts for the finished plugin and then call DistributionTool to create the packaged plugin there. and opens a finder window. you can just double click the .streamDeckPlugin file as usual to install the plugin into the streamdeck software.
a log file for the process is created in /tmp/

you probably want to exclude pluginfrom source control. or change the script to create it somewhere else.
the $URI should also adjusted to match the api specs and your prefix.

createPlugin.sh:

#/bin/sh

SELF=`basename $0 .sh`
exec > /tmp/${SELF}.log 2>&1

echo `date`

PROJECT_DIR=${WORKSPACE_PATH}/../../..
cd ${PROJECT_DIR}

RESULT_DIR=./plugin

echo "using `pwd` as project dir"
echo "using ${RESULT_DIR} as result dir"

rm -fr ${RESULT_DIR}
mkdir ${RESULT_DIR}

# as of the api doc this sould rather be something like com.….<plugin-name>
URI=${PRODUCT_NAME}

# create manifest & combine with binary 
${TARGET_BUILD_DIR}/${PRODUCT_NAME} export ${URI} --generate-manifest --copy-executable --output ${RESULT_DIR}

# copy resources like Icons, previews & translations to components dir
COMPONENTS_DIR=${RESULT_DIR}/${URI}.sdPlugin
cp -r Resources/* ${COMPONENTS_DIR}

# pack everything into the plugin
Tools/DistributionTool -b -i ${COMPONENTS_DIR} -o ${RESULT_DIR}

open ${RESULT_DIR}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions