Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle: Improve configuration & TestClient build #368

Merged
merged 5 commits into from
Jan 21, 2021

Conversation

xeruf
Copy link
Member

@xeruf xeruf commented Jan 20, 2021

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

  • :test-client:jar, if run independently, should fail on master but work on this branch
  • check the deployed targets

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.

The jar task was resolving the default configuration in the configuration phase,
leading to spurious failure when executing any task in the testclient directly.
It was only because of two constants...
Copy link
Contributor

@SKoschnicke SKoschnicke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:test-client:jar does not fail in master.

In master (17ca22ab):

$ ./gradlew :test-client:jar
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true

> 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)

> Task :server:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/sven/development/sc/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 4s
10 actionable tasks: 10 executed

in this branch

$ ./gradlew clean  && ./gradlew :test-client:jar
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true

> 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)

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 721ms
6 actionable tasks: 5 executed, 1 up-to-date
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true

> 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)

> Task :server:compileJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/sven/development/sc/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 2s
9 actionable tasks: 9 executed

}

dependencies {
implementation(project(":plugin"))
// TODO this dependency is only for accessing the Configuration, remove it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it... now? Or when?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we have time ^^

@xeruf
Copy link
Member Author

xeruf commented Jan 21, 2021

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
Copy link
Member Author

xeruf commented Jan 21, 2021

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
Copy link
Member Author

xeruf commented Jan 21, 2021

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 :)

@xeruf xeruf merged commit c7ce7cd into master Jan 21, 2021
@xeruf xeruf deleted the chore/gradle/fix-tasks branch January 21, 2021 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants