cstamas commented on code in PR #2254: URL: https://github.com/apache/maven/pull/2254#discussion_r2041127261
########## impl/maven-cli/src/main/java/org/apache/maven/cling/invoker/cisupport/CIDetectorHelper.java: ########## @@ -0,0 +1,51 @@ +/* + * 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.cling.invoker.cisupport; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.ServiceLoader; + +import org.apache.maven.api.cli.cisupport.CIInfo; + +/** + * CI detector helper: it uses service discovery to discover {@link CIDetector}s. If resulting list has more than + * one element, it will remove the {@link GenericCIDetector} result, assuming a more specific one is also present. + */ +public final class CIDetectorHelper { + private CIDetectorHelper() {} + + public static List<CIInfo> detectCI() { + List<CIDetector> detectors = ServiceLoader.load(CIDetector.class).stream() + .map(ServiceLoader.Provider::get) + .toList(); Review Comment: Fixed ########## api/maven-api-cli/src/main/java/org/apache/maven/api/cli/cisupport/CIInfo.java: ########## @@ -0,0 +1,47 @@ +/* + * 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.api.cli.cisupport; + +import org.apache.maven.api.annotations.Nonnull; + +/** + * CI support: this class contains gathered information and more from CI that Maven process runs on. + */ +public interface CIInfo { + /** + * Short distinct name of CI system: "GH", "Jenkins", etc. + */ + @Nonnull + String name(); + + /** + * May return a message that will be logged by Maven explaining why it was detected (and possibly more). + */ + @Nonnull + default String message() { + return ""; + } + + /** + * Some CI systems may allow running jobs in "debug" (or some equivalent) mode. + */ + default boolean isDebug() { Review Comment: Fixed ########## impl/maven-cli/src/main/resources/META-INF/services/org.apache.maven.cling.invoker.cisupport.CIDetector: ########## @@ -0,0 +1,6 @@ +org.apache.maven.cling.invoker.cisupport.CircleCIDetector +org.apache.maven.cling.invoker.cisupport.GenericCIDetector +org.apache.maven.cling.invoker.cisupport.GithubCIDetector +org.apache.maven.cling.invoker.cisupport.JenkinsCIDetector +org.apache.maven.cling.invoker.cisupport.TeamcityCIDetector +org.apache.maven.cling.invoker.cisupport.TravisCIDetector Review Comment: Fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org