Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
FIY695
jenkins
提交
a68d6447
J
jenkins
项目概览
FIY695
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a68d6447
编写于
6月 05, 2012
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
差异文件
Merge commit '
ddd68671
'
上级
0032c505
ddd68671
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
98 addition
and
7 deletion
+98
-7
core/src/main/java/hudson/PluginManager.java
core/src/main/java/hudson/PluginManager.java
+1
-0
core/src/main/java/hudson/model/AbstractBuild.java
core/src/main/java/hudson/model/AbstractBuild.java
+10
-2
core/src/main/java/hudson/model/AbstractProject.java
core/src/main/java/hudson/model/AbstractProject.java
+3
-4
core/src/main/resources/lib/hudson/project/config-scm.jelly
core/src/main/resources/lib/hudson/project/config-scm.jelly
+1
-1
maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
+10
-0
test/src/main/java/jenkins/scm/SCMCheckoutStrategyTest.java
test/src/main/java/jenkins/scm/SCMCheckoutStrategyTest.java
+73
-0
未找到文件。
core/src/main/java/hudson/PluginManager.java
浏览文件 @
a68d6447
...
@@ -706,6 +706,7 @@ public abstract class PluginManager extends AbstractModelObject {
...
@@ -706,6 +706,7 @@ public abstract class PluginManager extends AbstractModelObject {
throw
new
Failure
(
hudson
.
model
.
Messages
.
Hudson_NotAPlugin
(
fileName
));
throw
new
Failure
(
hudson
.
model
.
Messages
.
Hudson_NotAPlugin
(
fileName
));
}
}
final
String
baseName
=
FilenameUtils
.
getBaseName
(
fileName
);
final
String
baseName
=
FilenameUtils
.
getBaseName
(
fileName
);
new
File
(
rootDir
,
baseName
+
".hpi"
).
delete
();
// don't keep confusing legacy *.hpi
fileItem
.
write
(
new
File
(
rootDir
,
baseName
+
".jpi"
));
// rename all new plugins to *.jpi
fileItem
.
write
(
new
File
(
rootDir
,
baseName
+
".jpi"
));
// rename all new plugins to *.jpi
fileItem
.
delete
();
fileItem
.
delete
();
...
...
core/src/main/java/hudson/model/AbstractBuild.java
浏览文件 @
a68d6447
...
@@ -439,6 +439,14 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
...
@@ -439,6 +439,14 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
return
Executor
.
currentExecutor
().
getOwner
().
getNode
();
return
Executor
.
currentExecutor
().
getOwner
().
getNode
();
}
}
public
Launcher
getLauncher
()
{
return
launcher
;
}
public
BuildListener
getListener
()
{
return
listener
;
}
/**
/**
* Allocates the workspace from {@link WorkspaceList}.
* Allocates the workspace from {@link WorkspaceList}.
*
*
...
@@ -482,8 +490,8 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
...
@@ -482,8 +490,8 @@ public abstract class AbstractBuild<P extends AbstractProject<P,R>,R extends Abs
wl
.
beforeUse
(
AbstractBuild
.
this
,
lease
.
path
,
listener
);
wl
.
beforeUse
(
AbstractBuild
.
this
,
lease
.
path
,
listener
);
}
}
getProject
().
getS
CM
CheckoutStrategy
().
preCheckout
(
AbstractBuild
.
this
,
launcher
,
this
.
listener
);
getProject
().
getS
cm
CheckoutStrategy
().
preCheckout
(
AbstractBuild
.
this
,
launcher
,
this
.
listener
);
getProject
().
getS
CM
CheckoutStrategy
().
checkout
(
this
);
getProject
().
getS
cm
CheckoutStrategy
().
checkout
(
this
);
if
(!
preBuild
(
listener
,
project
.
getProperties
()))
if
(!
preBuild
(
listener
,
project
.
getProperties
()))
return
Result
.
FAILURE
;
return
Result
.
FAILURE
;
...
...
core/src/main/java/hudson/model/AbstractProject.java
浏览文件 @
a68d6447
...
@@ -531,11 +531,11 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
...
@@ -531,11 +531,11 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return
quietPeriod
!=
null
?
quietPeriod
:
Jenkins
.
getInstance
().
getQuietPeriod
();
return
quietPeriod
!=
null
?
quietPeriod
:
Jenkins
.
getInstance
().
getQuietPeriod
();
}
}
public
SCMCheckoutStrategy
getS
CM
CheckoutStrategy
()
{
public
SCMCheckoutStrategy
getS
cm
CheckoutStrategy
()
{
return
scmCheckoutStrategy
==
null
?
new
DefaultSCMCheckoutStrategyImpl
()
:
scmCheckoutStrategy
;
return
scmCheckoutStrategy
==
null
?
new
DefaultSCMCheckoutStrategyImpl
()
:
scmCheckoutStrategy
;
}
}
public
void
setS
CM
CheckoutStrategy
(
SCMCheckoutStrategy
scmCheckoutStrategy
)
throws
IOException
{
public
void
setS
cm
CheckoutStrategy
(
SCMCheckoutStrategy
scmCheckoutStrategy
)
throws
IOException
{
this
.
scmCheckoutStrategy
=
scmCheckoutStrategy
;
this
.
scmCheckoutStrategy
=
scmCheckoutStrategy
;
save
();
save
();
}
}
...
@@ -1988,9 +1988,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
...
@@ -1988,9 +1988,8 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return
c
;
return
c
;
}
}
public
List
<
SCMCheckoutStrategyDescriptor
>
getApplicableSCMCheckoutStrategyDescriptors
(
@AncestorInPath
AbstractProject
p
)
{
public
List
<
SCMCheckoutStrategyDescriptor
>
getApplicableSCMCheckoutStrategyDescriptors
(
AbstractProject
p
)
{
return
SCMCheckoutStrategyDescriptor
.
_for
(
p
);
return
SCMCheckoutStrategyDescriptor
.
_for
(
p
);
}
}
/**
/**
...
...
core/src/main/resources/lib/hudson/project/config-scm.jelly
浏览文件 @
a68d6447
...
@@ -38,7 +38,7 @@ THE SOFTWARE.
...
@@ -38,7 +38,7 @@ THE SOFTWARE.
</j:forEach>
</j:forEach>
</f:section>
</f:section>
<j:set var="descriptors" value="${descriptor.getApplicableSCMCheckoutStrategyDescriptors()}"/>
<j:set var="descriptors" value="${descriptor.getApplicableSCMCheckoutStrategyDescriptors(
instance
)}"/>
<j:if test="${descriptors.size() gt 1}">
<j:if test="${descriptors.size() gt 1}">
<f:section title="${%Advanced Source Code Management}">
<f:section title="${%Advanced Source Code Management}">
<f:dropdownDescriptorSelector title="${%SCM Checkout Strategy}" field="scmCheckoutStrategy"
<f:dropdownDescriptorSelector title="${%SCM Checkout Strategy}" field="scmCheckoutStrategy"
...
...
maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
浏览文件 @
a68d6447
...
@@ -807,8 +807,18 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
...
@@ -807,8 +807,18 @@ public class MavenModuleSet extends AbstractMavenProject<MavenModuleSet,MavenMod
return
activities
;
return
activities
;
}
}
/**
*
* @deprecated for backward comp only
* @return
*/
public
String
getRootPOM
(){
return
getRootPOM
(
null
);
}
/**
/**
* Gets the location of top-level <tt>pom.xml</tt> relative to the workspace root.
* Gets the location of top-level <tt>pom.xml</tt> relative to the workspace root.
* @since 1.466
*/
*/
public
String
getRootPOM
(
EnvVars
env
)
{
public
String
getRootPOM
(
EnvVars
env
)
{
if
(
rootPOM
==
null
)
return
"pom.xml"
;
if
(
rootPOM
==
null
)
return
"pom.xml"
;
...
...
test/src/main/java/jenkins/scm/SCMCheckoutStrategyTest.java
0 → 100644
浏览文件 @
a68d6447
package
jenkins.scm
;
import
com.gargoylesoftware.htmlunit.html.HtmlPage
;
import
hudson.model.FreeStyleProject
;
import
org.jvnet.hudson.test.HudsonTestCase
;
import
org.jvnet.hudson.test.TestExtension
;
import
hudson.model.AbstractProject
;
import
org.kohsuke.stapler.DataBoundConstructor
;
import
hudson.model.AbstractBuild.AbstractBuildExecution
;
import
org.xml.sax.SAXException
;
import
java.io.IOException
;
/**
*
*
* @author Kohsuke Kawaguchi
*/
public
class
SCMCheckoutStrategyTest
extends
HudsonTestCase
{
public
void
testConfigRoundtrip
()
throws
Exception
{
assertEquals
(
1
,
SCMCheckoutStrategyDescriptor
.
all
().
size
());
FreeStyleProject
p
=
createFreeStyleProject
();
assertFalse
(
pageHasUI
(
p
));
// no configuration UI because there's only one option
}
/**
* This should show the UI.
*/
public
void
testConfigRoundtrip2
()
throws
Exception
{
assertEquals
(
2
,
SCMCheckoutStrategyDescriptor
.
all
().
size
());
FreeStyleProject
p
=
createFreeStyleProject
();
System
.
out
.
println
(
SCMCheckoutStrategyDescriptor
.
all
());
TestSCMCheckoutStrategy
before
=
new
TestSCMCheckoutStrategy
();
p
.
setScmCheckoutStrategy
(
before
);
configRoundtrip
(
p
);
SCMCheckoutStrategy
after
=
p
.
getScmCheckoutStrategy
();
assertNotSame
(
before
,
after
);
assertSame
(
before
.
getClass
(),
after
.
getClass
());
assertTrue
(
pageHasUI
(
p
));
}
private
boolean
pageHasUI
(
FreeStyleProject
p
)
throws
IOException
,
SAXException
{
HtmlPage
page
=
createWebClient
().
getPage
(
p
,
"configure"
);
return
page
.
getWebResponse
().
getContentAsString
().
contains
(
"Advanced Source Code Management"
);
}
public
static
class
TestSCMCheckoutStrategy
extends
SCMCheckoutStrategy
{
@DataBoundConstructor
public
TestSCMCheckoutStrategy
()
{
}
@Override
public
void
checkout
(
AbstractBuildExecution
execution
)
throws
IOException
,
InterruptedException
{
execution
.
getListener
().
getLogger
().
println
(
"Hello!"
);
super
.
checkout
(
execution
);
}
@TestExtension
(
"testConfigRoundtrip2"
)
public
static
class
DescriptorImpl
extends
SCMCheckoutStrategyDescriptor
{
@Override
public
boolean
isApplicable
(
AbstractProject
project
)
{
return
true
;
}
@Override
public
String
getDisplayName
()
{
return
getClass
().
getName
();
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录