Add prototype against the new AGP API

* Add a separate Gradle source set, that is compiled against the new
  versions of AGP and Gradle

* Separate the public AGP API usages from the old internal API usages
  in KotlinPlugin.kt -- see AbstractAndroidProjectHandler

* Implement Android25ProjectHandler with the new AGP API, wired it
  to KotlinAndroidPlugin through reflection

(cherry picked from commit e6dbf54)

(cherry picked from commit 88e3d4b)
This commit is contained in:
Sergey Igushkin
2017-05-05 19:17:26 +03:00
committed by Alexey Tsvetkov
parent a5620454fa
commit eb71dee9cc
4 changed files with 344 additions and 145 deletions
@@ -19,6 +19,13 @@ repositories {
jcenter()
mavenLocal()
maven { url 'http://repository.jetbrains.com/utils/' }
// todo: remove this once the AGP artifacts get published
maven { url project.property("googlePreviewRepositoryPath") } // path to the local unpacked preview repo
}
configurations {
agp25CompileOnly
}
dependencies {
@@ -37,6 +44,10 @@ dependencies {
compileOnly 'org.codehaus.groovy:groovy-all:2.3.9'
compileOnly 'org.jetbrains.kotlin:gradle-api:2.2'
agp25CompileOnly 'com.android.tools.build:gradle:2.4.0-dev'
agp25CompileOnly 'org.codehaus.groovy:groovy-all:2.3.9'
agp25CompileOnly gradleApi()
testCompile "org.jetbrains.kotlin:kotlin-build-common-test:$kotlin_version"
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
}
@@ -54,12 +65,21 @@ sourceSets.main.compileClasspath += files(groovyClassesDir)
compileGroovy.classpath = sourceSets.main.compileClasspath - files(groovyClassesDir)
sourceSets.main.java.srcDirs += sourceSets.main.kotlin.srcDirs
sourceSets {
agp25 {
compileClasspath += configurations.compile + configurations.agp25CompileOnly + sourceSets.main.output
}
}
processResources {
expand(project.properties)
}
jar.dependsOn agp25Classes
jar {
from compileGroovy.destinationDir
from sourceSets.agp25.output.classesDir
}
test.executable = "${JDK_18}/bin/java"