private static String processPart(String pluginIdPart) { StringBuilder sb = new StringBuilder(); String[] parts = pluginIdPart.split("-"); for (String part: parts) { sb.append(StringUtil.capitalize(part)); } return sb.toString(); }
private static String processPart(String pluginIdPart) { StringBuilder sb = new StringBuilder(); String[] parts = pluginIdPart.split("-"); for (String part: parts) { sb.append(StringUtil.capitalize(part)); } return sb.toString(); }
/** * 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)); }
/** * 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)); }
static List<String> getClassCandidates(String pluginId) { List<String> candidates = new ArrayList<>(); String[] pluginIdParts = pluginId.split("\\."); String previousCandidate = "Plugin"; if (pluginId.toLowerCase().endsWith(previousCandidate.toLowerCase())) { previousCandidate = ""; } for (int i = pluginIdParts.length - 1; i >= 0; i--) { String candidate = StringUtil.capitalize(processPart(pluginIdParts[i])) + previousCandidate; candidates.add(candidate); previousCandidate = candidate; } return candidates; }
static List<String> getClassCandidates(String pluginId) { List<String> candidates = new ArrayList<>(); String[] pluginIdParts = pluginId.split("\\."); String previousCandidate = "Plugin"; if (pluginId.toLowerCase().endsWith(previousCandidate.toLowerCase())) { previousCandidate = ""; } for (int i = pluginIdParts.length - 1; i >= 0; i--) { String candidate = StringUtil.capitalize(processPart(pluginIdParts[i])) + previousCandidate; candidates.add(candidate); previousCandidate = candidate; } return candidates; }
private CloneGitRepositoryTask createCloneProjectFromGitHub(String gitHubRepoUrl, String repoName) { // TODO add depth clone configuration for shallow clone CloneGitRepositoryTask clone = project.getTasks().create( "cloneProjectFromGitHub" + capitalize(repoName), CloneGitRepositoryTask.class); clone.setRepository(gitHubRepoUrl); clone.setTargetDir(new File(project.getBuildDir(), repoName + "-pristine")); // For now for easier testing clone.dependsOn("clean"); return clone; }
private CloneGitRepositoryTask createCloneProjectToWorkDirTask(String repoName, CloneGitRepositoryTask clone) { // Clone from *-pristine to *-work. Copy task will not work because of ignoring git specific files: // https://discuss.gradle.org/t/copy-git-specific-files/11970 // Furthermore we can verify push to pristine origin File workDir = new File(project.getBuildDir(), repoName + "-work"); CloneGitRepositoryTask copy = project.getTasks().create( "cloneProjectToWorkDir" + capitalize(repoName), CloneGitRepositoryTask.class); copy.dependsOn(clone); copy.setRepository(clone.getTargetDir().getAbsolutePath()); copy.setTargetDir(workDir); return copy; }
private void createRunTestReleaseTask(String repoName, CloneGitRepositoryTask copy) { RunTestReleaseTask run = project.getTasks().create( "runTestRelease" + capitalize(repoName), RunTestReleaseTask.class); run.dependsOn(copy); run.setWorkDir(copy.getTargetDir()); run.setRepoName(repoName); // Using Gradle's composite builds ("--include-build") so that we're picking up current version of tools run.setCommand(asList("./gradlew", "publishToMavenLocal", "testRelease", "-x", "gitPush", "-x", "bintrayUpload", "--include-build", project.getRootDir().getAbsolutePath(), "-s")); // Build log in separate file instead of including it in the console of the parent build // Otherwise the output will be really messy run.setBuildOutputFile(new File(project.getBuildDir(), repoName + "-build.log")); }
private void createRunTestReleaseTask(final String camelCaseRepoName, CloneGitRepositoryTask copy) { final File buildOutputFile = new File(logsDirectory, camelCaseRepoName + "-build.log"); SilentExecTask run = getProject().getTasks().create( "test" + capitalize(camelCaseRepoName), SilentExecTask.class); run.dependsOn(copy); run.finalizedBy(uploadGistsTask); run.setWorkDir(copy.getTargetDir()); dependsOn(run); // Using Gradle's composite builds ("--include-build") so that we're picking up current version of tools run.setCommand(asList(GradleWrapper.getWrapperCommand(), "releaseNeeded", "performRelease", "releaseCleanUp", "-PdryRun", "-x", "gitPush", "-x", "bintrayUpload", "--include-build", getProject().getRootDir().getAbsolutePath(), "-s")); // Build log in separate file instead of including it in the console of the parent build // Otherwise the output will be really messy run.setBuildOutputFile(buildOutputFile); run.doFirst(new Action<Task>() { @Override public void execute(Task task) { LOG.lifecycle(testDownstreamLogMessage(camelCaseRepoName, buildOutputFile, uploadGistsTask.isEnabled(), uploadGistsTask.getName())); } }); }
private void createRunTestReleaseTask(final String camelCaseRepoName, CloneGitRepositoryTask copy) { final File buildOutputFile = new File(logsDirectory, camelCaseRepoName + "-build.log"); SilentExecTask run = getProject().getTasks().create( "test" + capitalize(camelCaseRepoName), SilentExecTask.class); run.dependsOn(copy); run.finalizedBy(uploadGistsTask); run.setWorkDir(copy.getTargetDir()); dependsOn(run); // Using Gradle's composite builds ("--include-build") so that we're picking up current version of tools run.setCommand(asList(GradleWrapper.getWrapperCommand(), "releaseNeeded", "performRelease", "releaseCleanUp", "-PdryRun", "-x", "gitPush", "-x", "bintrayUpload", "--include-build", getProject().getRootDir().getAbsolutePath(), "-s")); // Build log in separate file instead of including it in the console of the parent build // Otherwise the output will be really messy run.setBuildOutputFile(buildOutputFile); run.doFirst(new Action<Task>() { @Override public void execute(Task task) { LOG.lifecycle(testDownstreamLogMessage(camelCaseRepoName, buildOutputFile, uploadGistsTask.isEnabled(), uploadGistsTask.getName())); } }); }