提交 215d2a41 编写于 作者: I imod

rename method of new EP to by more precise

上级 da9b07ed
......@@ -18,7 +18,7 @@ public class DefaultGlobalSettingsProvider extends GlobalSettingsProvider {
}
@Override
public FilePath configure(AbstractBuild<?, ?> project, TaskListener listener) {
public FilePath supplySettings(AbstractBuild<?, ?> project, TaskListener listener) {
return null;
}
......
......@@ -17,7 +17,7 @@ public class DefaultSettingsProvider extends SettingsProvider {
}
@Override
public FilePath configure(AbstractBuild<?, ?> project, TaskListener listener) {
public FilePath supplySettings(AbstractBuild<?, ?> project, TaskListener listener) {
return null;
}
......
......@@ -30,7 +30,7 @@ public class FilePathGlobalSettingsProvider extends GlobalSettingsProvider {
}
@Override
public FilePath configure(AbstractBuild<?, ?> project, TaskListener listener) throws IOException, InterruptedException {
public FilePath supplySettings(AbstractBuild<?, ?> project, TaskListener listener) {
if (StringUtils.isEmpty(path)) {
return null;
}
......@@ -39,8 +39,13 @@ public class FilePathGlobalSettingsProvider extends GlobalSettingsProvider {
} else {
FilePath mrSettings = project.getModuleRoot().child(path);
FilePath wsSettings = project.getWorkspace().child(path);
if (!wsSettings.exists() && mrSettings.exists()) {
wsSettings = mrSettings;
try {
if (!wsSettings.exists() && mrSettings.exists()) {
wsSettings = mrSettings;
}
} catch (Exception e) {
listener.getLogger().print("ERROR: failed to find settings.xml at: "+wsSettings.getRemote());
e.printStackTrace();
}
return wsSettings;
}
......
......@@ -29,19 +29,20 @@ public class FilePathSettingsProvider extends SettingsProvider {
}
@Override
public FilePath configure(AbstractBuild<?, ?> project, TaskListener listener) {
public FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener) {
if (StringUtils.isEmpty(path))
return null;
if (IOUtils.isAbsolute(path)) {
return new FilePath(new File(path));
} else {
FilePath mrSettings = project.getModuleRoot().child(path);
FilePath wsSettings = project.getWorkspace().child(path);
FilePath mrSettings = build.getModuleRoot().child(path);
FilePath wsSettings = build.getWorkspace().child(path);
try {
if (!wsSettings.exists() && mrSettings.exists()) {
wsSettings = mrSettings;
}
} catch (Exception e) {
listener.getLogger().print("ERROR: failed to find settings.xml at: "+wsSettings.getRemote());
e.printStackTrace();
}
return wsSettings;
......
......@@ -28,7 +28,7 @@ public abstract class GlobalSettingsProvider extends AbstractDescribableImpl<Glo
* the build to provide the settigns for
* @return the filepath to the provided file. <code>null</code> if no settings will be provided.
*/
public abstract FilePath configure(AbstractBuild<?, ?> build, TaskListener listener) throws IOException, InterruptedException;
public abstract FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener);
public static GlobalSettingsProvider parseSettingsProvider(StaplerRequest req) throws Descriptor.FormException, ServletException {
JSONObject settings = req.getSubmittedForm().getJSONObject("globalSettings");
......@@ -53,7 +53,7 @@ public abstract class GlobalSettingsProvider extends AbstractDescribableImpl<Glo
FilePath settingsPath = null;
if (settings != null) {
try {
settingsPath = settings.configure(build, listener);
settingsPath = settings.supplySettings(build, listener);
} catch (Exception e) {
listener.getLogger().print("failed to get the path to the alternate global settings.xml");
}
......
......@@ -22,10 +22,10 @@ public abstract class SettingsProvider extends AbstractDescribableImpl<SettingsP
/**
* Configure maven launcher argument list with adequate settings path. Implementations should be aware that this method might get called multiple times during a build.
*
* @param project
* @param build
* @return the filepath to the provided file. <code>null</code> if no settings will be provided.
*/
public abstract FilePath configure(AbstractBuild<?, ?> project, TaskListener listener);
public abstract FilePath supplySettings(AbstractBuild<?, ?> build, TaskListener listener);
public static SettingsProvider parseSettingsProvider(StaplerRequest req) throws Descriptor.FormException, ServletException {
JSONObject settings = req.getSubmittedForm().getJSONObject("settings");
......@@ -46,10 +46,10 @@ public abstract class SettingsProvider extends AbstractDescribableImpl<SettingsP
* the listener of the current build
* @return the path to the settings.xml
*/
public static final FilePath getFilePathOppressed(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) {
public static final FilePath getSettingsFilePath(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) {
FilePath settingsPath = null;
if (settings != null) {
settingsPath = settings.configure(build, listener);
settingsPath = settings.supplySettings(build, listener);
}
return settingsPath == null ? null : settingsPath;
}
......@@ -65,8 +65,8 @@ public abstract class SettingsProvider extends AbstractDescribableImpl<SettingsP
* the listener of the current build
* @return the path to the settings.xml
*/
public static final String getRemotePath(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) {
FilePath fp = getFilePathOppressed(settings, build, listener);
public static final String getSettingsRemotePath(SettingsProvider settings, AbstractBuild<?, ?> build, TaskListener listener) {
FilePath fp = getSettingsFilePath(settings, build, listener);
return fp == null ? null : fp.getRemote();
}
......
......@@ -582,7 +582,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
LOGGER.fine(getFullDisplayName()+" is building with mavenVersion " + mavenVersion + " from file " + mavenInformation.getVersionResourcePath());
remoteSettings = SettingsProvider.getFilePathOppressed(project.getSettings(), MavenModuleSetBuild.this, listener);
remoteSettings = SettingsProvider.getSettingsFilePath(project.getSettings(), MavenModuleSetBuild.this, listener);
remoteGlobalSettings = GlobalSettingsProvider.getFilePath(project.getGlobalSettings(), MavenModuleSetBuild.this, listener);
if(!project.isAggregatorStyleBuild()) {
......@@ -1065,7 +1065,7 @@ public class MavenModuleSetBuild extends AbstractMavenBuild<MavenModuleSet,Maven
this.privateRepository = null;
}
this.alternateSettings = SettingsProvider.getRemotePath(project.getSettings(), build, listener);
this.alternateSettings = SettingsProvider.getSettingsRemotePath(project.getSettings(), build, listener);
this.globalSetings = GlobalSettingsProvider.getRemotePath(project.getGlobalSettings(), build, listener);
this.mavenVersion = mavenVersion;
......
......@@ -100,7 +100,7 @@ public class MavenUtil {
m = ((ProjectWithMaven) project).inferMavenInstallation().forNode(Jenkins.getInstance(),listener);
}
if (project instanceof MavenModuleSet) {
String altSet = SettingsProvider.getRemotePath(((MavenModuleSet) project).getSettings(), build, listener);
String altSet = SettingsProvider.getSettingsRemotePath(((MavenModuleSet) project).getSettings(), build, listener);
settingsLoc = (altSet == null) ? null
: new File(build.getWorkspace().child(altSet).getRemote());
......
......@@ -227,7 +227,7 @@ public class RedeployPublisher extends Recorder {
// TODO check if the remoteSettings has a localRepository configured and disabled it
String altSettingsPath = SettingsProvider.getRemotePath(((MavenModuleSet) project).getSettings(), build, listener);
String altSettingsPath = SettingsProvider.getSettingsRemotePath(((MavenModuleSet) project).getSettings(), build, listener);
String remoteGlobalSettingsPath = GlobalSettingsProvider.getRemotePath(((MavenModuleSet) project).getGlobalSettings(), build, listener);
if(remoteGlobalSettingsPath != null){
remoteGlobalSettingsFromConfig = new File(remoteGlobalSettingsPath);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册