Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Implementing Domain-Specific Languages with Xtext and Xtend

You're reading from  Implementing Domain-Specific Languages with Xtext and Xtend

Product type Book
Published in Aug 2013
Publisher Packt
ISBN-13 9781782160304
Pages 342 pages
Edition 1st Edition
Languages
Author (1):
Lorenzo Bettini Lorenzo Bettini
Profile icon Lorenzo Bettini

Table of Contents (21) Chapters

Implementing Domain-Specific Languages with Xtext and Xtend
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Implementing a DSL 2. Creating Your First Xtext Language 3. The Xtend Programming Language 4. Validation 5. Code Generation 6. Customizations 7. Testing 8. An Expression Language 9. Type Checking 10. Scoping 11. Building and Releasing 12. Xbase 13. Bibliography
Index

Chapter 11. Building and Releasing

In this chapter we describe how you can release your DSL implementation by creating an Eclipse p2 repository. In this way others can easily install it in Eclipse. With this respect, Xtext provides a wizard that creates the infrastructure to build a p2 repository with Buckminster, an Eclipse project for automatic building. The wizard will also create all the needed files to build your projects and test them in a headless way, that is, outside Eclipse. This makes it easy to run your builds on a continuous integration server.

Release engineering


Once your DSL implementation reaches a mature state, you would like to make it available on the Internet so that others can install it in their Eclipse. You could use the standard Eclipse Export wizard to create ZIP files that others can extract in their Eclipse installation. However, this installation method was deprecated many years ago, in favor of p2 repositories (also called p2 sites), which in turn, have replaced old style Eclipse update sites. Most of the sites you have been using to install new features into your Eclipse are p2 repositories, thus, you should build a p2 repository for your DSL, if you want users to easily install it.

In software engineering, release engineering, abbreviated as releng, concerns the compilation, assembly, and delivery of source code into finished products or other software components. In this section we briefly introduce some scenarios which require release engineering mechanisms. These will be connected to the creation of an installable...

Introduction to Buckminster


Buckminster (http://www.eclipse.org/buckminster) is a set of frameworks and tools for automating the building and assembling of components. It comes in two versions: one is to be installed in the IDE and the second one is to be used headlessly. A very nice feature of Buckminster is that it provides the same tools in both environments. This means that the IDE builds and headless builds are performed the same way; you do not have to deal with multiple ways of building and the potential differences between build technologies.

Buckminster resolves all the dependencies of the software components needed to build, including those that are built from source. When Buckminster knows what is needed, it materializes them by fetching the content, creates workspace projects for source that should be built, and places everything else in the target platform. Buckminster supports many different mechanisms for both dependency resolution and materialization. You can work with the...

Using the Xtext Buckminster wizard


In this chapter we will use a brand new example DSL project to demonstrate the building and releasing mechanisms (of course, the same mechanisms can be applied to an existing DSL as well):

  1. Go to File | New | Project..., in the dialog, navigate to the Xtext category and select Xtext Project.

  2. In the next dialog you should specify the following names:

    • Project name: org.example.build.hello

    • Name: org.example.build.hello.Hello

    • Extensions: hello

    • Check the option Create SDK feature project (this option must be checked for this example to work)

The wizard will create four projects in the workspace and it will open the file Hello.xtext.

We will use this example only for building and releasing, thus, we are not interested in the DSL itself; we can simply leave the default grammar as it is. However, make sure to run the MWE2 workflow at least once, so that all the Xtext artifacts are generated.

We add a Junit Xtend test class, HelloParserTest, in the org.example.build...

Maintaining the examples of this book


All the example DSLs shown in this book are built using Buckminster. Since we have many DSLs to build and we want a single headless build procedure to build them all, we modified the infrastructure of the projects and configuration files created by the Xtext Buckminster wizard. In particular, we have a single feature project, org.example.site, for building the p2 repository of all the example DSLs. Similarly, we have a single releng project, org.example.releng, to perform the headless build of the p2 site for the examples and to run all the Junit tests of all the DSLs.

You may want to look at all the Buckminster files in the releng project to see some variations of what we saw in this chapter. Moreover, the original build.ant file has been enhanced with some utility tasks like the one that automatically installs Buckminster headless if it is not present in the system where the ANT script is executed.

Furthermore, all the examples in this book are built...

Summary


Xtext also helps the programmer in the context of release engineering. Using the Xtext Buckminster wizard it is easy to build a p2 repository for releasing your DSL implementation. It is also easy to set up a headless build process that can be executed in a continuous integration server.

In the next chapter we will briefly present Xbase, a reusable expression language completely interoperable with the Java type system. When you use Xbase in your DSL you will not only inherit the grammar of its expressions, but also its Java type system, its code generator, and all its IDE aspects.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Implementing Domain-Specific Languages with Xtext and Xtend
Published in: Aug 2013 Publisher: Packt ISBN-13: 9781782160304
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}