Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1 from odict/buck
Browse files Browse the repository at this point in the history
Replaced Gradle with BUCK
  • Loading branch information
Nickersoft authored Mar 20, 2018
2 parents fa2c9dd + aa9bb8f commit 34c1f56
Show file tree
Hide file tree
Showing 38 changed files with 363 additions and 715 deletions.
28 changes: 28 additions & 0 deletions .buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[alias]
it = //src/main:odict-java

[httpserver]
port = 0

[maven_repositories]
central = https://repo1.maven.org/maven2

[intellij]
jdk_name = Java SDK 1.8
jdk_type = JavaSDK
java_module_sdk_type = JavaSDK
java_module_sdk_name = 1.8
module_group_name = hpc

[project]
ide = intellij
glob_handler = watchman
ignore = .git

[java]
src_roots = java, scala
source_level = 8
target_level = 8

[download]
in_build = true
122 changes: 71 additions & 51 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,53 +1,3 @@

# Created by https://www.gitignore.io/api/windows,osx,linux,java,intellij

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: /~https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint

### Java ###
# Compiled class file
*.class
Expand Down Expand Up @@ -151,4 +101,74 @@ gradle-app.setting
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

# End of https://www.gitignore.io/api/gradle
### Buck ###
buck-out/
.buckconfig.local
.buckd/
.buckversion
.fakebuckversion

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/dictionaries

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-debug/

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Ruby plugin and RubyMine
/.rakeTasks

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### Intellij Patch ###
# Comment Reason: /~https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
.idea/sonarlint
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/modules/java.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions .idea/modules/java_main.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/modules/java_test.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/modules/odict-java.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions BUCK
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
include_defs('//DEFS')

remote_jar(
name = "flatbuffers",
url = "mvn:com.google.flatbuffers:flatbuffers-java:jar:1.8.0",
hash = "c0a904119659fd9cd667e6e37fbcb6bab790edf4"
)

remote_jar(
name = "snappy",
url = "mvn:org.xerial.snappy:snappy-java:jar:1.1.4",
hash = "d94ae6d7d27242eaa4b6c323f881edbb98e48da6"
)

remote_jar(
name = "jackson-core",
url = "mvn:com.fasterxml.jackson.core:jackson-core:jar:2.9.4",
hash = "a9a71ec1aa37da47db168fede9a4a5fb5e374320"
)

remote_jar(
name = "jackson-annotations",
url = "mvn:com.fasterxml.jackson.core:jackson-annotations:jar:2.9.4",
hash = "1380b592ad70439346b5d954ad202be048451c5a"
)

remote_jar(
name = "jackson-databind",
url = "mvn:com.fasterxml.jackson.core:jackson-databind:jar:2.9.4",
hash = "498bbc3b94f566982c7f7c6d4d303fce365529be"
)
46 changes: 46 additions & 0 deletions DEFS
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
SCHEMA_SRCS = ["Dictionary", "Entry", "Etymology", "Group", "POS", "Usage"]
SCHEMA_TARGETS = []

def remote_jar(name, url, hash, deps = []):
remote_file(
name = name + "-source",
out = name + "-source.jar",
url = url,
sha1 = hash
)
prebuilt_jar(
name = name,
binary_jar = ":" + name + "-source",
deps=deps,
visibility=["PUBLIC"]
)

def build_schema():
remote_file(
name = "dl-schema",
out = "schema.fbs",
url = "https://raw.githubusercontent.com/odict/odict/master/src/schema.fbs",
sha1 = "e8423a70ebcf2222869ddb6ccb8e408843a79242",
visibility = ["//:gen-schema"]
)
genrule(
name = "gen-schema",
srcs = [":dl-schema"],
cmd = "flatc -j -o $OUT $SRCS",
out = ".",
visibility = ["//:schema"]
)
for src in SCHEMA_SRCS:
target = "get-schema-" + src
genrule(
name = target,
cmd = "cp -a $(location :gen-schema)/schema/" + src + ".java $OUT",
out = src + ".java"
)
SCHEMA_TARGETS.append(":" + target)
java_library(
name = "schema",
srcs = SCHEMA_TARGETS,
deps = ["//:flatbuffers"],
visibility = ["PUBLIC"]
)
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,18 @@ boolean hasEntry = dict.hasEntry("some entry");
short version = dict.getVersion();
```

Setting It Up Locally
---------------------
After cloning the repo, make sure you have `flatc` installed and run:
Building
--------
To build the ODict Java library, you'll need a copy of `flatc` installed and Facebook's `buck` build tool. Then just
run:

```bash
$ ./init schema
$ buck build it
```

Also make sure you have a recent version of Java (8+ preferably). Everything else should run just peachy. It helps if
you're on a UNIX system, though.
you're on a UNIX system, though. To export the library to a file, just add the `--out` option:

```bash
$ buck build it --out odict-java.jar
```
Loading

0 comments on commit 34c1f56

Please sign in to comment.