Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEVER MERGE: ROBOT plugin testing #9952

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Conversation

matentzn
Copy link
Contributor

@matentzn matentzn commented Aug 7, 2023

No description provided.

$(EDIT_PREPROCESSED): $(SRC)
# Instead of making the prepare-robot-plugins a dependency, we just call the goal
# to update the plugins when we need it
$(MAKE) prepare-robot-plugins
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be preferable to putting it into the dependencies (as it is a phony goal). The symlinks are very fast, and the other plugins are only updated when the make cache is invalidated first.

# Standard rule to create symlinks in $(TMPDIR)/plugins, so that the repository plugins
# are visible to ROBOT
prepare-robot-plugins:
for plugin in $(ROBOT_REPOSITORY_PLUGINS) ; do ln $plugin $(TMPDIR)/plugins ; done
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not throw an error when the ../../plugins directory does not exist, which is good.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this will throw an error if there are some plugins in the ../../plugins directory but the destination directory ($(TMPDIR)/plugins) does not exist. We need a mkdir -p $(TMPDIR)/plugins before attempting to create the symlinks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Just unix 101: what happens if a file is deleted in ../../plugins/*.jar after this is run? Does the seem link disappear as well?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. We’re creating a normal link here, not a symbolic one (or a “hard” link instead of a “soft” one) – my mistake in the previous comment for calling them “symlinks” out of habit.

If the original file in ../../plugins/ is deleted, the newly added link in $(TMPDIR)/plugins will still be there, and will still point to the same contents (technically the same inode) on the disk.

(FYI: The reason we are creating normal links instead of symbolic links is that for some reasons, from within the ODK ROBOT would not be able to correctly follow the symlinks, even if both the symlinks and the files they are pointing to are both visible from the container – I’ve tried.)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll be curious to see whether this works as expected on Windows, though. AFAIK Windows has no such concepts as links and inodes, so I don’t know how Docker on Windows will handle that…


# in the custom.Makefile, users can simply attach any custom plugins they need
# as dependencies to the prepare-robot-plugins goal
prepare-robot-plugins: $(ROBOT_PLUGINS_DIRECTORY)/monarch.jar
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed the goal a bit. Similar to test goal, custom Makefile extenders can simply attach the custom modules to that goal if they need to

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants