static String getNonEmpty(String value) { if (StringUtil.isEmpty(value)) { return null; } return value; } }
@Override public void apply(Project project) { TaskMaker.task(project, IDENTIFY_GIT_BRANCH, IdentifyGitBranchTask.class, new Action<IdentifyGitBranchTask>() { public void execute(final IdentifyGitBranchTask t) { t.setDescription("Identifies current git branch."); } }); }
public static String getHeadBranch(String forkRepositoryName, String headBranch) { return getUserOfForkRepo(forkRepositoryName) + ":" + headBranch; }
@Override public void apply(Project project) { ProjectUtil.requireRootProject(project, this.getClass(), "This is needed so that we don't invoke git commands multiple times, per each submodule."); identifyTask = TaskMaker.task(project, IDENTIFY_GIT_ORIGIN_TASK, IdentifyGitOriginRepoTask.class, new Action<IdentifyGitOriginRepoTask>() { public void execute(IdentifyGitOriginRepoTask t) { t.setDescription("Identifies current git origin repo."); } }); //Due to gnarly dependencies between plugins and tasks, we really need to apply this plugin after we declared the task //Trust me, it's all good :-) project.getPlugins().apply(ShipkitConfigurationPlugin.class); }
void updateReleaseNotes(boolean previewMode, File releaseNotesFile, String newContent) { if (previewMode) { LOG.lifecycle(" Preview of release notes update:\n" + " ----------------\n" + newContent + "----------------"); } else { FileUtil.appendToTop(newContent, releaseNotesFile); LOG.lifecycle(" Successfully updated release notes!"); } }
/** * Formats repositoryName to camel case version of it with the first letter capitalized. Eg. * "mockito/shipkit" -> "MockitoShipkit" * "mockito/shipkit-example" -> "MockitoShipkitExample" * * @param repositoryName GitHub repo name in format "org/repo", eg. "mockito/shipkit" */ public static String repositoryNameToCapitalizedCamelCase(String repositoryName) { return StringUtil.capitalize(repositoryNameToCamelCase(repositoryName)); }
/** * Returns file object for storing contributors. */ public static File contributorsFile(Project project) { return outputFile(project.getRootProject(), "all-contributors.json"); }
public static void requireRootProject(final Project project, final Class<?> clazz) { requireRootProject(project, clazz, null); }
static String getNonEmpty(String value) { if (StringUtil.isEmpty(value)) { return null; } return value; } }
@Override public void apply(Project project) { TaskMaker.task(project, IDENTIFY_GIT_BRANCH, IdentifyGitBranchTask.class, new Action<IdentifyGitBranchTask>() { public void execute(final IdentifyGitBranchTask t) { t.setDescription("Identifies current git branch."); } }); }
void updateReleaseNotes(boolean previewMode, File releaseNotesFile, String newContent) { if (previewMode) { LOG.lifecycle(" Preview of release notes update:\n" + " ----------------\n" + newContent + "----------------"); } else { FileUtil.appendToTop(newContent, releaseNotesFile); LOG.lifecycle(" Successfully updated release notes!"); } }
/** * Formats repositoryName to camel case version of it with the first letter capitalized. Eg. * "mockito/shipkit" -> "MockitoShipkit" * "mockito/shipkit-example" -> "MockitoShipkitExample" * * @param repositoryName GitHub repo name in format "org/repo", eg. "mockito/shipkit" */ public static String repositoryNameToCapitalizedCamelCase(String repositoryName) { return StringUtil.capitalize(repositoryNameToCamelCase(repositoryName)); }
public static String getHeadBranch(String forkRepositoryName, String headBranch) { return getUserOfForkRepo(forkRepositoryName) + ":" + headBranch; }
public static void requireRootProject(final Project project, final Class<?> clazz) { requireRootProject(project, clazz, null); }
private static String link(String text, String link) { return isEmpty(link) ? text : "[" + text + "](" + link + ")"; }
@Override public void apply(Project project) { TaskMaker.task(project, IDENTIFY_GIT_BRANCH, IdentifyGitBranchTask.class, new Action<IdentifyGitBranchTask>() { public void execute(final IdentifyGitBranchTask t) { t.setDescription("Identifies current git branch."); } }); }
private static String link(String text, String link) { return StringUtil.isEmpty(link) ? text : "[" + text + "](" + link + ")"; }
private static String link(String text, String link) { return StringUtil.isEmpty(link) ? text : "[" + text + "](" + link + ")"; }
private String formatVersionInformationInCommitMessage(String version, String previousVersion) { String versionMessage = format("%s release", version); if (StringUtil.isEmpty(previousVersion)) { return versionMessage; } else { return format("%s (previous %s)", versionMessage, previousVersion); } } }
private String extractPackageFromRepo(String publicationRepository, String pluginName) { String packageName = publicationRepository.substring(GRADLE_PORTAL_URL.length(), publicationRepository.length() - 1) .replace('.', '/'); if (!isEmpty(pluginName)) { packageName = packageName + "/" + pluginName; } return packageName; }