-
-
Notifications
You must be signed in to change notification settings - Fork 39
getModuleRoot returnes now the full path included the part specified as load rules #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
9df685c
10d537c
d144c3e
804b33e
2f3ae6d
2b09c7b
bd93085
11f06b8
87c2980
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,7 +180,7 @@ private static final class IsUnix implements Callable<Boolean, IOException> { | |
| IsUnix() { | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
| public Boolean call() throws IOException { | ||
| return File.pathSeparatorChar == ':'; | ||
| } | ||
|
|
@@ -203,6 +203,7 @@ public Boolean call() throws IOException { | |
| private boolean filteringOutDestroySubBranchEvent; | ||
| private boolean freezeCode; | ||
| private String loadRules; | ||
| private String[] loadRulesForModuleRoot = {}; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a build-scoped information, it shouldn't be persisted in the Scm object. |
||
| private String loadRulesForPolling; | ||
| private String mkviewOptionalParam; | ||
| private int multiSitePollBuffer; | ||
|
|
@@ -284,7 +285,7 @@ public AbstractClearCaseScm(final String viewName, final String mkviewOptionalPa | |
| */ | ||
| @Override | ||
| public void buildEnvVars(AbstractBuild<?, ?> build, Map<String, String> env) { | ||
| @SuppressWarnings("unchecked") | ||
| @SuppressWarnings("unchecked") | ||
| VariableResolver.Union<String> variableResolver = new VariableResolver.Union<String>(new BuildVariableResolver(build, true), | ||
| new VariableResolver.ByMap<String>(env)); | ||
| String normalizedViewName = getViewName(variableResolver); | ||
|
|
@@ -300,7 +301,11 @@ public void buildEnvVars(AbstractBuild<?, ?> build, Map<String, String> env) { | |
| } else { | ||
| String workspace = env.get("WORKSPACE"); | ||
| if (workspace != null) { | ||
| env.put(CLEARCASE_VIEWPATH_ENVSTR, workspace + PathUtil.fileSepForOS(isUnix) + normalizedViewPath); | ||
| if ( loadRulesForModuleRoot.length == 0 ) { | ||
| env.put(CLEARCASE_VIEWPATH_ENVSTR, workspace + PathUtil.fileSepForOS(isUnix) + normalizedViewPath); | ||
| } else { | ||
| env.put(CLEARCASE_VIEWPATH_ENVSTR, workspace + PathUtil.fileSepForOS(isUnix) + normalizedViewPath + PathUtil.fileSepForOS(isUnix) + loadRulesForModuleRoot[0]); | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -408,6 +413,7 @@ public Filter configureFilters(VariableResolver<String> variableResolver, Abstra | |
|
|
||
| String filterRegexp = ""; | ||
| String[] viewPaths = getViewPaths(variableResolver, build, launcher, false); | ||
| loadRulesForModuleRoot = viewPaths; | ||
| if (viewPaths != null) { | ||
| filterRegexp = getViewPathsRegexp(viewPaths, launcher.isUnix()); | ||
| } | ||
|
|
@@ -554,34 +560,54 @@ public String getLoadRulesForPolling() { | |
| public String getMkviewOptionalParam() { | ||
| return mkviewOptionalParam; | ||
| } | ||
|
|
||
| @Override | ||
| public FilePath getModuleRoot(FilePath workspace) { | ||
| return getModuleRoot(workspace, null); | ||
| return getModuleRoot(workspace, null); | ||
| } | ||
|
|
||
| @Override | ||
| public FilePath getModuleRoot(FilePath workspace, AbstractBuild build) { | ||
| if (loadRulesForModuleRoot.length == 0) { | ||
| return getModuleRoot(workspace, build, null); | ||
| } else { | ||
| return getModuleRoot(workspace, build, loadRulesForModuleRoot); | ||
| } | ||
| } | ||
| public FilePath getModuleRoot(FilePath workspace, AbstractBuild build, String[] loadRulesForModuleRoot) { | ||
| if (useDynamicView) { | ||
| String normViewName = getNormalizedViewName(); | ||
| return new FilePath(workspace.getChannel(), viewDrive).child(normViewName); | ||
| String normViewName = getNormalizedViewName(); | ||
| if (loadRulesForModuleRoot == null){ | ||
| return new FilePath(workspace.getChannel(), viewDrive).child(normViewName); | ||
| } | ||
| else { | ||
| return new FilePath(workspace.getChannel(), viewDrive).child(normViewName).child(loadRulesForModuleRoot[0]); | ||
| } | ||
| } | ||
| String normViewPath = getNormalizedViewPath(); | ||
| if (normViewPath != null) { | ||
| return workspace.child(normViewPath); | ||
| if (loadRulesForModuleRoot == null){ | ||
| return workspace.child(normViewPath); | ||
| } else { | ||
| return workspace.child(normViewPath).child(loadRulesForModuleRoot[0]); | ||
| } | ||
| } | ||
| if (build == null) { | ||
| normViewPath = getViewPath(); | ||
| } else { | ||
| normViewPath = getViewPath(new BuildVariableResolver(build)); | ||
| } | ||
| if (normViewPath != null) { | ||
| return workspace.child(normViewPath); | ||
| if (loadRulesForModuleRoot == null){ | ||
| return workspace.child(normViewPath); | ||
| } else { | ||
| return workspace.child(normViewPath).child(loadRulesForModuleRoot[0]); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a major breaking change. All existing jobs that define the relative path in the view to reach the pom.xml for instance will have to be updated.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Iam suggesting having a checkbox in the job configuration which explicitly needs to be checked to have the load rule in the path of the module root . This way all the current job configuration will not be affected unless people want to have it. |
||
| } | ||
| } | ||
| // Should never happen, because viewName must not be null, and if viewpath is null, then it is made equal to viewName | ||
| throw new IllegalStateException("View path name cannot be null. There is a bug inside AbstractClearCaseScm."); | ||
| } | ||
|
|
||
| public int getMultiSitePollBuffer() { | ||
|
|
||
| return multiSitePollBuffer; | ||
|
|
@@ -618,8 +644,7 @@ public String getViewPath(VariableResolver<String> variableResolver) { | |
| } | ||
| return normalized; | ||
| } | ||
|
|
||
| /** | ||
| /** | ||
| * Return string array containing the paths in the view that should be used when polling for changes. | ||
| * | ||
| * @param variableResolver | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid these kind of changes, they clutter the diff