提交 c9ad878e 编写于 作者: J Josh Soref 提交者: Oleg Nenashev

Cleanup groovy (#4033)

* IntelliJ/Groovy: deprecation

This is pretty useless as getSecurityKey is also deprecated

* IntelliJ/Groovy: deprecation

Resolve ApiTokenFilter is deprecated

* IntelliJ/Groovy: Semicolons are Optional

* This import is required by a bean/hudson.util.spring.BeanBuilder
上级 09f5fff8
// Usage: groovy move-l10n.groovy hudson/model/OldClass/old-view jenkins/model/NewClass/new-view 'Some\ Translatable\ Text'
// (The new view may be given as '-' to simply delete the key.)
def oldview = args[0];
def newview = args[1];
def key = args[2];
def oldview = args[0]
def newview = args[1]
def key = args[2]
def scriptDir = new File(getClass().protectionDomain.codeSource.location.path).parent;
def resDir = new File(scriptDir, 'src/main/resources');
def scriptDir = new File(getClass().protectionDomain.codeSource.location.path).parent
def resDir = new File(scriptDir, 'src/main/resources')
def basename = new File(resDir, oldview).name;
def basename = new File(resDir, oldview).name
for (p in new File(resDir, oldview).parentFile.listFiles()) {
def n = p.name;
def n = p.name
if (n == "${basename}.properties" || n.startsWith("${basename}_") && n.endsWith(".properties")) {
def lines = p.readLines('ISO-8859-1');
def lines = p.readLines('ISO-8859-1')
// TODO does not handle multiline values correctly
def matches = lines.findAll({it.startsWith("${key}=")});
def matches = lines.findAll({it.startsWith("${key}=")})
if (!matches.isEmpty()) {
lines.removeAll(matches);
lines.removeAll(matches)
p.withWriter('ISO-8859-1') {out ->
lines.each {line -> out.writeLine(line)}
}
if (newview == '-') {
println("deleting ${matches.size()} matches from ${n}");
println("deleting ${matches.size()} matches from ${n}")
} else {
def nue = new File(resDir, newview + n.substring(basename.length()));
println("moving ${matches.size()} matches from ${n} to ${nue.name}");
def nue = new File(resDir, newview + n.substring(basename.length()))
println("moving ${matches.size()} matches from ${n} to ${nue.name}")
// TODO if the original lacked a trailing newline, this will corrupt previously final key
nue.withWriterAppend('ISO-8859-1') {out ->
matches.each {line -> out.writeLine(line)}
......
package dsld
import com.intellij.openapi.module.*;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.module.*
import com.intellij.openapi.roots.*
def ctx = context(scope:scriptScope()) // TODO: make this more restrictive
......@@ -38,9 +38,9 @@ contributor(ctx) {
// normally, built-in delegateTo function would do, except in this case
// we'd like to avoid binding getMy.
for ( String t : ["org.kohsuke.stapler.jelly.groovy.JellyBuilder","org.kohsuke.stapler.jelly.groovy.StaplerClosureScript"]) {
def c = findClass(t);
c.allMethods.findAll { !it.isConstructor() && it.name!="getMy" }.each { add it; }
c.allFields.each { add it; }
def c = findClass(t)
c.allMethods.findAll { !it.isConstructor() && it.name!="getMy" }.each { add it }
c.allFields.each { add it }
}
}
......
......@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.PluginManager;
package hudson.PluginManager
l=namespace(lib.LayoutTagLib)
l.header()
......
package hudson.ProxyConfiguration;
package hudson.ProxyConfiguration
def f=namespace(lib.FormTagLib)
......
package hudson.model.EnvironmentContributor.EnvVarsHtml;
package hudson.model.EnvironmentContributor.EnvVarsHtml
import hudson.model.EnvironmentContributor
import hudson.scm.SCM
......
......@@ -25,5 +25,5 @@
def l = namespace(lib.LayoutTagLib)
l.icon(class: 'icon-yellow icon-md')
text(" ");
text(" ")
text(my.message)
package hudson.model.UsageStatistics;
package hudson.model.UsageStatistics
def f=namespace(lib.FormTagLib)
......
package hudson.model.View;
package hudson.model.View
t=namespace(lib.JenkinsTagLib)
st=namespace("jelly:stapler")
......@@ -7,19 +7,19 @@ if (items == null) {
p(_('broken'))
} else if (items.isEmpty()) {
if (app.items.size() != 0) {
set("views",my.owner.views);
set("currentView",my);
include(my.owner.viewsTabBar, "viewTabs");
set("views",my.owner.views)
set("currentView",my)
include(my.owner.viewsTabBar, "viewTabs")
}
include(my,"noJob.jelly");
include(my,"noJob.jelly")
} else {
t.projectView(jobs: items, showViewTabs: true, columnExtensions: my.columns, indenter: my.indenter, itemGroup: my.owner.itemGroup) {
set("views",my.owner.views);
set("currentView",my);
set("views",my.owner.views)
set("currentView",my)
if (my.owner.class == hudson.model.MyViewsProperty.class) {
include(my.owner?.myViewsTabBar, "myViewTabs");
include(my.owner?.myViewsTabBar, "myViewTabs")
} else {
include(my.owner.viewsTabBar,"viewTabs");
include(my.owner.viewsTabBar,"viewTabs")
}
}
}
\ No newline at end of file
......@@ -22,8 +22,8 @@ l.layout(norefresh:true, permission:app.ADMINISTER, title:my.displayName, csscla
p()
div(class:"behavior-loading", _("LOADING"))
f.form(method:"post",name:"config",action:"configure") {
set("instance",my);
set("descriptor", my.descriptor);
set("instance",my)
set("descriptor", my.descriptor)
f.optionalBlock( field:"useSecurity", title:_("Enable security"), checked:app.useSecurity) {
f.entry() {
......@@ -58,7 +58,7 @@ l.layout(norefresh:true, permission:app.ADMINISTER, title:my.displayName, csscla
}
f.advanced(title: _("Agent protocols"), align:"left") {
f.entry(title: _("Agent protocols")) {
def agentProtocols = my.agentProtocols;
def agentProtocols = my.agentProtocols
table(width:"100%") {
for (AgentProtocol p : AgentProtocol.all()) {
if (p.name != null && !p.required) {
......@@ -66,19 +66,19 @@ l.layout(norefresh:true, permission:app.ADMINISTER, title:my.displayName, csscla
f.checkbox(name: "agentProtocol",
title: p.displayName,
checked: agentProtocols.contains(p.name),
json: p.name);
json: p.name)
}
tr() {
td(colspan:"2");
td(colspan:"2")
td(class:"setting-description"){
st.include(from:p, page: "description", optional:true);
st.include(from:p, page: "description", optional:true)
if (p.deprecated) {
br()
text(b(_("Deprecated. ")))
st.include(from:p, page: "deprecationCause", optional:true);
st.include(from:p, page: "deprecationCause", optional:true)
}
}
td();
td()
}
}
}
......
......@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.tasks.Shell;
package hudson.tasks.Shell
f=namespace(lib.FormTagLib)
f.entry(title:_("Command"),description:_("description",rootURL)) {
......
......@@ -21,7 +21,7 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package hudson.tasks.Shell;
package hudson.tasks.Shell
f=namespace(lib.FormTagLib)
f.section(title:_("Shell")) {
......
......@@ -39,14 +39,14 @@ f.section(title: _("Administrative monitors configuration")) {
f.checkbox(name: "administrativeMonitor",
title: am.displayName,
checked: am.enabled,
json: am.id);
json: am.id)
}
tr() {
td(colspan: "2");
td(colspan: "2")
td(class: "setting-description") {
st.include(from: am, page: "description", optional: true);
st.include(from: am, page: "description", optional: true)
}
td();
td()
}
}
}
......
......@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package jenkins.management.AsynchronousAdministrativeMonitor;
package jenkins.management.AsynchronousAdministrativeMonitor
def l = namespace(lib.LayoutTagLib)
def t = namespace(lib.JenkinsTagLib)
......
......@@ -22,9 +22,9 @@
* THE SOFTWARE.
*/
package jenkins.model.ArtifactManagerConfiguration;
package jenkins.model.ArtifactManagerConfiguration
f = namespace(lib.FormTagLib);
f = namespace(lib.FormTagLib)
if (!jenkins.model.ArtifactManagerFactoryDescriptor.all().isEmpty()) {
f.section(title: _("Artifact Management for Builds")) {
......
package jenkins.model.CauseOfInterruption.UserInterruption;
package jenkins.model.CauseOfInterruption.UserInterruption
// by default we just print the short description.
def user = my.userOrNull
......
package jenkins.model.CauseOfInterruption;
package jenkins.model.CauseOfInterruption
// by default we just print the short description.
text(my.shortDescription)
\ No newline at end of file
package jenkins.model.CoreEnvironmentContributor;
package jenkins.model.CoreEnvironmentContributor
def l = namespace(lib.JenkinsTagLib)
......
......@@ -5,4 +5,4 @@ import hudson.Functions
def f=namespace(lib.FormTagLib)
f.descriptorList(title:_("Global properties"), name:"globalNodeProperties",
instances: app.globalNodeProperties, descriptors: Functions.getGlobalNodePropertyDescriptors());
instances: app.globalNodeProperties, descriptors: Functions.getGlobalNodePropertyDescriptors())
package jenkins.model.ProjectNamingStrategy.PatternProjectNamingStrategy;
package jenkins.model.ProjectNamingStrategy.PatternProjectNamingStrategy
def f=namespace(lib.FormTagLib)
......
package jenkins.mvn.GlobalMavenConfig;
package jenkins.mvn.GlobalMavenConfig
def f = namespace(lib.FormTagLib)
......
package jenkins.security.LastGrantedAuthoritiesProperty;
package jenkins.security.LastGrantedAuthoritiesProperty
// nothing to configure here
\ No newline at end of file
package jenkins.security.QueueItemAuthenticator;
package jenkins.security.QueueItemAuthenticator
// the default is empty configuration
\ No newline at end of file
......@@ -23,7 +23,7 @@
*/
package jenkins.security.QueueItemAuthenticatorConfiguration
import jenkins.security.QueueItemAuthenticatorDescriptor;
import jenkins.security.QueueItemAuthenticatorDescriptor
f=namespace(lib.FormTagLib)
......
......@@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package jenkins.security.RekeySecretAdminMonitor;
package jenkins.security.RekeySecretAdminMonitor
def f = namespace(lib.FormTagLib)
......
......@@ -34,7 +34,7 @@ def printEntry(warning, title, checked) {
f.checkbox(name: warning.id,
title: title,
checked: checked,
class: 'hideWarnings');
class: 'hideWarnings')
div(class: "setting-description") {
a(warning.url, href: warning.url)
}
......
......@@ -3,7 +3,7 @@ import hudson.slaves.SlaveComputer
def fmt = new java.text.DecimalFormat("0.0")
def right = 'text-align: right'
if (my instanceof SlaveComputer) {
SlaveComputer c = my;
SlaveComputer c = my
table(class: 'bigtable') {
tr {
......@@ -16,7 +16,7 @@ if (my instanceof SlaveComputer) {
td(style: right) {text(fmt.format(c.classLoadingTime / 1000000000))}
td(style: right) {
text(c.classLoadingCount)
def classLoadingPrefetchCacheCount = c.classLoadingPrefetchCacheCount;
def classLoadingPrefetchCacheCount = c.classLoadingPrefetchCacheCount
if (classLoadingPrefetchCacheCount != -1) {
text(_(' (prefetch cache: '))
text(classLoadingPrefetchCacheCount)
......
package jenkins.widgets.BuildQueueWidget;
package jenkins.widgets.BuildQueueWidget
def t = namespace(lib.JenkinsTagLib.class)
......
......@@ -10,7 +10,7 @@ package lib.form
*/
int port = instance?instance[field]:0;
int port = instance?instance[field]:0
def f=namespace(lib.FormTagLib)
......
......@@ -60,7 +60,7 @@ complete {
match("relaxngDatatype:relaxngDatatype") {
// see http://sourceforge.net/projects/relaxng/
rewriteLicense([],bsdLicense);
rewriteLicense([],bsdLicense)
}
match(["org.kohsuke.jinterop:j-interop","org.kohsuke.jinterop:j-interopdeps"]) {
......@@ -83,7 +83,7 @@ complete {
match("*:sezpoz") {
// GPL-phobia people react to "GPL" strongly, so accept sezpoz under CDDL
rewriteLicense([license("CDDL or GPL 2 with Classpath Exception",null)],cddl);
rewriteLicense([license("CDDL or GPL 2 with Classpath Exception",null)],cddl)
}
match("net.jcip:jcip-annotations") {
......
package jenkins.bugs.Jenkins19124Test.Foo;
package jenkins.bugs.Jenkins19124Test.Foo
def f = namespace(lib.FormTagLib)
......
......@@ -37,7 +37,7 @@ authenticationManager(ProviderManager) {
// these providers apply everywhere
bean(RememberMeAuthenticationProvider) {
key = Jenkins.getInstance().getSecretKey();
key = Jenkins.get().getSecretKey()
},
// this doesn't mean we allow anonymous access.
// we just authenticate anonymous users as such,
......
......@@ -33,15 +33,11 @@ import hudson.security.ChainedServletFilter
import hudson.security.UnwrapSecurityExceptionFilter
import hudson.security.HudsonAuthenticationEntryPoint
import jenkins.security.BasicHeaderProcessor
import org.acegisecurity.providers.anonymous.AnonymousProcessingFilter
import jenkins.security.ExceptionTranslationFilter
import org.acegisecurity.ui.basicauth.BasicProcessingFilter
import org.acegisecurity.providers.anonymous.AnonymousProcessingFilter
import org.acegisecurity.ui.basicauth.BasicProcessingFilterEntryPoint
import org.acegisecurity.ui.rememberme.RememberMeProcessingFilter
import hudson.security.HttpSessionContextIntegrationFilter2
import hudson.security.SecurityRealm
import hudson.security.NoopFilter
import jenkins.security.ApiTokenFilter
// providers that apply to both patterns
def commonProviders() {
......@@ -53,7 +49,7 @@ def commonProviders() {
bean(ExceptionTranslationFilter) {
accessDeniedHandler = new AccessDeniedHandlerImpl()
authenticationEntryPoint = bean(HudsonAuthenticationEntryPoint) {
loginFormUrl = '/'+securityRealm.getLoginUrl()+"?from={0}";
loginFormUrl = '/'+securityRealm.getLoginUrl()+"?from={0}"
}
},
bean(UnwrapSecurityExceptionFilter)
......@@ -69,7 +65,7 @@ filter(ChainedServletFilter) {
// I suspect this is related to JENKINS-12585, in that
// it ends up setting Set-Cookie for image responses.
// Instead, we use layout.jelly to create sessions.
allowSessionCreation = false;
allowSessionCreation = false
},
// if any "Authorization: Basic xxx:yyy" is sent this is the filter that processes it
bean(BasicHeaderProcessor) {
......@@ -104,4 +100,4 @@ legacy(ChainedServletFilter) {
// when using container-authentication we can't hit /login directly.
// we first have to hit protected /loginEntry, then let the container
// trap that into /login.
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册