source: branches/4.1/scan-deps.pl @ 5508

Revision 5508, 29.7 KB checked in by curtis, 11 years ago (diff)

Remove obsolete OMERO JARs; fix tools-ome target.

  • 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 %autogen = (
50  NAME    => "autogen",
51  TITLE   => "LOCI code generator",
52  PATH    => "components/autogen",
53  JAR     => "loci-autogen.jar",
54  PACKAGE => "(none)",
55  DESC    => <<ZZ,
56Package for generating other code, including the Bio-Formats metadata API,
57related documentation, Ice bindings, and Bio-Formats C++ bindings headers
58ZZ
59  LICENSE => "GPL",
60);
61
62my %bfIce = (
63  NAME    => "bf-ice",
64  TITLE   => "Bio-Formats Ice framework",
65  PATH    => "components/bf-ice",
66  JAR     => "bf-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 => "loci.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.3.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 %jiio = (
420  NAME    => "jiio",
421  TITLE   => "JAI ImageIO wrapper",
422  JAR     => "clibwrapper_jiio.jar",
423  PACKAGE => "com.sun.medialib.codec",
424  LICENSE => "BSD",
425  URL     => "https://jai-imageio.dev.java.net/",
426  NOTES   => <<ZZ,
427used by Bio-Formats via reflection for JPEG2000 support (ND2, JP2) and lossless
428JPEG decompression (DICOM)
429ZZ
430);
431
432my %junit = (
433  NAME    => "junit",
434  TITLE   => "JUnit",
435  JAR     => "junit.jar",
436  PACKAGE => "junit",
437  LICENSE => "Common Public License",
438  URL     => "http://www.junit.org/",
439  NOTES   => <<ZZ,
440unit testing framework used for a few VisBio unit tests
441ZZ
442);
443
444my %lma = (
445  NAME    => "lma",
446  TITLE   => "L-M Fit",
447  JAR     => "lma.jar",
448  PACKAGE => "jaolho.data.lma",
449  LICENSE => "LGPL",
450  URL     => "http://users.utu.fi/jaolho/",
451  NOTES   => <<ZZ,
452Levenberg-Marquardt algorithm for exponential curve fitting, used by SLIM
453Plotter
454ZZ
455);
456
457my %looks = (
458  NAME    => "looks",
459  TITLE   => "JGoodies Looks",
460  JAR     => "looks-1.2.2.jar",
461  PACKAGE => "com.jgoodies.plaf",
462  LICENSE => "BSD",
463  URL     => "http://www.jgoodies.com/freeware/looks/index.html",
464  NOTES   => <<ZZ,
465used for a nicer Look & Feel by VisBio and OME Metadata Editor
466ZZ
467);
468
469my %netcdf = (
470  NAME    => "netcdf",
471  TITLE   => "NetCDF",
472  JAR     => "netcdf-4.0.jar",
473  PACKAGE => "ucar.nc2",
474  LICENSE => "LGPL",
475  URL     => "http://www.unidata.ucar.edu/software/netcdf-java/",
476  NOTES   => <<ZZ,
477used by Bio-Formats via reflection for HDF support (Imaris 5.5)
478ZZ
479);
480
481my %netcdfBufr = (
482  NAME    => "netcdf-bufr",
483  TITLE   => "BUFR Java Decoder",
484  JAR     => "bufr-1.1.00.jar",
485  PACKAGE => "ucar.bufr",
486  LICENSE => "LGPL",
487  URL     => "http://www.unidata.ucar.edu/software/netcdf-java/",
488  NOTES   => <<ZZ,
489used by NetCDF library
490ZZ
491);
492
493my %netcdfGrib = (
494  NAME    => "netcdf-grib",
495  TITLE   => "GRIB Java Decoder",
496  JAR     => "grib-5.1.03.jar",
497  PACKAGE => "ucar.grib",
498  LICENSE => "LGPL",
499  URL     => "http://www.unidata.ucar.edu/software/netcdf-java/",
500  NOTES   => <<ZZ,
501used by NetCDF library
502ZZ
503);
504
505my %omeJava = (
506  NAME    => "ome-java",
507  TITLE   => "OME-Java",
508  JAR     => "ome-java.jar",
509  PACKAGE => "org.openmicroscopy.[di]s",
510  LICENSE => "LGPL",
511  URL     => "http://www.openmicroscopy.org/site/documents/data-management/".
512             "ome-server/developer/java-api",
513  NOTES   => <<ZZ,
514used by OME I/O to connect to OME servers
515ZZ
516);
517
518my %omeJavaDeprecated = (
519  NAME    => "ome-java-deprecated",
520  TITLE   => "OME-Java deprecated classes",
521  JAR     => "ome-java-deprecated.jar",
522  PACKAGE => "org.openmicroscopy.xml",
523  LICENSE => "LGPL",
524  URL     => "http://www.openmicroscopy.org/site/documents/data-management/".
525             "ome-server/developer/java-api",
526  NOTES   => <<ZZ,
527used by OME Notes and OME Metadata Editor to work with OME-XML
528ZZ
529);
530
531my %omeroClient = (
532  NAME    => "omero-client",
533  TITLE   => "OMERO Client",
534  JAR     => "omero-client-4.0.3.jar",
535  PACKAGE => "ome.system",
536  LICENSE => "GPL",
537  URL     => "http://trac.openmicroscopy.org.uk/omero/wiki/MilestoneDownloads",
538  NOTES   => <<ZZ,
539used by OME I/O to connect to OMERO servers
540ZZ
541);
542
543my %omeroCommon = (
544  NAME    => "omero-common",
545  TITLE   => "OMERO Common",
546  JAR     => "omero-common-4.0.3.jar",
547  PACKAGE => "ome.api",
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
555#my %omeroImporter = (
556#  NAME    => "omero-importer",
557#  TITLE   => "OMERO Importer",
558#  JAR     => "omero-importer-3.0-Beta3.jar",
559#  PACKAGE => "ome.formats",
560#  LICENSE => "GPL",
561#  URL     => "http://trac.openmicroscopy.org.uk/omero/wiki/MilestoneDownloads",
562#  NOTES   => <<ZZ,
563#used by OME I/O to connect to OMERO servers
564#ZZ
565#);
566
567#my %omeroModelPSQL = (
568#  NAME    => "omero-model-psql",
569#  TITLE   => "OMERO Model PostgreSQL",
570#  JAR     => "omero-model-psql-3.0-Beta3.jar",
571#  PACKAGE => "ome.model",
572#  LICENSE => "GPL",
573#  URL     => "http://trac.openmicroscopy.org.uk/omero/wiki/MilestoneDownloads",
574#  NOTES   => <<ZZ,
575#used by OME I/O to connect to OMERO servers
576#ZZ
577#);
578
579my %skinlf = (
580  NAME    => "skinlf",
581  TITLE   => "Skin Look and Feel",
582  JAR     => "skinlf.jar",
583  PACKAGE => "com.l2fprod",
584  LICENSE => "Custom (BSD-like)",
585  URL     => "http://skinlf.l2fprod.com/",
586  NOTES   => <<ZZ,
587not used (may be used in the future for flexible skinning)
588ZZ
589);
590
591my %slf4j = (
592  NAME    => "slf4j",
593  TITLE   => "Simple Logging Facade for Java",
594  JAR     => "slf4j-jdk14.jar",
595  PACKAGE => "org.slf4j",
596  LICENSE => "BSD",
597  URL     => "http://www.slf4j.org/",
598  NOTES   => <<ZZ,
599used by NetCDF library
600ZZ
601);
602
603my %testng = (
604  NAME    => "testng",
605  TITLE   => "TestNG",
606  JAR     => "testng-5.7-jdk14.jar",
607  PACKAGE => "org.testng",
608  LICENSE => "Apache",
609  URL     => "http://testng.org/",
610  NOTES   => <<ZZ,
611testing framework used for LOCI software automated test suite
612ZZ
613);
614
615my %velocity = (
616  NAME    => "velocity",
617  TITLE   => "Apache Velocity",
618  JAR     => "velocity-dep-1.5.jar",
619  PACKAGE => "org.apache.velocity",
620  LICENSE => "Apache",
621  URL     => "http://velocity.apache.org/",
622  NOTES   => <<ZZ,
623used to autogenerate the loci.formats.meta and loci.formats.ome Bio-Formats
624packages
625ZZ
626);
627
628my %visad = (
629  NAME    => "visad",
630  TITLE   => "VisAD",
631  JAR     => "visad-lite.jar",
632  PACKAGE => "visad",
633  LICENSE => "LGPL",
634  URL     => "http://www.ssec.wisc.edu/~billh/visad.html",
635  NOTES   => <<ZZ,
636stripped down VisAD library used by VisBio and SLIM Plotter for interactive
637visualization
638ZZ
639);
640
641my %xmlrpc = (
642  NAME    => "xmlrpc",
643  TITLE   => "Apache XML-RPC",
644  JAR     => "xmlrpc-1.2-b1.jar",
645  PACKAGE => "org.apache.xmlrpc",
646  LICENSE => "Apache",
647  URL     => "http://ws.apache.org/xmlrpc/",
648  NOTES   => <<ZZ,
649used by OME-Java library to communicate with OME servers
650ZZ
651);
652
653# -- DATA STRUCTURES --
654
655# List of active LOCI software components
656my @active = (
657  \%lociCommon,
658  \%omeXML,
659  \%bioFormats,
660  \%autogen,
661  \%bfIce,
662  \%lociPlugins,
663  \%omeIO,
664  \%omePlugins,
665  \%visbio,
666  \%slimPlotter,
667  \%flowCytometry,
668  \%lociChecks,
669  \%testSuite,
670);
671
672# List of legacy components (no longer supported)
673my @legacy = (
674  \%jvmlink,
675  \%multiLUT,
676  \%omeNotes,
677  \%omeEditor,
678);
679
680# List of external project forks
681my @forks = (
682  \%poi,
683  \%mdbtools,
684  \%jai,
685);
686
687# List of all LOCI software components
688my @components = (@active, @legacy, @forks);
689
690# List of external libraries
691my @libs = (
692  \%appleJavaExtensions,
693  \%antContrib,
694  \%checkstyle,
695  \%commonsHTTPClient,
696  \%commonsLogging,
697  \%findbugs,
698  \%forms,
699  \%ice,
700  \%ij,
701  \%jiio,
702  \%junit,
703  \%lma,
704  \%looks,
705  \%netcdf,
706  \%netcdfBufr,
707  \%netcdfGrib,
708  \%slf4j,
709  \%omeJava,
710  \%omeJavaDeprecated,
711  \%omeroClient,
712  \%omeroCommon,
713#  \%omeroImporter,
714#  \%omeroModelPSQL,
715  \%skinlf,
716  \%testng,
717  \%velocity,
718  \%visad,
719  \%xmlrpc,
720);
721
722# -- DATA COLLECTION --
723
724# verify that all JAR files exist -- if not, this file is probably out of date
725print STDERR "--== VERIFYING JAR FILE EXISTENCE ==--\n\n";
726foreach my $c (@components) {
727  my $jar = $$c{JAR};
728  unless (-e "artifacts/$jar") {
729    die "Component $jar does not exist";
730  }
731}
732foreach my $l (@libs) {
733  my $jar = $$l{JAR};
734  unless (-e "jar/$jar") {
735    die "Library $jar does not exist";
736  }
737}
738
739# scan for project dependencies
740print STDERR "--== SCANNING PROJECT DEPENDENCIES ==--\n\n";
741foreach my $c (@components) {
742  my $path = $$c{PATH};
743  print STDERR "[$$c{TITLE}]\n";
744  my @deps = ();
745  my @opt = ();
746  foreach my $c2 (@components) {
747    if ($c eq $c2) { next; }
748    my $name = $$c2{TITLE};
749    my $package = $$c2{PACKAGE};
750    if (checkDirect($package, $path)) {
751      push (@deps, $c2);
752      print STDERR "$name\n";
753    }
754    elsif (checkReflect($package, $path)) {
755      push (@opt, $c2);
756      print STDERR "$name (reflected)\n";
757    }
758  }
759  $$c{PROJ_DEPS} = \@deps;
760  $$c{PROJ_OPT} = \@opt;
761  print STDERR "\n";
762}
763
764print STDERR "--== SCANNING LIBRARY DEPENDENCIES ==--\n\n";
765foreach my $c (@components) {
766  my @deps = ();
767  my @opt = ();
768  my $path = $$c{PATH};
769  print STDERR "[$$c{TITLE}]\n";
770  foreach my $l (@libs) {
771    my $name = $$l{TITLE};
772    my $package = $$l{PACKAGE};
773    if (checkDirect($package, $path)) {
774      push (@deps, $l);
775      print STDERR "$name\n";
776    }
777    elsif (checkReflect($package, $path)) {
778      push (@opt, $l);
779      print STDERR "$name (reflected)\n";
780    }
781  }
782  $$c{LIB_DEPS} = \@deps;
783  $$c{LIB_OPT} = \@opt;
784  print STDERR "\n";
785}
786
787print STDERR "--== GATHERING COMPONENT CLASSPATHS ==--\n\n";
788foreach my $c (@components) {
789  my $path = $$c{PATH};
790
791  # read compile-time and runtime classpaths from properties file
792  open FILE, "$path/build.properties"
793    or die "$path/build.properties: $!";
794  my @lines = <FILE>;
795  close(FILE);
796  my $inCompile = 0;
797  my $inManifest = 0;
798  my @compile = ();
799  my @runtime = ();
800  foreach my $line (@lines) {
801    $line = rtrim($line);
802    if ($line =~ /^component.classpath/) {
803      # found the compile-time classpath variable
804      $inCompile = 1;
805    }
806    elsif ($line =~ /^component.runtime-cp/) {
807      # found the runtime classpath variable
808      $inManifest = 1;
809    }
810    if ($inCompile || $inManifest) {
811      my $end = $line !~ /\\$/;
812      # append the entry to the classpath list
813      $line =~ s/[ :\\]*$//;
814      $line =~ s/.*[ =]+//;
815      if ($line ne '(none)' && $line ne '') {
816        if ($inCompile) {
817          push(@compile, $line);
818        }
819        elsif ($inManifest) {
820          if ($line =~ /\${component.classpath}/) {
821            push(@runtime, @compile);
822          }
823          else {
824            push(@runtime, $line);
825          }
826        }
827      }
828      if ($end) {
829        # line does not end with a backslash; end of variable
830        $inCompile = $inManifest = 0;
831      }
832    }
833  }
834  $$c{COMPILE} = \@compile;
835  $$c{RUNTIME} = \@runtime;
836}
837
838print STDERR "--== GATHERING ECLIPSE DEPENDENCIES ==--\n\n";
839foreach my $c (@components) {
840  my $path = $$c{PATH};
841
842  # read Eclipse classpath from classpath file
843  open FILE, "$path/.classpath"
844    or die "$path/.classpath: $!";
845  my @lines = <FILE>;
846  close(FILE);
847  my @eclipse = ();
848  foreach my $line (@lines) {
849    $line = rtrim($line);
850    if ($line =~ /<classpathentry /) {
851      # found a compile-time classpath entry
852      $line =~ s/.* path="//;
853      $line =~ s/"\/>$//;
854      push(@eclipse, $line);
855    }
856  }
857  @eclipse = sort @eclipse;
858  $$c{ECLIPSE} = \@eclipse;
859}
860
861print STDERR "--== VERIFYING CLASSPATH MATCHES ==--\n\n";
862foreach my $c (@components) {
863  my @projDeps = @{$$c{PROJ_DEPS}};
864  my @libDeps = @{$$c{LIB_DEPS}};
865  my @projOpt = @{$$c{PROJ_OPT}};
866  my @libOpt = @{$$c{LIB_OPT}};
867  my $name = $$c{TITLE};
868
869  # verify compile-time classpath
870  my @deps = ();
871  foreach my $dep (@projDeps) {
872    push(@deps, "\${artifact.dir}/$$dep{JAR}");
873  }
874  foreach my $dep (@libDeps) {
875    push(@deps, "\${lib.dir}/$$dep{JAR}");
876  }
877  my @cp = @{$$c{COMPILE}};
878  my $compileError = 0;
879  if (@deps != @cp) {
880    print STDERR "Dependency mismatch for $name compile time classpath:\n";
881    $compileError = 1;
882  }
883  else {
884    for (my $i = 0; $i < @cp; $i++) {
885      my $depJar = $deps[$i];
886      my $cpJar = $cp[$i];
887      if ($cpJar ne $depJar) {
888        print STDERR "Dependency mismatch for $name compile time classpath:\n";
889        print STDERR "  #$i: $depJar != $cpJar\n";
890        $compileError = 1;
891        last;
892      }
893    }
894  }
895  if ($compileError) {
896    print STDERR "  project deps        =";
897    foreach my $q (@projDeps) {
898      print STDERR " $$q{NAME}";
899    }
900    print STDERR "\n  library deps        =";
901    foreach my $q (@libDeps) {
902      print STDERR " $$q{NAME}";
903    }
904    print STDERR "\n  component.classpath = @cp\n";
905    print STDERR "\n";
906  }
907
908  # verify Eclipse classpath
909  @deps = ();
910  foreach my $dep (@projDeps) {
911    push(@deps, "/$$dep{NAME}");
912  }
913  if (@libDeps > 0) {
914    push(@deps, "/External libraries");
915  }
916  push(@deps, "build/classes");
917  push(@deps, "org.eclipse.jdt.launching.JRE_CONTAINER");
918  push(@deps, "src");
919  @deps = sort @deps;
920  @cp = @{$$c{ECLIPSE}};
921  my $eclipseError = 0;
922  if (@deps != @cp) {
923    print STDERR "Dependency mismatch for $name Eclipse classpath:\n";
924    $eclipseError = 1;
925  }
926  else {
927    for (my $i = 0; $i < @cp; $i++) {
928      my $depEntry = $deps[$i];
929      my $cpEntry = $cp[$i];
930      if ($cpEntry ne $depEntry) {
931        print STDERR "Dependency mismatch for $name Eclipse classpath:\n";
932        print STDERR "  #$i: $depEntry != $cpEntry\n";
933        $eclipseError = 1;
934        last;
935      }
936    }
937  }
938  if ($eclipseError) {
939    print STDERR "  project deps      =";
940    foreach my $q (@projDeps) {
941      print STDERR " $$q{NAME}";
942    }
943    print STDERR "\n  library deps      =";
944    foreach my $q (@libDeps) {
945      print STDERR " $$q{NAME}";
946    }
947    print STDERR "\n  Eclipse classpath = @cp\n";
948    print STDERR "\n";
949  }
950
951  # verify runtime classpath
952  @deps = ();
953  foreach my $dep (@projDeps) {
954    push(@deps, "\${artifact.dir}/$$dep{JAR}");
955  }
956  foreach my $dep (@libDeps) {
957    push(@deps, "\${lib.dir}/$$dep{JAR}");
958  }
959  foreach my $dep (@projOpt) {
960    push(@deps, "\${artifact.dir}/$$dep{JAR}");
961  }
962  foreach my $dep (@libOpt) {
963    push(@deps, "\${lib.dir}/$$dep{JAR}");
964  }
965  @cp = @{$$c{RUNTIME}};
966  my $runtimeError = 0;
967  if (@deps != @cp) {
968    print STDERR "Dependency mismatch for $name runtime classpath:\n";
969    $runtimeError = 1;
970  }
971  else {
972    for (my $i = 0; $i < @cp; $i++) {
973      my $depJar = $deps[$i];
974      my $cpJar = $cp[$i];
975      if ($cpJar ne $depJar) {
976        print STDERR "Dependency mismatch for $name runtime classpath:\n";
977        print STDERR "  #$i: $depJar != $cpJar\n";
978        $runtimeError = 1;
979        last;
980      }
981    }
982  }
983  if ($runtimeError) {
984    print STDERR "  project deps         =";
985    foreach my $q (@projDeps) {
986      print STDERR " $$q{NAME}";
987    }
988    print STDERR "\n  reflected projects   =";
989    foreach my $q (@projOpt) {
990      print STDERR " $$q{NAME}";
991    }
992    print STDERR "\n  library deps         =";
993    foreach my $q (@libDeps) {
994      print STDERR " $$q{NAME}";
995    }
996    print STDERR "\n  reflected libraries  =";
997    foreach my $q (@libOpt) {
998      print STDERR " $$q{NAME}";
999    }
1000    print STDERR "\n  component.runtime-cp = @cp\n";
1001    print STDERR "\n";
1002  }
1003}
1004
1005# -- FORMATTED DATA OUTPUT --
1006
1007print STDERR "--== DUMPING RESULTS TO STDOUT ==--\n\n";
1008
1009my $div = <<ZZ;
1010===============================================================================
1011ZZ
1012
1013# components - active
1014print "$div";
1015print "This build file handles the following components.\n";
1016print "For more information on a component, see the\n";
1017print "build.properties file in that component's subtree.\n";
1018print "Run ./scan-deps.pl to programmatically generate this list.\n\n";
1019foreach my $c (@active) {
1020  print "$$c{TITLE}\n";
1021  smartSplit("    ", " ", split(/[ \n]/, $$c{DESC}));
1022  print "    -=-\n";
1023  print "    JAR file:      $$c{JAR}\n";
1024  print "    Path:          $$c{PATH}\n";
1025
1026  my $lead = "                   ";
1027
1028  my @projDeps = @{$$c{PROJ_DEPS}};
1029  my @prettyDeps = ();
1030  foreach my $q (@projDeps) {
1031    push(@prettyDeps, $$q{TITLE});
1032  }
1033  smartSplit("    Project deps:  ", ", ", @prettyDeps);
1034
1035  my @libDeps = @{$$c{LIB_DEPS}};
1036  @prettyDeps = ();
1037  foreach my $q (@libDeps) {
1038    push(@prettyDeps, $$q{TITLE});
1039  }
1040  smartSplit("    Library deps:  ", ", ", @prettyDeps);
1041
1042  my @projOpt = @{$$c{PROJ_OPT}};
1043  my @prettyOpt = ();
1044  foreach my $q (@projOpt) {
1045    push(@prettyOpt, $$q{TITLE});
1046  }
1047  my @libOpt = @{$$c{LIB_OPT}};
1048  foreach my $q (@libOpt) {
1049    push(@prettyOpt, $$q{TITLE});
1050  }
1051  smartSplit("    Optional:      ", ", ", @prettyOpt);
1052
1053  print "    License:       $$c{LICENSE}\n";
1054  print "\n";
1055}
1056
1057# components - legacy
1058print "$div";
1059print "The following components are considered \"legacy\" but still " .
1060      "available:\n\n";
1061foreach my $c (@legacy) {
1062  print "$$c{TITLE}\n";
1063  smartSplit("    ", " ", split(/[ \n]/, $$c{DESC}));
1064  print "    -=-\n";
1065  print "    JAR file:      $$c{JAR}\n";
1066  print "    Path:          $$c{PATH}\n";
1067
1068  my $lead = "                   ";
1069
1070  my @deps = @{$$c{PROJ_DEPS}};
1071  my @prettyDeps = ();
1072  foreach my $q (@deps) {
1073    push(@prettyDeps, $$q{TITLE});
1074  }
1075  smartSplit("    Project deps:  ", ", ", @prettyDeps);
1076
1077  my @opt = @{$$c{PROJ_OPT}};
1078  my @prettyOpt = ();
1079  foreach my $q (@opt) {
1080    push(@prettyOpt, $$q{TITLE});
1081  }
1082  smartSplit("    Optional:      ", ", ", @prettyOpt);
1083
1084  print "    License:       $$c{LICENSE}\n";
1085  print "\n";
1086}
1087
1088# components - forks
1089print "$div";
1090print "The following components are forks of third party projects:\n\n";
1091foreach my $c (@forks) {
1092  print "$$c{TITLE}\n";
1093  smartSplit("    ", " ", split(/[ \n]/, $$c{DESC}));
1094  print "    -=-\n";
1095  print "    JAR file:      $$c{JAR}\n";
1096  print "    Path:          $$c{PATH}\n";
1097
1098  my @deps = @{$$c{PROJ_DEPS}};
1099  my @prettyDeps = ();
1100  foreach my $q (@deps) {
1101    push(@prettyDeps, $$q{TITLE});
1102  }
1103  smartSplit("    Project deps:  ", ", ", @prettyDeps);
1104
1105  my @opt = @{$$c{PROJ_OPT}};
1106  my @prettyOpt = ();
1107  foreach my $q (@opt) {
1108    push(@prettyOpt, $$q{TITLE});
1109  }
1110  smartSplit("    Optional:      ", ", ", @prettyOpt);
1111
1112  print "    License:       $$c{LICENSE}\n";
1113  print "    Project URL:   $$c{URL}\n";
1114  smartSplit("    Notes:         ", " ", split(/[ \n]/, $$c{NOTES}));
1115  print "\n";
1116}
1117
1118# libraries
1119print "$div";
1120print "The following external dependencies (in the jar folder) may be " .
1121      "required:\n";
1122foreach my $l (@libs) {
1123  print "$$l{TITLE}\n";
1124  print "    JAR file:  $$l{JAR}\n";
1125  print "    URL:       $$l{URL}\n";
1126  smartSplit("    Notes:     ", " ", split(/[ \n]/, $$l{NOTES}));
1127  print "    License:   $$l{LICENSE}\n";
1128  print "\n";
1129}
1130
1131# -- SUBROUTINES --
1132
1133sub checkDirect {
1134  my ($package, $path) = @_;
1135  return `find $path/src -name '*.java' | xargs grep -l "^import $package\\."`;
1136}
1137
1138sub checkReflect {
1139  my ($package, $path) = @_;
1140  return `find $path/src -name '*.java' | xargs grep -l "import $package\\."`;
1141}
1142
1143sub smartSplit {
1144  my ($front, $div, @list) = @_;
1145  my $lead = $front;
1146  $lead =~ s/./ /g;
1147  my $tDiv = rtrim($div);
1148  my $end = 79;
1149  my $len = @list;
1150  my $line = $front;
1151  if ($len == 0) {
1152    $line .= "(none)";
1153  }
1154  for (my $i = 0; $i < $len; $i++) {
1155    my $item = $list[$i];
1156    if ($item eq '') { next; }
1157    if ($i == 0) {
1158      # first item
1159      $line .= $item;
1160    }
1161    else {
1162      my $q = $line . $div . $item;
1163      my $max = $i == $len - 1 ? $end : $end - length($tDiv);
1164      if (length($q) > $max) {
1165        # line wrap
1166        $line .= $tDiv;
1167        print "$line\n";
1168        $line = $lead . $item;
1169      }
1170      else {
1171        # append
1172        $line = $q;
1173      }
1174    }
1175  }
1176  print "$line\n";
1177}
1178
1179sub rtrim {
1180  my $string = shift;
1181  $string =~ s/\s+$//;
1182  return $string;
1183}
Note: See TracBrowser for help on using the repository browser.