Merged
Conversation
25 tasks
d963982 to
80d0e2c
Compare
1 task
80d0e2c to
367d716
Compare
367d716 to
d9909fd
Compare
Using perl commands: To get basic (type, name) plugins with some javadoc before perl -0777 -i -pe 's/ \*\/\s*\@plugin\(\s*type\s*=\s*([^\.]*)[^n]*name\s*=\s*"\s*([^"]*)"\s*\)/ * \@implNote \L\1\E names="\2"\n *\//igs' **/*.java To get basic (type, name, priority) plugins with some javadoc before perl -0777 -i -pe 's/ \*\/\s*\@plugin\(\s*type\s*=\s*([^\.]*)[^n]*name\s*=\s*"\s*([^"]*)",\s*priority\s*=\s*([^,\s]*)\s*\)/ * \@implNote \L\1\E names="\2", priority="\3"\n *\//igs' **/*.java To get basic (type, name, label, priority) plugins with some javadoc before perl -0777 -i -pe 's/ \*\/\s*\@plugin\(\s*type\s*=\s*([^\.]*)[^n]*name\s*=\s*"\s*([^"]*)",\s*label\s*=\s*"([^"]*)"\s*,\s*priority\s*=\s*([^,\s]*)\s*\)/ * \@implNote \L\1\E names="\2", label="\3", priority="\4"\n *\//igs' **/*.java To get basic (type, name, label) plugins with some javadoc before perl -0777 -i -pe 's/ \*\/\s*\@plugin\(\s*type\s*=\s*([^\.]*)[^n]*name\s*=\s*"\s*([^"]*)",\s*label\s*=\s*"([^"]*)"\s*\)/ * \@implNote \L\1\E names="\2", label="\3"\n *\//igs' **/*.java To get basic (type, name) plugins with no javadoc before perl -0777 -i -pe 's/\@plugin\(\s*type\s*=\s*([^\.]*)[^n]*name\s*=\s*"\s*([^"]*)"\s*\)/\/**\n * \@implNote \L\1\E names="\2"\n *\//igs' **/*.java To get basic (type, name, priority) plugins with no javadoc before perl -0777 -i -pe 's/\@plugin\(\s*type\s*=\s*([^\.]*)[^n]*name\s*=\s*"\s*([^"]*)",\s*priority\s*=\s*([^,\s]*)\s*\)/\/**\n * \@implNote \L\1\E names="\2", priority="\3"\n *\//igs' **/*.java After using these commands, remaining Ops were converted manually We then need to convert the double quotes in the created implNotes into single quotes. We do this with the following commands: perl -0777 -i -pe "s/ \@implnote op names=\"([^\"]*)\"/\@implNote op names='\1'/igs" **/*.java perl -0777 -i -pe "s/\*(\s*)\@implNote op(.*'.*'), priority=\"([^\"]*)\"/\* \@implNote op\2, priority='\3'/igs" **/*.java perl -0777 -i -pe "s/\*(\s*)\@implNote op(.*'.*'), label=\"([^\"]*)\"/\* \@implNote op\2, label='\3'/igs" **/*.java perl -0777 -i -pe "s/\*(\s*)\@implNote op(.*'.*'), priority=\"([^\"]*)\"/\* \@implNote op\2, priority='\3'/igs" **/*.java Again, after running these command, remaining implNotes were fixed Then, we convert the SciJava Priority enums to numbers (as SciJava Discovery Therapi doesn't support Priority (yet)): sed -i -e "s/'Priority.VERY_HIGH'/'10000.'/g" **/*.java sed -i -e "s/'Priority.HIGH'/'100.'/g" **/*.java sed -i -e "s/'Priority.LOW'/'100.'/g" **/*.java
First, the parameters were converted to custom taglets (manually, sob). Then the following perl commands were used to convert OpField annotations into implNotes: perl -0777 -i -pe "s/(\s*)\*\/(\s*)\@OpField\(\s*names\s*=\s*\"([^\"]*)\"\s*,\s*params\s*=\s*\"[^\"]*\"\s*,\s*priority\s*=\s*([^\)]*)\)/\1* \@implNote op names='\3', priority='\4'\1*\/\2\@FlopField/igs" **/*.java perl -0777 -i -pe "s/(\s*)\*\/(\s*)\@OpField\(\s*names\s*=\s*\"([^\"]*)\"\s*,\s*params\s*=\s*\"[^\"]*\"[^\)]*\)/\1* \@implNote op names='\3'\1*\/\2\@FlopField/igs" **/*.java Then I realized I had left my @FlopField indicator string in, yielding the usage of the sed command: sed -i -e '/@FlopField/d' **/*.java Now I continue: perl -0777 -i -pe "s/(\s*)\*\/(\s*)\@OpField\(\s*names\s*=\s*\"([^\"]*)\"[^\)]*\)/\1* \@implNote op names='\3'\1*\//igs" **/*.java Of course, there are some with @SuppressWarnings annotations *sigh* perl -0777 -i -pe "s/(\s*)\*\/(\s*)\@OpField\(\s*names\s*=\s*\"([^\"]*)\"[^\)]*\)/\1* \@implNote op names='\3'\1*\//igs" **/*.java Continuing on: perl -0777 -i -pe "s/([\t ]*)\@OpField\(\s*names\s*=\s*\"([^\"]*)\"\s*,\s*priority\s*=\s*([^\)]*)\s*\)/\1\/**\n\1 * \@implNote op names='\2', priority='\3'\n\1 *\//igs" **/*.java perl -0777 -i -pe "s/([\t ]*)\@OpField\(\s*names\s*=\s*\"([^\"]*)\"[^\)]*\)/\1\/**\n\1 * \@implNote op names='\2'\n\1 *\//igs" **/*.java Finally, we rename the priorities to their decimal value. See last commmit for method
d9909fd to
a910289
Compare
And fix a couple of warnings. Co-authored-by: Curtis Rueden <ctrueden@wisc.edu>
a910289 to
8a62ad7
Compare
ctrueden
approved these changes
Jun 30, 2022
Member
ctrueden
left a comment
There was a problem hiding this comment.
Looks good. Thank you for documenting the perl commands used. That could conceivably come in handy later (or at least educate someone on how to do this sort of work).
I squashed your import cleaning commits, and did my own import cleaning pass, since there were still many unused ones left.
I will note that I got some nondeterministic test failures on my system, where ops or their dependencies sometimes could not be matched. I am inclined to blame Eclipse, even though I tried to have the projects closed in Eclipse any time I ran tests from the command line. Anyway, the last couple of rounds of testing built successfully for me, so I'm going to move ahead with this.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR follows #48 as the second PR designed to purge SciJava Common 2 from the Incubator projects. It:
@Plugindefinitions as@implNotes, consistent with the methodology described in Therapi-based Discovery #44.@PluginandPriorityimports from the ImageJ Ops2 module.