@TaskAction public void launch() throws Exception { addClasspath(new File(_installationDir, "startup.jar").getAbsolutePath()); List<String> args = new ArrayList<>(); args.add("-clean"); args.add("-application"); args.add(_sApplication); if(_workspaceDir != null) { args.add("-data"); args.add(_workspaceDir.getAbsolutePath()); } args.addAll(_args); try(URLClassLoader cl = new URLClassLoader(_classpath.toArray(new URL[_classpath.size()]))) { Class<?> c = cl.loadClass("org.eclipse.equinox.launcher.Main"); Method m = c.getDeclaredMethod("run", String[].class); Object o = c.newInstance(); int nRC = (int) m.invoke(o, new Object[] { args.toArray(new String[args.size()]) }); if(nRC != 0) throw new StopExecutionException("Eclipse returned exit code " + nRC + "!"); } }
public FileCollection stopExecutionIfEmpty() { if (isEmpty()) { throw new StopExecutionException(String.format("%s does not contain any files.", getCapDisplayName())); } return this; }
private FieldMap loadInternal(File file) { checkFile(file); try { byte[] readAllBytes = Files.readAllBytes(Paths.get(file.getAbsolutePath())); String jsonString = new String(readAllBytes); cachedFieldMap = gson.fromJson(jsonMinify.minify(jsonString), FieldMap.class); } catch (FileNotFoundException e) { throw new IllegalStateException("File not found", e); } catch (IOException e) { throw new IllegalStateException("Can't read file", e); } catch (JsonParseException e) { StopExecutionException stopExecutionException = new StopExecutionException( "Can't parse fields from file: " + file.getAbsolutePath()); stopExecutionException.initCause(e); throw stopExecutionException; } cacheTimestamp = file.lastModified(); return cachedFieldMap; }
public void execute(ExecResult exec) { if (exec.getExitValue() != 0) { LOG.info("External process returned exit code: {}. Stopping the execution of the task."); //Cleanly stop executing the task, without making the task failed. throw new StopExecutionException(); } } };
public void execute(ExecResult exec) { if (exec.getExitValue() != 0) { LOG.info("External process returned exit code: {}. Stopping the execution of the task."); //Cleanly stop executing the task, without making the task failed. throw new StopExecutionException(); } } };
private String createLink(CloudBlobContainer blobContainer, String projectDir, String versionDir, String fileName) throws URISyntaxException, StorageException { String blobRef = new StringBuffer() .append(projectDir) .append("/") .append(versionDir) .append("/") .append(fileName) .toString(); if (!blobContainer.getBlockBlobReference(blobRef).exists()) { throw new StopExecutionException("blob file does not exists: " + blobRef); } String link = new StringBuffer() .append(blobContainer.getUri().toASCIIString()) .append("/") .append(blobRef) .append("?") .append(generateSASToken(blobContainer, TOKEN_TIME_SPAN)) .toString(); return link; } }
@TaskAction public void generateWorkspaceId() { if (idFile.getAsFile().get().exists()) { throw new StopExecutionException("A workspaceID file already exists. Use 'clean' for deleting it."); } String wsid = new StringBuilder() .append(this.workspaceIdPrefix.toLowerCase().replaceAll("[^a-z0-9]", "")) .append('-') .append(this.projectName.get().toLowerCase().replaceAll("[^a-z0-9]", "")) .append('-') .append(SdkContext.randomResourceName("", 6)) .toString() .replaceAll("^-+", ""); try { BufferedWriter writer = new BufferedWriter(new FileWriter(idFile.getAsFile().get())); writer.write(wsid); writer.close(); } catch(IOException e) { throw new TaskExecutionException(this, e); } }
@Override public void execute(ShipkitExecTask task) { task.setDescription("Checks if release is needed. If so it will prepare for ci release and perform release."); task.getExecCommands().add(execCommand( "Checking if release is needed", asList(GradleWrapper.getWrapperCommand(), ReleaseNeededPlugin.RELEASE_NEEDED), execResult -> { if (!new File(project.getBuildDir(), ReleaseNeeded.RELEASE_NEEDED_FILENAME).exists()) { throw new StopExecutionException(); } })); task.getExecCommands().add(execCommand( "Preparing working copy for the release", asList(GradleWrapper.getWrapperCommand(), GitSetupPlugin.CI_RELEASE_PREPARE_TASK))); task.getExecCommands().add(execCommand( "Performing the release", asList(GradleWrapper.getWrapperCommand(), ReleasePlugin.PERFORM_RELEASE_TASK))); TaskSuccessfulMessage.logOnSuccess(task, " Release " + project.getVersion() + " was shipped! Thank you for using Shipkit!"); } });
@Override public void execute(ShipkitExecTask task) { task.setDescription("Checks if release is needed. If so it will prepare for ci release and perform release."); task.getExecCommands().add(execCommand( "Checking if release is needed", asList(GradleWrapper.getWrapperCommand(), ReleaseNeededPlugin.RELEASE_NEEDED), execResult -> { if (!new File(project.getBuildDir(), ReleaseNeeded.RELEASE_NEEDED_FILENAME).exists()) { throw new StopExecutionException(); } })); task.getExecCommands().add(execCommand( "Preparing working copy for the release", asList(GradleWrapper.getWrapperCommand(), GitSetupPlugin.CI_RELEASE_PREPARE_TASK))); task.getExecCommands().add(execCommand( "Performing the release", asList(GradleWrapper.getWrapperCommand(), ReleasePlugin.PERFORM_RELEASE_TASK))); TaskSuccessfulMessage.logOnSuccess(task, " Release " + project.getVersion() + " was shipped! Thank you for using Shipkit!"); } });
Project project = getProject(); throw new StopExecutionException( project + " does not have changes for range " + range);
t.onlyIf(a -> { if (a.getInputs().getSourceFiles().isEmpty()) { throw new StopExecutionException("no platform file found"); t.onlyIf(a -> { if (a.getInputs().getSourceFiles().isEmpty()) { throw new StopExecutionException("no allExtensions file found");
t.onlyIf(a -> { if (a.getInputs().getSourceFiles().isEmpty()) { throw new StopExecutionException("no datahub file found");
String sha256SumOrNull = sha256Sum.getOrNull(); if (md5HashOrNull == null && sha256SumOrNull == null) { throw new StopExecutionException("Please define either md5Hash or sha256Sum"); throw new StopExecutionException(String.format("Download of %s not successful. Hashes don't match. Found: %s Expected: %s", targetPath.getFileName(), fileHash, expectedHash));
} else { getLogger().lifecycle(failedMessage); throw new StopExecutionException(failedMessage);
String sha256SumOrNull = sha256Sum.getOrNull(); if (md5HashOrNull == null && sha256SumOrNull == null) { throw new StopExecutionException("Please define either md5Hash or sha256Sum");