
com.liferay.gradle.plugins.tasks.ReplaceRegexTask Maven / Gradle / Ivy
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.gradle.plugins.tasks;
import com.liferay.gradle.plugins.util.GradleUtil;
import groovy.lang.Closure;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.gradle.api.DefaultTask;
import org.gradle.api.GradleException;
import org.gradle.api.Project;
import org.gradle.api.file.FileCollection;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.SkipWhenEmpty;
import org.gradle.api.tasks.TaskAction;
import org.gradle.util.GUtil;
/**
* @author Andrea Di Giorgi
*/
public class ReplaceRegexTask extends DefaultTask {
@Input
@SkipWhenEmpty
public Map getMatches() {
return _matches;
}
public List> getPre() {
return _preClosures;
}
@Input
public Object getReplacement() {
return _replacement;
}
public List> getReplaceOnlyIf() {
return _replaceOnlyIfClosures;
}
public boolean isIgnoreUnmatched() {
return _ignoreUnmatched;
}
public ReplaceRegexTask match(String regex, Iterable
© 2015 - 2025 Weber Informatics LLC | Privacy Policy