davisusanibar commented on a change in pull request #125:
URL: https://github.com/apache/arrow-cookbook/pull/125#discussion_r788055818
##########
File path: java/ext/javadoctest.py
##########
@@ -0,0 +1,57 @@
+import subprocess
+import os
+from sphinx.ext.doctest import TestcodeDirective, TestoutputDirective,
DocTestBuilder, Any, Dict, doctest, sphinx
+from sphinx.locale import __
+from subprocess import Popen, PIPE
+
+class JavaDocTestBuilder(DocTestBuilder):
+ """
+ Runs java test snippets in the documentation.
+ """
+ name = 'javadoctest'
+ epilog = __('Java testing of doctests in the sources finished, look at the
'
+ 'results in %(outdir)s/output.txt.')
+ def compile(self, code: str, name: str, type: str, flags: Any,
dont_inherit: bool) -> Any:
+ # go to project that contains all your arrow maven dependencies
+ dir_arrow_maven_project =
os.path.dirname(os.getcwd())+'/java/source/demo'
+
+ # create list of all arrow jar dependencies
+ proc_mvn_dependency = subprocess.Popen(['mvn', '-q',
'dependency:build-classpath', '-DincludeTypes=jar',
'-Dmdep.outputFile=.cp.tmp'], cwd=dir_arrow_maven_project,
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
+ stdout_mvn, stderr_mvn = proc_mvn_dependency.communicate()
+ if not os.path.exists(dir_arrow_maven_project + '/.cp.tmp'):
Review comment:
When we run jshell it is loading default jar libraries included on the
jre, .... but for our case we need to upload arrow jar library to the
classloader for that reason we use a fake maven project and download all the
jar needed and attach that jar to our jshell classpath at runtime
This is an example of that .cp.tmp file:
```
/Users/dsusanibar/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/Users/dsusanibar/.m2/repository/org/apache/arrow/arrow-memory-unsafe/6.0.0/arrow-memory-unsafe-6.0.0.jar:
```
And its need to be generated at runtime dinamically
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]