Introduce tooling model for Kapt gradle projects
A Kapt model for Gradle projects including 'kotlin-kapt'plugin is introduced. Its model builder KaptModelBuilder produces an implementation of these models and can be queried through the Gradle Tooling API when needed. Model builder is registered in Kapt3GradleSubplugin.
This commit is contained in:
committed by
Sergey Igushkin
parent
9def6f020f
commit
5671dbb929
+41
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.model;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* Entry point for annotation processor model.
|
||||
* Plugin 'kotlin-kapt' can produce this model.
|
||||
*/
|
||||
public interface Kapt {
|
||||
|
||||
/**
|
||||
* Return a number representing the version of this API.
|
||||
* Always increasing if changed.
|
||||
*
|
||||
* @return the version of this model.
|
||||
*/
|
||||
long getModelVersion();
|
||||
|
||||
/**
|
||||
* Returns the module (Gradle project) name.
|
||||
*
|
||||
* @return the module name.
|
||||
*/
|
||||
@NotNull
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Return all kapt source sets.
|
||||
*
|
||||
* @return all kapt source sets.
|
||||
*/
|
||||
@NotNull
|
||||
Collection<KaptSourceSet> getKaptSourceSets();
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||
* that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.model;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Represents a source set for a given kapt model.
|
||||
* @see Kapt
|
||||
*/
|
||||
public interface KaptSourceSet {
|
||||
|
||||
/**
|
||||
* Possible source set types.
|
||||
*/
|
||||
enum KaptSourceSetType {
|
||||
PRODUCTION,
|
||||
TEST
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the source set name.
|
||||
*
|
||||
* @return the source set name.
|
||||
*/
|
||||
@NotNull
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Return the type of the source set.
|
||||
*
|
||||
* @return the type of the source set.
|
||||
*/
|
||||
@NotNull
|
||||
KaptSourceSetType getType();
|
||||
|
||||
/**
|
||||
* Return generated sources directory.
|
||||
*
|
||||
* @return generated sources directory.
|
||||
*/
|
||||
@NotNull
|
||||
File getGeneratedSourcesDirectory();
|
||||
|
||||
/**
|
||||
* Return Kotlin generated sources directory.
|
||||
*
|
||||
* @return Kotlin generated sources directory.
|
||||
*/
|
||||
@NotNull
|
||||
File getGeneratedKotlinSourcesDirectory();
|
||||
|
||||
/**
|
||||
* Return Kotlin generated classes directory.
|
||||
*
|
||||
* @return Kotlin generated classes directory.
|
||||
*/
|
||||
@NotNull
|
||||
File getGeneratedClassesDirectory();
|
||||
}
|
||||
Reference in New Issue
Block a user