permissions-dispatcher / kompile-testing Goto Github PK
View Code? Open in Web Editor NEWTesting tools for kotlinc and kapt
License: Apache License 2.0
Testing tools for kotlinc and kapt
License: Apache License 2.0
Tried running:
@Test
fun firstTest() {
//val inFiles = dirToObjectFiles("com.github.alexdochioiu.test1")
kotlinc()
.withProcessors(TimeTurnerProcessor())
.addKotlin(
"input.kt", """
package com.github.alexdochioiu.example
import android.arch.lifecycle.Lifecycle
import com.github.alexdochioiu.timeturner.GlobalSurvivor
import com.github.alexdochioiu.timeturner.Survivor
import com.github.alexdochioiu.timeturner.SurvivorBinding
import java.util.*
/**
* Created by Alexandru Iustin Dochioiu on 30-Jan-19
*/
@Survivor
class TestPresenter(lifecycle: Lifecycle) {
@GlobalSurvivor
var survivingElements: MutableList<String> = ArrayList()
@GlobalSurvivor
var myInt: Int = 2
@GlobalSurvivor
var myBool: Boolean = true
@GlobalSurvivor
var myStr = "Test"
init {
}
}
""".trimIndent()
)
.compile()
.succeeded()
}
java.io.IOException: Directory 'C:\Users\JeeFo\AppData\Local\Temp\tmp9008736054030136230.tmp\unzippedAar\C:\Users\JeeFo\.gradle\caches\modules-2\files-2.1\com.android.support\appcompat-v7\28.0.0\132586ec59604a86703796851a063a0ac61f697b' could not be created
at org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:361)
at org.apache.commons.io.FileUtils.openOutputStream(FileUtils.java:324)
at org.apache.commons.io.FileUtils.copyToFile(FileUtils.java:1529)
at org.apache.commons.io.FileUtils.copyInputStreamToFile(FileUtils.java:1506)
at kompile.testing.Compiler.extractJarFromAar(Compiler.kt:143)
at kompile.testing.Compiler.access$extractJarFromAar(Compiler.kt:22)
at kompile.testing.Compiler$classpathFiles$2.invoke(Compiler.kt:130)
at kompile.testing.Compiler$classpathFiles$2.invoke(Compiler.kt:22)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at kompile.testing.Compiler.getClasspathFiles(Compiler.kt)
at kompile.testing.Compiler.fullClasspath(Compiler.kt:95)
at kompile.testing.Compiler.compile(Compiler.kt:58)
at com.github.alexdochioiu.timeturnerprocessor.TimeTurnerProcessorTest.firstTest(TimeTurnerProcessorTest.kt:70)
P.S. I am running Android Studio 3.3.1 on Windows 10
I have this test
class SampleTest {
@Test
fun testTriggersErrorWhenAppliedToClass() {
kotlinc()
.withProcessors(ModelGeneratorProcessor())
.addKotlin("TestModel.kt", """
fun main() {
}
""".trimIndent())
.compile()
.failed()
.withErrorContaining("blah")
}
}
It fails with
org.junit.ComparisonFailure: null
Expected :blah
Actual :error: [kapt] 'com.sun.tools.javac.util.Context' class can't be found ('tools.jar' is absent in the plugin classpath). Kapt won't work.
I am using kotlin 1.3.21
, The build.gradle contains:
testImplementation("org.permissionsdispatcher:kompile-testing:0.1.2")
testImplementation(files(Jvm.current().toolsJar)) // tried to add this, didn't help
Any hints on what do I do wrong?
The file https://github.com/permissions-dispatcher/kompile-testing/blob/master/src/main/java/kompile/testing/Compiler.kt is derived from https://github.com/square/moshi/blob/master/kotlin/codegen/src/test/java/com/squareup/moshi/kotlin/codegen/KotlinCompilerCall.kt but does not retain the copyright designation and license information in the derived work. In order to use this code, you must comply with item 4 of the Apache license (the license of the original work).
Currently library's performance is not so good because there're so many File I/O. We should improve that by introducing on-memory based File manipulation system.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.