-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add default manifest entries with Maven #318
Changes from all commits
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 |
---|---|---|
|
@@ -17,6 +17,30 @@ | |
<packaging>hpi</packaging> | ||
|
||
<name>MyNewPlugin</name> | ||
<description>My New Plugin</description> | ||
<url>https://github.com/jenkinsci/verify-it-plugin</url> | ||
|
||
<licenses> | ||
<license> | ||
<name>MIT License</name> | ||
<url>https://opensource.org/licenses/MIT</url> | ||
</license> | ||
</licenses> | ||
|
||
<developers> | ||
<developer> | ||
<id>nchomsky</id> | ||
<name>Noam Chomsky</name> | ||
<email>[email protected]</email> | ||
</developer> | ||
</developers> | ||
|
||
<scm> | ||
<connection>scm:git:https://github.com/jenkinsci/verify-it-plugin.git</connection> | ||
<developerConnection>scm:git:[email protected]:jenkinsci/verify-it-plugin.git</developerConnection> | ||
<tag>HEAD</tag> | ||
<url>https://github.com/jenkinsci/verify-it-plugin</url> | ||
</scm> | ||
|
||
<properties> | ||
<jenkins.version>2.249.1</jenkins.version> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,9 @@ | |
* under the License. | ||
*/ | ||
|
||
import java.nio.file.Files | ||
import java.util.jar.Manifest | ||
|
||
assert new File(basedir, 'target/classes').exists(); | ||
assert new File(basedir, 'target/classes/org/jenkinsci/tools/hpi/its').exists(); | ||
assert new File(basedir, 'target/classes/org/jenkinsci/tools/hpi/its/HelloWorldBuilder.class').exists(); | ||
|
@@ -31,6 +34,31 @@ assert new File(basedir, 'target/generated-sources/localizer/org/jenkinsci/tools | |
content = new File(basedir, 'target/generated-sources/localizer/org/jenkinsci/tools/hpi/its/Messages.java').text; | ||
assert content.contains(" holder.format(\"it.msg\");"); | ||
|
||
assert new File(basedir, 'target/verify-it/META-INF/MANIFEST.MF').exists() | ||
|
||
Files.newInputStream(new File(basedir, 'target/verify-it/META-INF/MANIFEST.MF').toPath()).withCloseable { is -> | ||
Manifest manifest = new Manifest(is) | ||
assert !manifest.getMainAttributes().getValue('Build-Jdk-Spec').isEmpty() | ||
assert manifest.getMainAttributes().getValue('Created-By').startsWith('Maven Archiver') | ||
assert manifest.getMainAttributes().getValue('Extension-Name') == null // was provided by Maven 2, but core prefers Short-Name | ||
assert manifest.getMainAttributes().getValue('Group-Id').equals('org.jenkins-ci.tools.hpi.its') | ||
assert manifest.getMainAttributes().getValue('Hudson-Version').equals('2.249.1') | ||
assert manifest.getMainAttributes().getValue('Implementation-Title').equals('MyNewPlugin') // was project.artifactId in previous versions, now project.name | ||
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. Maven 2 set this to the artifact ID, but Maven 3 sets this to the project name. I couldn't find any code in the ecosystem that relied on this being set to any particular value. |
||
assert manifest.getMainAttributes().getValue('Implementation-Version').equals('1.0-SNAPSHOT') | ||
assert manifest.getMainAttributes().getValue('Jenkins-Version').equals('2.249.1') | ||
assert manifest.getMainAttributes().getValue('Long-Name').equals('MyNewPlugin') | ||
assert manifest.getMainAttributes().getValue('Manifest-Version').equals('1.0') | ||
assert manifest.getMainAttributes().getValue('Minimum-Java-Version').equals('1.8') | ||
assert manifest.getMainAttributes().getValue('Plugin-Developers').equals('Noam Chomsky:nchomsky:[email protected]') | ||
assert manifest.getMainAttributes().getValue('Plugin-License-Name').equals('MIT License') | ||
assert manifest.getMainAttributes().getValue('Plugin-License-Url').equals('https://opensource.org/licenses/MIT') | ||
assert manifest.getMainAttributes().getValue('Plugin-ScmUrl').equals('https://github.com/jenkinsci/verify-it-plugin') | ||
assert manifest.getMainAttributes().getValue('Plugin-Version').startsWith('1.0-SNAPSHOT') | ||
assert manifest.getMainAttributes().getValue('Short-Name').equals('verify-it') | ||
assert manifest.getMainAttributes().getValue('Specification-Title').equals('MyNewPlugin') // was project.description in previous versions, now project.name | ||
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. Core does consume this to display on the installed plugins page, but only if |
||
assert manifest.getMainAttributes().getValue('Url').equals('https://github.com/jenkinsci/verify-it-plugin') | ||
} | ||
|
||
// TODO add some test on hpi file content | ||
|
||
return true; |
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.
Maven 2 set this to the short name, but Maven 3 does not. Core always checks
Short-Name
first and only falls back toExtension-Name
ifShort-Name
is not present. And we always setShort-Name
in this plugin. So this was always redundant and can be safely removed.