@Override public void write(int b) throws IOException { wholeTextBuilder.append((char) b); if (b == '\n') { LOG.lifecycle("[checker] {}", lineTextBuilder.toString()); processLine(lineTextBuilder.toString()); lineTextBuilder = new StringBuilder(); } else { lineTextBuilder.append((char) b); } }
@TaskAction public void checkFilesForChanges(IncrementalTaskInputs inputs) getLogger().lifecycle("Checking idl and snapshot files for changes..."); getLogger().info("idlFiles: " + idlFiles.getAsPath()); getLogger().info("snapshotFiles: " + snapshotFiles.getAsPath()); getLogger().lifecycle( "The following files have been removed, be sure to remove them from source control: {}", files); getLogger().lifecycle("The following files have been added, be sure to add them to source control: {}", files); getLogger().lifecycle( "The following files have been changed, be sure to commit the changes to source control: {}", files);
@Override public void execute(Task task) { LOG.lifecycle(supplier.get()); } });
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!"); } }
@TaskAction public void initShipkitConfigFile(){ if(configFile.exists()){ LOG.lifecycle(" Shipkit configuration already exists, nothing to do. Configuration file: {}", configFile.getPath()); } else{ createShipKitConfigFile(); LOG.lifecycle(" Shipkit configuration created at {}!\n" + " You can modify it manually. Remember to check it into VCS!", configFile.getPath()); } }
private void downloadRemoteFile(String remoteUrl, File localFile) { LOG.lifecycle("Downloading remote artifact\n" + " - from {}\n" + " - and saving it to {}", remoteUrl, localFile); IOUtil.downloadToFile(remoteUrl, localFile); }
@TaskAction public void createSetupPy() throws IOException { File file = getProject().file("setup.py"); if (file.exists()) { logger.lifecycle("Contents of setup.py are going to be overwritten!!"); file.delete(); } file.createNewFile(); String setupPy = IOUtils.toString(GenerateSetupPyTask.class.getResourceAsStream("/templates/setup.py.template")); FileUtils.write(file, setupPy); } }
private String determineVersion(Project project){ if("unspecified".equals(project.getVersion()) ){ LOG.lifecycle(" BEWARE! 'project.version' is unspecified. Version will be set to '{}'. You can change it in '{}'.", FALLBACK_INITIAL_VERSION, versionFile.getName()); return FALLBACK_INITIAL_VERSION; } else{ LOG.lifecycle(" Initial project version in '{}' set to '{}' (taken from 'project.version' property).", versionFile.getName(), project.getVersion()); return project.getVersion().toString(); } }
static void setPushUrl(GitPushTask pushTask, String writeTokenEnvValue, String ghUser, String ghRepo, String writeToken) { if (writeToken != null) { String url = MessageFormat.format("https://{0}:{1}@github.com/{2}.git", ghUser, writeTokenEnvValue, ghRepo); pushTask.setUrl(url); pushTask.setSecretValue(writeToken); } else { LOG.lifecycle(" 'git push' does not use GitHub write token because it was not specified."); String url = MessageFormat.format("https://github.com/{0}.git", ghRepo); pushTask.setUrl(url); } }
@TaskAction public void cloneRepository() { if (!isTargetEmpty()) { LOG.lifecycle("{} - target directory already exists and is not empty. Skipping execution of the task. Exists: {}", getPath(), targetDir); return; } LOG.lifecycle(" Cloning repository {}\n into {}", repositoryUrl, targetDir); getProject().getBuildDir().mkdirs(); // build dir can be not created yet ProcessRunner processRunner = Exec.getProcessRunner(getProject().getBuildDir()); processRunner.run(getCloneCommand()); }
private String determineVersion(Project project, File versionFile) { if ("unspecified".equals(project.getVersion())) { LOG.info("'project.version' is unspecified. Version will be set to '{}'. You can change it in '{}'.", FALLBACK_INITIAL_VERSION, versionFile.getName()); return FALLBACK_INITIAL_VERSION; } else { LOG.lifecycle(" Configured '{}' version in '{}' file. Please remove 'version={}' setting from *.gradle file.", project.getVersion(), versionFile.getName(), project.getVersion()); return project.getVersion().toString(); } } }
@TaskAction public void fetchContributors() { LOG.lifecycle(" Fetching all contributors for project"); GitHubContributorsProvider contributorsProvider = Contributors.getGitHubContributorsProvider(apiUrl, repository, readOnlyAuthToken); ProjectContributorsSet contributors = contributorsProvider.getAllContributorsForProject(); AllContributorsSerializer serializer = new AllContributorsSerializer(); final String json = serializer.serialize(contributors); IOUtil.writeFile(outputFile, json); LOG.lifecycle(" Serialized all contributors into: {}", getProject().relativePath(outputFile)); } }
@TaskAction public void compile() { if (!msbuildConfiguration.getItems().isEmpty()) { getLogger().lifecycle("Compiling with BDS " + bds.get()); for (MsbuildItem p : msbuildConfiguration.getItems()) { getLogger().lifecycle(String.format("\t- %s", p.toString())); compileProject(p); } } else { getLogger().warn("Nothing to compile! Add project files to project.dproj property."); } }
@TaskAction public void check() { checkProjectFiles(); checkBinDirectory(); checkBdsVersion(); getLogger().lifecycle("Configuration verified successfully"); }
public void execute(PackageInfo packageInfo, List<String> extraArgs) { if (packageExcludeFilter != null && packageExcludeFilter.isSatisfiedBy(packageInfo)) { if (PythonHelpers.isPlainOrVerbose(project)) { getLogger().lifecycle("Skipping {} - Excluded", packageInfo.toShortHand()); } return; } doPipOperation(packageInfo, extraArgs); }
public void execute(PackageInfo packageInfo, List<String> extraArgs) { if (packageExcludeFilter != null && packageExcludeFilter.isSatisfiedBy(packageInfo)) { if (PythonHelpers.isPlainOrVerbose(project)) { getLogger().lifecycle("Skipping {} - Excluded", packageInfo.toShortHand()); } return; } doPipOperation(packageInfo, extraArgs); }
public String getAccountId() { try { AWSSecurityTokenService sts = createClient(AWSSecurityTokenServiceClient.class, profileName); sts.setRegion(getActiveRegion(region)); return sts.getCallerIdentity(new GetCallerIdentityRequest()).getAccount(); } catch (SdkClientException e) { project.getLogger().lifecycle("AWS credentials not configured!"); return null; } }
public Mono<Void> scaleInstances(CloudFoundryOperations cfOperations, CfProperties cfProperties, int instanceCount) { Mono<Void> resp = cfOperations.applications().scale( ScaleApplicationRequest.builder() .instances(instanceCount) .build() ).doOnSubscribe((s) -> { LOGGER.lifecycle("Scaling app {} to instance count {}", cfProperties.name(), instanceCount); }); return resp; }
public void waitForStatus(WaitCondition condition) { new Poller(waitingDuration -> { final String status = condition.getStatus(); logger.lifecycle("Got status {} after {}", status, waitingDuration); if (condition.isFailure(status)) { throw new DeploymentException("Got failure status " + status + ": " + condition.getFailureMessage()); } return condition.isSuccess(status); }).waitUntilFinished(); }
@Override public void execute(JavaExecSpec spec) { getLogger().lifecycle(CONFIG_MESSAGE, getFormat(), formatPath(getBaseDir()), formatPath(getDestDir())); getLogger().info("Using main class {}", getMainClass()); Configuration configuration = getProject().getConfigurations().getAt(CONFIGURATION_NAME); String toolPath = configuration.getAsPath(); spec.setIgnoreExitValue(true); spec.setClasspath(createToolClasspath(configuration)); spec.setMain(getMainClass()); spec.args(getFormat(), getBaseDir().getAbsolutePath(), getDestDir().getAbsolutePath(), toolPath); }