No-op plugin for performance

I have a file that I need to copy into the staging area.

The organise statement does this fine.

The problem is one of performance.

I have two other parts that I could add the organise statement too but they take a long time to bulid.
As I’m doing development of the snap the file I need to copy is currently changing a lot.

If I add an organize to one of the other two large parts then doing a rebuild takes a long time.

If I can add the organise to a separate part, then I can just clean that part and quickly have my snap rebuilt.

The problem is that parts must have a plugin type. Given this simple organise what plugin can I user that actually does nothing?

the nil plugin does nothing, and is usually used with prepare, build and install scriptlets:

parts:
  nil-plugin-example:
    plugin: nil
    source: source-dir
    prepare:
      chmod +x somescript.sh
    install:
      cp somescript.sh $SNAPCRAFT_PART_INSTALL/bin/somescript.sh

You can only organize files that are created by a particular part. i.e. you cannot organize files from your currently defined part in your new part unless you move the installation of those files to the new part.

As an alternative, if you’re just copying the files into the snap you can use the dump plugin instead of using the nil plugin with an install scriptlet copying the files into the installation:

parts:
  dump-plugin-example:
    plugin: dump
    source: source-dir
    prepare:
      chmod +x somescript.sh
    organize:
      somescript.sh: bin/somescript.sh

Thanks for the response.

I think the real answer to my underlying question is actually that I should use

snap try --devmode prime

snap remove

snap try --devmode prime.

My understanding is that by using try I can edit the scripts directly in the prime directory and re-test without going through a build phase.

1 Like