r27801 - fix: gradle warnings by @midgleyc in t

xKiv

Active member
Now I am getting:

FAILURE: Build failed with an exception.

* Where:
Build file '/home/xkiv/src2/kolmafia-git/build.gradle' line: 198

* What went wrong:
Could not determine the dependencies of task ':jar'.
> Resolving dependency configuration 'implementation' is not allowed as it is defined as 'canBeResolved=false'.
Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'implementation' should be resolved.

Workaround: use configurations.compileClasspath.collect instead of configurations.implementation.collect


after that, I still can't run build (./gradlew build) because of missing dependencies

Workaround: add to build.gradle:
distZip.dependsOn shadowJar
distTar.dependsOn shadowJar
startScripts.dependsOn shadowJar
startShadowScripts.dependsOn jar
 

Crowther

Active member
Same problem. I tried deleting the if statement at 198 and it compiled, but didn't run right. I'm stuck running my backup version of mafia.
 

Veracity

Developer
Staff member
For me, ./gradlew jar fails but ./gradlew shadowjar works.
That's a change; I'd never used the latter before.
It does make me a usable jar file.
 

fronobulax

Developer
Staff member
FWIW everything that worked before for me still works.

When we first moved to Gradle, the jar task did not work for me. I was advised to use shadowjar instead and it continues to work. The jar task does fail for me now from a command line so we should probably fix it or deprecate it.
 

Veracity

Developer
Staff member
I (still) have no idea what a "shadow" jar is. I want gradlew to make me a jar, so I tell it to make "jar".
It used to work. Now it is broken.

I see no reason to "deprecate" things if the replacement takes more typing and does nothing better.
 

fronobulax

Developer
Staff member
I see no reason to "deprecate" things if the replacement takes more typing and does nothing better.

If that is the reason not to then we could just rename the task :)

To be clear, we should fix it. But if we are still trying to fix it in a few weeks then I'd be OK with deprecating it.
 

fronobulax

Developer
Staff member

xKiv

Active member
As far as I can tell, "shadow jar" is one of many generic terms for "jar that also includes all dependencies .. but kolmafia already includes all of its dependencies in its own sources, and so they are compiled into the normal jar instead of being distributed as separate precompiled jar files that are just copied around (and potentially downloaded from completely different repositories).

In fact, looking at https://romanmarkunas.com/build/2018/11/13/0007-build-gradle-fat-jars/ and looking at mafia's build.gradle ... I think the jar task already does (most of) what the shadow plugin does for shadowJar? Specifically the "from { configurations....collect { it.isDirectory() ... } }" bit
 
Top