source: branches/4.2/scan-deps.pl @ 6517

Revision 6517, 31.9 KB checked in by melissa, 9 years ago (diff)

Fixed scan-deps.pl warnings.

  • 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,  # URL for each external project (forks, stubs & libs)
25  NOTES     => 8,  # notes for each external project (forks, stubs & 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 %autogen = (
39  NAME    => "autogen",
40  TITLE   => "LOCI code generator",
41  PATH    => "components/autogen",
42  JAR     => "loci-autogen.jar",
43  PACKAGE => "(none)",
44  DESC    => <<ZZ,
45Package for generating other code, including the Bio-Formats metadata API,
46related documentation, Ice bindings, and Bio-Formats C++ bindings headers
47ZZ
48  LICENSE => "GPL",
49);
50
51my %bfIce = (
52  NAME    => "bf-ice",
53  TITLE   => "Bio-Formats Ice framework",
54  PATH    => "components/bf-ice",
55  JAR     => "bf-ice.jar",
56  PACKAGE => "loci.ice.formats",
57  DESC    => <<ZZ,
58Bindings for Bio-Formats client/server communication enabling cross-language
59interoperability
60ZZ
61  LICENSE => "GPL",
62);
63
64my %bioFormats = (
65  NAME    => "bio-formats",
66  TITLE   => "Bio-Formats",
67  PATH    => "components/bio-formats",
68  JAR     => "bio-formats.jar",
69  PACKAGE => "loci.formats",
70  DESC    => <<ZZ,
71A library for reading and writing popular microscopy file formats
72ZZ
73  LICENSE => "GPL",
74);
75
76my %flowCytometry = (
77  NAME    => "flow-cytometry",
78  TITLE   => "WiscScan Flow Cytometry",
79  PATH    => "components/flow-cytometry",
80  JAR     => "flow-cytometry.jar",
81  PACKAGE => "loci.apps.flow",
82  DESC    => <<ZZ,
83Server application for flow cytometry with WiscScan using JVMLink
84ZZ
85  LICENSE => "BSD",
86);
87
88my %lociChecks = (
89  NAME    => "loci-checks",
90  TITLE   => "LOCI Checkstyle checks",
91  PATH    => "components/checkstyle",
92  JAR     => "loci-checks.jar",
93  PACKAGE => "loci.checks",
94  DESC    => <<ZZ,
95LOCI's Checkstyle extensions, for checking source code style
96ZZ
97  LICENSE => "Public domain",
98);
99
100my %lociCommon = (
101  NAME    => "common",
102  TITLE   => "LOCI Common",
103  PATH    => "components/common",
104  JAR     => "loci-common.jar",
105  PACKAGE => "loci.common",
106  DESC    => <<ZZ,
107A library containing common I/O and reflection classes
108ZZ
109  LICENSE => "GPL",
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# -- COMPONENT DEFINITIONS - STUBS --
310
311my %lwfStubs = (
312  NAME    => "lwf-stubs",
313  TITLE   => "Luratech LuraWave stubs",
314  PATH    => "components/stubs/lwf-stubs",
315  JAR     => "lwf-stubs.jar",
316  PACKAGE => "com.luratech.lwf",
317  DESC    => <<ZZ,
318Stub of proprietary Java API to handle Luratech LWF compression
319ZZ
320  LICENSE => "BSD",
321  URL     => "http://www.luratech.com/",
322  NOTES   => <<ZZ,
323required to compile Bio-Formats's support for Luratech LWF compression for
324the Opera Flex format
325ZZ
326);
327
328# -- LIBRARY DEFINITIONS --
329
330my %appleJavaExtensions = (
331  NAME    => "AppleJavaExtensions",
332  TITLE   => "Apple eAWT stubs",
333  JAR     => "AppleJavaExtensions.jar",
334  PACKAGE => "com.apple",
335  LICENSE => "BSD",
336  URL     => "http://developer.apple.com/samplecode/AppleJavaExtensions/",
337  NOTES   => <<ZZ,
338required to compile Mac-specific functionality on non-Mac OS X machines
339ZZ
340);
341
342my %antContrib = (
343  NAME    => "ant-contrib",
344  TITLE   => "Ant-Contrib",
345  JAR     => "ant-contrib-1.0b3.jar",
346  PACKAGE => "net.sf.antcontrib",
347  LICENSE => "Apache",
348  URL     => "http://ant-contrib.sourceforge.net/",
349  NOTES   => <<ZZ,
350used by tools target to iterate over JAR files ("for" task)
351ZZ
352  VERSION => "1.0b3"
353);
354
355my %checkstyle = (
356  NAME    => "checkstyle",
357  TITLE   => "Checkstyle",
358  JAR     => "checkstyle-all-5.0.jar",
359  PACKAGE => "com.puppycrawl.tools.checkstyle",
360  LICENSE => "LGPL",
361  URL     => "http://checkstyle.sourceforge.net/",
362  NOTES   => <<ZZ,
363used by style Ant target to check source code style conventions
364ZZ
365  VERSION => "5.0"
366);
367
368my %commonsHTTPClient = (
369  NAME    => "commons-httpclient",
370  TITLE   => "Apache Jakarta Commons HttpClient",
371  JAR     => "commons-httpclient-2.0-rc2.jar",
372  PACKAGE => "org.apache.commons.httpclient",
373  LICENSE => "Apache",
374  URL     => "http://jakarta.apache.org/commons/httpclient/",
375  NOTES   => <<ZZ,
376required for OME-Java to communicate with OME servers
377ZZ
378  VERSION => "2.0-rc2"
379);
380
381my %commonsLogging = (
382  NAME    => "commons-logging",
383  TITLE   => "Apache Jakarta Commons Logging",
384  JAR     => "commons-logging.jar",
385  PACKAGE => "org.apache.commons.logging",
386  LICENSE => "Apache",
387  URL     => "http://jakarta.apache.org/commons/logging/",
388  NOTES   => <<ZZ,
389used by OME-Java
390ZZ
391  VERSION => "1.0.3"
392);
393
394my %findbugs = (
395  NAME    => "findbugs",
396  TITLE   => "FindBugs Ant task",
397  JAR     => "findbugs-ant.jar",
398  PACKAGE => "edu.umd.cs.findbugs.anttask",
399  LICENSE => "LGPL",
400  URL     => "http://findbugs.sourceforge.net/",
401  NOTES   => <<ZZ,
402used by findbugs Ant target to check for program bugs
403ZZ
404  VERSION => "1.3.9"
405);
406
407my %forms = (
408  NAME    => "forms",
409  TITLE   => "JGoodies Forms",
410  JAR     => "forms-1.3.0.jar",
411  PACKAGE => "com.jgoodies.forms",
412  LICENSE => "BSD",
413  URL     => "http://www.jgoodies.com/freeware/forms/index.html",
414  NOTES   => <<ZZ,
415used for layout by VisBio, Data Browser and OME Notes
416ZZ
417  VERSION => "1.3.0"
418);
419
420my %ice = (
421  NAME    => "ice",
422  TITLE   => "Ice",
423  JAR     => "Ice-3.3.1.jar",
424  PACKAGE => "Ice",
425  LICENSE => "GPL",
426  URL     => "http://www.zeroc.com/ice.html",
427  NOTES   => <<ZZ,
428used by Bio-Formats Ice framework
429ZZ
430  VERSIOn => "3.3.1"
431);
432
433my %ij = (
434  NAME    => "ij",
435  TITLE   => "ImageJ",
436  JAR     => "ij.jar",
437  PACKAGE => "ij",
438  LICENSE => "Public domain",
439  URL     => "http://rsb.info.nih.gov/ij/",
440  NOTES   => <<ZZ,
441used by LOCI plugins for ImageJ and OME plugins for ImageJ; bundled with VisBio
442to achieve ImageJ interconnectivity
443ZZ
444  VERSION => "1.43o"
445);
446
447my %jiio = (
448  NAME    => "jiio",
449  TITLE   => "JAI ImageIO wrapper",
450  JAR     => "clibwrapper_jiio.jar",
451  PACKAGE => "com.sun.medialib.codec",
452  LICENSE => "BSD",
453  URL     => "https://jai-imageio.dev.java.net/",
454  NOTES   => <<ZZ,
455used by Bio-Formats via reflection for JPEG2000 support (ND2, JP2) and lossless
456JPEG decompression (DICOM)
457ZZ
458  VERSION => "1.1"
459);
460
461my %junit = (
462  NAME    => "junit",
463  TITLE   => "JUnit",
464  JAR     => "junit.jar",
465  PACKAGE => ".*junit",
466  LICENSE => "Common Public License",
467  URL     => "http://www.junit.org/",
468  NOTES   => <<ZZ,
469unit testing framework used for a few VisBio unit tests
470ZZ
471  VERSION => "3.8.2"
472);
473
474my %lma = (
475  NAME    => "lma",
476  TITLE   => "L-M Fit",
477  JAR     => "lma.jar",
478  PACKAGE => "jaolho.data.lma",
479  LICENSE => "LGPL",
480  URL     => "http://users.utu.fi/jaolho/",
481  NOTES   => <<ZZ,
482Levenberg-Marquardt algorithm for exponential curve fitting, used by SLIM
483Plotter
484ZZ
485);
486
487my %log4j = (
488  NAME    => "log4j",
489  TITLE   => "Apache log4j",
490  JAR     => "log4j-1.2.15.jar",
491  PACKAGE => "org.apache.log4j",
492  LICENSE => "Apache",
493  URL     => "http://logging.apache.org/log4j/",
494  NOTES   => <<ZZ,
495required by SLF4J implementation
496ZZ
497  VERSION => "1.2.15"
498);
499
500my %looks = (
501  NAME    => "looks",
502  TITLE   => "JGoodies Looks",
503  JAR     => "looks-2.3.1.jar",
504  PACKAGE => "com.jgoodies.looks",
505  LICENSE => "BSD",
506  URL     => "http://www.jgoodies.com/freeware/looks/index.html",
507  NOTES   => <<ZZ,
508used for a nicer Look & Feel by VisBio and OME Metadata Editor
509ZZ
510  VERSION => "2.3.1"
511);
512
513my %netcdf = (
514  NAME    => "netcdf",
515  TITLE   => "NetCDF",
516  JAR     => "netcdf-4.0.jar",
517  PACKAGE => "ucar.nc2",
518  LICENSE => "LGPL",
519  URL     => "http://www.unidata.ucar.edu/software/netcdf-java/",
520  NOTES   => <<ZZ,
521used by Bio-Formats via reflection for HDF support (Imaris 5.5)
522ZZ
523  VERSION => "4.0"
524);
525
526my %omeJava = (
527  NAME    => "ome-java",
528  TITLE   => "OME-Java",
529  JAR     => "ome-java.jar",
530  PACKAGE => "org.openmicroscopy.[di]s",
531  LICENSE => "LGPL",
532  URL     => "http://www.openmicroscopy.org/site/documents/data-management/".
533             "ome-server/developer/java-api",
534  NOTES   => <<ZZ,
535used by OME I/O to connect to OME servers
536ZZ
537);
538
539my %omeJavaDeprecated = (
540  NAME    => "ome-java-deprecated",
541  TITLE   => "OME-Java deprecated classes",
542  JAR     => "ome-java-deprecated.jar",
543  PACKAGE => "org.openmicroscopy.xml",
544  LICENSE => "LGPL",
545  URL     => "http://www.openmicroscopy.org/site/documents/data-management/".
546             "ome-server/developer/java-api",
547  NOTES   => <<ZZ,
548used by OME Notes and OME Metadata Editor to work with OME-XML
549ZZ
550);
551
552my %omeroClient = (
553  NAME    => "omero-client",
554  TITLE   => "OMERO Client",
555  JAR     => "omero-client-4.1.1.jar",
556  PACKAGE => "ome.system",
557  LICENSE => "GPL",
558  URL     => "http://trac.openmicroscopy.org.uk/omero/wiki/MilestoneDownloads",
559  NOTES   => <<ZZ,
560used by OME I/O to connect to OMERO servers
561ZZ
562  VERSION => "4.1.1"
563);
564
565my %omeroCommon = (
566  NAME    => "omero-common",
567  TITLE   => "OMERO Common",
568  JAR     => "omero-common-4.1.1.jar",
569  PACKAGE => "ome.api",
570  LICENSE => "GPL",
571  URL     => "http://trac.openmicroscopy.org.uk/omero/wiki/MilestoneDownloads",
572  NOTES   => <<ZZ,
573used by OME I/O to connect to OMERO servers
574ZZ
575  VERSION => "4.1.1"
576);
577
578my %skinlf = (
579  NAME    => "skinlf",
580  TITLE   => "Skin Look and Feel",
581  JAR     => "skinlf.jar",
582  PACKAGE => "com.l2fprod",
583  LICENSE => "Custom (BSD-like)",
584  URL     => "http://skinlf.l2fprod.com/",
585  NOTES   => <<ZZ,
586not used (may be used in the future for flexible skinning)
587ZZ
588  VERSION => "6.7"
589);
590
591my %slf4j_api = (
592  NAME    => "slf4j-api",
593  TITLE   => "Simple Logging Facade for Java API",
594  JAR     => "slf4j-api-1.5.10.jar",
595  PACKAGE => "org.slf4j",
596  LICENSE => "BSD",
597  URL     => "http://www.slf4j.org/",
598  NOTES   => <<ZZ,
599used for all logging in loci.*
600ZZ
601  VERSION => "1.5.10"
602);
603
604my %slf4j_impl = (
605  NAME    => "slf4j-log4j",
606  TITLE   => "Simple Logging Facade for Java log4j Binding",
607  JAR     => "slf4j-log4j12-1.5.10.jar",
608  PACKAGE => "org.slf4j.impl",
609  LICENSE => "BSD",
610  URL     => "http://www.slf4j.org/",
611  NOTES   => <<ZZ,
612used for all logging in loci.*
613ZZ
614  VERSION => "1.5.10"
615);
616
617my %testng = (
618  NAME    => "testng",
619  TITLE   => "TestNG",
620  JAR     => "testng-5.11-jdk15.jar",
621  PACKAGE => "org.testng",
622  LICENSE => "Apache",
623  URL     => "http://testng.org/",
624  NOTES   => <<ZZ,
625testing framework used for LOCI software automated test suite
626ZZ
627  VERSION => "5.7"
628);
629
630my %velocity = (
631  NAME    => "velocity",
632  TITLE   => "Apache Velocity",
633  JAR     => "velocity-1.6.3-dep.jar",
634  PACKAGE => "org.apache.velocity",
635  LICENSE => "Apache",
636  URL     => "http://velocity.apache.org/",
637  NOTES   => <<ZZ,
638used to autogenerate the loci.formats.meta and loci.formats.ome Bio-Formats
639packages
640ZZ
641  VERSION => "1.6.3"
642);
643
644my %visad = (
645  NAME    => "visad",
646  TITLE   => "VisAD",
647  JAR     => "visad-lite.jar",
648  PACKAGE => "visad",
649  LICENSE => "LGPL",
650  URL     => "http://www.ssec.wisc.edu/~billh/visad.html",
651  NOTES   => <<ZZ,
652stripped down VisAD library used by VisBio and SLIM Plotter for interactive
653visualization
654ZZ
655);
656
657my %xmlrpc = (
658  NAME    => "xmlrpc",
659  TITLE   => "Apache XML-RPC",
660  JAR     => "xmlrpc-1.2-b1.jar",
661  PACKAGE => "org.apache.xmlrpc",
662  LICENSE => "Apache",
663  URL     => "http://ws.apache.org/xmlrpc/",
664  NOTES   => <<ZZ,
665used by OME-Java library to communicate with OME servers
666ZZ
667  VERSION => "1.2-b1"
668);
669
670my %serializer = (
671  NAME    => "serializer",
672  TITLE   => "Xalan Serializer",
673  JAR     => "serializer-2.7.1.jar",
674  PACKAGE => "org.apache.xml.serializer",
675  LICENSE => "Apache",
676  URL     => "http://xml.apache.org/xalan-j/",
677  NOTES   => <<ZZ,
678used for OME-XML transformations
679ZZ
680  VERSION => "2.7.1"
681);
682
683my %xalan = (
684  NAME    => "xalan",
685  TITLE   => "Xalan",
686  JAR     => "xalan-2.7.1.jar",
687  PACKAGE => "org.apache.xalan",
688  LICENSE => "Apache",
689  URL     => "http://xml.apache.org/xalan-j/",
690  NOTES   => <<ZZ,
691used for OME-XML transformations
692ZZ
693  VERSION => "2.7.1"
694);
695
696
697
698# -- DATA STRUCTURES --
699
700# List of active LOCI software components
701my @active = (
702  \%autogen,
703#  \%bfIce,
704  \%bioFormats,
705  \%flowCytometry,
706  \%lociChecks,
707  \%lociCommon,
708  \%lociPlugins,
709  \%omeIO,
710  \%omePlugins,
711  \%omeXML,
712  \%slimPlotter,
713  \%testSuite,
714  \%visbio,
715);
716
717# List of legacy components (no longer supported)
718my @legacy = (
719  \%jvmlink,
720  \%multiLUT,
721  \%omeEditor,
722#  \%omeNotes,
723);
724
725# List of external project forks
726my @forks = (
727  \%jai,
728  \%mdbtools,
729  \%poi,
730);
731
732# List of external project stubs
733my @stubs = (
734  \%lwfStubs,
735);
736
737# List of all LOCI software components
738my @components = (@active, @legacy, @forks, @stubs);
739
740# List of external libraries
741my @libs = (
742  \%appleJavaExtensions,
743  \%antContrib,
744  \%checkstyle,
745  \%commonsHTTPClient,
746  \%commonsLogging,
747  \%findbugs,
748  \%forms,
749  \%ice,
750  \%ij,
751  \%jiio,
752  \%junit,
753  \%lma,
754  \%log4j,
755  \%looks,
756  \%netcdf,
757  \%slf4j_api,
758  \%slf4j_impl,
759  \%omeJava,
760  \%omeJavaDeprecated,
761  \%omeroClient,
762  \%omeroCommon,
763  \%serializer,
764  \%skinlf,
765  \%testng,
766  \%velocity,
767  \%visad,
768  \%xalan,
769  \%xmlrpc,
770);
771
772my $programErrors = 0;
773
774# -- ARGUMENT PARSING --
775
776my $skipSummary = 0;
777foreach my $arg (@ARGV) {
778  if ($arg eq '-nosummary') {
779    $skipSummary = 1;
780  }
781}
782
783# -- DATA COLLECTION --
784
785# verify that all JAR files exist -- if not, this file is probably out of date
786print STDERR "--== VERIFYING JAR FILE EXISTENCE ==--\n\n";
787foreach my $c (@components) {
788  my $jar = $$c{JAR};
789  unless (-e "artifacts/$jar") {
790    die "Component $jar does not exist";
791  }
792}
793foreach my $l (@libs) {
794  my $jar = $$l{JAR};
795  unless (-e "jar/$jar") {
796    die "Library $jar does not exist";
797  }
798}
799
800# scan for project dependencies
801print STDERR "--== SCANNING PROJECT DEPENDENCIES ==--\n\n";
802foreach my $c (@components) {
803  my $path = $$c{PATH};
804  print STDERR "[$$c{TITLE}]\n";
805  my @deps = ();
806  my @opt = ();
807  foreach my $c2 (@components) {
808    if ($c eq $c2) { next; }
809    my $name = $$c2{TITLE};
810    my $package = $$c2{PACKAGE};
811    if (checkDirect($package, $path)) {
812      push (@deps, $c2);
813      print STDERR "$name\n";
814    }
815    elsif (checkReflect($package, $path)) {
816      push (@opt, $c2);
817      print STDERR "$name [reflected]\n";
818    }
819  }
820  $$c{PROJ_DEPS} = \@deps;
821  $$c{PROJ_OPT} = \@opt;
822  print STDERR "\n";
823}
824
825print STDERR "--== SCANNING LIBRARY DEPENDENCIES ==--\n\n";
826foreach my $c (@components) {
827  my @deps = ();
828  my @opt = ();
829  my $path = $$c{PATH};
830  print STDERR "[$$c{TITLE}]\n";
831  foreach my $l (@libs) {
832    my $name = $$l{TITLE};
833    my $package = $$l{PACKAGE};
834    if (checkDirect($package, $path)) {
835      push (@deps, $l);
836      print STDERR "$name\n";
837    }
838    elsif (checkReflect($package, $path)) {
839      push (@opt, $l);
840      print STDERR "$name [reflected]\n";
841    }
842  }
843  $$c{LIB_DEPS} = \@deps;
844  $$c{LIB_OPT} = \@opt;
845  print STDERR "\n";
846}
847
848print STDERR "--== GATHERING COMPONENT CLASSPATHS ==--\n\n";
849foreach my $c (@components) {
850  my $path = $$c{PATH};
851
852  # read compile-time and runtime classpaths from properties file
853  open FILE, "$path/build.properties"
854    or die "$path/build.properties: $!";
855  my @lines = <FILE>;
856  close(FILE);
857  my $inCompile = 0;
858  my $inManifest = 0;
859  my @compile = ();
860  my @runtime = ();
861  foreach my $line (@lines) {
862    $line = rtrim($line);
863    if ($line =~ /^component.classpath/) {
864      # found the compile-time classpath variable
865      $inCompile = 1;
866    }
867    elsif ($line =~ /^component.runtime-cp/) {
868      # found the runtime classpath variable
869      $inManifest = 1;
870    }
871    if ($inCompile || $inManifest) {
872      my $end = $line !~ /\\$/;
873      # append the entry to the classpath list
874      $line =~ s/[ :\\]*$//;
875      $line =~ s/.*[ =]+//;
876      if ($line ne '(none)' && $line ne '') {
877        if ($inCompile) {
878          push(@compile, $line);
879        }
880        elsif ($inManifest) {
881          if ($line =~ /\${component.classpath}/) {
882            push(@runtime, @compile);
883          }
884          else {
885            push(@runtime, $line);
886          }
887        }
888      }
889      if ($end) {
890        # line does not end with a backslash; end of variable
891        $inCompile = $inManifest = 0;
892      }
893    }
894  }
895  $$c{COMPILE} = \@compile;
896  $$c{RUNTIME} = \@runtime;
897}
898
899print STDERR "--== GATHERING ECLIPSE DEPENDENCIES ==--\n\n";
900foreach my $c (@components) {
901  my $path = $$c{PATH};
902
903  # read Eclipse classpath from classpath file
904  open FILE, "$path/.classpath"
905    or die "$path/.classpath: $!";
906  my @lines = <FILE>;
907  close(FILE);
908  my @eclipse = ();
909  foreach my $line (@lines) {
910    $line = rtrim($line);
911    if ($line =~ /<classpathentry /) {
912      # found a compile-time classpath entry
913      $line =~ s/.* path="//;
914      $line =~ s/"\/>$//;
915      push(@eclipse, $line);
916    }
917  }
918  @eclipse = sort @eclipse;
919  $$c{ECLIPSE} = \@eclipse;
920}
921
922# -- DATA VERIFICATION --
923
924print STDERR "--== VERIFYING CLASSPATH MATCHES ==--\n\n";
925foreach my $c (@components) {
926  my @projDeps = @{$$c{PROJ_DEPS}};
927  my @libDeps = @{$$c{LIB_DEPS}};
928  my @projOpt = @{$$c{PROJ_OPT}};
929  my @libOpt = @{$$c{LIB_OPT}};
930  my $name = $$c{TITLE};
931  my $path = $$c{PATH};
932  my @deps;
933
934  # verify compile-time classpath
935  my @compile = ();
936  foreach my $dep (@projDeps) {
937    push(@compile, "\${artifact.dir}/$$dep{JAR}");
938  }
939  foreach my $dep (@libDeps) {
940    push(@compile, "\${lib.dir}/$$dep{JAR}");
941  }
942  @compile = sort @compile;
943  my @cp = @{$$c{COMPILE}};
944  my $compileError = 0;
945  if (@compile != @cp) {
946    print STDERR "Dependency mismatch for $name compile time classpath:\n";
947    $compileError = 1;
948  }
949  else {
950    for (my $i = 0; $i < @cp; $i++) {
951      my $depJar = $compile[$i];
952      my $cpJar = $cp[$i];
953      if ($cpJar ne $depJar) {
954        print STDERR "Dependency mismatch for $name compile time classpath:\n";
955        print STDERR "  #$i: $depJar != $cpJar\n";
956        $compileError = 1;
957        last;
958      }
959    }
960  }
961  if ($compileError) {
962    print STDERR "  component.classpath:\n";
963    print STDERR "    Actual    = @cp\n";
964    print STDERR "    Synthetic = @deps\n";
965    print STDERR "\n";
966    print STDERR "  project deps =";
967    foreach my $q (@projDeps) {
968      print STDERR " $$q{NAME}";
969    }
970    print STDERR "\n";
971    print STDERR "  library deps =";
972    foreach my $q (@libDeps) {
973      print STDERR " $$q{NAME}";
974    }
975    print STDERR "\n";
976    $programErrors++;
977  }
978
979  # verify Eclipse classpath
980  @deps = ();
981  push(@deps, "src");
982  if (-e "$path/test") {
983    push(@deps, "test");
984  }
985  push(@deps, "org.eclipse.jdt.launching.JRE_CONTAINER");
986  foreach my $dep (@projDeps) {
987    push(@deps, "/$$dep{NAME}");
988  }
989  if (@libDeps > 0) {
990    push(@deps, "/External libraries");
991    foreach my $q (@libDeps) {
992      if ($$q{NAME} eq $testng{NAME}) {
993        push(@deps, "org.testng.TESTNG_CONTAINER");
994      }
995      if ($$q{NAME} eq $junit{NAME}) {
996        push(@deps, "org.eclipse.jdt.junit.JUNIT_CONTAINER/4");
997      }
998    }
999  }
1000  push(@deps, "build-eclipse");
1001  @deps = sort @deps;
1002  @cp = @{$$c{ECLIPSE}};
1003  my $eclipseError = 0;
1004  if (@deps != @cp) {
1005    print STDERR "Dependency mismatch for $name Eclipse classpath:\n";
1006    $eclipseError = 1;
1007  }
1008  else {
1009    for (my $i = 0; $i < @cp; $i++) {
1010      my $depEntry = $deps[$i];
1011      my $cpEntry = $cp[$i];
1012      if ($cpEntry ne $depEntry) {
1013        print STDERR "Dependency mismatch for $name Eclipse classpath:\n";
1014        print STDERR "  #$i: $depEntry != $cpEntry\n";
1015        $eclipseError = 1;
1016        last;
1017      }
1018    }
1019  }
1020  if ($eclipseError) {
1021    print STDERR "  Eclipse classpath:\n";
1022    print STDERR "    Actual    = @cp\n";
1023    print STDERR "    Synthetic = @deps\n";
1024    print STDERR "\n";
1025    print STDERR "  project deps =";
1026    foreach my $q (@projDeps) {
1027      print STDERR " $$q{NAME}";
1028    }
1029    print STDERR "\n";
1030    print STDERR "  library deps =";
1031    foreach my $q (@libDeps) {
1032      print STDERR " $$q{NAME}";
1033    }
1034    print STDERR "\n";
1035    $programErrors++;
1036  }
1037
1038  # verify runtime classpath
1039  my @runtime = ();
1040  foreach my $dep (@projOpt) {
1041    push(@runtime, "\${artifact.dir}/$$dep{JAR}");
1042  }
1043  foreach my $dep (@libOpt) {
1044    push(@runtime, "\${lib.dir}/$$dep{JAR}");
1045  }
1046  @runtime = sort @runtime;
1047  @deps = (@compile, @runtime);
1048  @cp = @{$$c{RUNTIME}};
1049  my $runtimeError = 0;
1050  if (@deps != @cp) {
1051    print STDERR "Dependency mismatch for $name runtime classpath:\n";
1052    $runtimeError = 1;
1053  }
1054  else {
1055    for (my $i = 0; $i < @cp; $i++) {
1056      my $depJar = $deps[$i];
1057      my $cpJar = $cp[$i];
1058      if ($cpJar ne $depJar) {
1059        print STDERR "Dependency mismatch for $name runtime classpath:\n";
1060        print STDERR "  #$i: $depJar != $cpJar\n";
1061        $runtimeError = 1;
1062        last;
1063      }
1064    }
1065  }
1066  if ($runtimeError) {
1067    print STDERR "  component.runtime-cp:\n";
1068    print STDERR "    Actual    = @cp\n";
1069    print STDERR "    Synthetic = @deps\n";
1070    print STDERR "\n";
1071    print STDERR "  project deps        =";
1072    foreach my $q (@projDeps) {
1073      print STDERR " $$q{NAME}";
1074    }
1075    print STDERR "\n";
1076    print STDERR "  reflected projects  =";
1077    foreach my $q (@projOpt) {
1078      print STDERR " $$q{NAME}";
1079    }
1080    print STDERR "\n";
1081    print STDERR "  library deps        =";
1082    foreach my $q (@libDeps) {
1083      print STDERR " $$q{NAME}";
1084    }
1085    print STDERR "\n";
1086    print STDERR "  reflected libraries =";
1087    foreach my $q (@libOpt) {
1088      print STDERR " $$q{NAME}";
1089    }
1090    $programErrors++;
1091  }
1092}
1093
1094if ($skipSummary) {
1095  exit $programErrors;
1096}
1097
1098# -- FORMATTED DATA OUTPUT --
1099
1100print STDERR "--== DUMPING RESULTS TO STDOUT ==--\n\n";
1101
1102my $div = <<ZZ;
1103===============================================================================
1104ZZ
1105
1106# components - active
1107print "$div";
1108print "This build file handles the following components.\n";
1109print "For more information on a component, see the\n";
1110print "build.properties file in that component's subtree.\n";
1111print "Run ./scan-deps.pl to programmatically generate this list.\n\n";
1112foreach my $c (@active) {
1113  print "$$c{TITLE}\n";
1114  smartSplit("    ", " ", split(/[ \n]/, $$c{DESC}));
1115  print "    -=-\n";
1116  print "    JAR file:      $$c{JAR}\n";
1117  print "    Path:          $$c{PATH}\n";
1118
1119  my $lead = "                   ";
1120
1121  my @projDeps = @{$$c{PROJ_DEPS}};
1122  my @prettyDeps = ();
1123  foreach my $q (@projDeps) {
1124    push(@prettyDeps, $$q{TITLE});
1125  }
1126  smartSplit("    Project deps:  ", ", ", @prettyDeps);
1127
1128  my @libDeps = @{$$c{LIB_DEPS}};
1129  @prettyDeps = ();
1130  foreach my $q (@libDeps) {
1131    push(@prettyDeps, $$q{TITLE});
1132  }
1133  smartSplit("    Library deps:  ", ", ", @prettyDeps);
1134
1135  my @projOpt = @{$$c{PROJ_OPT}};
1136  my @prettyOpt = ();
1137  foreach my $q (@projOpt) {
1138    push(@prettyOpt, $$q{TITLE});
1139  }
1140  my @libOpt = @{$$c{LIB_OPT}};
1141  foreach my $q (@libOpt) {
1142    push(@prettyOpt, $$q{TITLE});
1143  }
1144  smartSplit("    Optional:      ", ", ", @prettyOpt);
1145
1146  print "    License:       $$c{LICENSE}\n";
1147  print "\n";
1148}
1149
1150# components - legacy
1151print "$div";
1152print "The following components are considered \"legacy\" but still " .
1153      "available:\n\n";
1154foreach my $c (@legacy) {
1155  print "$$c{TITLE}\n";
1156  smartSplit("    ", " ", split(/[ \n]/, $$c{DESC}));
1157  print "    -=-\n";
1158  print "    JAR file:      $$c{JAR}\n";
1159  print "    Path:          $$c{PATH}\n";
1160
1161  my $lead = "                   ";
1162
1163  my @deps = @{$$c{PROJ_DEPS}};
1164  my @prettyDeps = ();
1165  foreach my $q (@deps) {
1166    push(@prettyDeps, $$q{TITLE});
1167  }
1168  smartSplit("    Project deps:  ", ", ", @prettyDeps);
1169
1170  my @opt = @{$$c{PROJ_OPT}};
1171  my @prettyOpt = ();
1172  foreach my $q (@opt) {
1173    push(@prettyOpt, $$q{TITLE});
1174  }
1175  smartSplit("    Optional:      ", ", ", @prettyOpt);
1176
1177  print "    License:       $$c{LICENSE}\n";
1178  print "\n";
1179}
1180
1181# components - forks
1182for (my $i = 0; $i < 2; $i++) {
1183  print "$div";
1184  my @list;
1185  if ($i == 0) {
1186    @list = @forks;
1187    print "The following components are forks of third party projects:\n\n";
1188  }
1189  else {
1190    @list = @stubs;
1191    print "The following components are stubs of third party projects:\n\n";
1192  }
1193  foreach my $c (@list) {
1194    print "$$c{TITLE}\n";
1195    smartSplit("    ", " ", split(/[ \n]/, $$c{DESC}));
1196    print "    -=-\n";
1197    print "    JAR file:      $$c{JAR}\n";
1198    print "    Path:          $$c{PATH}\n";
1199
1200    my @deps = @{$$c{PROJ_DEPS}};
1201    my @prettyDeps = ();
1202    foreach my $q (@deps) {
1203      push(@prettyDeps, $$q{TITLE});
1204    }
1205    smartSplit("    Project deps:  ", ", ", @prettyDeps);
1206
1207    my @opt = @{$$c{PROJ_OPT}};
1208    my @prettyOpt = ();
1209    foreach my $q (@opt) {
1210      push(@prettyOpt, $$q{TITLE});
1211    }
1212    smartSplit("    Optional:      ", ", ", @prettyOpt);
1213
1214    print "    License:       $$c{LICENSE}\n";
1215    print "    Project URL:   $$c{URL}\n";
1216    smartSplit("    Notes:         ", " ", split(/[ \n]/, $$c{NOTES}));
1217    print "\n";
1218  }
1219}
1220
1221# libraries
1222print "$div";
1223print "The following external dependencies (in the jar folder) may be " .
1224      "required:\n";
1225foreach my $l (@libs) {
1226  print "$$l{TITLE}\n";
1227  print "    JAR file:  $$l{JAR}\n";
1228  print "    URL:       $$l{URL}\n";
1229  smartSplit("    Notes:     ", " ", split(/[ \n]/, $$l{NOTES}));
1230  print "    License:   $$l{LICENSE}\n";
1231  print "\n";
1232}
1233
1234exit $programErrors;
1235
1236# -- SUBROUTINES --
1237
1238sub checkDirect {
1239  my ($package, $path) = @_;
1240  return `find $path -name '*.java' | xargs grep -l "^import $package\\."`;
1241}
1242
1243sub checkReflect {
1244  my ($package, $path) = @_;
1245  return `find $path -name '*.java' | xargs grep -l "optional $package"`;
1246}
1247
1248sub smartSplit {
1249  my ($front, $div, @list) = @_;
1250  my $lead = $front;
1251  $lead =~ s/./ /g;
1252  my $tDiv = rtrim($div);
1253  my $end = 79;
1254  my $len = @list;
1255  my $line = $front;
1256  if ($len == 0) {
1257    $line .= "(none)";
1258  }
1259  for (my $i = 0; $i < $len; $i++) {
1260    my $item = $list[$i];
1261    if ($item eq '') { next; }
1262    if ($i == 0) {
1263      # first item
1264      $line .= $item;
1265    }
1266    else {
1267      my $q = $line . $div . $item;
1268      my $max = $i == $len - 1 ? $end : $end - length($tDiv);
1269      if (length($q) > $max) {
1270        # line wrap
1271        $line .= $tDiv;
1272        print "$line\n";
1273        $line = $lead . $item;
1274      }
1275      else {
1276        # append
1277        $line = $q;
1278      }
1279    }
1280  }
1281  print "$line\n";
1282}
1283
1284sub rtrim {
1285  my $string = shift;
1286  $string =~ s/\s+$//;
1287  return $string;
1288}
Note: See TracBrowser for help on using the repository browser.