开发者

Eclipse: how to run plugin test as part of local build

开发者 https://www.devze.com 2022-12-08 19:24 出处:网络
Due to incomplete understanding of eclipse infrastructure I have one problem. Historically we have one ugly thing in our build procedure. It looks like following:

Due to incomplete understanding of eclipse infrastructure I have one problem. Historically we have one ugly thing in our build procedure. It looks like following:

After eclipse builds entire workspace there is one incomplete thing in local build of plugins. It is some data file which is currently built during execution of special plugin test (which is actually tests nothing, but do generation of necessary data). It isn't necessary to execute that test after any change in workspace. Actually that needed only after changes in parts of code which is touched very rarely. But if changes in that parts of code are made then the build became unusable before update of that special data file. That fi开发者_如何学Gole is now stored on CVS since now it can be created only locally, but it's necessary in product build.

I want to change build procedure in such way that this plugin test will be executed during workspace build procedure so it will be unnecessary to have manual runs of it. I've tried to write ant file which will run that test using templates from org.eclipse.test/library.xml, but the plugin didn't loaded. I don't know why this happens, but I'm afraid that this can happen due to absence of test plugins in my working copy of eclipse.

I've read some articles about running plugin tests in batch mode, but they only strengthen my feeling about necessity of separate eclipse copy for testing developed plugins.

We're using ant for plugin builds and the entire structure of these scripts is very complex, so I think it will be impossible to make global changes in build procedure on top level. Which options do I have to finish my task? Maybe someone already had a similar experience...

Please note, that in fact I want to get rid of that test in favor of some special eclipse application, but I think it isn't important right now, since I believe that my problem can be more general than running plugin tests.


My guess is that you have some source files which, when changed, force a rebuild of the data file. That rebuild is somewhat slow, so you don't want to do it all the time.

I'd attack this like so: Move all the code, that the data file depends on, into a single project. Write an ANT script which builds the data file. Add that ANT script as a custom builder to the project (open the project properties and then click on "Builders") and run it on every change in the project. That will keep your data file current just by saving one of the input files.


This is how ANT script should look like:

  <!-- Prepare extension -->
  <mkdir dir="${extension_dir}/eclipse"/>
  <antcall target="make_symlink">
     <param name="target" value="${workspace_loc}"/>
     <param name="source" value="${symlink_location}"/>
  </antcall>

  <!-- Install extension -->
  <mkdir dir="${eclipse-home}/links"/>
  <echo file="${link_file}">path=${extension_dir}</echo>

  <!-- Run test -->
  <antcall target="core-test">
     <param name="plugin-name" value="testsPlugin"/>
     <param name="classname" value="testsPlugin.TestsClass"/>
     <param name="data-dir" value="${workspace_loc}/../some_workspace"/>
     <param name="plugin-path" value="${workspace_loc}"/>
  </antcall>

  <!-- Uninstall extension -->
  <delete file="${link_file}"/>

  <!-- Delete extension -->
  <antcall target="delete_symlink">
     <param name="source" value="${symlink_location}"/>
  </antcall>
  <delete dir="${extension_dir}"/>

This script should be parameterized by "eclipse-home", "os", "ws", "arch" paremeters. First of them is path to slave eclipse instance and last three is properties used to match running platform. In local builds they can have values of osgi.os, ogsi.ws and osgi.arch respectively.

0

精彩评论

暂无评论...
验证码 换一张
取 消