[ https://issues.apache.org/jira/browse/MNG-7820?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17763676#comment-17763676 ]
ASF GitHub Bot commented on MNG-7820: ------------------------------------- gnodet commented on code in PR #1208: URL: https://github.com/apache/maven/pull/1208#discussion_r1321443872 ########## maven-model-builder/src/main/java/org/apache/maven/utils/Os.java: ########## @@ -0,0 +1,213 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.maven.utils; + +import java.util.Locale; +import java.util.stream.Stream; + +/** + * OS support + */ +public class Os { + + /** + * The OS Name. + */ + public static final String OS_NAME = System.getProperty("os.name").toLowerCase(Locale.ENGLISH); + + /** + * The OA architecture. + */ + public static final String OS_ARCH = System.getProperty("os.arch").toLowerCase(Locale.ENGLISH); + + /** + * The OS version. + */ + public static final String OS_VERSION = System.getProperty("os.version").toLowerCase(Locale.ENGLISH); + + /** + * OS Family + */ + public static final String OS_FAMILY; + + public static final boolean IS_WINDOWS; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_WINDOWS = "windows"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_WIN9X = "win9x"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_NT = "winnt"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_OS2 = "os/2"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_NETWARE = "netware"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_DOS = "dos"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_MAC = "mac"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_TANDEM = "tandem"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_UNIX = "unix"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_OPENVMS = "openvms"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_ZOS = "z/os"; + + /** + * OS family that can be tested for. {@value} + */ + public static final String FAMILY_OS400 = "os/400"; + + /** + * OpenJDK is reported to call MacOS X "Darwin" + * + * @see <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=44889">bugzilla issue</a> + * @see <a href="https://issues.apache.org/jira/browse/HADOOP-3318">HADOOP-3318</a> + */ + private static final String DARWIN = "darwin"; + + /** + * The path separator. + */ + private static final String PATH_SEP = System.getProperty("path.separator"); + + static { + OS_FAMILY = getOsFamily(); + IS_WINDOWS = isWindowsFamily(); + } + + private Os() {} + + /** + * Determines if the OS on which Maven is executing matches the + * given OS family. + * + * @param family the family to check for + * @return true if the OS matches + * + */ + public static boolean isFamily(String family) { Review Comment: Yes, I think you missed the fact that it's part of the public Maven 3.x API because it's used by [OS profile activation](https://github.com/apache/maven/blob/3ce0d951c199c9a0e9375f23587dcd7b1b657026/maven-model-builder/src/main/java/org/apache/maven/model/profile/activation/OperatingSystemProfileActivator.java#L140) and the families are documented on the [Maven site](https://maven.apache.org/enforcer/enforcer-rules/requireOS.html), so I don't think it makes much sense making those constants private as they are publicly documented, even if technically, they could be made private. > Remove dependency on plexus-utils > --------------------------------- > > Key: MNG-7820 > URL: https://issues.apache.org/jira/browse/MNG-7820 > Project: Maven > Issue Type: Task > Reporter: Guillaume Nodet > Priority: Major > Fix For: 4.0.0-alpha-8 > > -- This message was sent by Atlassian Jira (v8.20.10#820010)