private Map<String, String> loadPredefinedProperties(final Map<String, String> properties, final Map<String, String> externalProps) {
    final Map<String, String> destination = new HashMap<>();
    if (properties != null) {
      properties.forEach((name, value) -> appendProperty(destination, name, value));
    }
    if (externalProps != null) {
      externalProps.forEach((name, value) -> appendProperty(destination, name, value));
    }

    String basedir = getProjectBasedirPath();
    if (basedir == null) {
      basedir = ".";
    }
    if (!FileUtil.isAbsolute(basedir)) {
      final String containingFileDir = getContainingFileDir();
      if (containingFileDir != null) {
        try {
          basedir = new File(containingFileDir, basedir).getCanonicalPath();
        }
        catch (IOException ignored) {
        }
      }
    }
    appendProperty(destination, "basedir", FileUtil.toSystemIndependentName(basedir));

    final AntInstallation installation = getAntInstallation();
    final String homeDir = installation.getHomeDir();
    if (homeDir != null) {
      appendProperty(destination, "ant.home", FileUtil.toSystemIndependentName(homeDir));
    }
    appendProperty(destination, "ant.version", installation.getVersion());

    final String projectName = getName().getRawText();
    appendProperty(destination, "ant.project.name", (projectName == null) ? "" : projectName);

    final Sdk jdkToRunWith = getTargetJdk();
    final String version = jdkToRunWith != null? jdkToRunWith.getVersionString() : null;
    appendProperty(destination, "ant.java.version", version != null? version : SystemInfo.JAVA_VERSION);

    final VirtualFile containingFile = getXmlTag().getContainingFile().getOriginalFile().getVirtualFile();
    if (containingFile != null) {
      final String antFilePath = containingFile.getPath();
      appendProperty(destination, "ant.file", antFilePath);
      if (projectName != null) {
        appendProperty(destination, "ant.file." + projectName, antFilePath);
        appendProperty(destination, "ant.file.type." + projectName, "file");
      }
    }
    return destination;
  }
private Map<String, String> loadPredefinedProperties(final Map<String, String> properties, final Map<String, String> externalProps)