code: public static void addVersionFiles(final VersionInfo versionInfo, final LinkType linkType, final File outputFile,
        final boolean isDebug, final File objDir, final TargetMatcher matcher) throws IOException {
      if (versionInfo == null) {
        throw new NullPointerException("versionInfo");
      }
      if (linkType == null) {
        throw new NullPointerException("linkType");
      }
      if (outputFile == null) {
        throw new NullPointerException("outputFile");
      }
      if (objDir == null) {
        throw new NullPointerException("objDir");
      }
  
      /**
       * Fully resolve version info
       */
      final VersionInfo mergedInfo = versionInfo.merge();
  
      final File versionResource = new File(objDir, "versioninfo.rc");
  
      boolean notChanged = false;
      //
      // if the resource exists
      //
      if (versionResource.exists()) {
        final ByteArrayOutputStream memStream = new ByteArrayOutputStream();
        final Writer writer = new BufferedWriter(new OutputStreamWriter(memStream));
        writeResource(writer, mergedInfo, outputFile, isDebug, linkType);
        writer.close();
        final ByteArrayInputStream proposedResource = new ByteArrayInputStream(memStream.toByteArray());
  
        final InputStream existingResource = new FileInputStream(versionResource);
        //
        //
        //
        notChanged = hasSameContent(proposedResource, existingResource);
        existingResource.close();
      }
  
      //
      // if the resource file did not exist or will be changed then
      // write the file
      //
      if (!notChanged) {
        final Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(versionResource)));
        writeResource(writer, mergedInfo, outputFile, isDebug, linkType);
        writer.close();
      }
      if (matcher != null) {
        matcher.visit(new File(versionResource.getParent()), versionResource.getName());
      }
  
    }
docs: Adds source or object files to the bidded fileset to
  support version information.
  
  @param versionInfo
  version information
  @param linkType
  link type
  @param isDebug
  true if debug build
  @param outputFile
  name of generated executable
  @param objDir
  directory for generated files
  @param matcher
  bidded fileset
  @throws IOException
  if unable to write version resource