Engidea/FreeRoutingNew

Consider removing non-essential deps, or adjusting the build.xml

Closed this issue · 4 comments

wez commented

I wanted to build the router using the standard JDK that I have installed on my laptop just using ant, but this doesn't work out of the box.

To get things to compile locally, I removed references to gui.win.WindowBeanshell and javax.help. The router functionality appears to work just fine; see embedded diff below.

I'm not really a java expert so I don't know if there is an easy way to encode and obtain the help and bean shell deps in the build.xml; it would be preferable to do that if it is possible.

diff --git a/src/gui/BoardFrame.java b/src/gui/BoardFrame.java
index 090e2a0..0fe57a9 100644
--- a/src/gui/BoardFrame.java
+++ b/src/gui/BoardFrame.java
@@ -28,7 +28,6 @@ import gui.varie.SubwindowSelections;
 import gui.win.WindowAbout;
 import gui.win.WindowAssignNetClass;
 import gui.win.WindowAutorouteParameter;
-import gui.win.WindowBeanshell;
 import gui.win.WindowClearanceMatrix;
 import gui.win.WindowClearanceViolations;
 import gui.win.WindowColorManager;
@@ -136,7 +135,6 @@ public final class BoardFrame
    public WindowLayerVisibility layer_visibility_window = null;
    public WindowObjectVisibility object_visibility_window = null;
    public WindowDisplayMisc display_misc_window = null;
-   public WindowBeanshell window_beanshell = null;
    public WindowColorManager color_manager = null;
    public WindowDebugConfig debug_config;
 
@@ -527,10 +525,6 @@ public final class BoardFrame
       display_misc_window = new WindowDisplayMisc(this);
       permanent_subwindows.add(display_misc_window);
 
-      window_beanshell = new WindowBeanshell(this);
-      permanent_subwindows.add(window_beanshell);
-      window_beanshell.initialize();
-      
       route_parameter_window = new WindowRouteParameter(stat, this);
       permanent_subwindows.add(route_parameter_window);
 
@@ -625,7 +619,6 @@ public final class BoardFrame
       net_info_window.setLocation(350, 30);
       unconnected_route_window.setLocation(650, 30);
       route_stubs_window.setLocation(600, 30);
-      window_beanshell.setLocation(0, 250);
       layer_visibility_window.setLocation(0, 450);
       object_visibility_window.setLocation(0, 550);
       display_misc_window.setLocation(0, 350);
diff --git a/src/gui/config/GuiConfigFile.java b/src/gui/config/GuiConfigFile.java
index 3752015..2c1b08e 100644
--- a/src/gui/config/GuiConfigFile.java
+++ b/src/gui/config/GuiConfigFile.java
@@ -201,7 +201,6 @@ public final class GuiConfigFile
       write_frame_scope(board_frame.layer_visibility_window, "layer_visibility");
       write_frame_scope(board_frame.object_visibility_window, "object_visibility");
       write_frame_scope(board_frame.display_misc_window, "display_miscellanious");
-      write_frame_scope(board_frame.window_beanshell, "snapshots");
       write_frame_scope(board_frame.select_parameter_window, "select_parameter");
       write_frame_scope(board_frame.route_parameter_window, "route_parameter");
       write_frame_scope(board_frame.route_parameter_window.manual_rule_window, "manual_rules");
@@ -288,10 +287,6 @@ public final class GuiConfigFile
          {
          sub_window = board_frame.display_misc_window;
          }
-      else if (p_frame == GuiConfigKeyword.SNAPSHOTS)
-         {
-         sub_window = board_frame.window_beanshell;
-         }
       else if (p_frame == GuiConfigKeyword.SELECT_PARAMETER)
          {
          sub_window = board_frame.select_parameter_window;
diff --git a/src/gui/menu/BoardMenuOther.java b/src/gui/menu/BoardMenuOther.java
index de15492..3d0da0f 100644
--- a/src/gui/menu/BoardMenuOther.java
+++ b/src/gui/menu/BoardMenuOther.java
@@ -48,7 +48,6 @@ public final class BoardMenuOther extends JMenu
          {
          public void actionPerformed(ActionEvent evt)
             {
-            board_frame.window_beanshell.setVisible(true);
             }
          };
 
diff --git a/src/gui/varie/GuiHelp.java b/src/gui/varie/GuiHelp.java
index 242a171..0270f8b 100644
--- a/src/gui/varie/GuiHelp.java
+++ b/src/gui/varie/GuiHelp.java
@@ -23,9 +23,6 @@ package gui.varie;
 
 import java.awt.Component;
 import java.net.URL;
-import javax.help.CSH;
-import javax.help.HelpSet;
-import javax.help.HelpSetException;
 import javax.swing.JFrame;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
@@ -37,63 +34,13 @@ import freert.main.Stat;
  */
 public final class GuiHelp
    {
-   private javax.help.HelpSet help_set = null;
-   private javax.help.HelpBroker help_broker = null;
-   
-   private CSH.DisplayHelpFromSource contents_help = null;
-   private CSH.DisplayHelpAfterTracking direct_help = null;
-
-   private GuiResources resources;
-   
    public GuiHelp(Stat p_stat)
       {
-      resources = new GuiResources(p_stat,"gui.resources.BoardMenuHelp");
-      
-      String language = p_stat.locale.getLanguage();
-
-      // default value if no other match
-      String helpset_name = "helpset/en/Help.hs";
-      
-      if (language.equalsIgnoreCase("de"))
-         {
-         helpset_name = "helpset/de/Help.hs";
-         }
-
-      try
-         {
-         URL hsURL = HelpSet.findHelpSet(getClass().getClassLoader(), helpset_name);
-         if (hsURL == null)
-            {
-            System.out.println("HelpSet " + helpset_name + " not found.");
-            }
-         else
-            {
-            help_set = new HelpSet(null, hsURL);
-            }
-         }
-      catch (HelpSetException ee)
-         {
-         System.out.println("HelpSet " + helpset_name + " could not be opened.");
-         System.out.println(ee.getMessage());
-         }
-
-      help_broker = help_set.createHelpBroker();
-      
-      // CSH.DisplayHelpFromSource is a convenience class to display the helpset
-      contents_help = new CSH.DisplayHelpFromSource(help_broker);
-      direct_help = new CSH.DisplayHelpAfterTracking(help_broker);
       }
 
 
    public void add_menu_items ( JMenu to_menu )
       {
-      JMenuItem direct_help_item = resources.newJMenuItem("direct_help",null,direct_help);
-
-      to_menu.add(direct_help_item);
-      
-      JMenuItem contents_item = resources.newJMenuItem("contents",null,contents_help);
-
-      to_menu.add(contents_item);
       }
 
 
@@ -103,23 +50,6 @@ public final class GuiHelp
     */
    public void set_context_sensitive_help(Component p_component, String p_help_id)
       {
-      Component curr_component;
-
-      if (p_component instanceof JFrame)
-         {
-         curr_component = ((JFrame) p_component).getRootPane();
-         }
-      else
-         {
-         curr_component = p_component;
-         }
-      
-      
-      String help_id = "html_files." + p_help_id;
-      
-      javax.help.CSH.setHelpIDString(curr_component, help_id);
-      
-      help_broker.enableHelpKey(curr_component, help_id, help_set);
       }
 
    }

Beanshell is quite useful to "inspect" the inner workings of Freeroute without using a debugger and the Help is ... well a help.
Maybe it is worth to investigate how to fix the build.xml
What kind of issues did you have ?

wez commented

The issue I had was that the classes in the import statements that I removed in the above diff were not found in my classpath, so the jar didn't compile.

The help thing seems to only be available if you have the special netbeans flavor of the JDK (which I don't have and can't install on this particular system for local policy reasons). The beanshell dependency seems like it is shipped in the repo, but the build file doesn't appear to be configured to reference it.

The steps to reproduce the issue on my system were:

  1. clone the repo
  2. cd into it
  3. ant

ok, the last build.xml should work properly, jar files where provided, just not in the classpath.
If you report all good I may close even this issue

wez commented

I just confirmed this, thanks!