Commit Graph

41 Commits

Author SHA1 Message Date
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
Alexander Bezzubov
bc5e031cee Drop src-d org ref except for issues
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2020-03-19 14:04:36 +01:00
Alexander Bezzubov
ee7a0f1139
python: initial impl of bindings using cFFI
A PoC that exposes single function
`enry.language_by_extension()` and a small
number of helpers to deal with string
coversion between Go<->C<->Python.

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-10-14 19:38:33 +02:00
Lauris Bukšis-Haberkorns
25b29ebdc4 Implement getting color code for languages
Signed-off-by: Lauris Bukšis-Haberkorns <lauris@nix.lv>
2019-07-19 23:59:46 +03:00
Alexander Bezzubov
453caf7d19
ci: simplify go & add maintainer to java pom
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2019-04-14 19:28:51 +02:00
Alexander
13d3d66d37
refactoring: remove un-used code, add go doc, fix ci (#199)
Refactoring, consisting of
 - remove unused method `isAuxiliaryLanguage` and `FileCountList`
   in order to reduce public API surfaces (go/java)
 - add GoDoc to public APIs
 - ci: java profile use latest go src
  It also now mimics https://docs.travis-ci.com/user/languages/go/#go-import-path
  for non-go build image, as code relies on internal imports.

TEST PLAN:
 - make test
2019-02-05 22:54:14 +01:00
Alexander
8953e0e19a
Merge pull request #165 from pratik97/Mybranch
#163 - Added version automation
2018-10-24 19:02:30 +02:00
Alexander Bezzubov
a5974effe4
build: enable sbt-git plugin
As in linked example
 f6351dbffa

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2018-10-24 17:16:38 +02:00
Alexander Bezzubov
5147de90b8
java: retrofit bindings for JNA generated from Cgo 1.10
Go 1.10 improved the way of passing strings between C and Go
with https://go-review.googlesource.com/c/go/+/70890

This change adapts API/helpers to a new convention,
without changing existing API surface and without benefiting
from a new way of passing strings.

Another, perferable on my readind of `go doc cgo`, but
more invasive approach would be to change ALL enry C API to
always return *C.char \w C.CString()

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2018-10-21 16:03:33 +02:00
Alexander Bezzubov
115a7bdc64
java: fix macOS binding generation
`/usr/include/sys/cdefs.h:74:25: warning: #warning "Unsupported compiler detected"`

is solved by by tricking cdefs.h into thinking we're gcc,
similar to https://github.com/nativelibs4java/JNAerator/issues/8#issuecomment-81965369

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2018-10-21 16:01:13 +02:00
Alexander Bezzubov
f8d128eeaa
ci: force missing include for java
Otherwise JNAetor enry.jar binding generation on
CI using `make all` results in

```
 /home/travis/build/bzz/enry/java/shared/libenry.h:8:0:
  error: File not found: stddef.h in
  . /usr/include /usr/local/include /usr/include/c++/4.8.4 /usr/include/c++/4.8.4/tr1
```

Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2018-10-21 16:01:13 +02:00
Pratik Gandhi
ddeebf4a49 Added Version Automation
Signed-off-by: Pratik Gandhi <pratikgandhi1997@gmail.com>
2018-10-21 16:05:01 +05:30
Alexander Bezzubov
53ab5b0cd6
bump java release artefact version
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2018-10-17 15:55:55 +03:00
Alfredo Beaumont
b268fad92d enry-java: Tentative fix for the enry crashes in enry-java.
Signed-off-by: Alfredo Beaumont <alfredo.beaumont@gmail.com>
2018-01-12 12:17:30 +01:00
Alfredo Beaumont
747b293abf java: bump version to 1.6.2
Signed-off-by: Alfredo Beaumont <alfredo.beaumont@gmail.com>
2017-12-12 12:28:40 +01:00
Alfredo Beaumont
7c00dc5480 enry-java: Bump version to 1.6.1
Signed-off-by: Alfredo Beaumont <alfredo.beaumont@gmail.com>
2017-11-10 13:15:56 +01:00
Alfredo Beaumont
f3aafaf1e0 enry-java: Bump version to 1.5.2
Signed-off-by: Alfredo Beaumont <alfredo.beaumont@gmail.com>
2017-10-16 16:31:25 +02:00
Alfredo Beaumont
c73f347afa Merge pull request #123 from abeaumont/feature/bump-java-artifact-version
java: Bump enry-java version to 1.5.1
2017-10-05 16:41:02 +02:00
Alfredo Beaumont
e97299ec08 java: Bump enry-java version to 1.5.1 2017-10-05 16:28:46 +02:00
Alfredo Beaumont
f710460ae4 docs: Replace enry-java version literal by a variable.
Signed-off-by: Alfredo Beaumont <alfredo.beaumont@gmail.com>
2017-10-05 15:37:09 +02:00
Alfredo Beaumont
e2a58f0984 enry-java: Add instructions to include enry-java as a dependency.
Signed-off-by: Alfredo Beaumont <alfredo.beaumont@gmail.com>
2017-10-05 10:22:41 +02:00
Alfredo Beaumont
717ac138c0 build: Remove custom signing key 2017-10-02 14:33:21 +02:00
Alfredo Beaumont
3db3b2702a build: Fix artifact release code 2017-10-02 14:24:54 +02:00
Alfredo Beaumont
f3446a3f10 ci: Update encrypted GPG key 2017-10-02 14:24:33 +02:00
Miguel Molina
d6e70542da test
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-10-02 14:18:49 +02:00
Alexander Bezzubov
e6cf6af6d9
Java: self-contained build, using sbt wrapper
Signed-off-by: Alexander Bezzubov <bzz@apache.org>
2017-09-22 19:10:08 +02:00
Miguel Molina
9a36e8f398 enry-java: allow empty file contents
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-09-22 19:00:19 +03:00
Alexander Bezzubov
b020f78841
Add test for empty file content 2017-09-22 17:39:02 +02:00
Alfredo Beaumont
a6faaaf012 Merge pull request #99 from mcarmonaa/fix/enry-java
fix getLanguage when arguments are null
2017-09-07 15:57:34 +02:00
Manuel Carmona
1d7b975743 fix getLanguage when arguments are null 2017-09-07 14:17:56 +02:00
Miguel Molina
818f77fc42
enry-java: publish fat jar without any classifiers in assembly task
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-09-04 11:49:14 +02:00
Alexander Bezzubov
0a6ed07591 Convenience: Enry.unknownLanguage and Guess.toString/.equals/.hashCode 2017-08-11 15:29:18 +02:00
Alfredo Beaumont
2c6a48ef9e Merge pull request #94 from bzz/publish-full-jar
Java bindings: make final jar publishable
2017-08-11 15:16:40 +02:00
Alexander Bezzubov
b73364d147 Add ability to publish final jar locally 2017-08-11 15:09:14 +02:00
Miguel Molina
5bde175c91
add a test for getLanguageByFilename
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-11 12:27:51 +02:00
Alexander Bezzubov
0c60da0f48 Add convenience sbt runner 2017-08-11 10:02:25 +02:00
Miguel Molina
4da1c5605c
rename result and sure in Guess to language and safe
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-09 11:29:45 +02:00
Miguel Molina
61827a3630
remove references to maven usage in both README and travis.yml
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-09 10:14:47 +02:00
Miguel Molina
2825eb22e6
get jnaerator from a jitpack jar
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-08 18:20:16 +02:00
Miguel Molina
f53abe6bc2
travis configuration
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-08 18:02:01 +02:00
Miguel Molina
d8fc4fe92f
java implementation of enry
Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
2017-08-08 18:01:54 +02:00