org.ajoberstar.gradle.git.publish.GitPublication Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-git-publish Show documentation
Show all versions of gradle-git-publish Show documentation
Gradle plugin for publishing to Git repositories
package org.ajoberstar.gradle.git.publish;
import org.gradle.api.Action;
import org.gradle.api.Named;
import org.gradle.api.Project;
import org.gradle.api.file.CopySpec;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.model.ObjectFactory;
import org.gradle.api.provider.Property;
import org.gradle.api.tasks.util.PatternFilterable;
import org.gradle.api.tasks.util.PatternSet;
public class GitPublication implements Named {
private final String name;
private final DirectoryProperty repoDir;
private final Property repoUri;
private final Property referenceRepoUri;
private final Property branch;
private final Property fetchDepth;
private final Property commitMessage;
private final Property sign;
private final CopySpec contents;
private final PatternFilterable preserve;
public GitPublication(String name, Project project, ObjectFactory objectFactory) {
this.name = name;
this.repoDir = objectFactory.directoryProperty();
this.repoUri = objectFactory.property(String.class);
this.referenceRepoUri = objectFactory.property(String.class);
this.branch = objectFactory.property(String.class);
this.fetchDepth = objectFactory.property(Integer.class);
this.commitMessage = objectFactory.property(String.class);
this.sign = objectFactory.property(Boolean.class);
this.contents = project.copySpec();
this.preserve = new PatternSet();
this.preserve.include(".git/**/*");
}
@Override
public String getName() {
return name;
}
public DirectoryProperty getRepoDir() {
return repoDir;
}
public Property getRepoUri() {
return repoUri;
}
public Property getReferenceRepoUri() {
return referenceRepoUri;
}
public Property getBranch() {
return branch;
}
public Property getFetchDepth() {
return fetchDepth;
}
public Property getCommitMessage() {
return commitMessage;
}
public Property getSign() {
return sign;
}
public CopySpec getContents() {
return contents;
}
public void contents(Action super CopySpec> action) {
action.execute(contents);
}
public PatternFilterable getPreserve() {
return preserve;
}
public void preserve(Action super PatternFilterable> action) {
action.execute(preserve);
}
}