signalapp / libsignal

Home to the Signal Protocol as well as other cryptographic primitives which make Signal possible.
GNU Affero General Public License v3.0
3.08k stars 362 forks source link

0.14: Cannot compile java part without android sdk #455

Closed bratkartoffel closed 2 years ago

bratkartoffel commented 2 years ago

Hi there,

starting with 0.14 release I cannot compile the java without the android sdk:

[libsignal-client-0.14.0/java] $> ./gradlew compileJava
Downloading https://services.gradle.org/distributions/gradle-7.4-bin.zip
..............................................................................................................

Welcome to Gradle 7.4!

Here are the highlights of this release:
 - Aggregated test and JaCoCo reports
 - Marking additional test source directories as tests in IntelliJ
 - Support for Adoptium JDKs in Java toolchains

For more details see https://docs.gradle.org/7.4/release-notes.html

To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build

> Task :client:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/john/aports/testing/java-libsignal-client/src/libsignal-client-0.14.0/java/shared/java/org/whispersystems/libsignal/groups/state/InMemorySenderKeyStore.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :server:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/john/aports/testing/java-libsignal-client/src/libsignal-client-0.14.0/java/shared/java/org/whispersystems/libsignal/groups/state/InMemorySenderKeyStore.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

BUILD SUCCESSFUL in 38s
2 actionable tasks: 2 executed
To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':android:testDebugUnitTest'.
> SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/home/john/aports/testing/java-libsignal-client/src/libsignal-client-0.14.0/java/local.properties'.

* 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 6s
>>> ERROR: java-libsignal-client: check failed

How can I disable the android stuff without modifying the settings.gradle?

Thanks!

jrose-signal commented 2 years ago

Instead of using the top-level compileJava task, you should specifically use the tasks in the client sub-project, e.g. client:build or client:compileJava. (You probably don't need the server project artifacts either.)

bratkartoffel commented 2 years ago

That does work, at least when using jdk11+ to compile the code. When using java 8, the build fails with another error:

[libsignal-client-0.14.0/java] $> ./gradlew :client:jar

To honour the JVM settings for this build a single-use Daemon process will be forked. See https://docs.gradle.org/7.4/userguide/gradle_daemon.html#sec:disabling_the_daemon.
Daemon will be stopped at the end of the build

FAILURE: Build failed with an exception.

* Where:
Build file '/home/john/aports/testing/java-libsignal-client/src/libsignal-client-0.14.0/java/android/build.gradle' line: 2

* What went wrong:
An exception occurred applying plugin request [id: 'com.android.library', version: '7.0.0']
> Failed to apply plugin 'com.android.internal.library'.
   > Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
     You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

* 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 3s

As the compile target for the source is Java 8, I think it should also compile using that JDK.

jrose-signal commented 2 years ago

A reasonable request! Incorporated into the just-tagged v0.15.0.