Sharpen is an Eclipse plugin created by db4o that allows you to convert your Java project into c#
Перейти к файлу
Nathanael Jones d6ea9528fc Merge remote-tracking branch 'upstream/master' 2015-04-29 09:19:53 -04:00
src flat namespace directory structure support, backport from ngit's sharper 2015-04-06 16:44:38 +03:00
travis Travis: Fix bug preventing versions from being detected. 2015-01-23 17:46:31 -05:00
.gitignore Travis: Add code_quality_report.txt to every release. AppVeyor: fix log classification type. 2015-01-27 13:01:02 -05:00
.travis.yml Travis: Add code_quality_report.txt to every release. AppVeyor: fix log classification type. 2015-01-27 13:01:02 -05:00
LICENSE.txt Rename LICENSE.txt to make qulice happy 2015-01-27 10:17:46 -05:00
README.md Readme: Fix badges. 2015-04-13 08:52:17 -07:00
appveyor.yml Travis: Add code_quality_report.txt to every release. AppVeyor: fix log classification type. 2015-01-27 13:01:02 -05:00
pom.xml pom.xml: Fix source directories to match new layout; correct contributor name. 2015-01-27 10:19:54 -05:00

README.md

Sharpen - Automated Java->C# coversion

imazen/sharpen masterimazen master - AppVeyor develop imazen develop - AppVeyor

mono/sharpen mastermono master - AppVeyor (permissions issue) develop mono develop - AppVeyor (permissions issue)

Sharpen is a library and command-line tool for automating Java to C# code conversion. You can provide configuration classes to control a wide range of class and functionality mapping.

Sharpen doesnt provide a compatibility runtime (i.e, an implementation of all java functionality on top of .NET), but it does provide some utility classes to meet the most common needs.

Its likely that you will need to create a configuration class to customize and perfect your conversion, and you may need to apply patches to the result as well.

Sharpen was originally created by db40 svn source here in the format of an Eclipse plugin, but it has since been refactored to work from the command line and on build servers.

Building and testing sharpen itself

  1. Clone this repository
  2. Install Java 7 and maven. Java 6 and 8 arent supported.
  3. Run mvn clean test to test
  4. Run mvn install to generate .jar files in /sharpen.core/target

Running sharpen

  1. mvn install should have created a file named sharpencore-0.0.1-SNAPSHOT-jar-with-dependencies.jar. This is a self-contained copy of sharpen that can be run anywhere.
  2. Run java -jar sharpencore-0.0.1-SNAPSHOT-jar-with-dependencies.jar SOURCEPATH -cp JAR_DEPENDENCY_A JAR_DEPENDENCY_B
    Each dependecy needed by the java source should be specified as a full path to the jar file. SOURCEPATH should also be a full path.
  3. Run -help for syntax

Sharpen allows for configuration through code

Sharpens command-line options dont let you fully override all conversion options and behaviour. For example if you need to change mapping of primitive types or allow/deny mapping between iterators and enumerators, ...

Creating external config class

Your external configuration class must:

  • inherit Configuration class;
  • must be publicly visible;
  • must have a public constructor;

An example configuration project can be found here https://github.com/ydanila/sharpen_imazen_config.

Using your custom config class

Name your jar file <configuration class name>.sharpenconfig.jar in the sharpen directory. Then specify the full configuration name via the command line parameter -configurationClass (or via the options file).

For example, for the XMP core port with this prebuilt Sharpen configuration could be used as follows.

java -jar sharpen-jar-with-dependencies.jar C:/java_src/ -configurationClass sharpen.config.MEConfiguration @sharpen-all-options-without-configuration

Configuration also could be specified in an options file. In this case, for the XMP core port with this prebuilt Sharpen configuration it could be used like this:

java -jar sharpen-jar-with-dependencies.jar C:/java_src/ @sharpen-all-options