stephenh / mirror

A tool for real-time, two-way sync for remote (e.g. desktop/laptop) development
Apache License 2.0
391 stars 35 forks source link

Instructions for compiling / contributing? #8

Closed jdb8 closed 6 years ago

jdb8 commented 6 years ago

I've been trying to debug an issue with mirror, and am having trouble working out what's going on.

I tried cloning the repo and building a local copy of the project so as to insert some print statements etc. but wasn't able to get it working. I tried:

$ gradle shadowJar

> Task :generateProto UP-TO-DATE
Using TaskInputs.file() with something that doesn't resolve to a File object has been deprecated and is scheduled to be removed in Gradle 5.0. Use TaskInputs.files() instead.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileJava'.
> invalid flag: --release

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 0s
4 actionable tasks: 1 executed, 3 up-to-date
$ gradle -version                                                                                                              

------------------------------------------------------------
Gradle 4.4.1
------------------------------------------------------------

Build time:   2017-12-20 15:45:23 UTC
Revision:     10ed9dc355dc39f6307cc98fbd8cea314bdd381c

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_25 (Oracle Corporation 25.25-b02)
OS:           Mac OS X 10.12.6 x86_64

I tried removing/changing the line in build.gradle referencing --release, but it then produced binaries with zsh: exec format error: ./build/libs/mirror-all.jar.

If you have any guidance on how best to build a local copy for debugging purposes, I'd be happy to help contribute and try to fix bugs where I find them. Having trouble since I'm a little rusty with java build systems D:

stephenh commented 6 years ago

Ah shoot, sorry about that --release flag; I added it because I'm trying the new Java 1.9 release, and didn't realize that gradle should only apply that to the newer/1.9 releases. Just removing it for now is good, I'll remove it.

To avoid the format error, if you run ./mirror in the main directory, it should have an if statement in there that automatically picks up the build/libs/mirror-all.jar.

(If that doesn't work, what it's basically doing is calling java -jar build/libs/mirror-all.jar instead of directly invoking the jar, which is a JVM-ish, that it does not produce native executables).

Good call on adding a section on contributing/compiling; I'll fix the --release issue and add a note to the readme.

stephenh commented 6 years ago

Thanks for the issue; I'll take a look at the others as well, but let me know if you run into any more build/compiling issues.