/** * Returns the root directory of the checked-out module. * <p> * This is usually where {@code pom.xml}, {@code build.xml} * and so on exists. * * @deprecated as of 1.319 * See {@link #getWorkspace()} for a migration strategy. */ @Deprecated public FilePath getModuleRoot() { AbstractBuild b = getBuildForDeprecatedMethods(); return b != null ? b.getModuleRoot() : null; }
@Override public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) { if (StringUtils.isEmpty(path)) { return null; } try { EnvVars env = build.getEnvironment(listener); String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver()); targetPath = env.expand(targetPath); if (IOUtils.isAbsolute(targetPath)) { return new FilePath(new File(targetPath)); } else { FilePath mrSettings = build.getModuleRoot().child(targetPath); FilePath wsSettings = build.getWorkspace().child(targetPath); try { if (!wsSettings.exists() && mrSettings.exists()) { wsSettings = mrSettings; } } catch (Exception e) { throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote()); } return wsSettings; } } catch (Exception e) { throw new IllegalStateException("failed to prepare global settings.xml"); } }
@Override public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) { if (StringUtils.isEmpty(path)) { return null; } try { EnvVars env = build.getEnvironment(listener); String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver()); targetPath = env.expand(targetPath); if (IOUtils.isAbsolute(targetPath)) { return new FilePath(new File(targetPath)); } else { FilePath mrSettings = build.getModuleRoot().child(targetPath); FilePath wsSettings = build.getWorkspace().child(targetPath); try { if (!wsSettings.exists() && mrSettings.exists()) { wsSettings = mrSettings; } } catch (Exception e) { throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote()); } return wsSettings; } } catch (Exception e) { throw new IllegalStateException("failed to prepare settings.xml"); } }
int r = launcher.launch().cmds(args).envs(env).stdout(mca).pwd(build.getModuleRoot()).join(); if (0 != r) { return false;
/** * Returns the root directory of the checked-out module. <p> This is usually * where <tt>pom.xml</tt>, <tt>build.xml</tt> and so on exists. * * @deprecated as of 1.319 See {@link #getWorkspace()} for a migration * strategy. */ public FilePath getModuleRoot() { AbstractBuild b = getBuildForDeprecatedMethods(); return b != null ? b.getModuleRoot() : null; }
/** * Returns the root directory of the checked-out module. <p> This is usually * where <tt>pom.xml</tt>, <tt>build.xml</tt> and so on exists. * * @deprecated as of 1.319 See {@link #getWorkspace()} for a migration * strategy. */ public FilePath getModuleRoot() { AbstractBuild b = getBuildForDeprecatedMethods(); return b != null ? b.getModuleRoot() : null; }
/** * Returns the root directory of the checked-out module. * <p> * This is usually where <tt>pom.xml</tt>, <tt>build.xml</tt> * and so on exists. * * @deprecated as of 1.319 * See {@link #getWorkspace()} for a migration strategy. */ public FilePath getModuleRoot() { AbstractBuild b = getBuildForDeprecatedMethods(); return b != null ? b.getModuleRoot() : null; }
/** * Returns the root directory of the checked-out module. * <p> * This is usually where <tt>pom.xml</tt>, <tt>build.xml</tt> * and so on exists. * * @deprecated as of 1.319 * See {@link #getWorkspace()} for a migration strategy. */ public FilePath getModuleRoot() { AbstractBuild b = getBuildForDeprecatedMethods(); return b != null ? b.getModuleRoot() : null; }
/** * Returns the root directory of the checked-out module. * <p> * This is usually where <tt>pom.xml</tt>, <tt>build.xml</tt> * and so on exists. * * @deprecated as of 1.319 * See {@link #getWorkspace()} for a migration strategy. */ @Deprecated public FilePath getModuleRoot() { AbstractBuild b = getBuildForDeprecatedMethods(); return b != null ? b.getModuleRoot() : null; }
private FilePath getNormalizedRootBuildScriptDir(AbstractBuild<?, ?> build, VariableResolver<String> resolver) { FilePath normalizedRootBuildScriptDir = null; if (rootBuildScriptDir != null && rootBuildScriptDir.trim().length() != 0) { String rootBuildScriptNormalized = replaceWhitespaceBySpace(rootBuildScriptDir.trim()); rootBuildScriptNormalized = Util.replaceMacro(rootBuildScriptNormalized.trim(), resolver); normalizedRootBuildScriptDir = new FilePath(build.getModuleRoot(), rootBuildScriptNormalized); } return normalizedRootBuildScriptDir; }
private String getMavenProjectPath(Run<?, ?> build, FilePath ws) { if (build instanceof AbstractBuild) { if (StringUtils.isNotBlank(getRootPom())) { return ((AbstractBuild) build).getModuleRoot().getRemote() + File.separatorChar + getRootPom().replace("/pom.xml", StringUtils.EMPTY); } return ((AbstractBuild) build).getModuleRoot().getRemote(); } return ws.getRemote(); }
private List<FilePath> getPossibleWrapperLocations(AbstractBuild<?, ?> build, Launcher launcher, VariableResolver<String> resolver, FilePath normalizedRootBuildScriptDir) throws IOException, InterruptedException { FilePath moduleRoot = build.getModuleRoot(); if (wrapperLocation != null && wrapperLocation.trim().length() != 0) { // Override with provided relative path to gradlew String wrapperLocationNormalized = wrapperLocation.trim().replaceAll("[\t\r\n]+", ""); wrapperLocationNormalized = Util.replaceMacro(wrapperLocationNormalized.trim(), resolver); return ImmutableList.of(new FilePath(moduleRoot, wrapperLocationNormalized)); } else if (buildFile != null && !buildFile.isEmpty()) { // Check if the target project is located not at the root dir FilePath parentOfBuildFile = new FilePath(normalizedRootBuildScriptDir == null ? moduleRoot : normalizedRootBuildScriptDir, buildFile).getParent(); if (parentOfBuildFile != null && !parentOfBuildFile.equals(moduleRoot)) { return ImmutableList.of(parentOfBuildFile, moduleRoot); } } return ImmutableList.of(moduleRoot); }
private List<FilePath> getPossibleWrapperLocations(AbstractBuild<?, ?> build, Launcher launcher, EnvVars env, FilePath normalizedRootBuildScriptDir) throws IOException, InterruptedException { FilePath moduleRoot = build.getModuleRoot(); if (wrapperLocation != null && wrapperLocation.trim().length() != 0) { // Override with provided relative path to gradlew String wrapperLocationNormalized = wrapperLocation.trim().replaceAll("[\t\r\n]+", ""); wrapperLocationNormalized = Util.replaceMacro(wrapperLocationNormalized.trim(), env); wrapperLocationNormalized = Util.replaceMacro(wrapperLocationNormalized, build.getBuildVariableResolver()); return ImmutableList.of(new FilePath(moduleRoot, wrapperLocationNormalized)); } else if (buildFile != null && !buildFile.isEmpty()) { // Check if the target project is located not at the root dir char fileSeparator = launcher.isUnix() ? '/' : '\\'; int i = buildFile.lastIndexOf(fileSeparator); if (i > 0) { // Check if there is a wrapper script at the target project's dir. FilePath candidate = new FilePath(normalizedRootBuildScriptDir == null ? moduleRoot : normalizedRootBuildScriptDir, buildFile.substring(0, i)); return ImmutableList.of(candidate, moduleRoot); } } return ImmutableList.of(moduleRoot); }
public static FilePath getModuleRoot(Run<?, ?> run, FilePath workspace) { FilePath moduleRoot = null; if (run instanceof AbstractBuild) { AbstractBuild<?, ?> build = (AbstractBuild<?, ?>) run; moduleRoot = build.getModuleRoot(); } else { // otherwise get the first module of the first SCM Object parent = run.getParent(); if (parent instanceof SCMTriggerItem) { SCMTriggerItem scmTrigger = (SCMTriggerItem) parent; Collection<? extends SCM> scms = scmTrigger.getSCMs(); if (!scms.isEmpty()) { SCM scm = scms.iterator().next(); FilePath[] moduleRoots = scm.getModuleRoots(workspace, null); moduleRoot = moduleRoots != null && moduleRoots.length > 0 ? moduleRoots[0] : null; } } if (moduleRoot == null) { moduleRoot = workspace; } } return moduleRoot; } }
@Override public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) { if (StringUtils.isEmpty(path)) { return null; } try { EnvVars env = build.getEnvironment(listener); String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver()); targetPath = env.expand(targetPath); if (IOUtils.isAbsolute(targetPath)) { return new FilePath(new File(targetPath)); } else { FilePath mrSettings = build.getModuleRoot().child(targetPath); FilePath wsSettings = build.getWorkspace().child(targetPath); try { if (!wsSettings.exists() && mrSettings.exists()) { wsSettings = mrSettings; } } catch (Exception e) { throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote()); } return wsSettings; } } catch (Exception e) { throw new IllegalStateException("failed to prepare settings.xml"); } }
@Override public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) { if (StringUtils.isEmpty(path)) { return null; } try { EnvVars env = build.getEnvironment(listener); String targetPath = Util.replaceMacro(this.path, build.getBuildVariableResolver()); targetPath = env.expand(targetPath); if (IOUtils.isAbsolute(targetPath)) { return new FilePath(new File(targetPath)); } else { FilePath mrSettings = build.getModuleRoot().child(targetPath); FilePath wsSettings = build.getWorkspace().child(targetPath); try { if (!wsSettings.exists() && mrSettings.exists()) { wsSettings = mrSettings; } } catch (Exception e) { throw new IllegalStateException("failed to find settings.xml at: " + wsSettings.getRemote()); } return wsSettings; } } catch (Exception e) { throw new IllegalStateException("failed to prepare global settings.xml"); } }
private ArgumentListBuilder prepareCommandlineArguments(AbstractBuild<?,?> build, Launcher launcher, Unity3dInstallation ui, EnvVars vars) throws IOException, InterruptedException, PerformException { String exe = ui.getExecutable(launcher); if (exe==null) { throw new PerformException(Messages.Unity3d_ExecutableNotFound(ui.getName())); } FilePath moduleRoot = build.getModuleRoot(); String moduleRootRemote = moduleRoot.getRemote(); Map<String,String> buildParameters = build.getBuildVariables(); return createCommandlineArgs(exe, moduleRootRemote, vars, buildParameters); }
FilePath workDir = build.getModuleRoot(); try {
@Override public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { listener.getLogger().println("Jenkins Artifactory Plugin version: " + ActionableHelper.getArtifactoryPluginVersion()); EnvVars env = build.getEnvironment(listener); FilePath workDir = build.getModuleRoot(); FilePath ws = build.getWorkspace(); FilePath mavenHome = getMavenHome(listener, env, launcher); if (!mavenHome.exists()) { listener.error("Couldn't find Maven home: " + mavenHome.getRemote()); throw new Run.RunnerAbortedException(); } ArgumentListBuilder cmdLine = buildMavenCmdLine(build, listener, env, launcher, mavenHome, ws, ws); String[] cmds = cmdLine.toCommandArray(); return RunMaven(build, launcher, listener, env, workDir, cmds); }
new FilePath(build.getProject().getRootDir()), new FilePath(build.getRootDir()), build.getModuleRoot(), build.getTimestamp()); || masterGhostwriter.performFromMaster(build, build.getModuleRoot(), listener);