Boris Brodski's Profile

GitHub User: borisbrodski

Site: http://sevenzipjbind.sourceforge.net/

Comments by Boris Brodski

Avatar

Hi,

You generate code in the IGenerator implementation.
Take a look of the screencast 3:

http://xtextcasts.org/episodes/3-parameterized-enum-2

Cheers,
Boris

Avatar

Hello,

this isn't that easy and it wasn't topic of the screencast. You have to configure and run eclipse in headless mode using eclipse compiler and export routines.

Avatar

Yes, starting with Xtext 2.5.0 you need a new dependency:

  • org.objectweb.asm (version 3.3.1 or later)

Just add the new jar to your build process.

Avatar

Thank you very much for your contribution!

Avatar

Hi Kunal,

you alter wrong MWE workflow file.

Normally with Xtext 2.0 you have two MWE files. First MWE workflow (that you posted here) is used to generate java and other artifacts from your MyDsl.xtext grammar. We will leave it alone for now.

The second workflow is used to generate code from your DSL. You will find this MWE file in the same directory your generator class located in. Within this MWE file you can define custom outlets, like I showed in my previous comment.

Avatar

In Xtext version 2.0.1 you probably use MWE workflow files to run the generator. In this case you define your output configurations (called outlets) as follow

component = org.eclipse.xtext.generator.GeneratorComponent {
  ...
  outlet = { // Default output configuration
    path = targetDir
  }

  outlet = { // Custom output configuration
    path = targetDir
    outletName = "XML-FILES"
  }
}

Then within your generator you can specify the letout to use

Generator.java
  // Write into "XML-FILES" outlet
  fsa.generateFile("config.xml", "XML-FILES", fileContent);
Avatar

Hi,

could you please provide the Xtext version you are using?

Cheers

Avatar

Thank you for the contribution. Scope is a complex topic, that will be often misunderstood. I will definitely make more episodes about it in the future.

Avatar

Hi,

I use following command to find jars with required classes:

$ cd path/to/eclipse/plugins
$ find . -name "*.jar" -print -exec bash -c 'unzip -l "{}" | grep IStatus' \;

Works on Linux/Mac or on MinGW/Cygwin on Windows

Avatar

This is definitively a nice improvement. Prior to this, you had to know or google on how to retrieve your model elements from the resource.

Avatar

I'm happy you like XtextCasts!

Also thank you for the advice with the version information. I already put the versions of the used software at the bottom on the show notes of the episode 17. I will do it for all other episodes soon.

And here again:

  • Eclipse version: 4.2 (Juno)
  • Xtext version: 2.3

There shouldn't be so much differences between Xtext 2.3 and 2.4 considering episode 17. What problems do you have exactly?

Operators:

  • The documentation uses def keyword. For example, see definition of the compile method def compile(Entity e) (page 28).
  • The '::' operator is good, if you want to call a static method, see "Character::isUpperCase(..)" (page 32)

The extended scoping tutorial is planed, but the topic is pretty complicated and because of this very time consuming :-(

Avatar

Yes, it will come :-)

The build with maven is pretty good documented already. Most open source projects (like Jnario and Xtext itself) use it. So, I decided to start with the Ant build.

Meanwhile, you could also take a look at this:
https://github.com/aphethean/xtext-maven-examples