summaryrefslogtreecommitdiffstats
path: root/external/beanshell
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--external/beanshell/ExternalPackage_beanshell.mk16
-rw-r--r--external/beanshell/ExternalProject_beanshell.mk30
-rw-r--r--external/beanshell/Makefile7
-rw-r--r--external/beanshell/Module_beanshell.mk18
-rw-r--r--external/beanshell/README4
-rw-r--r--external/beanshell/UnpackedTarball_beanshell.mk24
-rw-r--r--external/beanshell/beanshell-invoke.patch78
-rw-r--r--external/beanshell/bsh-2.0b1-src.patch50
-rw-r--r--external/beanshell/java9.patch.025
9 files changed, 252 insertions, 0 deletions
diff --git a/external/beanshell/ExternalPackage_beanshell.mk b/external/beanshell/ExternalPackage_beanshell.mk
new file mode 100644
index 000000000..ea22d8394
--- /dev/null
+++ b/external/beanshell/ExternalPackage_beanshell.mk
@@ -0,0 +1,16 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,beanshell,beanshell))
+
+$(eval $(call gb_ExternalPackage_use_external_project,beanshell,beanshell))
+
+$(eval $(call gb_ExternalPackage_add_file,beanshell,$(LIBO_SHARE_JAVA_FOLDER)/bsh.jar,dist/bsh-2.0b6.jar))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/beanshell/ExternalProject_beanshell.mk b/external/beanshell/ExternalProject_beanshell.mk
new file mode 100644
index 000000000..450ac2b70
--- /dev/null
+++ b/external/beanshell/ExternalProject_beanshell.mk
@@ -0,0 +1,30 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,beanshell))
+
+$(eval $(call gb_ExternalProject_register_targets,beanshell,\
+ build \
+))
+
+$(call gb_ExternalProject_get_state_target,beanshell,build) :
+ $(call gb_Trace_StartRange,beanshell,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ JAVA_HOME=$(JAVA_HOME_FOR_BUILD) \
+ $(ICECREAM_RUN) "$(ANT)" \
+ $(if $(verbose),-v,-q) \
+ -f build.xml \
+ -Dbuild.label="build-$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)" \
+ -Dant.build.javac.source=$(JAVA_SOURCE_VER) \
+ -Dant.build.javac.target=$(JAVA_TARGET_VER) \
+ $(if $(debug),-Dbuild.debug="on") \
+ )
+ $(call gb_Trace_EndRange,beanshell,EXTERNAL)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/beanshell/Makefile b/external/beanshell/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/beanshell/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/beanshell/Module_beanshell.mk b/external/beanshell/Module_beanshell.mk
new file mode 100644
index 000000000..14432fd2a
--- /dev/null
+++ b/external/beanshell/Module_beanshell.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,beanshell))
+
+$(eval $(call gb_Module_add_targets,beanshell,\
+ ExternalPackage_beanshell \
+ ExternalProject_beanshell \
+ UnpackedTarball_beanshell \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/beanshell/README b/external/beanshell/README
new file mode 100644
index 000000000..0b03fd35a
--- /dev/null
+++ b/external/beanshell/README
@@ -0,0 +1,4 @@
+Java interpreter from [http://www.beanshell.org/] with some patches.
+
+So you can write java in command shell; interactive java good for prototyping/macros.
+
diff --git a/external/beanshell/UnpackedTarball_beanshell.mk b/external/beanshell/UnpackedTarball_beanshell.mk
new file mode 100644
index 000000000..dc0ce6dc6
--- /dev/null
+++ b/external/beanshell/UnpackedTarball_beanshell.mk
@@ -0,0 +1,24 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,beanshell))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,beanshell,$(BSH_TARBALL),,beanshell))
+
+$(eval $(call gb_UnpackedTarball_fix_end_of_line,beanshell,\
+ engine/src/TestBshScriptEngine.java \
+))
+
+$(eval $(call gb_UnpackedTarball_add_patches,beanshell,\
+ external/beanshell/bsh-2.0b1-src.patch \
+ external/beanshell/beanshell-invoke.patch \
+ external/beanshell/java9.patch.0 \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/beanshell/beanshell-invoke.patch b/external/beanshell/beanshell-invoke.patch
new file mode 100644
index 000000000..b78f1db61
--- /dev/null
+++ b/external/beanshell/beanshell-invoke.patch
@@ -0,0 +1,78 @@
+--- old/beanshell/engine/src/bsh/engine/BshScriptEngine.java
++++ new/beanshell/engine/src/bsh/engine/BshScriptEngine.java
+@@ -229,6 +229,12 @@
+ }
+ }
+
++ public Object invoke( Object thiz, String name, Object... args )
++ throws ScriptException, NoSuchMethodException
++ {
++ return invokeMethod( thiz, name, args );
++ }
++
+ /**
+ * Same as invoke(Object, String, Object...) with <code>null</code> as the
+ * first argument. Used to call top-level procedures defined in scripts.
+@@ -249,6 +255,12 @@
+ return invokeMethod( getGlobal(), name, args );
+ }
+
++ public Object invoke( String name, Object... args )
++ throws ScriptException, NoSuchMethodException
++ {
++ return invokeFunction( name, args );
++ }
++
+ /**
+ * Returns an implementation of an interface using procedures compiled in the
+ * interpreter. The methods of the interface may be implemented using the
+--- old/beanshell/engine/src/TestBshScriptEngine.java
++++ new/beanshell/engine/src/TestBshScriptEngine.java
+@@ -2,11 +2,12 @@
+ import java.io.*;
+ import javax.script.*;
+ import static javax.script.ScriptContext.*;
++import java.lang.reflect.*;
+
+ public class TestBshScriptEngine
+ {
+ public static void main( String [] args )
+- throws ScriptException, NoSuchMethodException, IOException
++ throws ScriptException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, IOException
+ {
+ ScriptEngineManager manager =
+ new ScriptEngineManager( bsh.Interpreter.class.getClassLoader() );
+@@ -39,11 +40,23 @@
+ assertTrue( engine.get("bar").equals("gee") );
+ assertTrue( engine.eval("bar").equals("gee") );
+
++ // use reflection to pick available method
++ Method invokeMe = null;
++ try {
++ invokeMe = Invocable.class.getMethod( "invokeFunction", String.class, Object[].class );
++ } catch ( Exception e ) { }
++ if (invokeMe == null)
++ {
++ try {
++ invokeMe = Invocable.class.getMethod( "invoke", String.class, Object[].class );
++ } catch ( Exception e ) { }
++ }
++
+ // install and invoke a method
+ engine.eval("foo() { return foo+1; }");
+ // invoke a method
+ Invocable invocable = (Invocable) engine;
+- int foo = (Integer)invocable.invokeFunction( "foo" );
++ int foo = (Integer)invokeMe.invoke( invocable, "foo", (Object) new Object[]{} );
+ assertTrue( foo == 43 );
+
+ // get interface
+@@ -58,7 +71,7 @@
+ engine.eval(
+ "flag2=false; myObj() { run() { flag2=true; } return this; }");
+ assertTrue( (Boolean)engine.get("flag2") == false );
+- Object scriptedObject = invocable.invokeFunction("myObj");
++ Object scriptedObject = invokeMe.invoke( invocable, "myObj", (Object) new Object[]{} );
+ assertTrue( scriptedObject instanceof bsh.This );
+ runnable =
+ (Runnable)invocable.getInterface( scriptedObject, Runnable.class );
diff --git a/external/beanshell/bsh-2.0b1-src.patch b/external/beanshell/bsh-2.0b1-src.patch
new file mode 100644
index 000000000..6124f18d1
--- /dev/null
+++ b/external/beanshell/bsh-2.0b1-src.patch
@@ -0,0 +1,50 @@
+--- misc/BeanShell/build.xml Fri Dec 19 17:14:27 2003
++++ misc/build/BeanShell/build.xml Fri Mar 28 15:55:04 2008
+@@ -10,7 +10,7 @@
+ - Why can't I nest filesets? This seems like it would be so easy and
+ useful...
+ -->
+-<project name="beanshell" default="compile" basedir=".">
++<project name="beanshell" default="jarall" basedir=".">
+
+ <!-- Project Configuration -->
+
+@@ -65,6 +65,9 @@
+ <property name="exclude-engine" value="bsh/engine/**"/>
+ -->
+
++ <property name="exclude-bsf"
++ value="bsh/util/BeanShellBSFEngine.java,TestBshBSF.java"/>
++
+ <!-- Uncomment to build without the ASM class generator code.
+ <property name="exclude-classgen"
+ value="bsh/org/objectweb/asm/**,bsh/ClassGeneratorImpl.java,bsh/ClassGeneratorUtil.java,bsh/DelayedEvalBshMethod.java"/>
+@@ -75,6 +78,9 @@
+ value="bsh/servlet/*"/>
+ -->
+
++ <property name="exclude-servlet"
++ value="bsh/servlet/*"/>
++
+ <!-- Legacy excludes. Comment this *out* to build these legacy items -->
+ <property name="excludes-legacy"
+ value="bsh/JThis.java"/>
+--- misc/BeanShell/src/bsh/classpath/BshClassPath.java 2003-12-19 17:14:28.000000000 +0100
++++ misc/build/BeanShell/src/bsh/classpath/BshClassPath.java 2014-07-22 21:02:52.000000000 +0200
+@@ -36,6 +36,7 @@
+ import bsh.StringUtil;
+ import bsh.ClassPathException;
+ import java.lang.ref.WeakReference;
++import java.lang.SecurityException;
+ import bsh.NameSource;
+
+ /**
+@@ -659,6 +660,8 @@
+ URL url = new File( rtjar ).toURI().toURL();
+ bootClassPath = new BshClassPath(
+ "Boot Class Path", new URL[] { url } );
++ } catch ( SecurityException e ) {
++ throw new ClassPathException(" can't access to boot jar: "+e);
+ } catch ( MalformedURLException e ) {
+ throw new ClassPathException(" can't find boot jar: "+e);
+ }
diff --git a/external/beanshell/java9.patch.0 b/external/beanshell/java9.patch.0
new file mode 100644
index 000000000..824e54286
--- /dev/null
+++ b/external/beanshell/java9.patch.0
@@ -0,0 +1,25 @@
+--- build.xml
++++ build.xml
+@@ -176,7 +176,6 @@
+ deprecation="${deprecation}"
+ optimize="on"
+ debug="on"
+- target="1.5"
+ includes="**/*.java"
+ excludes="${excludes},**/bak/**"
+ >
+--- src/bsh/util/AWTConsole.java
++++ src/bsh/util/AWTConsole.java
+@@ -214,8 +214,11 @@
+ Great. What a piece of crap.
+ */
+ public void setCaretPosition( int pos ) {
+- ((java.awt.peer.TextComponentPeer)getPeer()).setCaretPosition(
++ try {
++ ((java.awt.peer.TextComponentPeer)getClass().getMethod("getPeer").invoke(this, null)).setCaretPosition(
+ pos + countNLs() );
++ } catch (Exception e) {
++ }
+ }
+
+ /*