https://kotlinlang.org logo
Title
m

mkobit

05/15/2018, 3:17 PM
my root project
settings.gradle.kts
is red, but not my
buildSrc/settings.gradle.kts
😕
x

xenoterracide

05/15/2018, 5:14 PM
snort sounds like IDEA's normal BS, go to the gradle tab and refresh the project.
m

mkobit

05/15/2018, 5:57 PM
Unfortunately none of my normal tricks are working - refresh gradle - reimport module - New project and import module It's strange because rest of import works fine Might be something specific to this project. Maybe I can look at intellij logs to see what is going on
e

eskatos

05/15/2018, 6:43 PM
Another place to look at would be the logs of the kotlin-dsl dependency resolver for intellij. System dependent location encoded here: https://github.com/gradle/kotlin-dsl/blob/master/provider/src/main/kotlin/org/gradle/kotlin/dsl/resolver/ResolverEventLogger.kt#L112
Look for
settings.gradle.kts
in the most recent log file
m

mkobit

05/15/2018, 7:12 PM
thanks @eskatos, ill take a look and follow up
ok @eskatos think i have an idea of what was happening. i couldnt figure out how to "retrigger" a settings resolution (synchronization/opening the file/refreshing the gradle project all didn't seem to work) so i just restarted intellij each time we have a file at
gradle/kotlinVersion.txt
and in
settings.gradle.kts
that we refer to in a couple places
resolutionStrategy {
        val kotlinVersion = Paths.get("gradle", "kotlinVersion.txt").toFile().readText().trim()
and also a
dependencies.gradle
that we use in
build.gradle
as
apply from: 'dependencies.gradle'
file that does the same crap
ext {
    versions = [
        kotlin: Paths.get("gradle", "kotlinVersion.txt").getText(StandardCharsets.UTF_8.name()).trim(),
both of these lead to a
failure = 		org.gradle.tooling.BuildException: Could not fetch model of type 'KotlinBuildScriptModel' using Gradle installation '/home/mkobit/.gradle/wrapper/dists/gradle-4.7-all/4cret0dgl5o3b21weaoncl7ys/gradle-4.7'.
	Caused by: java.nio.file.NoSuchFileException: gradle/kotlinVersion.txt` coming up
if i just change those to constants everything in the IDE is dandy
should the tooling models be built relative to the project dir? or i should i be doing something differently here?
i could use a
gradle.properties
and get it from there too, i think that'll work in the meantime
e

eskatos

05/16/2018, 9:30 AM
Hey Mike, The Gradle properties should work indeed.
I wonder about your usage of
Paths.get()
Why not use
file("..")
that handles paths relative to the script whatever is the CWD?
val kotlinVersion = file("gradle/kotlinVersion.txt").readText().trim()
and
def kotlinVersion = file(‘gradle/kotlinVersion.txt’).text.trim()
m

mkobit

05/16/2018, 12:27 PM
Came from what we had prior, which I think was just a preference for nio apis
e

eskatos

05/16/2018, 12:56 PM
I see
We need to get better error reporting in cases such as yours
https://github.com/gradle/kotlin-dsl/pull/866 will already be a step forward, but no details about the error yet
m

mkobit

05/16/2018, 1:01 PM
awesome, thanks - pointing me to where the logs go was enough to figure it out. i didnt realize
file
method was available in
settings.gradle.kts
, thanks for the pointer
e

eskatos

05/16/2018, 1:10 PM
👍