spring security GlobalLockTask 源码

  • 2022-08-13
  • 浏览 (468)

spring security GlobalLockTask 代码

文件路径:/buildSrc/src/main/java/lock/GlobalLockTask.java

package lock;

import org.gradle.api.Action;
import org.gradle.api.DefaultTask;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.tasks.TaskAction;

import java.util.function.Consumer;

/**
 * @author Rob Winch
 */
public class GlobalLockTask extends DefaultTask {
	@TaskAction
	public void lock() {
		Project taskProject = getProject();
		if (!taskProject.getGradle().getStartParameter().isWriteDependencyLocks()) {
			throw new IllegalStateException("You just specify --write-locks argument");
		}
		writeLocksFor(taskProject);
		taskProject.getSubprojects().forEach(new Consumer<Project>() {
			@Override
			public void accept(Project subproject) {
				writeLocksFor(subproject);
			}
		});
	}

	private void writeLocksFor(Project project) {
		project.getConfigurations().configureEach(new Action<Configuration>() {
			@Override
			public void execute(Configuration configuration) {
				if (configuration.isCanBeResolved()) {
					configuration.resolve();
				}
			}
		});
	}
}

相关信息

spring security 源码目录

相关文章

spring security GlobalLockPlugin 源码

0  赞