|
1 | 1 | allprojects { project ->
|
2 |
| - |
3 |
| - task kotlinLSPDeps { |
4 |
| - task -> doLast { |
5 |
| - System.out.println "" |
6 |
| - System.out.println "gradle-version " + gradleVersion |
7 |
| - System.out.println "kotlin-lsp-project " + project.name |
8 |
| - |
9 |
| - if(project.hasProperty('android')) { |
10 |
| - |
11 |
| - def rootDir = project.rootDir |
12 |
| - |
13 |
| - def level = "21" |
14 |
| - if(project.android.defaultConfig.targetSdkVersion != null) { |
15 |
| - level = project.android.defaultConfig.targetSdkVersion.getApiLevel() |
16 |
| - System.out.println "kotlin-lsp-target android-" + level |
17 |
| - } |
18 |
| - |
19 |
| - def localProperties = new File(rootDir, "local.properties") |
20 |
| - |
21 |
| - if (localProperties.exists()) { |
22 |
| - Properties properties = new Properties() |
23 |
| - localProperties.withInputStream { instr -> properties.load(instr) } |
24 |
| - def sdkDir = properties.getProperty('sdk.dir') |
25 |
| - def androidJarPath = sdkDir + "/platforms/android-" + level + "/android.jar" |
26 |
| - System.out.println "kotlin-lsp-gradle " + androidJarPath |
27 |
| - } |
28 |
| - |
29 |
| - if(project.android.hasProperty('applicationVariants')) { |
30 |
| - project.android.applicationVariants.all { variant -> |
31 |
| - variant.getCompileClasspath().each { |
32 |
| - System.out.println "kotlin-lsp-gradle " + it |
33 |
| - } |
34 |
| - } |
35 |
| - } |
36 |
| - |
37 |
| - def buildClasses = project.getBuildDir().absolutePath + File.separator + "intermediates" + File.separator + "classes" + File.separator + "debug" |
38 |
| - System.out.println "kotlin-lsp-gradle " + buildClasses |
39 |
| - |
40 |
| - } else { |
41 |
| - // Print the list of all dependencies jar files. |
42 |
| - project.configurations.findAll { |
43 |
| - it.metaClass.respondsTo(it, "isCanBeResolved") ? it.isCanBeResolved() : false |
44 |
| - }.each { |
45 |
| - it.resolve().each { |
46 |
| - if(it.inspect().endsWith("jar")) { |
47 |
| - System.out.println "kotlin-lsp-gradle " + it |
48 |
| - } else if(it.inspect().endsWith("aar")) { |
49 |
| - // If the dependency is an AAR file we try to determine the location |
50 |
| - // of the classes.jar file in the exploded aar folder. |
51 |
| - def splitted = it.inspect().split("/") |
52 |
| - def namespace = splitted[-5] |
53 |
| - def name = splitted[-4] |
54 |
| - def version = splitted[-3] |
55 |
| - def explodedPath = "$project.buildDir/intermediates/exploded-aar" + |
56 |
| - "/$namespace/$name/$version/jars/classes.jar" |
57 |
| - System.out.println "kotlin-lsp-gradle " + explodedPath |
58 |
| - } |
59 |
| - } |
60 |
| - } |
61 |
| - } |
62 |
| - } |
63 |
| - } |
| 2 | + task kotlinLSPDeps { |
| 3 | + task -> doLast { |
| 4 | + System.out.println "" |
| 5 | + System.out.println "gradle-version $gradleVersion" |
| 6 | + System.out.println "kotlin-lsp-project ${project.name}" |
| 7 | + |
| 8 | + if (project.hasProperty('android')) { |
| 9 | + def rootDir = project.rootDir |
| 10 | + |
| 11 | + def level = "21" |
| 12 | + if (project.android.defaultConfig.targetSdkVersion != null) { |
| 13 | + level = project.android.defaultConfig.targetSdkVersion.getApiLevel() |
| 14 | + System.out.println "kotlin-lsp-target android-$level" |
| 15 | + } |
| 16 | + |
| 17 | + def localProperties = new File(rootDir, "local.properties") |
| 18 | + |
| 19 | + if (localProperties.exists()) { |
| 20 | + Properties properties = new Properties() |
| 21 | + localProperties.withInputStream { instr -> properties.load(instr) } |
| 22 | + def sdkDir = properties.getProperty('sdk.dir') |
| 23 | + def androidJarPath = sdkDir + "/platforms/android-$level/android.jar" |
| 24 | + System.out.println "kotlin-lsp-gradle $androidJarPath" |
| 25 | + } |
| 26 | + |
| 27 | + if (project.android.hasProperty('applicationVariants')) { |
| 28 | + project.android.applicationVariants.all { variant -> |
| 29 | + variant.getCompileClasspath().each { |
| 30 | + System.out.println "kotlin-lsp-gradle $it" |
| 31 | + } |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + def buildClasses = project.getBuildDir().absolutePath + File.separator + "intermediates" + File.separator + "classes" + File.separator + "debug" |
| 36 | + System.out.println "kotlin-lsp-gradle $buildClasses" |
| 37 | + } else { |
| 38 | + // Print the list of all dependencies jar files. |
| 39 | + project.configurations.findAll { |
| 40 | + it.metaClass.respondsTo(it, "isCanBeResolved") ? it.isCanBeResolved() : false |
| 41 | + }.each { |
| 42 | + it.resolve().each { |
| 43 | + if (it.inspect().endsWith("jar")) { |
| 44 | + System.out.println "kotlin-lsp-gradle $it" |
| 45 | + } else if (it.inspect().endsWith("aar")) { |
| 46 | + // If the dependency is an AAR file we try to determine the location |
| 47 | + // of the classes.jar file in the exploded aar folder. |
| 48 | + def splitted = it.inspect().split("/") |
| 49 | + def namespace = splitted[-5] |
| 50 | + def name = splitted[-4] |
| 51 | + def version = splitted[-3] |
| 52 | + def explodedPath = "$project.buildDir/intermediates/exploded-aar/$namespace/$name/$version/jars/classes.jar" |
| 53 | + System.out.println "kotlin-lsp-gradle $explodedPath" |
| 54 | + } |
| 55 | + } |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + } |
64 | 60 | }
|
65 |
| - |
66 |
| - |
0 commit comments