Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ant to build the complete jar file for the Java wrapper.
- Loading branch information
Showing
13 changed files
with
867 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" ?> | ||
|
||
<project name="EditorConfigJava" default="all" basedir="."> | ||
|
||
<property name="tmp.dir" value="${user.dir}/tmp" /> | ||
<property name="editorconfig.py.dir" value="${user.dir}/.." /> | ||
<property name="build.dir" value="${user.dir}/build" /> | ||
|
||
<!-- Build EditorConfig Java wrapper --> | ||
<target name="build-java-wrapper"> | ||
<mkdir dir="./classes" /> | ||
<javac srcdir="./src" destdir="./classes" /> | ||
</target> | ||
|
||
<!-- Download jython installer --> | ||
<property name="jython.url" value="http://downloads.sourceforge.net/project/jython/jython/2.2.1/jython_installer-2.2.1.jar?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fjython%2Ffiles%2Fjython%2F2.2.1%2F&ts=1338203268" /> | ||
<target name="download-jython"> | ||
<mkdir dir="${tmp.dir}" /> | ||
<get src="${jython.url}" dest="${tmp.dir}/jython_installer.jar" usetimestamp="true" verbose="true" /> | ||
</target> | ||
|
||
<!-- Build the Jython engine --> | ||
<target name="build-jython-engine"> | ||
<ant dir="./jython-engine/make" inheritall="false" /> | ||
</target> | ||
|
||
<!-- pack jython EditorConfig --> | ||
<target name="pack-jython-editorconfig" depends="build-java-wrapper,download-jython,build-jython-engine"> | ||
<java jar="${tmp.dir}/jython_installer.jar" fork="true"> | ||
<arg value="-s" /> | ||
<arg value="-v" /> | ||
<arg value="-d" /> | ||
<arg value="${tmp.dir}/install" /> | ||
<arg value="-t" /> | ||
<arg value="standalone" /> | ||
</java> | ||
<move file="${tmp.dir}/install/jython.jar" todir="${tmp.dir}" /> | ||
<symlink link="${tmp.dir}/Lib" resource="${editorconfig.py.dir}" overwrite="true" /> | ||
<mkdir dir="${build.dir}" /> | ||
<jar destfile="${build.dir}/editorconfig.jar"> | ||
<fileset dir="./classes" /> | ||
<zipfileset src="${tmp.dir}/jython.jar" /> | ||
<zipfileset src="./jython-engine/build/jython-engine.jar" /> | ||
<fileset dir="${tmp.dir}"> | ||
<include name="Lib/editorconfig/**.py" /> | ||
</fileset> | ||
</jar> | ||
</target> | ||
|
||
<target name="all" depends="pack-jython-editorconfig"> | ||
</target> | ||
</project> |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Copyright (c) 2006, Sun Microsystems, Inc. | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
- Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
- Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
- Neither the name of the Sun Microsystems, Inc. nor the names of | ||
contributors may be used to endorse or promote products derived from this | ||
software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED | ||
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | ||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY | ||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | ||
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE | ||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | ||
DAMAGE. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This is JSR-223 script engine for Jython - Java implementation of Python. | ||
Jython is available for download at http://www.jython.org/. We have built | ||
and tested with Jython version 2.2.1. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
HISTORY OF THE SOFTWARE | ||
======================= | ||
|
||
JPython was created in late 1997 by Jim Hugunin. Jim was also the | ||
primary developer while he was at CNRI. In February 1999 Barry Warsaw | ||
took over as primary developer and released JPython version 1.1. | ||
In October 2000 Barry helped move the software to SourceForge | ||
where it was renamed to Jython. Jython 2.0 is developed by a group | ||
of volunteers. | ||
|
||
|
||
The standard library is covered by the BeOpen / CNRI license. See the | ||
Lib/LICENSE file for details. | ||
|
||
The oro regular expresion matcher is covered by the apache license. | ||
See the org/apache/LICENSE file for details. | ||
|
||
The zxJDBC package was written by Brian Zimmer and originally licensed | ||
under the GNU Public License. The package is now covered by the Jython | ||
Software License. | ||
|
||
Jython changes Software License. | ||
================================ | ||
|
||
Copyright (c) 2000, Jython Developers | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions | ||
are met: | ||
|
||
- Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
- Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in | ||
the documentation and/or other materials provided with the distribution. | ||
|
||
- Neither the name of the Jython Developers nor the names of | ||
its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR | ||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | ||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | ||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
|
||
|
||
|
||
JPython Software License. | ||
========================= | ||
|
||
______________________________________________________________________ | ||
|
||
IMPORTANT: PLEASE READ THE FOLLOWING AGREEMENT CAREFULLY. | ||
|
||
BY CLICKING ON THE "ACCEPT" BUTTON WHERE INDICATED, OR BY INSTALLING, | ||
COPYING OR OTHERWISE USING THE SOFTWARE, YOU ARE DEEMED TO HAVE AGREED TO | ||
THE TERMS AND CONDITIONS OF THIS AGREEMENT. | ||
|
||
______________________________________________________________________ | ||
|
||
JPython version 1.1.x | ||
|
||
1. This LICENSE AGREEMENT is between the Corporation for National Research | ||
Initiatives, having an office at 1895 Preston White Drive, Reston, VA | ||
20191 ("CNRI"), and the Individual or Organization ("Licensee") | ||
accessing and using JPython version 1.1.x in source or binary form and | ||
its associated documentation as provided herein ("Software"). | ||
|
||
2. Subject to the terms and conditions of this License Agreement, CNRI | ||
hereby grants Licensee a non-exclusive, non-transferable, royalty-free, | ||
world-wide license to reproduce, analyze, test, perform and/or display | ||
publicly, prepare derivative works, distribute, and otherwise use the | ||
Software alone or in any derivative version, provided, however, that | ||
CNRI's License Agreement and CNRI's notice of copyright, i.e., | ||
"Copyright �1996-1999 Corporation for National Research Initiatives; | ||
All Rights Reserved" are both retained in the Software, alone or in any | ||
derivative version prepared by Licensee. | ||
|
||
Alternatively, in lieu of CNRI's License Agreement, Licensee may | ||
substitute the following text (omitting the quotes), provided, however, | ||
that such text is displayed prominently in the Software alone or in any | ||
derivative version prepared by Licensee: "JPython (Version 1.1.x) is | ||
made available subject to the terms and conditions in CNRI's License | ||
Agreement. This Agreement may be located on the Internet using the | ||
following unique, persistent identifier (known as a handle): | ||
1895.22/1006. The License may also be obtained from a proxy server on | ||
the Web using the following URL: http://hdl.handle.net/1895.22/1006." | ||
|
||
3. In the event Licensee prepares a derivative work that is based on or | ||
incorporates the Software or any part thereof, and wants to make the | ||
derivative work available to the public as provided herein, then | ||
Licensee hereby agrees to indicate in any such work, in a prominently | ||
visible way, the nature of the modifications made to CNRI's Software. | ||
|
||
4. Licensee may not use CNRI trademarks or trade name, including JPython | ||
or CNRI, in a trademark sense to endorse or promote products or | ||
services of Licensee, or any third party. Licensee may use the mark | ||
JPython in connection with Licensee's derivative versions that are | ||
based on or incorporate the Software, but only in the form | ||
"JPython-based ___________________," or equivalent. | ||
|
||
5. CNRI is making the Software available to Licensee on an "AS IS" basis. | ||
CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY | ||
OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY | ||
REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY | ||
PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE | ||
ANY THIRD PARTY RIGHTS. | ||
|
||
6. CNRI SHALL NOT BE LIABLE TO LICENSEE OR OTHER USERS OF THE SOFTWARE FOR | ||
ANY INCIDENTAL, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF | ||
USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY DERIVATIVE | ||
THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. SOME STATES DO NOT | ||
ALLOW THE LIMITATION OR EXCLUSION OF LIABILITY SO THE ABOVE DISCLAIMER | ||
MAY NOT APPLY TO LICENSEE. | ||
|
||
7. This License Agreement may be terminated by CNRI (i) immediately upon | ||
written notice from CNRI of any material breach by the Licensee, if the | ||
nature of the breach is such that it cannot be promptly remedied; or | ||
(ii) sixty (60) days following notice from CNRI to Licensee of a | ||
material remediable breach, if Licensee has not remedied such breach | ||
within that sixty-day period. | ||
|
||
8. This License Agreement shall be governed by and interpreted in all | ||
respects by the law of the State of Virginia, excluding conflict of law | ||
provisions. Nothing in this Agreement shall be deemed to create any | ||
relationship of agency, partnership, or joint venture between CNRI and | ||
Licensee. | ||
|
||
9. By clicking on the "ACCEPT" button where indicated, or by installing, | ||
copying or otherwise using the Software, Licensee agrees to be bound by | ||
the terms and conditions of this License Agreement. | ||
|
||
[ACCEPT BUTTON] | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
jrunscript -Dpython.path=../lib/jython.jar -cp ../build/jython-engine.jar;../lib/jython.jar -l jython %* | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
jrunscript -Dpython.path=../lib/jython.jar -cp ../build/jython-engine.jar:../lib/jython.jar -l jython $* | ||
|
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<project name="Jython Engine" default="all" basedir="."> | ||
|
||
<!-- Property Definitions --> | ||
|
||
<property name="app.name" value="jython-engine"/> | ||
<property name="src.dir" value="../src"/> | ||
<property name="lib.dir" value="../lib"/> | ||
<property name="build.dir" value="../build"/> | ||
<property name="dist.jar" value="${build.dir}/${app.name}.jar"/> | ||
<property name="classes.dir" value="${build.dir}/classes"/> | ||
|
||
<target name="prepare"> | ||
<mkdir dir="${classes.dir}"/> | ||
</target> | ||
|
||
|
||
<target name="clean"> | ||
<delete dir="${build.dir}"/> | ||
</target> | ||
|
||
<path id="javac.classpath"> | ||
<pathelement path="${jsr223.jar}" /> | ||
<pathelement path="${lib.dir}/jython.jar" /> | ||
</path> | ||
|
||
<target name="compile" depends="prepare" description="Compiles the sources"> | ||
<javac srcdir="${src.dir}" | ||
destdir="${classes.dir}" | ||
debug="on" deprecation="on"> | ||
<classpath refid="javac.classpath" /> | ||
</javac> | ||
<copy todir="${classes.dir}/META-INF/services"> | ||
<fileset dir="${src.dir}/META-INF/services"/> | ||
</copy> | ||
</target> | ||
|
||
<target name="deploy" depends="compile" description="Creates a deployment bundle"> | ||
<jar jarfile="${dist.jar}" | ||
basedir="${classes.dir}"/> | ||
</target> | ||
|
||
<target name="all" depends="deploy" description="Builds sources and deployment jar"/> | ||
|
||
</project> |
2 changes: 2 additions & 0 deletions
2
jython/jython-engine/src/META-INF/services/javax.script.ScriptEngineFactory
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
com.sun.script.jython.JythonScriptEngineFactory | ||
|
Oops, something went wrong.
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@treyhunner
The Java wrapper should be completed. To show the usage, write the following to
TestJython.java
:Then
Document still need to be completed.
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add documentation for the Jython/Java library in the Python Core documentation?
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the API, we could have a standard javadoc for java developers. But I'm not sure yet whether the usage should be put in the python doc. Maybe we could also include the usage in the javadoc and put a link to that place on the website?
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could include all instructions in the Java doc and link to it from the Python Core README and/or documentation.
Can we include an EditorConfig compiled jar file on the downloads page so developers do not have to compile their own from Jython?
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I believe so. But since the C# wrapper is going to be born according to the mailing list, things would become a bit complicated. How do you think we should deal with these wrappers?
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should just upload them to the downloads sections of their respective EditorConfig core repositories and mention them in the README and/or documentation.
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The java binding is almost finished now, except the license. Shall we use PSF license?
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless the Java binding uses code under another license we should probably use the Simplified BSD license (or similar). I chose PSF for the main editorconfig module because
ini.py
andfnmatch.py
are both based on PSF licensed modules.11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The java binding should be based on the Python core.
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It uses the Python code as a library but does not actually copy the code itself, correct? If that is the case then it does not need to use the PSFL.
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I didn't explain it clearly. We finally will upload a jar file, which contains the python files and jython, which are both PSFL. Should we release under PSFL?
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. At least the jython and editorconfig code needs to be under PSFL. All other code that connects the two can also be under PSFL if you think that is most logical.
11985ab
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid our user to be in trouble with what license they should use, let's use PSFL.