All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ajoberstar.gradle.git.publish.GitPublication Maven / Gradle / Ivy

There is a newer version: 4.2.2
Show newest version
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 action) {
    action.execute(contents);
  }

  public PatternFilterable getPreserve() {
    return preserve;
  }

  public void preserve(Action action) {
    action.execute(preserve);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy