de.smartics.maven.plugin.buildmetadata.common.ScmControl Maven / Gradle / Ivy
/*
* Copyright 2006-2019 smartics, Kronseder & Reiner GmbH
*
* Licensed 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 de.smartics.maven.plugin.buildmetadata.common;
/**
* Information to control the gathering of SCM meta data.
*/
public final class ScmControl {
// ********************************* Fields *********************************
// --- constants ------------------------------------------------------------
// --- members --------------------------------------------------------------
/**
* Flag to fail if local modifications have been found. The value is
* true
if the build should fail if there are modifications (any
* files not in-sync with the remote repository), false
if the
* fact is only to be noted in the build properties.
*/
private final boolean failOnLocalModifications;
/**
* The flag to ignore files and directories starting with a dot for checking
* modified files. This implicates that any files or directories, starting
* with a dot, are ignored when the check on changed files is run. If the
* value is true
, dot files are ignored, if it is set to
* false
, dot files are respected.
*/
private final boolean ignoreDotFilesInBaseDir;
/**
* In offline mode the plugin will not generate revision information.
*/
private final boolean offline;
/**
* Add SCM information if set to true
, skip it, if set to
* false
. If you are not interested in SCM information, set this
* to false
.
*/
private final boolean addScmInfo;
/**
* If it should be checked if the local files are up-to-date with the remote
* files in the SCM repository. If the value is true
the result
* of the check, including the list of changed files, is added to the build
* meta data.
*/
private final boolean validateCheckout;
/**
* Fail if revision is requested to be retrieved, access to SCM is provided,
* system is online, nothing should prevent the build from fetching the
* information.
*
* If set to true
the build will fail, if revision cannot be
* fetched, false
will continue so that the meta data do not
* contain the revision.
*
*/
private final boolean failOnMissingRevision;
// ****************************** Initializer *******************************
// ****************************** Constructors ******************************
// CHECKSTYLE:OFF
/**
* Default constructor.
*
* @param failOnLocalModifications the value for failOnLocalModifications.
* @param ignoreDotFilesInBaseDir the flag to ignore files and directories
* starting with a dot for checking modified files.
* @param offline the value for offline.
* @param addScmInfo the value for addScmInfo.
* @param validateCheckout the value for validateCheckout.
* @param failOnMissingRevision the value for failOnMissingRevision.
*/
public ScmControl(// NOPMD
final boolean failOnLocalModifications,
final boolean ignoreDotFilesInBaseDir, final boolean offline,
final boolean addScmInfo, final boolean validateCheckout,
final boolean failOnMissingRevision) {
this.failOnLocalModifications = failOnLocalModifications;
this.ignoreDotFilesInBaseDir = ignoreDotFilesInBaseDir;
this.offline = offline;
this.addScmInfo = addScmInfo;
this.validateCheckout = validateCheckout;
this.failOnMissingRevision = failOnMissingRevision;
}
// CHECKSTYLE:ON
// ****************************** Inner Classes *****************************
// ********************************* Methods ********************************
// --- init -----------------------------------------------------------------
// --- get&set --------------------------------------------------------------
/**
* Returns the value for failOnLocalModifications.
*
* Flag to fail if local modifications have been found. The value is
* true
if the build should fail if there are modifications (any
* files not in-sync with the remote repository), false
if the
* fact is only to be noted in the build properties.
*
*
* @return the value for failOnLocalModifications.
*/
public boolean isFailOnLocalModifications() {
return failOnLocalModifications;
}
/**
* Returns the flag to ignore files and directories starting with a dot for
* checking modified files. This implicates that any files or directories,
* starting with a dot, are ignored when the check on changed files is run. If
* the value is true
, dot files are ignored, if it is set to
* false
, dot files are respected.
*
* @return the flag to ignore files and directories starting with a dot for
* checking modified files.
*/
public boolean isIgnoreDotFilesInBaseDir() {
return ignoreDotFilesInBaseDir;
}
/**
* Returns the value for offline.
*
* In offline mode the plugin will not generate revision information.
*
*
* @return the value for offline.
*/
public boolean isOffline() {
return offline;
}
/**
* Returns the value for addScmInfo.
*
* Add SCM information if set to true
, skip it, if set to
* false
. If you are not interested in SCM information, set this
* to false
.
*
*
* @return the value for addScmInfo.
*/
public boolean isAddScmInfo() {
return addScmInfo;
}
/**
* Returns the value for validateCheckout.
*
* If it should be checked if the local files are up-to-date with the remote
* files in the SCM repository. If the value is true
the result
* of the check, including the list of changed files, is added to the build
* meta data.
*
*
* @return the value for validateCheckout.
*/
public boolean isValidateCheckout() {
return validateCheckout;
}
/**
* Returns the value for failOnMissingRevision.
*
* Fail if revision is requested to be retrieved, access to SCM is provided,
* system is online, nothing should prevent the build from fetching the
* information.
*
*
* If set to true
the build will fail, if revision cannot be
* fetched, false
will continue so that the meta data do not
* contain the revision.
*
*
* @return the value for failOnMissingRevision.
*/
public boolean isFailOnMissingRevision() {
return failOnMissingRevision;
}
// --- business -------------------------------------------------------------
// --- object basics --------------------------------------------------------
}