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

libdoc: Please add a functionality to create a libdoc for several ressource documents #28

Closed
alexhaller opened this issue Jan 23, 2015 · 15 comments

Comments

@alexhaller
Copy link

Hi,

we have many ressource files (about 20) for which we want to create a libdoc. In my opinion it is not possible to create for all files the libdoc at once. So please add a parameter for the libdoc functionality such as "ressourcePath".

Thanks a lot!

Best regards,
Alex

@diakula
Copy link

diakula commented Feb 27, 2015

I also find this helpful to have to have! With having multiple <libdoc> the plugin only processes 1 of them (the last).

I have worked around this using multiple executions in the plugin, each having own <libdoc> section.

@jussimalinen
Copy link
Member

This would be useful for sure. Unless someone requests this from inside Nokia, I dont think we will have time to implement this anytime soon though. Pull requests are welcome!

@diakula
Copy link

diakula commented Apr 21, 2015

Hi guys, I played with the idea, see here: diakula@7f11b65 , diakula@58a60c8 .

Basically, I changed the semantic of the tag so it could accept ant-like patterns (same implement as what maven uses for ).

Before:

<libraryOrResourceFile>${basedir}/src/main/java/bla/XmlUtilitiesLibrary.java</libraryOrResourceFile>

After:

<libraryOrResourceFile>${basedir}/src/main/java/**/*.java</libraryOrResourceFile>

Can someone look at my branch, if the approach looks sound?

@jussimalinen
Copy link
Member

Sorry for the delay, I have been quite busy lately. The solution is quite complex, but if it works I'm ready to include it. It would be a great addition to maven plugin!

I would however prefer shorter and less complex methods in a pull request. If you could try to clean the code up to shorter more specialized helper methods, it would make it easier to do a code review.

Thanks!

@diakula
Copy link

diakula commented May 6, 2015

Thanks for the feedback. Regarding the readability of the changes - I tried to keep the changes to existing files to the minimum. Most of the new code went to new files. Below I give a small walktrough summary for the intended changes, a bit better structured than the commit message:

Changes to original files:

  • pom.xml - added a dependency to the reflections library that harvests source/resource/class names.
  • LibDocMojo - made the call to libdoc from single to multiple - 1 after the other. The LibDocConfiguration supplies the collection of different parameters, instead of a parameters set.
  • LibDocConfiguration - biggest change - added harvesting of resources from the classpath by checking for patterns in the order of source file (.java), classes, resources (.py included). Harvesting code in separate harvesters classes, with unit tests. I also derive an output file unique to the whole path of the source and put in the output directory location.

I hope this helps.

@jussimalinen
Copy link
Member

Thanks. If you could make a pull request for this with a slightly cleaned up code (especially shorter methods), I could include this into the distribution!

@diakula
Copy link

diakula commented May 8, 2015

Ok, I'll do some more extensive testing and cleanup first.

@diakula
Copy link

diakula commented May 12, 2015

Ok, finished testing, result in #34 .

@diakula
Copy link

diakula commented Dec 18, 2015

Any news whether we can get the libdoc and the testdoc enhancements for multiple sources in any time soon?

@jussimalinen
Copy link
Member

Sorry, we have been very busy making the RF 3.0 release. Once we get that out, I should have some free time.

@shamaho
Copy link

shamaho commented Sep 13, 2016

What's the current status on this? it's a most valuable feature !

@YK1434
Copy link

YK1434 commented Mar 3, 2017

Any update on this pleaseeee

@simplyviks
Copy link

was this implemented?

@r-cohen
Copy link

r-cohen commented May 29, 2017

since this is not yet implemented, I opened the sources of a generated html doc created with libdoc and noticed the keywords, documentation and arguments are all in the libdoc javascript variable. a solution would be to generate a doc file for each resource, and then merge all libdoc variables into one, and then generate a new doc file based on the same template and replace the js variable with the merged one. it's a hack but maybe can work.
EDIT: if anyone is interested, I will probably need to implement this, and will probably do it in python.
UPDATE: here is a nodejs script which does the job for me (if it can help anyone)
https://github.com/phearme/RecursiveRobotLibdoc

@rfabbris
Copy link

rfabbris commented Jul 4, 2017

Not sure this is the best way to do it but I managed to run libdoc on multiple files in a pom.
Below my code:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.8</version> <executions> <execution> <phase>package</phase> <configuration> <target> <fileset id="my-fileset" dir="src/main/resources/resources/" /> <pathconvert targetos="unix" pathsep="," property="my-file-list" refid="my-fileset"> <map from="${project.basedir}\src\main\resources\resources\" to="" /> </pathconvert> <echo file="${project.basedir}\target\Resources.txt">${my-file-list}</echo> </target> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin</artifactId> <version>1.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>execute</goal> </goals> <configuration> <properties> <resource_file>${project.basedir}\target\Resources.txt</resource_file> </properties> <source> def file = new File(project.properties.resource_file) project.properties.resource_content = file.getText().replace(".robot", "") </source> </configuration> </execution> </executions> </plugin> <plugin> <groupId>com.soebes.maven.plugins</groupId> <artifactId>iterator-maven-plugin</artifactId> <version>0.5.0</version> <executions> <execution> <phase>package</phase> <goals> <goal>iterator</goal> </goals> <configuration> <content>${resource_content}</content> <pluginExecutors> <pluginExecutor> <plugin> <groupId>org.robotframework</groupId> <artifactId>robotframework-maven-plugin</artifactId> <version>1.4.7</version> </plugin> <goal>libdoc</goal> <configuration> <libdoc> <!--for multiple files see https://github.com/robotframework/MavenPlugin/issues/28--> <libraryOrResourceFile>src/main/resources/resources/@[email protected]</libraryOrResourceFile> <outputFile>@[email protected]</outputFile> </libdoc> </configuration> </pluginExecutor> </pluginExecutors> </configuration> </execution> </executions> </plugin>

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

No branches or pull requests

8 participants