Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-1457

yang-maven-plugin execution is not reliably following the configuration

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed
    • Medium
    • Resolution: Unresolved
    • 10.0.0
    • 14.0.0, 11.0.6, 13.0.2
    • maven plugin
    • None

    Description

      Case #1

      Actual: if multiple fileGenerator sections are using same identifier then only one will be processed, the others will be ignored. the issue is caused by configuration data transformation  from list to map, resulting part of configuration being lost

      example (addresses org.opendaylight.yangtools.yang2sources.plugin.it.YangToSourcesPluginTestIT#testAdditionalConfiguration):

      <plugin>
          <groupId>org.opendaylight.yangtools</groupId>
          <artifactId>yang-maven-plugin</artifactId>
          <version>${project.version}</version>
          <executions>
              <execution>
                  <goals>
                      <goal>generate-sources</goal>
                  </goals>
                  <configuration>
                      <yangFilesRootDir>../files</yangFilesRootDir>
                      <inspectDependencies>false</inspectDependencies>
                      <fileGenerators>
                          <fileGenerator>
                              <identifier>
                                  org.opendaylight.yangtools.plugin.generator.api.TestFileGenerator
                              </identifier>
                              <configuration>
                                  <nm1>abcd=a.b.c.d</nm1>
                                  <nm2>abcd2=a.b.c.d.2</nm2>
                              </configuration>
                          </fileGenerator>
                          <fileGenerator>
                              <identifier>
                                  org.opendaylight.yangtools.plugin.generator.api.TestFileGenerator
                              </identifier>
                              <configuration>
                                  <c1>config</c1>
                              </configuration>
                          </fileGenerator>
                      </fileGenerators>
                  </configuration>
              </execution>
          </executions>
       ...
      </plugin> 

      Expected: it should be possible to execute same file generator

      Case #2

      Actual: The file generation is executed for every FileGeneratorFactory implementation found in the classpath even if the FileGenerator identifier is absent in the configuration.
      The issue is caused by incorrect logic within
      org.opendaylight.yangtools.yang2sources.plugin.YangToSourcesProcessor#instantiateGenerators,
      where the main condition is factory existence, fileGenerator configuration for associated identifier is optional

      Expected: file generation should be executed only for explicitly defined generators.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              Unassigned Unassigned
              rkashapov Ruslan Kashapov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: