Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8055661

Cleanup usage and modification of modules.xml

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • 9
    • 9
    • infrastructure

      From Magnus on code restructure review:

      *** Issues regarding modules.xml ***

      The new modules.xml and associated Java tools and make files seems rather confusing to me. I understand some of the mysteries here are due the the fact that the file has moved around during development. Nevertheless, such historical relics should be removed when the code is ready to be pushed to mainline. More concretely:

      * ModulesXml.gmk referes to make/data/checkdeps/modules.xml. This file does not exist. I believe this should be the $(TOPDIR)/modules.xml.

      * GenererateModules.Xml says: "This tool is used to generate com/sun/tools/jdeps/resources/modules.xml". This is an incorrect claim. In fact, the output file of the tool is specified by the user. The way it is used by the build tool currently, the output file is placed in $(JDK_OUTPUTDIR)/modules/jdk.dev/com/sun/tools/jdeps/resources/modules.xml, but that is decided by the make file and not the Java utility.

      * In fact, what happens is this:
      ** $(TOPDIR)/modules.xml is copied to $(JDK_OUTPUTDIR)/btclasses/build/tools/module/modules.xml
      ** Then the GenerateModulesXml tool is executed.
      ** The tool will open and read this file using GenerateModulesXml.class.getResourceAsStream("modules.xml").
      ** The tool will generate output to a new file, specified to be $(JDK_OUTPUTDIR)/modules/jdk.dev/com/sun/tools/jdeps/resources/modules.xml.
      ** Afterwards, the separate tool $(JDK_OUTPUTDIR)/bin/jdeps is executed, which will pick up the $(JDK_OUTPUTDIR)/modules/jdk.dev/com/sun/tools/jdeps/resources/modules.xml, presumably using getResourceAsStream. (I have not verified this.)

      I have several objections to this.

      * First, we are actually dealing with two different files, but both are named modules.xml. I believe one of them is an annotated version of the other, but I have not chec,ed. Nevertheless, this is just an unneccessary source of confusion. One of them should change name, e.g. annotated-modules.xml or jdeps-modules.xml or whatever.

      * Second, it is not documented anywhere that GenerateModulexXml requires an modules.xml as input.

      * Third, and this links into the bullet above, this dependency is not explicit but hidden away with unnessary shuffling and hard-to-understand shuffling of files as result. A better solution, I believe, is two modify GenerateModulesXml to require a path to the input modules.xml as an argument, in addition to the output file. That way, the dependency will be obvious, and we can just point to $(TOPDIR)/modules.xml instead of copying it around.

      * And fourth, all old comments etc refering to old placements of the files should be corrected.

      * Finally, I'm also not entirely happy with the placement of modules.xml in the root directory. Erik has told me that the intention is that this file will ultimately be created dynamically at build time, and when that happens, it will just be a build by-product which can be placed elsewhere. If this is indeed the case, I can live with some temporary extra cluttering of the top-level directory.

            Unassigned Unassigned
            erikj Erik Joelsson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: