collinsmith / riiablo

Diablo II remade using Java and LibGDX
http://riiablo.com
Apache License 2.0
869 stars 99 forks source link

[Build] Unable to build #125

Closed sunneo closed 3 years ago

sunneo commented 3 years ago

When I use gradlew desktop:dist gradlew shows:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine java version from '14.0.2'.

gradle-6.7

After gradle-6.7 is downloaded, the error message shows:

D:\INSTALLx86\riiablo>gradle-6.7\bin\gradle desktop:dist
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':android'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2m 26s

gradle --refresh-dependencies

D:\INSTALLx86\riiablo>gradle-6.7\bin\gradle --refresh-dependencies

> Configure project :
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':android'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 46s

I'm not going to build it for android, and I'd like to build a jar for rapsberry pi. What can I do

Or could you publish/release built jar file?

According to the Post

I removed android-related references

diff --git a/build.gradle b/build.gradle
index 6459644..6ed88b7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -8,7 +8,6 @@ buildscript {
         google()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:3.1.3'
         classpath "gradle.plugin.io.netifi:gradle-flatbuffers-plugin:1.0.5"
     }
     dependencies {
@@ -157,40 +156,7 @@ project(":desktop") {
     }
 }

-project(":android") {
-    apply plugin: "android"

-    configurations { natives }
-
-    dependencies {
-        implementation project(":core")
-        implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
-        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi"
-        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
-        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
-        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
-        natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
-        implementation "com.badlogicgames.gdx:gdx-controllers:$gdxVersion"
-        implementation "com.badlogicgames.gdx:gdx-controllers-android:$gdxVersion"
-    }
-
-    dependencies {
-        compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
-        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi"
-        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
-        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
-        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
-        natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
-    }
-
-    repositories {
-        jcenter()
-    }
-
-    dependencies {
-        implementation "org.sufficientlysecure:openpgp-api:12.0"
-    }
-}

 project(":core") {
     apply plugin: "java"
@@ -205,7 +171,7 @@ project(":core") {

     dependencies {
         compile group: 'com.google.guava', name: 'guava', version: '20.0'
-        compile group: 'com.android.support', name: 'support-annotations', version: '27.1.1'
+
         compile group: 'commons-io', name: 'commons-io', version: '2.5'
         compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.6'
         compile group: 'org.apache.commons', name: 'commons-collections4', version: '4.1'

However the gradle outputs another error

D:\INSTALLx86\riiablo>gradle-6.7\bin\gradle desktop:dist

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\INSTALLx86\riiablo\desktop\build.gradle' line: 32

* What went wrong:
A problem occurred evaluating project ':desktop'.
> Could not get unknown property 'classesDir' for main classes of type org.gradle.api.internal.tasks.DefaultSourceSetOutput.

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 13s
sunneo commented 3 years ago

after run in android studio I got 'Could not get unknown property 'classesDir' for main classes of type Org.gradle.api.internal.tasks.DefaultSourceSetOutput. ' afterward I try to alternate it with classesDirs However the other error comes out:

$ ./gradle-6.7/bin/gradle desktop:dist

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':desktop:compileJava'.
> Could not resolve all task dependencies for configuration ':desktop:compileClasspath'.
   > Could not resolve project :core.
     Required by:
         project :desktop
      > No matching variant of project :core was found. The consumer was configured to find an API of a library compatible with Java 6, preferably in the form of class files, and its dependencies declared externally but:
          - Variant 'apiElements' capability riiablo:core:1.0 declares an API of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 7 and the consumer needed a component compatible with Java 6
          - Variant 'runtimeElements' capability riiablo:core:1.0 declares a runtime of a library, packaged as a jar, and its dependencies declared externally:
              - Incompatible because this component declares a component compatible with Java 7 and the consumer needed a component compatible with Java 6

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 5s

Perhaps it is exactly a bad idea to utilize gradle, because gradle heavily depends on jdk version, and commands/recipe are frequently deleted or marked as deprecated. Which would lead to unnecessary cost of maintenance after project published. Use make file could be better.

collinsmith commented 3 years ago

1) use included gradle wrapper to build the project (newer versions are incompatible with the scripts as you're seeing) 2) only Java 8 is officially supported in the current state (this is what works for me) 3) android sdk is required to build the project unless you remove all traces of it from the project hierarchy 4) virtually all of the above issues are currently being worked on in the gradle-migration branch -- as well as importing the project into IntelliJ 2019+. I'm hoping to get this done ASAP.

LibGDX project structures are generated using a tool -- and this one was generated years ago, so much of it is just outdated now -- which is why is a bit of a pain to deal with and I'm in the process of attempting to migrate it myself and learning about gradle. I'm sure someone with a greater domain knowledge of gradle would not have these issues, but I'm not that person :). If you want to build the project in its current form without android -- you will need to use the included gradle wrapper and Java 8 and comment out the android module from build.gradle and settings.gradle. Sit tight in the meantime, I'm hoping I can have a better solution soon.

collinsmith commented 3 years ago

@sunneo Feel free to try the updated gradle wrapper in the gradle-migration branch and let me know if there are any issues. I've been putting in a lot of effort updating it to be more compatible. Bear in mind, I'm not a build script guy, but I'm doing my best. It's not completely finished, but I want to get it functional so that I can merge.

collinsmith commented 3 years ago

@sunneo gradle-migration has been merged back into master -- I think that should resolve the issues you were having.