Command line compiler for XTend

后端 未结 2 835
谎友^
谎友^ 2021-02-15 15:34

Hi all
I\'ve found XTend (http://xtend-lang.org) and it really sounds great! But, I can\'t see any standalone command line compiler for this language. It seems only to run un

相关标签:
2条回答
  • 2021-02-15 16:21

    It is not documented, but there is indeed a command line compiler in the Xtend code base - the same one used by the Maven plug-in (that is documented in the Xtend homepage).

    If Maven plug-in does not work for you, then you could download the standalone jar version directly from the Maven repository at http://build.eclipse.org/common/xtend/maven/org/eclipse/xtend/org.eclipse.xtend.standalone/2.3.1/ (for version 2.3.1), and execute the org.eclipse.xtend.core.compiler.batch.Main class from it.

    This class executes the xtend compiler, and usage information can be displayed (also readable from the source file).

    0 讨论(0)
  • 2021-02-15 16:23

    You can use the xtend standalone compiler. For my case I copied the following .jar files to a folder named xtendc:

    com.google.guava_21.0.0.v20170206-1425.jar
    com.google.inject_3.0.0.v201312141243.jar
    javax.inject_1.0.0.v20091030.jar
    org.antlr.runtime_3.2.0.v201101311130.jar
    org.apache.log4j_1.2.15.v201012070815.jar
    org.eclipse.emf.common_2.15.0.v20180914-1817.jar
    org.eclipse.emf.ecore.xmi_2.15.0.v20180706-1146.jar
    org.eclipse.emf.ecore_2.16.0.v20181124-0637.jar
    org.eclipse.equinox.common_3.10.200.v20181021-1645.jar
    org.eclipse.jdt.core_3.16.0.v20181130-1748.jar
    org.eclipse.xtend.core_2.16.0.v20181203-1347.jar
    org.eclipse.xtend.lib.macro_2.16.0.v20181203-0507.jar
    org.eclipse.xtext.common.types_2.16.0.v20181203-0528.jar
    org.eclipse.xtext.util_2.16.0.v20181203-0514.jar
    org.eclipse.xtext.xbase.lib_2.16.0.v20181203-0507.jar
    org.eclipse.xtext.xbase_2.16.0.v20181203-0528.jar
    org.eclipse.xtext_2.16.0.v20181203-0514.jar
    org.objectweb.asm_7.0.0.v20181030-2244.jar
    

    And then, in that folder I executed the CLI main class of the batch compiler:

    java -cp "*" org.eclipse.xtend.core.compiler.batch.Main -d <path-to-xtend-gen-folder>  -useCurrentClassLoader <path-to-src-folder>
    

    CLI usage of main class is documented to be as following:

    Usage: Main <options> <source directories>
    where possible options include:
    -d <directory>                      Specify where to place generated xtend files
    -tp <path>                          Temp directory to hold generated stubs and classes
    -cp <path>                          Specify where to find user class files
    -encoding <encoding>                Specify character encoding used by source files
    -javaSourceVersion <version>        Create Java Source compatible to this version. Can be: 1.5, 1.6, 1.7, 1.8, 9, 10
    -noSuppressWarningsAnnotation       Don't put @SuppressWarnings() into generated Java Code
    -generateGeneratedAnnotation        Put @Generated into generated Java Code
    -includeDateInGeneratedAnnnotation  If -generateGeneratedAnnotation is used, add the current date/time.
    -generateAnnotationComment <string> If -generateGeneratedAnnotation is used, add a comment.
    -useCurrentClassLoader              Use current classloader as parent classloader
    -writeTraceFiles                    Write Trace-Files
    

    so you will need to pass your classpath there.

    0 讨论(0)
提交回复
热议问题