Skip to content
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

Convert Groovy views to Jelly | use Jenkins.get() #33

Merged
merged 5 commits into from
Aug 27, 2019

Conversation

Wadeck
Copy link
Contributor

@Wadeck Wadeck commented Oct 28, 2018

  • convert groovy view to jelly
  • use Jenkins.get()
  • reformat code to follow Java convention
  • reorder pom file parts to follow convention
  • rename test variables to follow Jenkins standard

@cloudbees/team-foundation @reviewbybees

@Wadeck Wadeck changed the title Rewamp Upgrade parent pom Oct 28, 2018
<!--
The MIT License

Copyright (c) 2016, CloudBees, Inc.
Copy link
Member

@jvz jvz Oct 29, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Copyright (c) 2016, CloudBees, Inc.
Copyright (c) 2018, CloudBees, Inc.

Or maybe add 2018 to the list?

Copy link
Member

@batmat batmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

pom.xml Outdated
</repository>
</repositories>
<properties>
<jenkins.version>2.107.3</jenkins.version>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note, this bumps the new min baseline pretty aggressively, but fine by me. Anyway old instances never update or close to it.

@@ -79,10 +80,10 @@ public void setJdk(String jdk) {
@Override
public void setUp(Context context, Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener, EnvVars initialEnvironment) throws IOException, InterruptedException {
if (installation != null) {
toolEnv(context, installation, Jenkins.getActiveInstance().getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(), workspace, listener, initialEnvironment);
toolEnv(context, installation, Jenkins.get().getDescriptorByType(Ant.DescriptorImpl.class).getInstallations(), workspace, listener, initialEnvironment);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\o/

src/main/resources/hudson/tasks/AntWrapper/config.jelly Outdated Show resolved Hide resolved
</table>
</l:ajax>
</j:jelly>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/me not convinced about this kind of change: IMO though tempting, we should refrein from reformating unrelated code to make code archeology easier.

jglick
jglick previously requested changes Oct 29, 2018
Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to see what is actually being changed here and why. Anyway #32 probably covers most of what this was doing.

pom.xml Outdated
<relativePath />
</parent>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not reformat existing lines of code.

@@ -1,18 +1,18 @@
/*
* The MIT License
*
*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

- convert groovy view to jelly
- reformat code to follow Java convention
- reorder pom file to follow convention https://maven.apache.org/developers/conventions/code.html
- rename test variables to follow Jenkins standard
- use Jenkins.get()
@Wadeck Wadeck force-pushed the REVAMP_UPGRADE_POM branch from 3d9a0d4 to a3bb68f Compare October 30, 2018 10:02
@Wadeck Wadeck changed the title Upgrade parent pom Rewamp plugin Oct 30, 2018
@Wadeck
Copy link
Contributor Author

Wadeck commented Oct 30, 2018

I rebase the PR after the merge of #32. Also remove some of the pure tab/space reformat to keep mostly the relevant one that increase readability.

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer all formatting changes to be reverted. Use of nondeprecated methods, Groovy → Jelly switch, etc. are actual code changes which sound right, if I could find them.

@@ -23,7 +23,8 @@
public class AntTargetAnnotationTest {

@Rule
public JenkinsRule r = new JenkinsRule();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have actually been preferring the name r, since j is too easily confused with the Jenkins instance itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern here was essentially because the same name is used for RestartableJenkinsRule r. No worries I revert them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My style (FWIW!) is to use RestartableJenkinsRule rr.

@@ -5,7 +5,7 @@
import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Common style for static imports in tests is to use wildcards.

@@ -104,7 +104,7 @@
private final String properties;

@DataBoundConstructor
public Ant(String targets,String antName, String antOpts, String buildFile, String properties) {
public Ant(String targets, String antName, String antOpts, String buildFile, String properties) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately https://github.com/jenkinsci/ant-plugin/pull/33/files?w still does not ignore this, making this diff too long to be read.

@jglick
Copy link
Member

jglick commented Oct 30, 2018

Anyway I am done “maintaining” this—just needed to deliver #32 urgently.

@jglick jglick dismissed their stale review October 30, 2018 14:17

less reformatting than before

@Wadeck Wadeck changed the title Rewamp plugin Convert Groovy views to Jelly | use Jenkins.get() Oct 31, 2018
Copy link
Contributor

@MRamonLeon MRamonLeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐝

Copy link
Member

@fcojfernandez fcojfernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-Approved

Copy link
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience!

-->
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<j:if test="${size(descriptor.installations) != 0}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You tested this logic interactively, right? (Cannot recall if there is a functional test for it.)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(There are actually good reasons to discards the if block and show this dropdown unconditionally, but that would be out of scope for this PR.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You tested this logic interactively, right?

I tested with and without installations but not sure to have cover all other potential cases there.

<select class="setting-input" name="ant.antName">
<option value="(Default)">${%Default}</option>
<j:forEach var="install" items="${descriptor.installations}">
<f:option selected="${install.name == instance.ant.name}" value="${install.name}">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW we ought to have a standard control in core for selecting a tool installation.

@jglick jglick added the chore label Aug 27, 2019
@jglick jglick merged commit 9b28f6f into jenkinsci:master Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants