|
1 | 1 | /* |
2 | | - * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
| 2 | + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. |
3 | 3 | */ |
4 | 4 |
|
5 | 5 | repositories { |
@@ -66,30 +66,36 @@ class RunR8Task extends JavaExec { |
66 | 66 | } |
67 | 67 | } |
68 | 68 |
|
69 | | -def optimizedDex = new File(buildDir, "dex-optim/") |
70 | | -def unOptimizedDex = new File(buildDir, "dex-unoptim/") |
| 69 | +def optimizedDexDir = new File(buildDir, "dex-optim/") |
| 70 | +def unOptimizedDexDir = new File(buildDir, "dex-unoptim/") |
| 71 | + |
| 72 | +def optimizedDexFile = new File(optimizedDexDir, "classes.dex") |
| 73 | +def unOptimizedDexFile = new File(unOptimizedDexDir, "classes.dex") |
71 | 74 |
|
72 | 75 | task runR8(type: RunR8Task, dependsOn: 'jar'){ |
73 | | - outputDex = optimizedDex |
| 76 | + outputDex = optimizedDexDir |
74 | 77 | inputConfig = file('testdata/r8-test-rules.pro') |
75 | 78 | } |
76 | 79 |
|
77 | 80 | task runR8NoOptim(type: RunR8Task, dependsOn: 'jar'){ |
78 | | - outputDex = unOptimizedDex |
| 81 | + outputDex = unOptimizedDexDir |
79 | 82 | inputConfig = file('testdata/r8-test-rules-no-optim.pro') |
80 | 83 | } |
81 | 84 |
|
82 | 85 | test { |
83 | 86 | // Ensure the R8-processed dex is built and supply its path as a property to the test. |
84 | 87 | dependsOn(runR8) |
85 | 88 | dependsOn(runR8NoOptim) |
86 | | - def dex1 = new File(optimizedDex, "classes.dex") |
87 | | - def dex2 = new File(unOptimizedDex, "classes.dex") |
88 | 89 |
|
89 | | - inputs.files(dex1, dex2) |
| 90 | + inputs.files(optimizedDexFile, unOptimizedDexFile) |
| 91 | + |
| 92 | + systemProperty 'dexPath', optimizedDexFile.absolutePath |
| 93 | + systemProperty 'noOptimDexPath', unOptimizedDexFile.absolutePath |
90 | 94 |
|
91 | | - systemProperty 'dexPath', dex1.absolutePath |
92 | | - systemProperty 'noOptimDexPath', dex2.absolutePath |
| 95 | + // Output custom metric with the size of the optimized dex |
| 96 | + doLast { |
| 97 | + println("##teamcity[buildStatisticValue key='optimizedDexSize' value='${optimizedDexFile.length()}']") |
| 98 | + } |
93 | 99 | } |
94 | 100 |
|
95 | 101 | tasks.withType(dokka.getClass()) { |
|
0 commit comments