Wednesday, April 8, 2009

Releasing jEdit plugins

I am a member of the jEdit development group, and as part of that group, I sometimes help release plugins. These are my instructions. I copied this from email and put it here so it is easy to find.

Hudson home page: https://hudson.dev.java.net

Download the latest from here: http://hudson.gotdns.com/latest/hudson.war

Start it with: java -jar hudson.war

It has its own built-in servlet container, so it runs as a webapp.

Point your browser to: http://localhost:8080

Hudson will create ~/.hudson. All the work files (svn checkout, build artifacts, etc) end up there. I didn't bother to change the default directory.

Configure Hudson:
- Click the "Manage Hudson" link. Add in your JDK installations and Ant installations. This lets you easily pick the right JDK and Ant version to build a specific plugin.
- Click the "Manage Plugins" link. Add the "batch-task" plugin.


To build a plugin: (Note, depending on the plugin, you'll need to do this step for each plugin that the plugin depends on.)

On the Hudson front page, click "New Job".
- Fill in the "Job Name". Hudson will make a directory with this name so don't put spaces in the name if you don't like them in your directory names.
- Click "Build a free-style software project". After the first one, you can do "Copy existing job" to save some time.
- Click OK, you'll be taken to the Configure page
- Pick the JDK to use to build the plugin
- Choose Subversion and fill in the the url to the release tag for the plugin
- Fill in the module name if you want.
- Check "Use update" if you want.
- Pick the version of Ant to use to build the plugin.
- You can probably leave the targets field blank, but that might depend on the specific plugin.
- Click the "Advanced" button and add these properties, adjusting for your local paths and the appropriate jEdit installation. I've got my various jEdit installations in ~/apps/jedit/$version/. You might also need to include your xdoclet properties:

build.support=/home/danson/src/plugins/build-support
jedit.install.dir=/home/danson/apps/jedit/4.3pre7
install.dir=/home/danson/apps/jedit/4.3pre7/jars

- Click the "Save" button, you'll be taken to the project home page.
- Click the "Build Now" link.
- Click the date link when the build starts.
- Click "Console output" to see the build output.
- Adjust and repeat as necessary to get the plugin to build.


To package a plugin: (The first 4 steps could be done with the configure steps above.)
- From the project home page, click the "Configure" link.
- Check the "Batch tasks" check box.
- Fill in the task name, I called it "package".
- Fill in the "Script" text area with this, adjusting the values for the plugin:
ant -f /home/danson/src/plugins/build-support/package.xml -Dplugin.name=CommonControls -Dplugin.version=1.0.2 -Djar.filename=CommonControls.jar -Djar.location=/home/danson/apps/jedit/4.3pre11/build/jars -Dsrc.dir=/home/danson/.hudson/jobs/CommonControls/workspace/CommonControls -Dout.dir=/home/danson/tmp/CommonControls
- Go back to the project front page
- Click "task", then "package" (or whatever you named the task) from the box on the right.
- Click the "Build Now" link to tar/zip the files.

I've attached the "package.xml" file referenced in the "Script" section above, I'll probably add it to the build-support project in jEdit subversion. This is what creates the .tgz and .zip files to upload to the file release system.

To release the plugin:
- upload the .tgz and .zip files:
cd to the directory containing the files to upload
> sftp username@frs.sourceforge.net
> cd uploads
> mput *
> bye
- log into https://sourceforge.net/projects/jedit-plugins/
- Click the "Download" tab, then "Browse All Packages", then "Manage Packages/Releases".
- Find your plugin, then click "[Add Release]"
- Enter the version number of the plugin for the release name
- Click the button to create the release
- Paste in the release notes from the plugin release request, click "Submit"
- Check the boxes by the 4 files you uploaded to frs.sourceforge.net, click the "Add files" button.
- Set the processor type and file type for each uploaded file. You have to do these one at a time.
- Send the email release notice if applicable.
- Check that the files with the right version number are available at https://sourceforge.net/project/showfiles.php?group_id=64089
- Log into http://plugins.jedit.org/wiz
- Click the "View packages" link.
- Find your plugin in the list and follow the link.
- Click "View releases"
- Click "Create new release"
- Fill in the form, version number, file sizes, and changes are required. Use the announcement line from the plugin release request or the text for the plugin from http://plugins.jedit.org/list.php. The "changes" text will end up on the http://plugins.jedit.org/list.php page.
- Enter the dependencies, then click the "Update dependencies" button.
- Click the "Create release" button. Ensure your new version is on the next page, you might have to refresh the page to see it.
- Go back to http://plugins.jedit.org/wiz
- Click the "Generate a new plugin list" link.
- Wait a while (next day, maybe) and check that the plugin shows up in Project Manager in jEdit.
- close the release request.




This is package.xml:

   1:<project name="package" default="package" basedir=".">
2:
3: <!-- name of the plugin, e.g. TextObjects -->
4: <property name="plugin.name" value="TextObjects"/>
5:
6: <!-- version of the plugin, e.g. 1.0.1 -->
7: <property name="plugin.version" value="1.0.1"/>
8:
9: <!-- name of the plugin jar file, e.g. TextObjects.jar -->
10: <property name="jar.filename" value="TextObjects.jar"/>
11:
12: <!-- full path location of the plugin jar -->
13: <property name="jar.location" location="/home/danson/.hudson/jobs/jEdit 4.3pre15/workspace/jEdit_4.3pre15/build/jars"/>
14:
15: <!-- comma or whitespace separated list of additional jars to bundle -->
16: <property name="additional.jars" value=""/>
17:
18: <!-- directory containing additional jars to bundle -->
19: <property name="additional.jars.dir" location="${jar.location}"/>
20:
21: <!-- full path location of the source directory for the plugin -->
22: <property name="src.dir" location="/home/danson/.hudson/jobs/TextObjects/workspace/TextObjects_1.0.1"/>
23:
24: <!-- where to put the tgz and zip files -->
25: <property name="out.dir" location="/home/danson/tmp"/>
26:
27: <!-- package the plugin for release to plugin central -->
28: <target name="package">
29: <mkdir dir="${out.dir}"/>
30:
31: <!-- tar/gzip, includes plugin jar, additional jars, and source code -->
32: <property name="tar.filename" value="${out.dir}/${plugin.name}-${plugin.version}"/>
33: <tar destfile="${tar.filename}.tar">
34: <tarfileset dir="${src.dir}">
35: <include name="**/*"/>
36: </tarfileset>
37: <tarfileset dir="${jar.location}">
38: <include name="${jar.filename}"/>
39: </tarfileset>
40: <filelist dir="${additional.jars.dir}" files="${additional.jars}"/>
41: </tar>
42: <gzip zipfile="${tar.filename}.tgz" src="${tar.filename}.tar"/>
43: <delete file="${tar.filename}.tar"/>
44:
45: <!-- tar/gzip bin, only includes plugin jar and additional jars -->
46: <property name="tar.bin.filename" value="${out.dir}/${plugin.name}-${plugin.version}-bin"/>
47: <tar destfile="${tar.bin.filename}.tar">
48: <tarfileset dir="${jar.location}">
49: <include name="${jar.filename}"/>
50: </tarfileset>
51: <filelist dir="${additional.jars.dir}" files="${additional.jars}"/>
52: </tar>
53: <gzip zipfile="${tar.bin.filename}.tgz" src="${tar.bin.filename}.tar"/>
54: <delete file="${tar.bin.filename}.tar"/>
55:
56: <!-- zip bin, only includes plugin jar and additional jars -->
57: <property name="zip.bin.filename" value="${out.dir}/${plugin.name}-${plugin.version}-bin.zip"/>
58: <zip destfile="${zip.bin.filename}">
59: <zipfileset dir="${jar.location}">
60: <include name="${jar.filename}"/>
61: </zipfileset>
62: <filelist dir="${additional.jars.dir}" files="${additional.jars}"/>
63: </zip>
64:
65: <!-- zip, includes plugin jar, additional jars, and source code -->
66: <property name="zip.filename" value="${out.dir}/${plugin.name}-${plugin.version}.zip"/>
67: <zip destfile="${zip.filename}">
68: <zipfileset dir="${src.dir}">
69: <include name="**/*"/>
70: </zipfileset>
71: <zipfileset dir="${jar.location}">
72: <include name="${jar.filename}"/>
73: </zipfileset>
74: <filelist dir="${additional.jars.dir}" files="${additional.jars}"/>
75: </zip>
76: </target>
77:</project>