software-challenge / backend

Server, Client und Spiel-Plugins der Software-Challenge Germany
https://www.software-challenge.de
11 stars 10 forks source link

Gradle: Improve configuration & TestClient build #368

Closed xeruf closed 3 years ago

xeruf commented 3 years ago

Even if you don't understand it, please have a glance at it and run a few tasks locally

You probably won't notice any big differences, but architecturally the code is now a lot cleaner and my gradle understanding improved a lot as well after hours of tinkering with it. Feel free to ask what the changes do, too.

xeruf commented 3 years ago

That is interesting, I get this on master:

❯ ./gradlew :test-client:jar
Picked up _JAVA_OPTIONS: -Djava.util.prefs.userRoot=/home/janek/.config/java
Configuration on demand is an incubating feature.

> Configure project :
Current version: 21.2.1 Game: blokus_2021 (Java version: 1.8)

FAILURE: Build failed with an exception.

* Where:
Build file '/home/janek/data/1-projects/software-challenge/gui/backend/server/build.gradle.kts' line: 3

* What went wrong:
An exception occurred applying plugin request [id: 'org.gradle.application']
> Failed to apply plugin class 'org.gradle.api.distribution.plugins.DistributionPlugin'.
   > Project#afterEvaluate(Action) on project ':server' cannot be executed in the current context.
xeruf commented 3 years ago

Java version isn't the issue either:

❯ ./gradlew :test-client:jar
Picked up _JAVA_OPTIONS: -Djava.util.prefs.userRoot=/home/janek/.config/java
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
Configuration on demand is an incubating feature.

> Configure project :
Current version: 21.2.1 Game: blokus_2021 (Java version: 11)
Java version 1.8 is recommended - expect issues with generating documentation (consider using '-x doc' if you don't care)

FAILURE: Build failed with an exception.

* Where:
Build file '/home/janek/data/1-projects/software-challenge/gui/backend/server/build.gradle.kts' line: 3

* What went wrong:
An exception occurred applying plugin request [id: 'org.gradle.application']
> Failed to apply plugin class 'org.gradle.api.distribution.plugins.DistributionPlugin'.
   > Project#afterEvaluate(Action) on project ':server' cannot be executed in the current context.
xeruf commented 3 years ago

Interesting, combining it with clean makes it work:

❯ ./gradlew clean :test-client:jar
Picked up _JAVA_OPTIONS: -Djava.util.prefs.userRoot=/home/janek/.config/java
Configuration on demand is an incubating feature.

> Configure project :
Current version: 21.2.1 Game: blokus_2021 (Java version: 1.8)

> Task :server:compileJava
Note: /home/janek/data/1-projects/software-challenge/gui/backend/server/src/sc/server/network/PerspectiveAwareConverter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/janek/data/1-projects/software-challenge/gui/backend/server/src/sc/server/gaming/GameRoom.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

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.8/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 9s
16 actionable tasks: 15 executed, 1 up-to-date

Either way, it was unreliable and is now better :)