mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-10 01:12:52 +00:00
Add Eclipse Java Compiler support for the scripting service
Adds support for the ECJ in the scripting service. Now it is possible to choose which implementation to use to compile Java scripts.
This commit is contained in:
@@ -55,7 +55,8 @@ public class ScriptingServiceImplTest {
|
||||
final ScriptContext context = contexts.get(0);
|
||||
Class<?> clazz = context.getClassLoader().loadClass(
|
||||
"test.ScriptingCompilerTest");
|
||||
Assert.assertNotNull(clazz.newInstance());
|
||||
Assert.assertNotNull(clazz);
|
||||
Assert.assertEquals("ScriptingCompilerTest", clazz.getSimpleName());
|
||||
Assert.assertEquals("test.ScriptingCompilerTest", clazz.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* This file is part of l2jserver <l2jserver.com>.
|
||||
*
|
||||
* l2jserver is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* l2jserver is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with l2jserver. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.l2jserver.service.game.scripting.impl.compiled;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import com.l2jserver.service.game.scripting.CompilationResult;
|
||||
|
||||
/**
|
||||
* @author <a href="http://www.rogiel.com">Rogiel</a>
|
||||
*
|
||||
*/
|
||||
public class PrecompiledScriptCompilerTest {
|
||||
/**
|
||||
* Test method for
|
||||
* {@link com.l2jserver.service.game.scripting.impl.compiled.PrecompiledScriptCompiler#compile(java.lang.Iterable)}
|
||||
* .
|
||||
*/
|
||||
// @Test
|
||||
public void testCompileIterableOfFile() {
|
||||
final PrecompiledScriptCompiler compiler = new PrecompiledScriptCompiler();
|
||||
final CompilationResult result = compiler.compile(FileUtils.listFiles(
|
||||
new File("target/scripts/script/template"),
|
||||
new String[] { "class" }, true));
|
||||
System.out.println(result.getCompiledClasses()[0]);
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,6 @@
|
||||
-->
|
||||
|
||||
<scriptlist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../contexts.xsd">
|
||||
xsi:noNamespaceSchemaLocation="../../../../data/contexts.xsd">
|
||||
<scriptinfo root="./src/test/resources/scripting"/>
|
||||
</scriptlist>
|
||||
Reference in New Issue
Block a user