org.apache.tools.ant.taskdefs.condition.Os.isFamily()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(216)

本文整理了Java中org.apache.tools.ant.taskdefs.condition.Os.isFamily()方法的一些代码示例,展示了Os.isFamily()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Os.isFamily()方法的具体详情如下:
包路径:org.apache.tools.ant.taskdefs.condition.Os
类名称:Os
方法名:isFamily

Os.isFamily介绍

[英]Determines if the OS on which Ant is executing matches the given OS family.
[中]确定Ant正在执行的操作系统是否与给定的操作系统系列匹配。

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * Checks whether <code>exitValue</code> signals a failure on the current
 * system (OS specific).
 *
 * <p><b>Note</b> that this method relies on the conventions of
 * the OS, it will return false results if the application you are
 * running doesn't follow these conventions. One notable
 * exception is the Java VM provided by HP for OpenVMS - it will
 * return 0 if successful (like on any other platform), but this
 * signals a failure on OpenVMS. So if you execute a new Java VM
 * on OpenVMS, you cannot trust this method.</p>
 *
 * @param exitValue the exit value (return code) to be checked.
 * @return <code>true</code> if <code>exitValue</code> signals a failure.
 */
public static boolean isFailure(int exitValue) {
  // on openvms even exit value signals failure;
  // for other platforms nonzero exit value signals failure
  return Os.isFamily("openvms")
    ? (exitValue % 2 == 0) : (exitValue != 0);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * ByteArrayOutputStream#toString doesn't seem to work reliably on
 * OS/390, at least not the way we use it in the execution
 * context.
 *
 * @param bos the output stream that one wants to read.
 * @return the output stream as a string, read with
 * special encodings in the case of z/os and os/400.
 * @since Ant 1.5
 */
public static String toString(ByteArrayOutputStream bos) {
  if (Os.isFamily("z/os")) {
    try {
      return bos.toString("Cp1047");
    } catch (UnsupportedEncodingException e) {
      // noop default encoding used
    }
  } else if (Os.isFamily("os/400")) {
    try {
      return bos.toString("Cp500");
    } catch (UnsupportedEncodingException e) {
      // noop default encoding used
    }
  }
  return bos.toString();
}

代码示例来源:origin: org.apache.ant/ant

if (Os.isFamily("os/2")) {
if (Os.isFamily("windows")) {
  if (Os.isFamily("win9x")) {
if (Os.isFamily("z/os") || Os.isFamily("unix")) {
if (Os.isFamily("netware") || Os.isFamily("os/400")) {
if (Os.isFamily("openvms")) {
  return new String[] {"show", "logical"};

代码示例来源:origin: org.apache.ant/ant

/**
 * Creates a new execute object.
 *
 * @param streamHandler the stream handler used to handle the input and
 *        output streams of the subprocess.
 * @param watchdog a watchdog for the subprocess or <code>null</code>
 *        to disable a timeout for the subprocess.
 */
public Execute(ExecuteStreamHandler streamHandler,
        ExecuteWatchdog watchdog) {
  setStreamHandler(streamHandler);
  this.watchdog = watchdog;
  // By default, use the shell launcher for VMS
  //
  if (Os.isFamily("openvms")) {
    useVMLauncher = false;
  }
}

代码示例来源:origin: typ0520/fastdex

public void mergeJavaDirectoryResultSet(String path,JavaDirectoryDiffResultSet javaDirectoryResultSet) {
  List<String> addOrModifiedClassRelativePathList = addOrModifiedClassesMap.get(javaDirectoryResultSet.projectPath);
  if (addOrModifiedClassRelativePathList == null) {
    addOrModifiedClassRelativePathList = new LinkedList<>();
    addOrModifiedClassesMap.put(javaDirectoryResultSet.projectPath,addOrModifiedClassRelativePathList);
  }
  Set<PathInfo> pathInfoSet = addOrModifiedPathInfosMap.get(javaDirectoryResultSet.projectPath);
  if (pathInfoSet == null) {
    pathInfoSet = new HashSet<>();
    addOrModifiedPathInfosMap.put(javaDirectoryResultSet.projectPath,pathInfoSet);
  }
  for (JavaFileDiffInfo javaFileDiffInfo : javaDirectoryResultSet.changedDiffInfos) {
    switch (javaFileDiffInfo.status) {
      case ADDED:
      case MODIFIED:
        PathInfo pathInfo = new PathInfo(path,new File(path,javaFileDiffInfo.uniqueKey),javaFileDiffInfo.uniqueKey);
        addOrModifiedPathInfos.add(pathInfo);
        pathInfoSet.add(pathInfo);
        String classRelativePath = javaFileDiffInfo.getClassRelativePath();
        addOrModifiedClassRelativePathList.add(classRelativePath + ".class");
        addOrModifiedClassRelativePathList.add(classRelativePath + "$*.class");
        classRelativePath = classRelativePath.replaceAll(Os.isFamily(Os.FAMILY_WINDOWS) ? "\\\\" : File.separator,"\\.");
        addOrModifiedClasses.add(classRelativePath);
        break;
    }
  }
  this.changedJavaFileDiffInfos.addAll(javaDirectoryResultSet.changedDiffInfos);
}

代码示例来源:origin: org.apache.ant/ant

if (Os.isFamily("openvms")) {
  return env;

代码示例来源:origin: org.apache.ant/ant

/**
 * Set the command line for the exe.
 * On VMS, hands off to {@link #setupCommandLineForVMS(Execute, String[])}.
 * @param exe executable.
 * @param command command to execute.
 */
private void setupCommandLine(Execute exe, String[] command) {
  //On VMS platform, we need to create a special java options file
  //containing the arguments and classpath for the java command.
  //The special file is supported by the "-V" switch on the VMS JVM.
  if (Os.isFamily("openvms")) {
    setupCommandLineForVMS(exe, command);
  } else {
    exe.setCommandline(command);
  }
}

代码示例来源:origin: org.apache.ant/ant

break;
case FAMILY_DOS:
  isFamily = PATH_SEP.equals(";") && !isFamily(FAMILY_NETWARE);
  break;
case FAMILY_MAC:
case FAMILY_UNIX:
  isFamily = PATH_SEP.equals(":")
      && !isFamily(FAMILY_VMS)
      && (!isFamily(FAMILY_MAC) || OS_NAME.endsWith("x")
      || OS_NAME.contains(DARWIN));
  break;

代码示例来源:origin: org.apache.ant/ant

if (osFamily != null && !Os.isFamily(osFamily)) {
  return false;

代码示例来源:origin: org.apache.ant/ant

/**
   * Automatically approve Unix OS's.
   * @return true if a valid OS, for unix this is always true, otherwise
   *              use the superclasses' test (user set).
   */
  @Override
  protected boolean isValidOs() {
    return getOs() == null && getOsFamily() == null
      ? Os.isFamily(Os.FAMILY_UNIX) : super.isValidOs();
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
   * Check if the os is valid.
   * Always include unix.
   * @return true if the os is valid.
   */
  @Override
  protected boolean isValidOs() {
    return getOs() == null && getOsFamily() == null
      ? Os.isFamily(Os.FAMILY_UNIX) : super.isValidOs();
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Check if the os is valid.
 * Default is to allow windows
 * @return true if the os is valid.
 */
@Override
protected boolean isValidOs() {
  return getOs() == null && getOsFamily() == null
    ? Os.isFamily(Os.FAMILY_WINDOWS) : super.isValidOs();
}

代码示例来源:origin: org.apache.ant/ant

File f = new File(pElement,
         "rpmbuild"
         + (Os.isFamily("dos") ? ".exe" : ""));
if (f.canRead()) {
  return f.getAbsolutePath();

代码示例来源:origin: org.apache.ant/ant

return procEnvironment;
if (!Os.isFamily("openvms")) {
  try {
    procEnvironment = System.getenv();
    new BufferedReader(new StringReader(toString(out)));
  if (Os.isFamily("openvms")) {
    procEnvironment = getVMSLogicals(in);
    return procEnvironment;

代码示例来源:origin: org.apache.ant/ant

/**
 * Get the attribute type-value
 *
 * @param cmd containing the command line string with or
 *        without the type-value
 */
private void getTypeValueCommand(Commandline cmd) {
  String typevl = getTypeValue();
  if (typevl != null) {
    if (Os.isFamily("windows")) {
      typevl = "\\\"" + typevl + "\\\""; // Windows quoting of the value
    } else {
      typevl = "\"" + typevl + "\"";
    }
    cmd.createArgument().setValue(typevl);
  }
}

代码示例来源:origin: org.apache.ant/ant

getEnvironment(), workingDirectory,
                useVMLauncher);
if (Os.isFamily("windows")) {
  try {
    Thread.sleep(ONE_SECOND);

代码示例来源:origin: org.apache.ant/ant

Project.MSG_INFO,
                    Project.MSG_WARN));
if (Os.isFamily("openvms")) {

代码示例来源:origin: org.apache.ant/ant

if (!Os.isFamily("windows")) {
  log("Using listcab/libcabinet", Project.MSG_VERBOSE);

代码示例来源:origin: org.apache.ant/ant

/**
 * Performs a compile using the Javac externally.
 * @return true if the compilation succeeded
 * @throws BuildException on error
 */
@Override
public boolean execute() throws BuildException {
  attributes.log("Using external javac compiler", Project.MSG_VERBOSE);
  Commandline cmd = new Commandline();
  cmd.setExecutable(getJavac().getJavacExecutable());
  if (!assumeJava11() && !assumeJava12()) {
    setupModernJavacCommandlineSwitches(cmd);
  } else {
    setupJavacCommandlineSwitches(cmd, true);
  }
  int firstFileName = assumeJava11() ? -1 : cmd.size();
  logAndAddFilesToCompile(cmd);
  //On VMS platform, we need to create a special java options file
  //containing the arguments and classpath for the javac command.
  //The special file is supported by the "-V" switch on the VMS JVM.
  if (Os.isFamily("openvms")) {
    return execOnVMS(cmd, firstFileName);
  }
  return
      executeExternalCompile(cmd.getCommandline(), firstFileName,
          true)
      == 0;
}

代码示例来源:origin: org.apache.ant/ant

: new ExecuteWatchdog(timeout));
exe.setAntRun(pc.getProject());
if (Os.isFamily("openvms")) {
  setupCommandLineForVMS(exe, cmdl.getCommandline());
} else {

相关文章

Os类方法