source: branches/cleanup/scan-deps.pl @ 5904

Revision 5904, 29.5 KB checked in by melissa, 10 years ago (diff)

Moved dependency version information to scan-deps.pl. Updated build.properties for many components to resolve mismatches reported by scan-deps.pl.

  • Property svn:executable set to *
Line 
1#!/usr/bin/perl
2use strict;
3
4# scan-deps.pl - Scans source code to determine project interdependencies,
5#                as well as dependencies on external libraries.
6
7# This script was used to autogenerate the project dependency documentation in
8# the build.xml file's top-level comment, as well as verify the correctness of
9# the component.classpath field in each component's build.properties file.
10
11# TODO - Use this script to autogenerate the LOCI plugins configuration file:
12#   components/loci-plugins/src/loci/plugins/config/libraries.txt
13
14# TODO - Use this script to check build.xml's depends clauses.
15
16use constant {
17  NAME      => 0,  # short name, for ease of reference
18  TITLE     => 1,  # human-friendly title for each component and library
19  PATH      => 2,  # source code path for each component
20  JAR       => 3,  # JAR file name for each component and library
21  PACKAGE   => 4,  # base package for each component and library
22  DESC      => 5,  # description for each component
23  LICENSE   => 6,  # license governing each component and library
24  URL       => 7,  # project URL for each external project (forks & libs)
25  NOTES     => 8,  # important notes for each external project (forks & libs)
26  PROJ_DEPS => 9,  # compile-time project dependencies for each component
27  PROJ_OPT  => 10, # runtime project dependencies for each component
28  LIB_DEPS  => 11, # compile-time library dependencies for each component
29  LIB_OPT   => 12, # runtime library dependencies for each component
30  COMPILE   => 13, # compile-time classpath for each component
31  RUNTIME   => 14, # runtime classpath for each component
32  ECLIPSE   => 15, # Eclipse classpath for each component
33  VERSION   => 16, # version number for each library
34};
35
36# -- COMPONENT DEFINITIONS - ACTIVE --
37
38my %bioFormats = (
39  NAME    => "bio-formats",
40  TITLE   => "Bio-Formats",
41  PATH    => "components/bio-formats",
42  JAR     => "bio-formats.jar",
43  PACKAGE => "loci.formats",
44  DESC    => <<ZZ,
45A library for reading and writing popular microscopy file formats
46ZZ
47  LICENSE => "GPL",
48);
49
50my %autogen = (
51  NAME    => "autogen",
52  TITLE   => "LOCI code generator",
53  PATH    => "components/autogen",
54  JAR     => "loci-autogen.jar",
55  PACKAGE => "(none)",
56  DESC    => <<ZZ,
57Package for generating other code, including the Bio-Formats metadata API,
58related documentation, Ice bindings, and Bio-Formats C++ bindings headers
59ZZ
60  LICENSE => "GPL",
61);
62
63my %bfIce = (
64  NAME    => "bf-ice",
65  TITLE   => "Bio-Formats Ice framework",
66  PATH    => "components/bf-ice",
67  JAR     => "bf-ice.jar",
68  PACKAGE => "loci.ice.formats",
69  DESC    => <<ZZ,
70Bindings for Bio-Formats client/server communication enabling cross-language
71interoperability
72ZZ
73  LICENSE => "GPL",
74);
75
76my %lociCommon = (
77  NAME    => "common",
78  TITLE   => "LOCI Common",
79  PATH    => "components/common",
80  JAR     => "loci-common.jar",
81  PACKAGE => "loci.common",
82  DESC    => <<ZZ,
83A library containing common I/O and reflection classes
84ZZ
85  LICENSE => "GPL",
86);
87
88my %flowCytometry = (
89  NAME    => "flow-cytometry",
90  TITLE   => "WiscScan Flow Cytometry",
91  PATH    => "components/flow-cytometry",
92  JAR     => "flow-cytometry.jar",
93  PACKAGE => "loci.apps.flow",
94  DESC    => <<ZZ,
95Server application for flow cytometry with WiscScan using JVMLink
96ZZ
97  LICENSE => "BSD",
98);
99
100my %lociChecks = (
101  NAME    => "loci-checks",
102  TITLE   => "LOCI Checkstyle checks",
103  PATH    => "components/checkstyle",
104  JAR     => "loci-checks.jar",
105  PACKAGE => "loci.checks",
106  DESC    => <<ZZ,
107LOCI's Checkstyle extensions, for checking source code style
108ZZ
109  LICENSE => "Public domain",
110);
111
112my %lociPlugins = (
113  NAME    => "loci-plugins",
114  TITLE   => "LOCI Plugins for ImageJ",
115  PATH    => "components/loci-plugins",
116  JAR     => "loci_plugins.jar",
117  PACKAGE => "loci.plugins",
118  DESC    => <<ZZ,
119A collection of plugins for ImageJ, including the Bio-Formats Importer,
120Bio-Formats Exporter, Bio-Formats Macro Extensions, Data Browser, Stack
121Colorizer and Stack Slicer
122ZZ
123  LICENSE => "GPL",
124);
125
126my %omeIO = (
127  NAME    => "ome-io",
128  TITLE   => "OME I/O",
129  PATH    => "components/ome-io",
130  JAR     => "ome-io.jar",
131  PACKAGE => "loci.ome.io",
132  DESC    => <<ZZ,
133A library for OME database import, upload and download
134ZZ
135  LICENSE => "GPL",
136);
137
138my %omePlugins = (
139  NAME    => "ome-plugins",
140  TITLE   => "OME Plugins for ImageJ",
141  PATH    => "components/ome-plugins",
142  JAR     => "ome_plugins.jar",
143  PACKAGE => "loci.plugins.ome",
144  DESC    => <<ZZ,
145A collection of plugins for ImageJ, including the Download from OME and Upload
146to OME plugins
147ZZ
148  LICENSE => "GPL",
149);
150
151my %omeXML = (
152  NAME    => "ome-xml",
153  TITLE   => "OME-XML Java library",
154  PATH    => "components/ome-xml",
155  JAR     => "ome-xml.jar",
156  PACKAGE => "ome.xml",
157  DESC    => <<ZZ,
158A library for working with OME-XML metadata structures
159ZZ
160  LICENSE => "GPL",
161);
162
163my %slimPlotter = (
164  NAME    => "slim-plotter",
165  TITLE   => "SLIM Plotter",
166  PATH    => "components/slim-plotter",
167  JAR     => "SlimPlotter.jar",
168  PACKAGE => "loci.slim",
169  DESC    => <<ZZ,
170An application and curve fitting library for visualization and analysis of
171combined spectral lifetime data
172ZZ
173  LICENSE => "GPL",
174);
175
176my %testSuite = (
177  NAME    => "test-suite",
178  TITLE   => "LOCI testing framework",
179  PATH    => "components/test-suite",
180  JAR     => "loci-testing-framework.jar",
181  PACKAGE => "loci.tests",
182  DESC    => <<ZZ,
183Framework for automated and manual testing of the LOCI software packages
184ZZ
185  LICENSE => "BSD",
186);
187
188my %visbio = (
189  NAME    => "visbio",
190  TITLE   => "VisBio",
191  PATH    => "components/visbio",
192  JAR     => "visbio.jar",
193  PACKAGE => "loci.visbio",
194  DESC    => <<ZZ,
195A multi-purpose biological analysis tool
196ZZ
197  LICENSE => "GPL",
198);
199
200# -- COMPONENT DEFINITIONS - LEGACY --
201
202my %jvmlink = (
203  NAME    => "jvmlink",
204  TITLE   => "JVMLink",
205  PATH    => "components/legacy/jvmlink",
206  JAR     => "jvmlink.jar",
207  PACKAGE => "loci.jvmlink",
208  DESC    => <<ZZ,
209A library for communicating between a Java Virtual Machine and other programs
210(e.g., C++ applications) via IP over localhost (or remotely)
211ZZ
212  LICENSE => "BSD",
213);
214
215my %multiLUT = (
216  NAME    => "multi-lut",
217  TITLE   => "Multi-LUT",
218  PATH    => "components/legacy/multi-lut",
219  JAR     => "MultiLUT.jar",
220  PACKAGE => "loci.apps",
221  DESC    => <<ZZ,
222A demo application for visually exploring  multi-spectral image data
223ZZ
224  LICENSE => "Public domain",
225);
226
227my %omeEditor = (
228  NAME    => "ome-editor",
229  TITLE   => "OME Metadata Editor",
230  PATH    => "components/legacy/ome-editor",
231  JAR     => "ome-editor.jar",
232  PACKAGE => "loci.ome.editor",
233  DESC    => <<ZZ,
234An application for exploration and editing of OME-XML and OME-TIFF metadata
235ZZ
236  LICENSE => "LGPL",
237);
238
239my %omeNotes = (
240  NAME    => "ome-notes",
241  TITLE   => "OME Notes",
242  PATH    => "components/legacy/ome-notes",
243  JAR     => "ome-notes.jar",
244  PACKAGE => "loci.ome.notes",
245  DESC    => <<ZZ,
246A library for flexible organization and presentation of OME-XML metadata within
247a graphical browser and editor interface
248ZZ
249  LICENSE => "LGPL",
250);
251
252# -- COMPONENT DEFINITIONS - FORKS --
253
254my %jai = (
255  NAME    => "jai",
256  TITLE   => "JAI Image I/O Tools",
257  PATH    => "components/forks/jai",
258  JAR     => "jai_imageio.jar",
259  PACKAGE => "com.sun.media.imageioimpl",
260  DESC    => <<ZZ,
261Java API to handle JPEG and JPEG2000 files
262ZZ
263  LICENSE => "BSD",
264  URL     => "http://jai-imageio.dev.java.net/",
265  NOTES   => <<ZZ,
266Used by Bio-Formats to read images compressed with JPEG2000 and lossless JPEG.
267Modified from the 2008-10-14 source to include support for the YCbCr color
268space. Several files in the com.sun.media.jai packages were removed, as they
269are not needed by Bio-Formats, and created an additional dependency. This
270component will be removed once our changes have been added to the official JAI
271CVS repository.
272ZZ
273);
274
275my %mdbtools = (
276  NAME    => "mdbtools",
277  TITLE   => "MDB Tools (Java port)",
278  PATH    => "components/forks/mdbtools",
279  JAR     => "mdbtools-java.jar",
280  PACKAGE => "mdbtools",
281  DESC    => <<ZZ,
282Java API to handle Microsoft MDB format (Access)
283ZZ
284  LICENSE => "LGPL",
285  URL     => "http://sourceforge.net/forum/message.php?msg_id=2550619",
286  NOTES   => <<ZZ,
287Used by Bio-Formats for Zeiss LSM metadata in MDB files.
288ZZ
289);
290
291my %poi = (
292  NAME    => "poi",
293  TITLE   => "Apache Jakarta POI",
294  PATH    => "components/forks/poi",
295  JAR     => "poi-loci.jar",
296  PACKAGE => "loci.poi",
297  DESC    => <<ZZ,
298Java API to handle Microsoft OLE 2 Compound Document format (Word, Excel)
299ZZ
300  LICENSE => "Apache",
301  URL     => "http://jakarta.apache.org/poi/",
302  NOTES   => <<ZZ,
303Based on poi-2.5.1-final-20040804.jar, with bugfixes for OLE v2 and memory
304efficiency improvements. Used by Bio-Formats for OLE support (cxd, ipw, oib,
305zvi). Used by VisBio overlays logic for XLS export feature.
306ZZ
307);
308
309# -- LIBRARY DEFINITIONS --
310
311my %appleJavaExtensions = (
312  NAME    => "AppleJavaExtensions",
313  TITLE   => "Apple eAWT stubs",
314  JAR     => "AppleJavaExtensions.jar",
315  PACKAGE => "com.apple",
316  LICENSE => "BSD",
317  URL     => "http://developer.apple.com/samplecode/AppleJavaExtensions/",
318  NOTES   => <<ZZ,
319required to compile VisBio on non-Mac OS X machines
320ZZ
321);
322
323my %antContrib = (
324  NAME    => "ant-contrib",
325  TITLE   => "Ant-Contrib",
326  JAR     => "ant-contrib-1.0b3.jar",
327  PACKAGE => "net.sf.antcontrib",
328  LICENSE => "Apache",
329  URL     => "http://ant-contrib.sourceforge.net/",
330  NOTES   => <<ZZ,
331used by tools target to iterate over JAR files ("for" task)
332ZZ
333  VERSION => "1.0b3"
334);
335
336my %checkstyle = (
337  NAME    => "checkstyle",
338  TITLE   => "Checkstyle",
339  JAR     => "checkstyle-all-5.0.jar",
340  PACKAGE => "com.puppycrawl.tools.checkstyle",
341  LICENSE => "LGPL",
342  URL     => "http://checkstyle.sourceforge.net/",
343  NOTES   => <<ZZ,
344used by style Ant target to check source code style conventions
345ZZ
346  VERSION => "5.0"
347);
348
349my %commonsHTTPClient = (
350  NAME    => "commons-httpclient",
351  TITLE   => "Apache Jakarta Commons HttpClient",
352  JAR     => "commons-httpclient-2.0-rc2.jar",
353  PACKAGE => "org.apache.commons.httpclient",
354  LICENSE => "Apache",
355  URL     => "http://jakarta.apache.org/commons/httpclient/",
356  NOTES   => <<ZZ,
357required for OME-Java to communicate with OME servers
358ZZ
359  VERSION => "2.0-rc2"
360);
361
362my %commonsLogging = (
363  NAME    => "commons-logging",
364  TITLE   => "Apache Jakarta Commons Logging",
365  JAR     => "commons-logging.jar",
366  PACKAGE => "org.apache.commons.logging",
367  LICENSE => "Apache",
368  URL     => "http://jakarta.apache.org/commons/logging/",
369  NOTES   => <<ZZ,
370used by OME-Java
371ZZ
372  VERSION => "1.0.3"
373);
374
375my %findbugs = (
376  NAME    => "findbugs",
377  TITLE   => "FindBugs Ant task",
378  JAR     => "findbugs-ant.jar",
379  PACKAGE => "edu.umd.cs.findbugs.anttask",
380  LICENSE => "LGPL",
381  URL     => "http://findbugs.sourceforge.net/",
382  NOTES   => <<ZZ,
383used by findbugs Ant target to check for program bugs
384ZZ
385  VERSION => "1.3.9"
386);
387
388my %forms = (
389  NAME    => "forms",
390  TITLE   => "JGoodies Forms",
391  JAR     => "forms-1.3.0.jar",
392  PACKAGE => "com.jgoodies.forms",
393  LICENSE => "BSD",
394  URL     => "http://www.jgoodies.com/freeware/forms/index.html",
395  NOTES   => <<ZZ,
396used for layout by VisBio, Data Browser and OME Notes
397ZZ
398  VERSION => "1.3.0"
399);
400
401my %ice = (
402  NAME    => "ice",
403  TITLE   => "Ice",
404  JAR     => "Ice-3.3.1.jar",
405  PACKAGE => "Ice",
406  LICENSE => "GPL",
407  URL     => "http://www.zeroc.com/ice.html",
408  NOTES   => <<ZZ,
409used by Bio-Formats Ice framework
410ZZ
411  VERSIOn => "3.3.1"
412);
413
414my %ij = (
415  NAME    => "ij",
416  TITLE   => "ImageJ",
417  JAR     => "ij.jar",
418  PACKAGE => "ij",
419  LICENSE => "Public domain",
420  URL     => "http://rsb.info.nih.gov/ij/",
421  NOTES   => <<ZZ,
422used by LOCI plugins for ImageJ and OME plugins for ImageJ; bundled with VisBio
423to achieve ImageJ interconnectivity
424ZZ
425  VERSION => "1.43o"
426);
427
428my %jiio = (
429  NAME    => "jiio",
430  TITLE   => "JAI ImageIO wrapper",
431  JAR     => "clibwrapper_jiio.jar",
432  PACKAGE => "com.sun.medialib.codec",
433  LICENSE => "BSD",
434  URL     => "https://jai-imageio.dev.java.net/",
435  NOTES   => <<ZZ,
436used by Bio-Formats via reflection for JPEG2000 support (ND2, JP2) and lossless
437JPEG decompression (DICOM)
438ZZ
439  VERSION => "1.1"
440);
441
442my %junit = (
443  NAME    => "junit",
444  TITLE   => "JUnit",
445  JAR     => "junit.jar",
446  PACKAGE => "junit",
447  LICENSE => "Common Public License",
448  URL     => "http://www.junit.org/",
449  NOTES   => <<ZZ,
450unit testing framework used for a few VisBio unit tests
451ZZ
452  VERSION => "3.8.2"
453);
454
455my %lma = (
456  NAME    => "lma",
457  TITLE   => "L-M Fit",
458  JAR     => "lma.jar",
459  PACKAGE => "jaolho.data.lma",
460  LICENSE => "LGPL",
461  URL     => "http://users.utu.fi/jaolho/",
462  NOTES   => <<ZZ,
463Levenberg-Marquardt algorithm for exponential curve fitting, used by SLIM
464Plotter
465ZZ
466);
467
468my %log4j = (
469  NAME    => "log4j",
470  TITLE   => "Apache log4j",
471  JAR     => "log4j-1.2.15.jar",
472  PACKAGE => "org.apache.log4j",
473  LICENSE => "Apache",
474  URL     => "http://logging.apache.org/log4j/",
475  NOTES   => <<ZZ,
476required by SLF4J implementation
477ZZ
478  VERSION => "1.2.15"
479);
480
481my %looks = (
482  NAME    => "looks",
483  TITLE   => "JGoodies Looks",
484  JAR     => "looks-2.3.1.jar",
485  PACKAGE => "com.jgoodies.looks",
486  LICENSE => "BSD",
487  URL     => "http://www.jgoodies.com/freeware/looks/index.html",
488  NOTES   => <<ZZ,
489used for a nicer Look & Feel by VisBio and OME Metadata Editor
490ZZ
491  VERSION => "2.3.1"
492);
493
494my %netcdf = (
495  NAME    => "netcdf",
496  TITLE   => "NetCDF",
497  JAR     => "netcdf-4.0.jar",
498  PACKAGE => "ucar.nc2",
499  LICENSE => "LGPL",
500  URL     => "http://www.unidata.ucar.edu/software/netcdf-java/",
501  NOTES   => <<ZZ,
502used by Bio-Formats via reflection for HDF support (Imaris 5.5)
503ZZ
504  VERSION => "4.0"
505);
506
507my %omeJava = (
508  NAME    => "ome-java",
509  TITLE   => "OME-Java",
510  JAR     => "ome-java.jar",
511  PACKAGE => "org.openmicroscopy.[di]s",
512  LICENSE => "LGPL",
513  URL     => "http://www.openmicroscopy.org/site/documents/data-management/".
514             "ome-server/developer/java-api",
515  NOTES   => <<ZZ,
516used by OME I/O to connect to OME servers
517ZZ
518);
519
520my %omeJavaDeprecated = (
521  NAME    => "ome-java-deprecated",
522  TITLE   => "OME-Java deprecated classes",
523  JAR     => "ome-java-deprecated.jar",
524  PACKAGE => "org.openmicroscopy.xml",
525  LICENSE => "LGPL",
526  URL     => "http://www.openmicroscopy.org/site/documents/data-management/".
527             "ome-server/developer/java-api",
528  NOTES   => <<ZZ,
529used by OME Notes and OME Metadata Editor to work with OME-XML
530ZZ
531);
532
533my %omeroClient = (
534  NAME    => "omero-client",
535  TITLE   => "OMERO Client",
536  JAR     => "omero-client-4.1.1.jar",
537  PACKAGE => "ome.system",
538  LICENSE => "GPL",
539  URL     => "http://trac.openmicroscopy.org.uk/omero/wiki/MilestoneDownloads",
540  NOTES   => <<ZZ,
541used by OME I/O to connect to OMERO servers
542ZZ
543  VERSION => "4.1.1"
544);
545
546my %omeroCommon = (
547  NAME    => "omero-common",
548  TITLE   => "OMERO Common",
549  JAR     => "omero-common-4.1.1.jar",
550  PACKAGE => "ome.api",
551  LICENSE => "GPL",
552  URL     => "http://trac.openmicroscopy.org.uk/omero/wiki/MilestoneDownloads",
553  NOTES   => <<ZZ,
554used by OME I/O to connect to OMERO servers
555ZZ
556  VERSION => "4.1.1"
557);
558
559my %skinlf = (
560  NAME    => "skinlf",
561  TITLE   => "Skin Look and Feel",
562  JAR     => "skinlf.jar",
563  PACKAGE => "com.l2fprod",
564  LICENSE => "Custom (BSD-like)",
565  URL     => "http://skinlf.l2fprod.com/",
566  NOTES   => <<ZZ,
567not used (may be used in the future for flexible skinning)
568ZZ
569  VERSION => "6.7"
570);
571
572my %slf4j_api = (
573  NAME    => "slf4j",
574  TITLE   => "Simple Logging Facade for Java API",
575  JAR     => "slf4j-api-1.5.10.jar",
576  PACKAGE => "org.slf4j",
577  LICENSE => "BSD",
578  URL     => "http://www.slf4j.org/",
579  NOTES   => <<ZZ,
580used for all logging in loci.*
581ZZ
582  VERSION => "1.5.10"
583);
584
585my %slf4j_impl = (
586  NAME    => "slf4j",
587  TITLE   => "Simple Logging Facade for Java Binding",
588  JAR     => "slf4j-log4j12-1.5.10.jar",
589  PACKAGE => "org.slf4j",
590  LICENSE => "BSD",
591  URL     => "http://www.slf4j.org/",
592  NOTES   => <<ZZ,
593used for all logging in loci.*
594ZZ
595  VERSION => "1.5.10"
596);
597
598my %testng = (
599  NAME    => "testng",
600  TITLE   => "TestNG",
601  JAR     => "testng-5.11-jdk15.jar",
602  PACKAGE => "org.testng",
603  LICENSE => "Apache",
604  URL     => "http://testng.org/",
605  NOTES   => <<ZZ,
606testing framework used for LOCI software automated test suite
607ZZ
608  VERSION => "5.7"
609);
610
611my %velocity = (
612  NAME    => "velocity",
613  TITLE   => "Apache Velocity",
614  JAR     => "velocity-1.6.3-dep.jar",
615  PACKAGE => "org.apache.velocity",
616  LICENSE => "Apache",
617  URL     => "http://velocity.apache.org/",
618  NOTES   => <<ZZ,
619used to autogenerate the loci.formats.meta and loci.formats.ome Bio-Formats
620packages
621ZZ
622  VERSION => "1.6.3"
623);
624
625my %visad = (
626  NAME    => "visad",
627  TITLE   => "VisAD",
628  JAR     => "visad-lite.jar",
629  PACKAGE => "visad",
630  LICENSE => "LGPL",
631  URL     => "http://www.ssec.wisc.edu/~billh/visad.html",
632  NOTES   => <<ZZ,
633stripped down VisAD library used by VisBio and SLIM Plotter for interactive
634visualization
635ZZ
636);
637
638my %xmlrpc = (
639  NAME    => "xmlrpc",
640  TITLE   => "Apache XML-RPC",
641  JAR     => "xmlrpc-1.2-b1.jar",
642  PACKAGE => "org.apache.xmlrpc",
643  LICENSE => "Apache",
644  URL     => "http://ws.apache.org/xmlrpc/",
645  NOTES   => <<ZZ,
646used by OME-Java library to communicate with OME servers
647ZZ
648  VERSION => "1.2-b1"
649);
650
651# -- DATA STRUCTURES --
652
653# List of active LOCI software components
654my @active = (
655  \%lociCommon,
656  \%omeXML,
657  \%bioFormats,
658  \%autogen,
659  \%bfIce,
660  \%lociPlugins,
661  \%omeIO,
662  \%omePlugins,
663  \%visbio,
664  \%slimPlotter,
665  \%flowCytometry,
666  \%lociChecks,
667  \%testSuite,
668);
669
670# List of legacy components (no longer supported)
671my @legacy = (
672  \%jvmlink,
673  \%multiLUT,
674  \%omeNotes,
675  \%omeEditor,
676);
677
678# List of external project forks
679my @forks = (
680  \%poi,
681  \%mdbtools,
682  \%jai,
683);
684
685# List of all LOCI software components
686my @components = (@active, @legacy, @forks);
687
688# List of external libraries
689my @libs = (
690  \%appleJavaExtensions,
691  \%antContrib,
692  \%checkstyle,
693  \%commonsHTTPClient,
694  \%commonsLogging,
695  \%findbugs,
696  \%forms,
697  \%ice,
698  \%ij,
699  \%jiio,
700  \%junit,
701  \%lma,
702  \%log4j,
703  \%looks,
704  \%netcdf,
705  \%slf4j_api,
706  \%slf4j_impl,
707  \%omeJava,
708  \%omeJavaDeprecated,
709  \%omeroClient,
710  \%omeroCommon,
711  \%skinlf,
712  \%testng,
713  \%velocity,
714  \%visad,
715  \%xmlrpc,
716);
717
718# -- DATA COLLECTION --
719
720# verify that all JAR files exist -- if not, this file is probably out of date
721print STDERR "--== VERIFYING JAR FILE EXISTENCE ==--\n\n";
722foreach my $c (@components) {
723  my $jar = $$c{JAR};
724  unless (-e "artifacts/$jar") {
725    die "Component $jar does not exist";
726  }
727}
728foreach my $l (@libs) {
729  my $jar = $$l{JAR};
730  unless (-e "jar/$jar") {
731    die "Library $jar does not exist";
732  }
733}
734
735# scan for project dependencies
736print STDERR "--== SCANNING PROJECT DEPENDENCIES ==--\n\n";
737foreach my $c (@components) {
738  my $path = $$c{PATH};
739  print STDERR "[$$c{TITLE}]\n";
740  my @deps = ();
741  my @opt = ();
742  foreach my $c2 (@components) {
743    if ($c eq $c2) { next; }
744    my $name = $$c2{TITLE};
745    my $package = $$c2{PACKAGE};
746    if (checkDirect($package, $path)) {
747      push (@deps, $c2);
748      print STDERR "$name\n";
749    }
750    elsif (checkReflect($package, $path)) {
751      push (@opt, $c2);
752      print STDERR "$name (reflected)\n";
753    }
754  }
755  $$c{PROJ_DEPS} = \@deps;
756  $$c{PROJ_OPT} = \@opt;
757  print STDERR "\n";
758}
759
760print STDERR "--== SCANNING LIBRARY DEPENDENCIES ==--\n\n";
761foreach my $c (@components) {
762  my @deps = ();
763  my @opt = ();
764  my $path = $$c{PATH};
765  print STDERR "[$$c{TITLE}]\n";
766  foreach my $l (@libs) {
767    my $name = $$l{TITLE};
768    my $package = $$l{PACKAGE};
769    if (checkDirect($package, $path)) {
770      push (@deps, $l);
771      print STDERR "$name\n";
772    }
773    elsif (checkReflect($package, $path)) {
774      push (@opt, $l);
775      print STDERR "$name (reflected)\n";
776    }
777  }
778  $$c{LIB_DEPS} = \@deps;
779  $$c{LIB_OPT} = \@opt;
780  print STDERR "\n";
781}
782
783print STDERR "--== GATHERING COMPONENT CLASSPATHS ==--\n\n";
784foreach my $c (@components) {
785  my $path = $$c{PATH};
786
787  # read compile-time and runtime classpaths from properties file
788  open FILE, "$path/build.properties"
789    or die "$path/build.properties: $!";
790  my @lines = <FILE>;
791  close(FILE);
792  my $inCompile = 0;
793  my $inManifest = 0;
794  my @compile = ();
795  my @runtime = ();
796  foreach my $line (@lines) {
797    $line = rtrim($line);
798    if ($line =~ /^component.classpath/) {
799      # found the compile-time classpath variable
800      $inCompile = 1;
801    }
802    elsif ($line =~ /^component.runtime-cp/) {
803      # found the runtime classpath variable
804      $inManifest = 1;
805    }
806    if ($inCompile || $inManifest) {
807      my $end = $line !~ /\\$/;
808      # append the entry to the classpath list
809      $line =~ s/[ :\\]*$//;
810      $line =~ s/.*[ =]+//;
811      if ($line ne '(none)' && $line ne '') {
812        if ($inCompile) {
813          push(@compile, $line);
814        }
815        elsif ($inManifest) {
816          if ($line =~ /\${component.classpath}/) {
817            push(@runtime, @compile);
818          }
819          else {
820            push(@runtime, $line);
821          }
822        }
823      }
824      if ($end) {
825        # line does not end with a backslash; end of variable
826        $inCompile = $inManifest = 0;
827      }
828    }
829  }
830  $$c{COMPILE} = \@compile;
831  $$c{RUNTIME} = \@runtime;
832}
833
834print STDERR "--== GATHERING ECLIPSE DEPENDENCIES ==--\n\n";
835foreach my $c (@components) {
836  my $path = $$c{PATH};
837
838  # read Eclipse classpath from classpath file
839  open FILE, "$path/.classpath"
840    or die "$path/.classpath: $!";
841  my @lines = <FILE>;
842  close(FILE);
843  my @eclipse = ();
844  foreach my $line (@lines) {
845    $line = rtrim($line);
846    if ($line =~ /<classpathentry /) {
847      # found a compile-time classpath entry
848      $line =~ s/.* path="//;
849      $line =~ s/"\/>$//;
850      push(@eclipse, $line);
851    }
852  }
853  @eclipse = sort @eclipse;
854  $$c{ECLIPSE} = \@eclipse;
855}
856
857print STDERR "--== VERIFYING CLASSPATH MATCHES ==--\n\n";
858foreach my $c (@components) {
859  my @projDeps = @{$$c{PROJ_DEPS}};
860  my @libDeps = @{$$c{LIB_DEPS}};
861  my @projOpt = @{$$c{PROJ_OPT}};
862  my @libOpt = @{$$c{LIB_OPT}};
863  my $name = $$c{TITLE};
864
865  # verify compile-time classpath
866  my @deps = ();
867  foreach my $dep (@projDeps) {
868    push(@deps, "\${artifact.dir}/$$dep{JAR}");
869  }
870  foreach my $dep (@libDeps) {
871    push(@deps, "\${lib.dir}/$$dep{JAR}");
872  }
873  my @cp = @{$$c{COMPILE}};
874  my $compileError = 0;
875  if (@deps != @cp) {
876    print STDERR "Dependency mismatch for $name compile time classpath:\n";
877    $compileError = 1;
878  }
879  else {
880    for (my $i = 0; $i < @cp; $i++) {
881      my $depJar = $deps[$i];
882      my $cpJar = $cp[$i];
883      if ($cpJar ne $depJar) {
884        print STDERR "Dependency mismatch for $name compile time classpath:\n";
885        print STDERR "  #$i: $depJar != $cpJar\n";
886        $compileError = 1;
887        last;
888      }
889    }
890  }
891  if ($compileError) {
892    print STDERR "  project deps        =";
893    foreach my $q (@projDeps) {
894      print STDERR " $$q{NAME}";
895    }
896    print STDERR "\n  library deps        =";
897    foreach my $q (@libDeps) {
898      print STDERR " $$q{NAME}";
899    }
900    print STDERR "\n  component.classpath = @cp\n";
901    print STDERR "\n";
902  }
903
904  # verify Eclipse classpath
905  @deps = ();
906  foreach my $dep (@projDeps) {
907    push(@deps, "/$$dep{NAME}");
908  }
909  if (@libDeps > 0) {
910    push(@deps, "/External libraries");
911  }
912  push(@deps, "build/classes");
913  push(@deps, "org.eclipse.jdt.launching.JRE_CONTAINER");
914  push(@deps, "src");
915  @deps = sort @deps;
916  @cp = @{$$c{ECLIPSE}};
917  my $eclipseError = 0;
918  if (@deps != @cp) {
919    print STDERR "Dependency mismatch for $name Eclipse classpath:\n";
920    $eclipseError = 1;
921  }
922  else {
923    for (my $i = 0; $i < @cp; $i++) {
924      my $depEntry = $deps[$i];
925      my $cpEntry = $cp[$i];
926      if ($cpEntry ne $depEntry) {
927        print STDERR "Dependency mismatch for $name Eclipse classpath:\n";
928        print STDERR "  #$i: $depEntry != $cpEntry\n";
929        $eclipseError = 1;
930        last;
931      }
932    }
933  }
934  if ($eclipseError) {
935    print STDERR "  project deps      =";
936    foreach my $q (@projDeps) {
937      print STDERR " $$q{NAME}";
938    }
939    print STDERR "\n  library deps      =";
940    foreach my $q (@libDeps) {
941      print STDERR " $$q{NAME}";
942    }
943    print STDERR "\n  Eclipse classpath = @cp\n";
944    print STDERR "\n";
945  }
946
947  # verify runtime classpath
948  @deps = ();
949  foreach my $dep (@projDeps) {
950    push(@deps, "\${artifact.dir}/$$dep{JAR}");
951  }
952  foreach my $dep (@libDeps) {
953    push(@deps, "\${lib.dir}/$$dep{JAR}");
954  }
955  foreach my $dep (@projOpt) {
956    push(@deps, "\${artifact.dir}/$$dep{JAR}");
957  }
958  foreach my $dep (@libOpt) {
959    push(@deps, "\${lib.dir}/$$dep{JAR}");
960  }
961  @cp = @{$$c{RUNTIME}};
962  my $runtimeError = 0;
963  if (@deps != @cp) {
964    print STDERR "Dependency mismatch for $name runtime classpath:\n";
965    $runtimeError = 1;
966  }
967  else {
968    for (my $i = 0; $i < @cp; $i++) {
969      my $depJar = $deps[$i];
970      my $cpJar = $cp[$i];
971      if ($cpJar ne $depJar) {
972        print STDERR "Dependency mismatch for $name runtime classpath:\n";
973        print STDERR "  #$i: $depJar != $cpJar\n";
974        $runtimeError = 1;
975        last;
976      }
977    }
978  }
979  if ($runtimeError) {
980    print STDERR "  project deps         =";
981    foreach my $q (@projDeps) {
982      print STDERR " $$q{NAME}";
983    }
984    print STDERR "\n  reflected projects   =";
985    foreach my $q (@projOpt) {
986      print STDERR " $$q{NAME}";
987    }
988    print STDERR "\n  library deps         =";
989    foreach my $q (@libDeps) {
990      print STDERR " $$q{NAME}";
991    }
992    print STDERR "\n  reflected libraries  =";
993    foreach my $q (@libOpt) {
994      print STDERR " $$q{NAME}";
995    }
996    print STDERR "\n  component.runtime-cp = @cp\n";
997    print STDERR "\n";
998  }
999}
1000
1001# -- FORMATTED DATA OUTPUT --
1002
1003print STDERR "--== DUMPING RESULTS TO STDOUT ==--\n\n";
1004
1005my $div = <<ZZ;
1006===============================================================================
1007ZZ
1008
1009# components - active
1010print "$div";
1011print "This build file handles the following components.\n";
1012print "For more information on a component, see the\n";
1013print "build.properties file in that component's subtree.\n";
1014print "Run ./scan-deps.pl to programmatically generate this list.\n\n";
1015foreach my $c (@active) {
1016  print "$$c{TITLE}\n";
1017  smartSplit("    ", " ", split(/[ \n]/, $$c{DESC}));
1018  print "    -=-\n";
1019  print "    JAR file:      $$c{JAR}\n";
1020  print "    Path:          $$c{PATH}\n";
1021
1022  my $lead = "                   ";
1023
1024  my @projDeps = @{$$c{PROJ_DEPS}};
1025  my @prettyDeps = ();
1026  foreach my $q (@projDeps) {
1027    push(@prettyDeps, $$q{TITLE});
1028  }
1029  smartSplit("    Project deps:  ", ", ", @prettyDeps);
1030
1031  my @libDeps = @{$$c{LIB_DEPS}};
1032  @prettyDeps = ();
1033  foreach my $q (@libDeps) {
1034    push(@prettyDeps, $$q{TITLE});
1035  }
1036  smartSplit("    Library deps:  ", ", ", @prettyDeps);
1037
1038  my @projOpt = @{$$c{PROJ_OPT}};
1039  my @prettyOpt = ();
1040  foreach my $q (@projOpt) {
1041    push(@prettyOpt, $$q{TITLE});
1042  }
1043  my @libOpt = @{$$c{LIB_OPT}};
1044  foreach my $q (@libOpt) {
1045    push(@prettyOpt, $$q{TITLE});
1046  }
1047  smartSplit("    Optional:      ", ", ", @prettyOpt);
1048
1049  print "    License:       $$c{LICENSE}\n";
1050  print "\n";
1051}
1052
1053# components - legacy
1054print "$div";
1055print "The following components are considered \"legacy\" but still " .
1056      "available:\n\n";
1057foreach my $c (@legacy) {
1058  print "$$c{TITLE}\n";
1059  smartSplit("    ", " ", split(/[ \n]/, $$c{DESC}));
1060  print "    -=-\n";
1061  print "    JAR file:      $$c{JAR}\n";
1062  print "    Path:          $$c{PATH}\n";
1063
1064  my $lead = "                   ";
1065
1066  my @deps = @{$$c{PROJ_DEPS}};
1067  my @prettyDeps = ();
1068  foreach my $q (@deps) {
1069    push(@prettyDeps, $$q{TITLE});
1070  }
1071  smartSplit("    Project deps:  ", ", ", @prettyDeps);
1072
1073  my @opt = @{$$c{PROJ_OPT}};
1074  my @prettyOpt = ();
1075  foreach my $q (@opt) {
1076    push(@prettyOpt, $$q{TITLE});
1077  }
1078  smartSplit("    Optional:      ", ", ", @prettyOpt);
1079
1080  print "    License:       $$c{LICENSE}\n";
1081  print "\n";
1082}
1083
1084# components - forks
1085print "$div";
1086print "The following components are forks of third party projects:\n\n";
1087foreach my $c (@forks) {
1088  print "$$c{TITLE}\n";
1089  smartSplit("    ", " ", split(/[ \n]/, $$c{DESC}));
1090  print "    -=-\n";
1091  print "    JAR file:      $$c{JAR}\n";
1092  print "    Path:          $$c{PATH}\n";
1093
1094  my @deps = @{$$c{PROJ_DEPS}};
1095  my @prettyDeps = ();
1096  foreach my $q (@deps) {
1097    push(@prettyDeps, $$q{TITLE});
1098  }
1099  smartSplit("    Project deps:  ", ", ", @prettyDeps);
1100
1101  my @opt = @{$$c{PROJ_OPT}};
1102  my @prettyOpt = ();
1103  foreach my $q (@opt) {
1104    push(@prettyOpt, $$q{TITLE});
1105  }
1106  smartSplit("    Optional:      ", ", ", @prettyOpt);
1107
1108  print "    License:       $$c{LICENSE}\n";
1109  print "    Project URL:   $$c{URL}\n";
1110  smartSplit("    Notes:         ", " ", split(/[ \n]/, $$c{NOTES}));
1111  print "\n";
1112}
1113
1114# libraries
1115print "$div";
1116print "The following external dependencies (in the jar folder) may be " .
1117      "required:\n";
1118foreach my $l (@libs) {
1119  print "$$l{TITLE}\n";
1120  print "    JAR file:  $$l{JAR}\n";
1121  print "    URL:       $$l{URL}\n";
1122  smartSplit("    Notes:     ", " ", split(/[ \n]/, $$l{NOTES}));
1123  print "    License:   $$l{LICENSE}\n";
1124  print "\n";
1125}
1126
1127# -- SUBROUTINES --
1128
1129sub checkDirect {
1130  my ($package, $path) = @_;
1131  return `find $path -name '*.java' | xargs grep -l "^import $package\\."`;
1132}
1133
1134sub checkReflect {
1135  my ($package, $path) = @_;
1136  return `find $path -name '*.java' | xargs grep -l "import $package\\."`;
1137}
1138
1139sub smartSplit {
1140  my ($front, $div, @list) = @_;
1141  my $lead = $front;
1142  $lead =~ s/./ /g;
1143  my $tDiv = rtrim($div);
1144  my $end = 79;
1145  my $len = @list;
1146  my $line = $front;
1147  if ($len == 0) {
1148    $line .= "(none)";
1149  }
1150  for (my $i = 0; $i < $len; $i++) {
1151    my $item = $list[$i];
1152    if ($item eq '') { next; }
1153    if ($i == 0) {
1154      # first item
1155      $line .= $item;
1156    }
1157    else {
1158      my $q = $line . $div . $item;
1159      my $max = $i == $len - 1 ? $end : $end - length($tDiv);
1160      if (length($q) > $max) {
1161        # line wrap
1162        $line .= $tDiv;
1163        print "$line\n";
1164        $line = $lead . $item;
1165      }
1166      else {
1167        # append
1168        $line = $q;
1169      }
1170    }
1171  }
1172  print "$line\n";
1173}
1174
1175sub rtrim {
1176  my $string = shift;
1177  $string =~ s/\s+$//;
1178  return $string;
1179}
Note: See TracBrowser for help on using the repository browser.