source: trunk/scan-deps.pl @ 4612

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