@@ -21,27 +21,6 @@ repositories {
2121 jcenter()
2222}
2323
24- sourceSets {
25- testInlineMockito {
26- compileClasspath + = main. output + test. output
27- runtimeClasspath + = main. output + test. output
28- }
29- }
30-
31- configurations {
32- testInlineMockitoCompile. extendsFrom testCompile
33- testInlineMockitoRuntime. extendsFrom testRuntime
34- }
35-
36- // define custom test task for running integration tests
37- task testInlineMockito (type : Test ) {
38- testClassesDir = sourceSets. testInlineMockito. output. classesDir
39- classpath = sourceSets. testInlineMockito. runtimeClasspath
40- }
41-
42- test. dependsOn testInlineMockito
43-
44-
4524dependencies {
4625 compile " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
4726 compile " org.jetbrains.kotlin:kotlin-reflect:$kotlin_version "
@@ -63,3 +42,26 @@ dokka {
6342 }
6443}
6544javadoc. dependsOn dokka
45+
46+ // Switch inline
47+ task createTestResources << {
48+ def mockMakerFile = new File (" $projectDir /src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker" )
49+ if (System . env. MOCK_MAKER != null ) {
50+ logger. warn(" ! Using MockMaker ${ System.env.MOCK_MAKER} " )
51+ mockMakerFile. parentFile. mkdirs()
52+ mockMakerFile. createNewFile()
53+ mockMakerFile. write(System . env. MOCK_MAKER )
54+ } else {
55+ logger. warn(" ! Using default MockMaker" )
56+ }
57+ }
58+
59+ task removeTestResources << {
60+ def mockMakerFile = new File (" $projectDir /src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker" )
61+ if (mockMakerFile. exists()) {
62+ mockMakerFile. delete()
63+ }
64+ }
65+
66+ test. dependsOn createTestResources
67+ test. finalizedBy removeTestResources
0 commit comments