Skip to content

Adding a project to the Rascal libraries

Jurgen J. Vinju edited this page Oct 20, 2017 · 7 revisions

At https://update.rascal-mpl.org/libs/ we publish a set of Eclipse features which bundle Rascal projects that contain generic and reusable library feature or specific language support for programming languages.

Steps to add a project to the update site

  1. Create a Rascal project in Eclipse and add your Rascal and Java source code files.
  2. Make sure the project has a META-INF/RASCAL.MF file with the right information. If the project has a main function for example to register an Eclipse IDE language, this needs to be specified right there.
  3. Add a plugin.xml file with this extension: <extension id="rascal-ecore-library" point="rascal_eclipse.rascalLibrary"> </extension>
  4. Copy a Jenkinsfile from an existing plugin, like clair
  5. Copy a pom.xml from an existing plugin like clair and change the name of the project inside.
  6. git push your project with the new pom.xml and Jenkinsfile
  7. Go to http://ci.usethesource.io/ and edit the configuration of the SWAT organisation to include the new project name as one of the projects to search for a Jenkinsfile.
  8. Edit rascal-eclipse-libraries/pom.xml and add your new project as a module
  9. Copy -r an existing feature project to a new project: cp -r rascal-eclipse-libraries/clair rascal-eclipse-libraries/my-project
  10. Edit rascal-eclipse-libraries/my-project/feature.xml to contain the right information (pay attention to the title, the license, the URL)
  11. update update-site/{site,category}.xml by adding the new feature
  12. git commit -am "added new feature"; git push
  13. Done.

If your project contains Java code then it is imperative to have configured build.properties in such a way that:

  1. All Rascal source files en up in the jar in a sub-folder called src
  2. All class files end up in the top-level jar

Example build.properties file

bin.includes = META-INF/,\
               src/,\
               plugin.xml,\
               LICENSE,\
               CITATION,\
               .
source.. = src/

Example plugin.xml file

<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin
>
   <extension
         point="rascal_eclipse.rascalLibrary">
   </extension>
</plugin>

Example META-INF/MANIFEST.MF

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: clair
Bundle-SymbolicName: clair;singleton:=true
Bundle-Version: 0.1.0.qualifier
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: org.eclipse.cdt.core;bundle-version="6.2.0",
 rascal_eclipse;bundle-version="0.8.4",
 org.eclipse.core.runtime;bundle-version="3.12.0",
 org.apache.commons.lang;bundle-version="2.6.0"

Example META-INF/RASCAL.MF

Manifest-Version: 0.0.1
Main-Function: main
Main-Module: Plugin
Source: src

Example pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>io.usethesource</groupId>
		<artifactId>pom-parent</artifactId>
		<version>0.2.0-SNAPSHOT</version>
	</parent>

	<artifactId>clair</artifactId>
	<groupId>org.rascalmpl</groupId>
	<version>0.1.0-SNAPSHOT</version>
	<packaging>eclipse-plugin</packaging>

	<scm>
		<developerConnection>scm:git:https://github.com/cwi-swat/clair.git</developerConnection>			
	</scm>

</project>

Example Jenkinsfile

node {
  stage 'Clone'
  checkout scm

  stage 'Build and Test'
  def mvnHome = tool 'M3'
  sh "${mvnHome}/bin/mvn -B clean install"

  build job: '../rascal-eclipse-libraries/master', wait: false
}