jenkinsci/jenkins — pull request #545 by jglick (2012-08-22 02:31:26+00:00)
Title: [JENKINS-14495] Define Behaviour.specify.

_Not yet ready for merge; filed for evaluation._

The fix of JENKINS-14495 was a bit of a hack: relying on `Function.toString` to uniquely identify behaviors and thus prevent duplicate registrations. Anyway the old `Behaviour.register` failed to provide any way to prioritize registrations, with the result that some callers directly accessed `Behaviour.list`.

Introducing `Behaviour.specify` as a cleaner alternative to these things, and using it from core at least.

`hudsonRules` ~ `jenkinsRules` is a special challenge: this was again directly accessed from core and plugins. Proper handling TBD.

Sources known to use now-deprecated APIs:

ant-plugin/src/main/resources/hudson/tasks/_ant/AntTargetNote/script.js: Behaviour.register({
collapsing-console-sections-plugin/src/main/resources/org/jvnet/hudson/plugins/collapsingconsolesections/CollapsingSectionNote/script.js: Behaviour.register({
copyartifact-plugin/src/main/resources/hudson/plugins/copyartifact/SpecificBuildSelector/config.jelly: Behaviour.register({
ec2-plugin/src/main/resources/hudson/plugins/ec2/EC2Cloud/computerSet.jelly: Behaviour.register({
embeddable-build-status-plugin/src/main/resources/org/jenkinsci/plugins/badge/BadgeAction/index.groovy: Behaviour.register({
form-element-path-plugin/src/main/webapp/script.js: Behaviour.list.push({
form-element-path-plugin/src/main/webapp/script.js: Behaviour.list.unshift({
global-build-stats-plugin/src/main/webapp/scripts/global-build-stats/standardFunctions.js: Behaviour.register(Object.extend(hudsonRules, myHudsonRules));
global-build-stats-plugin/src/main/webapp/scripts/global-build-stats/standardFunctions.js: Behaviour.register(Object.extend(hudsonRules, myHudsonRules));
gradle-plugin/src/main/resources/hudson/plugins/gradle/GradleTaskNote/script.js: Behaviour.register({
jclouds-plugin/src/main/resources/jenkins/plugins/jclouds/compute/JCloudsCloud/computerSet.jelly: Behaviour.register({
jenkins/core/src/main/resources/hudson/matrix/LabelAxis/config.jelly: hudsonRules["DIV.labelAxis-tree"] = function(e) {
jenkins/core/src/main/resources/lib/hudson/projectViewNested.js: hudsonRules["IMG.treeview-fold-control"] = function(e) {
jenkins/core/src/main/resources/lib/layout/breadcrumbs.js: jenkinsRules["#breadcrumbs LI"] = function (e) {
jenkins/core/src/main/resources/lib/layout/breadcrumbs.js: jenkinsRules["A.model-link"] = function (a) {
jenkins/ui-samples-plugin/src/main/resources/jenkins/plugins/ui_samples/SyntaxHighlightedTextArea/index.groovy: hudsonRules["TEXTAREA.my-groovy-textbox"] = function(e) {
matrix-project-plugin/src/main/resources/hudson/matrix/LabelAxis/config.jelly: hudsonRules["DIV.labelAxis-tree"] = function(e) {
openid-plugin/src/main/resources/hudson/plugins/openid/OpenIdUserProperty/config.jelly: Behaviour.register({
openstack-plugin/src/main/resources/jenkins/plugins/openstack/OpenstackCloud/computerSet.jelly: Behaviour.register({
phing-plugin/src/main/resources/hudson/plugins/phing/console/PhingTargetNote/script.js: Behaviour.register({
publish-over-ssh-plugin/src/main/webapp/js/pos.js: Behaviour.register(sshBehave);
role-strategy-plugin/src/main/resources/com/michelin/cio/hudson/plugins/rolestrategy/RoleStrategyConfig/assign-global-roles.jelly: Behaviour.register({
role-strategy-plugin/src/main/resources/com/michelin/cio/hudson/plugins/rolestrategy/RoleStrategyConfig/assign-project-roles.jelly: Behaviour.register({
role-strategy-plugin/src/main/resources/com/michelin/cio/hudson/plugins/rolestrategy/RoleStrategyConfig/manage-global-roles.jelly: Behaviour.register({"#globalRoles TD.start A" : deleteGlobalRole});
role-strategy-plugin/src/main/resources/com/michelin/cio/hudson/plugins/rolestrategy/RoleStrategyConfig/manage-global-roles.jelly: Behaviour.register({"#globalRoles TD.stop A" : deleteGlobalRole});
role-strategy-plugin/src/main/resources/com/michelin/cio/hudson/plugins/rolestrategy/RoleStrategyConfig/manage-project-roles.jelly: Behaviour.register({"#projectRoles TD.in-place-edit" : function(e) {
role-strategy-plugin/src/main/resources/com/michelin/cio/hudson/plugins/rolestrategy/RoleStrategyConfig/manage-project-roles.jelly: Behaviour.register({"#projectRoles TD.start A" : deleteProjectRole});
role-strategy-plugin/src/main/resources/com/michelin/cio/hudson/plugins/rolestrategy/RoleStrategyConfig/manage-project-roles.jelly: Behaviour.register({"#projectRoles TD.stop A" : deleteProjectRole});
sectioned-view-plugin/src/main/resources/hudson/plugins/sectioned_view/ViewListingSection/config.jelly: hudsonRules["DIV.views-tree"] = function(e) {
shiningpanda-plugin/src/main/resources/jenkins/plugins/shiningpanda/matrix/PythonAxis/config.jelly: hudsonRules["DIV.pythonAxis-tree"] = function(e) {