tartrazine/java
Miguel Molina 8ff885a3a8
implement IsGenerated helper to filter out generated files
Closes #17

Implements the IsGenerated helper function to filter out generated
files using the rules and matchers in:
- https://github.com/github/linguist/blob/master/lib/linguist/generated.rb

Since the vast majority of matchers have very different logic, it cannot
be autogenerated directly from linguist like other logics in enry, so it's
translated by hand.

There are three different types of matchers in this implementation:
- By extension, which mark as generated based only in the extension. These
  are the fastest matchers, so they're done first.
- By file name, which matches patterns against the filename. These
  are performed in second place. Unlike linguist, we try to use string
  functions instead of regexps as much as possible.
- Finally, the rest of the matchers, which go into the content and try
  to identify if they're generated or not based on the content. Unlike
  linguist, we try to only read the content we need and not split it
  all unless it's necessary and use byte functions instead of regexps
  as much as possible.

Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2020-05-28 08:55:13 +02:00
..
project build: enable sbt-git plugin 2018-10-24 17:16:38 +02:00
src implement IsGenerated helper to filter out generated files 2020-05-28 08:55:13 +02:00
.gitignore test 2017-10-02 14:18:49 +02:00
build.sbt Drop src-d org ref except for issues 2020-03-19 14:04:36 +01:00
key.asc.enc ci: Update encrypted GPG key 2017-10-02 14:24:33 +02:00
Makefile python: initial impl of bindings using cFFI 2019-10-14 19:38:33 +02:00
README.md docs: Replace enry-java version literal by a variable. 2017-10-05 15:37:09 +02:00
sbt enry-java: publish fat jar without any classifiers in assembly task 2017-09-04 11:49:14 +02:00

enry-java

Usage

enry-java package is available thorugh maven central, so it be used easily added as a dependency in various package management systems. Examples of how to handle it for most commons systems are included below, for other systems just look at maven central's dependency information.

Apache Maven

<dependency>
    <groupId>tech.sourced</groupId>
    <artifactId>enry-java</artifactId>
    <version>${enry_version}</version>
</dependency>

Scala SBT

libraryDependencies += "tech.sourced" % "enry-java" % enryVersion

Build

Requirements

  • sbt
  • Java (tested with Java 1.8)
  • wget
  • Go (only for building the shared objects for your operating system)

Generate jar with Java bindings and shared libraries

You need to do this before exporting the jar and/or testing.

make

This will download JNAerator jar to generate the code from the libenry.h header file, it will be placed under lib. The shared libraries for your operating system will be built if needed and copied inside the shared directory.

For IntelliJ and other IDEs remember to mark shared folder as sources and add lib/enry.jar as library. If you use sbt from the command line directly that's already taken care of.

Run tests

make test

Export jar

make package

Will build fatJar under ./target/enry-java-assembly-X.X.X.jar. One can use ./sbt publish-local to install enry-java dependency on local machine.