Gradle is bullshit.

이희구·2023년 1월 9일

개발

목록 보기
2/8

The concept of gradle is crazy.

The most fuck-like part is configurations.
As an example, this is an example code from the section describing war plugin.

configurations {
  providedRuntime
}

Another example code shows you how to prevent caching.

configurations.all {
  resolutionStrategy.cacheChangingModulesFor 0, "seconds"
}

To apply all of the examples provided in the official manual to the project, our build.gradle looks like this.

configurations {
  providedRuntime
}
configurations.all {
  resolutionStrategy.cacheChangingModulesFor 0, "seconds"
}

This is the fucking point.
For the configurations, according to the source for gradle 5.6.4:

     * <p>This method executes the given closure against the {@link ConfigurationContainer}
     * for this project. The {@link ConfigurationContainer} is passed to the closure as the closure's delegate.

In other words, the closure part of configurations becomes configurations.all.
Therefore, logically, it can be thought that the code below would be the same.

configurations {
  providedRuntime
  resolutionStrategy.cacheChangingModulesFor 0, "seconds"
}
configurations.all {
  providedRuntime
  resolutionStrategy.cacheChangingModulesFor 0, "seconds"
}

However, the above two codes do not work.
The code that build.gradle goes into is a class called org.gradle.api.internal.artifacts.configurations.DefaultConfiguration. Since it is not supported by this class, it is inevitable to write two separate settings even for the settings to be applied in common.

Configurations and configurations.all are, after all, a grammar that users must memorize. I cannot call my father as "father". What should I express this shit?

There is no logical thinking in gradle.
As the version goes up, it becomes unorganized and shit.

profile
아쿠아믿으세요

0개의 댓글