[jlm] 07/11: drop scala support: we need v2.10+ that is not in debian yet
Martin Quinson
mquinson at alioth.debian.org
Wed Sep 4 19:27:12 UTC 2013
This is an automated email from the git hooks/post-receive script.
mquinson pushed a commit to branch debian-debian
in repository jlm.
commit d23a1645c7d648e5cb6622df5b12137b45fbbb44
Author: Martin Quinson <martin.quinson at loria.fr>
Date: Wed Sep 4 15:19:01 2013 +0200
drop scala support: we need v2.10+ that is not in debian yet
---
debian/changelog | 2 +-
debian/patches/no-scala | 245 +++++++++++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 247 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 655fd7c..d614392 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,7 +9,7 @@ plm (2.2+repack-1) UNRELEASED; urgency=low
- drop d/p/review_french: integrated upstream
- drop d/p/no-xmpp: upstream dropped XMPP too
- update the other patches
- - build-dep on scala
+ - d/p/no-scala: We need scala 2.10 that is not in debian yet
-- Martin Quinson <mquinson at debian.org> Wed, 04 Sep 2013 14:32:19 +0200
diff --git a/debian/patches/no-scala b/debian/patches/no-scala
new file mode 100644
index 0000000..93f3ba5
--- /dev/null
+++ b/debian/patches/no-scala
@@ -0,0 +1,245 @@
+---
+ src/plm/core/CompilerScala.java | 143 ----------------------------------------
+ src/plm/core/model/Game.java | 2
+ 2 files changed, 3 insertions(+), 142 deletions(-)
+
+Index: b/src/plm/core/CompilerScala.java
+===================================================================
+--- a/src/plm/core/CompilerScala.java
++++ b/src/plm/core/CompilerScala.java
+@@ -9,18 +9,6 @@
+ import java.util.Vector;
+
+ import plm.core.model.Game;
+-import scala.Option;
+-import scala.collection.JavaConverters;
+-import scala.reflect.internal.util.BatchSourceFile;
+-import scala.reflect.internal.util.Position;
+-import scala.reflect.internal.util.SourceFile;
+-import scala.reflect.io.VirtualDirectory;
+-import scala.reflect.io.VirtualFile;
+-import scala.tools.nsc.Global;
+-import scala.tools.nsc.Global.Run;
+-import scala.tools.nsc.Settings;
+-import scala.tools.nsc.interpreter.AbstractFileClassLoader;
+-import scala.tools.nsc.reporters.AbstractReporter;
+
+ public class CompilerScala {
+
+@@ -31,143 +19,16 @@
+ return instance;
+ }
+
+- private PLMReporter reporter;
+- private Settings settings;
+- private Map<String, Class<?>> cache = new HashMap<String, Class<?>>();
+- private Global global;
+- private VirtualDirectory target;
+- private ClassLoader classLoader = new AbstractFileClassLoader(target, this.getClass().getClassLoader());
+-
+ private CompilerScala() {
+- super();
+- settings = new Settings();
+- settings.nowarnings().tryToSetFromPropertyValue("true"); // warnings seem to be exceptions, and we don't want them to mess with us
+-
+- Option<VirtualDirectory> noAncestor = scala.Option$.MODULE$.apply(null);
+- target = new VirtualDirectory("(memory)", noAncestor);
+- settings.outputDirs().setSingleOutput(target);
+-
+- settings.usejavacp().tryToSetFromPropertyValue("true");
+- //settings.usemanifestcp().tryToSetFromPropertyValue("true");
+- reporter = new PLMReporter(settings);
+- global = new Global(settings,reporter);
++ /* Scala is too ancient in Debian (need 2.10), so kill that all */
+ }
+
+ public void reset() {
+- reporter.reset();
+- reporter.setOffset(0);
+- target.clear();
+- cache = new HashMap<String, Class<?>>();
+- classLoader = new AbstractFileClassLoader(target, this.getClass().getClassLoader());
+ }
+
+ public void compile(String name,String content,int offset) throws PLMCompilerException {
+-
+- Run compiler = global.new Run();
+- List<SourceFile> sources = new LinkedList<SourceFile>();
+-
+- sources.add(new BatchSourceFile(new VirtualFile(name) , content.toCharArray()));
+- reporter.setOffset(offset);
+-
+- compiler.compileSources(JavaConverters.asScalaBufferConverter(sources).asScala().toList());
+-
+- if (Game.getInstance().isDebugEnabled() && reporter.hasErrors())
+- System.out.println("Here is the scala source code of "+name+" (offset:"+offset+"): "+content);
+- reporter.throwExceptionOnNeed();
+ }
+ public Class<?> findClass(String className) {
+- synchronized (this) {
+- if (!cache.containsKey(className)) {
+- Class<?> res;
+- try {
+- res = classLoader.loadClass(className);
+- } catch (ClassNotFoundException e) {
+- res = null;
+- }
+- cache.put(className, res);
+- }
+-
+- return cache.get(className);
+- }
+- }
+-
+- class PLMReporter extends AbstractReporter {
+- final static int INFO = 0;
+- final static int WARNING = 1;
+- final static int ERROR = 2;
+- int offset=0;
+- Vector<String> messages = new Vector<String>();
+- Settings settings;
+-
+- public PLMReporter(Settings s) {
+- settings = s;
+- }
+- public void setOffset(int _offset) {
+- this.offset = _offset;
+- }
+- @Override
+- public Settings settings() {
+- return settings;
+- }
+- @Override
+- public void displayPrompt() {
+- /* Don't do that, pal. */
+- }
+- @Override
+- public void display(Position pos, String message, Severity _severity) {
+- String severityName = _severity.toString();
+- String label = "";
+- int severity = -1;
+- if (severityName.equals("INFO") || severityName.equals("scala.tools.nsc.reporters.Reporter$Severity at 0"))
+- severity = INFO;
+- if (severityName.equals("WARNING") || severityName.equals("scala.tools.nsc.reporters.Reporter$Severity at 1")) {
+- severity = WARNING;
+- label= "warning: ";
+- }
+- if (severityName.equals("ERROR") || severityName.equals("scala.tools.nsc.reporters.Reporter$Severity at 2")) {
+- severity = ERROR;
+- label = "error: ";
+- }
+- if (severity == -1)
+- throw new RuntimeException("Got an unknown severity: "+severityName+". Please adapt the PLM to this new version of scala (or whatever).");
+- if (severity == INFO && !Game.getInstance().isDebugEnabled())
+- return;
+-
+- int lineNum = -1;
+- try {
+- lineNum = pos.line() - offset;
+- } catch (Throwable t) {
+- // That's fine if the line number is not defined.
+- }
+-
+- String name = pos.source().path();
+- int lastDot = name.lastIndexOf('.');
+- if (lastDot != -1)
+- name = name.substring(lastDot+1);
+- String msg = name+(lineNum == -1? "": ":"+lineNum) +": "+label+message;
+-
+- // Append the line content and a position marker, if possible
+- if (pos != null && pos.isDefined()) {
+- msg += "\n"+pos.inUltimateSource(pos.source()).lineContent()+"\n";
+- for (int i=0;i<pos.column()-1;i++)
+- msg += " ";
+- msg += "^";
+- }
+-
+- messages.add(msg);
+- }
+- public void throwExceptionOnNeed() throws PLMCompilerException {
+- if (hasErrors()) {
+- StringBuffer sb = new StringBuffer();
+- for (String s : messages)
+- sb.append(s);
+- throw new PLMCompilerException(sb.toString(), null, null);
+- }
+- }
+- @Override
+- public void reset() {
+- super.reset();
+- messages.removeAllElements();
+- }
++ return null;
+ }
+ }
+\ No newline at end of file
+Index: b/src/plm/core/model/Game.java
+===================================================================
+--- a/src/plm/core/model/Game.java
++++ b/src/plm/core/model/Game.java
+@@ -93,7 +93,7 @@
+ public static final ProgrammingLanguage RUBY = new ProgrammingLanguage("Ruby","rb",ResourcesCache.getIcon("img/lang_ruby.png"));
+ public static final ProgrammingLanguage LIGHTBOT = new ProgrammingLanguage("lightbot","ignored",ResourcesCache.getIcon("img/lightbot_light.png"));
+ public static final ProgrammingLanguage[] programmingLanguages = new ProgrammingLanguage[] {
+- JAVA, PYTHON, SCALA, RUBY, LIGHTBOT // TODO: re-add JAVASCRIPT to this list once it works at least a bit
++ JAVA, PYTHON, RUBY, LIGHTBOT // TODO: re-add JAVASCRIPT to this list once it works at least a bit
+ };
+ private ProgrammingLanguage programmingLanguage = JAVA;
+
+diff --git a/src/plm/core/ui/PlmHtmlEditorKit.java b/src/plm/core/ui/PlmHtmlEditorKit.java
+index a305498..0d50209 100644
+--- a/src/plm/core/ui/PlmHtmlEditorKit.java
++++ b/src/plm/core/ui/PlmHtmlEditorKit.java
+@@ -68,18 +68,22 @@ public class PlmHtmlEditorKit extends HTMLEditorKit {
+
+ String res = in.replaceAll("\\[!thelang/?\\]", "[!java]Java[/!][!python]python[/!][!scala]Scala[/!]");
+ res = res.replaceAll("\\[!configfile/?\\]", Game.getSavingLocation()+File.separator+"plm.properties");
++ String []theProgLangs = new String[Game.getProgrammingLanguages().length+1];
++ for (int i=0; i<Game.getProgrammingLanguages().length;i++)
++ theProgLangs[i] = Game.getProgrammingLanguages()[i];
++ theProgLangs[theProgLangs.length-1] = Game.SCALA;
+
+ /* Display everything when in debug mode, with shiny colors */
+ if (showAll) {
+ // Process any block with one language first so that they can be nested in blocks with more than one language.
+- for (ProgrammingLanguage lang : Game.getProgrammingLanguages()) {
++ for (ProgrammingLanguage lang : theProgLangs) {
+ String l = lang.getLang().toLowerCase();
+ res = res.replaceAll("(?s)\\[!"+l+"\\](.*?)\\[/!\\]",
+ "<font color=\""+langColors.get(l)+"\">$1</font>");
+ }
+- for (ProgrammingLanguage lang : Game.getProgrammingLanguages()) {
++ for (ProgrammingLanguage lang : theProgLangs) {
+ String l = lang.getLang().toLowerCase();
+- for (ProgrammingLanguage lang2 : Game.getProgrammingLanguages()) {
++ for (ProgrammingLanguage lang2 : theProgLangs) {
+ if (!lang2.equals(lang)) {
+ String l2 = lang2.getLang().toLowerCase();
+ res = res.replaceAll("(?s)\\[!"+l+"\\|"+l2+"\\](.*?)\\[/!\\]",
+@@ -98,7 +102,7 @@ public class PlmHtmlEditorKit extends HTMLEditorKit {
+ // Process any block with one language first so that they can be nested in blocks with more than one language.
+ res = res.replaceAll( "(?s)\\[!"+cl+"\\](.*?)\\[/!\\]","$1");
+ //System.out.println("Keep "+"(?s)\\[!"+cl+"\\](.*?)\\[/!\\]");
+- for (ProgrammingLanguage lang : Game.getProgrammingLanguages()) {
++ for (ProgrammingLanguage lang : theProgLangs) {
+ if (!lang.equals(currLang)) {
+ String l = lang.getLang().toLowerCase();
+
+@@ -106,7 +110,7 @@ public class PlmHtmlEditorKit extends HTMLEditorKit {
+ //System.out.println("Kill "+"(?s)\\[!"+l+"\\](.*?)\\[/!\\]");
+ }
+ }
+- for (ProgrammingLanguage lang : Game.getProgrammingLanguages()) {
++ for (ProgrammingLanguage lang : theProgLangs) {
+ if (!lang.equals(currLang)) {
+ String l = lang.getLang().toLowerCase();
+
+@@ -115,7 +119,7 @@ public class PlmHtmlEditorKit extends HTMLEditorKit {
+ res = res.replaceAll( "(?s)\\[!"+cl+"\\|"+l +"\\](.*?)\\[/!\\]", "$1");
+ //System.out.println("Keep "+"(?s)\\[!"+cl+"\\|"+l +"\\](.*?)\\[/!\\]");
+
+- for (ProgrammingLanguage lang2 : Game.getProgrammingLanguages()) {
++ for (ProgrammingLanguage lang2 : theProgLangs) {
+ if (!lang2.equals(currLang) && !lang2.equals(lang)) {
+ String l2 = lang2.getLang().toLowerCase();
+ res = res.replaceAll( "(?s)\\[!"+l+"\\|"+l2+"\\](.*?)\\[/!\\]", "");
diff --git a/debian/patches/series b/debian/patches/series
index 3228fd8..4a88585 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
system-ant-tasks
no-twitter
+no-scala
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jlm.git
More information about the pkg-java-commits
mailing list