Comments (14)
Alright, I was able to reproduce aforementioned behavior on [email protected] (worked fine on gradle 2.4.1).
Solution is described at https://discuss.gradle.org/t/download-all-dependencies/6294/4, which boils down to:
- add to build.gradle
allprojects {
task dependenciesResolve {
doLast {
configurations.all { it.resolve() }
}
}
}
- instead of
gradle dependencies
usegradle dependenciesResolve
.
Tested on chibatching/docker-android-sdk
docker image.
🎈
from ktlint.
@jeremymailen thank you for trying to help, I appreciate it 🙇♂️
from ktlint.
Hi @Drarok. Any chance you can share your build.gradle? The only case I can think of where ktlint would download anything is when using external 3rd party ruleset (-R flag). But even then caching ~/.m2 should work just fine.
FYI: You can use ktlint as a standalone binary (see https://ktlint.github.io/#getting-started) without the need for Maven or Gradle.
from ktlint.
I may have put things into the wrong gradle file, so here's both! Thanks for looking into this.
Project build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.2-3'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// The exception to this rule is compile-time dependencies, such as these:
classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:3.5'
classpath 'com.github.shyiko:ktlint:0.6.1'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'de.felixschulze.gradle.hockeyapp'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "<REDACTED>"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations {
ktlint
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
testCompile 'junit:junit:4.12'
ktlint 'com.github.shyiko:ktlint:0.6.1'
}
task ktlint(type: JavaExec) {
main = "com.github.shyiko.ktlint.Main"
classpath = configurations.ktlint
args "src/**/*.kt"
}
check.dependsOn ktlint
task ktlintFormat(type: JavaExec) {
main = "com.github.shyiko.ktlint.Main"
classpath = configurations.ktlint
args "-F", "src/**/*.kt"
}
hockeyapp {
apiToken = "<REDACTED>"
}
from ktlint.
@Drarok Just to clarify: you are caching both ~/.gradle and ~/.m2?
from ktlint.
@Drarok what gradle target do you currently run in the dependencies
section of your circle.yml
to pull things to cache? Gradle of course is notoriously lazy/efficient about getting dependencies and of course CircleCI only caches after the dependencies step which is usually ahead of most people's gradle targets that do interesting things.
from ktlint.
I've just double checked, both are cached, yes.
Run: ./gradlew dependencies
Cache: Creating dependency cache from the following paths:
/home/ubuntu/.go_workspace
/home/ubuntu/.gradle
/home/ubuntu/.m2
Run: ./gradlew ktlint
Output (note the downloads from
> Connecting to Daemon> Configuring > 0/2 projects > root project > Resolving dependencies ':classpat> Configuring > 1/2 projects > :appNDK is missing a "platforms" directory.
If you are using NDK, verify the ndk.dir is set to a valid NDK directory. It is currently set to /usr/local/android-sdk-linux/ndk-bundle.
If you are not using NDK, unset the NDK variable from ANDROID_NDK_HOME or local.properties to remove this warning.
> Configuring > 2/2 projects > Resolving dependencies ':app:_debugApk'> Configuring > 2/2 projectsIncremental java compilation is an incubating feature.
> Configuring > 2/2 projects > Resolving dependencies ':app:_releaseUnitTestApk> Configuring > 2/2 projects > Resolving dependencies ':app:_debugAndroidTestAp> Configuring > 2/2 projects> Building 0% > :app:ktlint > Resolving dependencies ':app:ktlint'> Building 0% > :app:ktlint:app:ktlint
Download https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-compiler-embeddable/1.1.0/kotlin-compiler-embeddable-1.1.0.jar
> Building 0% > :app:ktlint> Building 0% > :app:ktlint > 833 KB/25.88 MB downloaded> Building 0% > :app:ktlint > 1.87 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 3.06 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 4.50 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 6.25 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 7.14 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 8.92 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 9.64 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 10.87 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 11.70 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 12.78 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 13.99 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 15.26 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 15.92 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 16.50 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 17.23 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 17.77 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 18.54 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 20.03 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 21.31 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 23.57 MB/25.88 MB downloaded> Building 0% > :app:ktlint > 25.88 MB/25.88 MB downloaded
> Building 0% > :app:ktlintDownload https://jcenter.bintray.com/org/apache/httpcomponents/httpclient/4.3.5/httpclient-4.3.5.jar
> Building 0% > :app:ktlint
Download https://jcenter.bintray.com/org/apache/httpcomponents/httpcore/4.3.2/httpcore-4.3.2.jar
> Building 0% > :app:ktlintDownload https://jcenter.bintray.com/commons-codec/commons-codec/1.6/commons-codec-1.6.jar
> Building 0% > :app:ktlint> Building 0%
BUILD SUCCESSFUL
from ktlint.
It looks like it only triggers the download when the configurations
ktlint
is resolved. I don't think the classpath 'com.github.shyiko:ktlint:0.6.1'
in the buildscript
block is triggering a dependency download since it isn't part of an applied plugin? If you remove it I think you'll find your ktlint
task still works 🤔.
from ktlint.
Well on 2nd take it looks like having classpath 'com.github.shyiko:ktlint:0.6.1'
in buildscript
does trigger a download of some dependencies on gradle dependencies
but not a few of the transitive ones like kotlin-compiler-embeddable
.
from ktlint.
Hmm, so am I stuck having it download its transitive dependencies, or can I force Gradle to download those somehow?
from ktlint.
Sorry @Drarok, got distracted at work. I'll try to provide an answer within 24h.
from ktlint.
Honestly, don't rush! I'm not back in work where this is is only a minor inconvenience until Tuesday anyway.
Have a good weekend! 😄
from ktlint.
@Drarok have a great weekend too ;)
from ktlint.
Finally got around to implementing this change, and my latest build didn't download anything extra, so everything's being cached as expected! 🎉
Thanks to everyone that helped.
from ktlint.
Related Issues (20)
- How to avoid wrapping when there is only one param in class? HOT 1
- Redundant suppression shown for PropertyName HOT 4
- Consider honoring `PrivatePropertyName` like `PropertyName` HOT 1
- Method Signature forcing multiline despite unset [`function_signature_rule_force_multiline`] HOT 1
- parameter-list-wrapping disable is not respected HOT 2
- Import incorrectly dropped when correcting string template expression with redundant braces HOT 1
- [Question] Why max_line_length contains number of indent white space? HOT 1
- Apply the `function-naming` exception for backticked test functions to apply to Test classes extending an org.junit Test class HOT 2
- Test was not passed when Default language is not English
- Ktlint Issue: Variable Declaration Format Inconsistency Despite Disabled Max-Line-Length Constraint HOT 4
- False positive for indentation in a nested lamba HOT 2
- Configuration setting confusing HOT 1
- Suport partial formatting of code
- long type parameter cause `Expected a single space` HOT 1
- Do not report PascalCase top-level constants in property-naming rule HOT 3
- Separate constant naming rule from property-naming HOT 1
- Suggest IntelliJ config of wildcard import HOT 1
- Split `multiline-if-else` into two rules HOT 2
- Prevent possible conflict between `multiline-expression-wrapping` and `function-signature` body wrapping
- Binary operators in `!(...)` not checked for missing horizontal whitespace
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ktlint.