Move model interfaces code from Java to Kotlin

This commit is contained in:
Lucas Smaira
2018-07-30 12:18:04 +01:00
committed by Sergey Igushkin
parent 52990c9eb1
commit 49292cd26c
21 changed files with 130 additions and 359 deletions
@@ -8,7 +8,7 @@ repositories {
}
dependencies {
compile "org.jetbrains:annotations:13.0"
compile project(':kotlin-stdlib')
}
artifacts {
@@ -3,17 +3,13 @@
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.model;
import org.jetbrains.annotations.NotNull;
import java.util.List;
package org.jetbrains.kotlin.gradle.model
/**
* Entry point for Kotlin All Open models.
* Represents the description of annotations interpreted by 'kotlin-allopen' plugin.
*/
public interface AllOpen {
interface AllOpen {
/**
* Return a number representing the version of this API.
@@ -21,29 +17,26 @@ public interface AllOpen {
*
* @return the version of this model.
*/
long getModelVersion();
val modelVersion: Long
/**
* Returns the module (Gradle project) name.
*
* @return the module name.
*/
@NotNull
String getName();
val name: String
/**
* Return the list of annotations.
*
* @return the list of annotations.
*/
@NotNull
List<String> getAnnotations();
val annotations: List<String>
/**
* Return the list of presets.
*
* @return the list of presets.
*/
@NotNull
List<String> getPresets();
}
val presets: List<String>
}
@@ -3,40 +3,34 @@
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.model;
package org.jetbrains.kotlin.gradle.model
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.List;
import java.io.File
/**
* Represents the compiler arguments for a given Kotlin source set.
* @see SourceSet
*/
public interface CompilerArguments {
interface CompilerArguments {
/**
* Return current arguments for the given source set.
*
* @return current arguments for the given source set.
*/
@NotNull
List<String> getCurrentArguments();
val currentArguments: List<String>
/**
* Return default arguments for the given source set.
*
* @return default arguments for the given source set.
*/
@NotNull
List<String> getDefaultArguments();
val defaultArguments: List<String>
/**
* Return the classpath the given source set is compiled against.
*
* @return the classpath the given source set is compiled against.
*/
@NotNull
List<File> getCompileClasspath();
}
val compileClasspath: List<File>
}
@@ -3,21 +3,18 @@
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.model;
import org.jetbrains.annotations.Nullable;
package org.jetbrains.kotlin.gradle.model
/**
* Wraps all experimental features information for a given Kotlin project.
* @see KotlinProject
*/
public interface ExperimentalFeatures {
interface ExperimentalFeatures {
/**
* Return coroutines string.
*
* @return coroutines.
*/
@Nullable
String getCoroutines();
}
val coroutines: String?
}
@@ -3,17 +3,13 @@
* 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;
package org.jetbrains.kotlin.gradle.model
/**
* Entry point for annotation processor model.
* Plugin 'kotlin-kapt' can produce this model.
*/
public interface Kapt {
interface Kapt {
/**
* Return a number representing the version of this API.
@@ -21,21 +17,19 @@ public interface Kapt {
*
* @return the version of this model.
*/
long getModelVersion();
val modelVersion: Long
/**
* Returns the module (Gradle project) name.
*
* @return the module name.
*/
@NotNull
String getName();
val name: String
/**
* Return all kapt source sets.
*
* @return all kapt source sets.
*/
@NotNull
Collection<KaptSourceSet> getKaptSourceSets();
}
val kaptSourceSets: Collection<KaptSourceSet>
}
@@ -3,22 +3,20 @@
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.model;
package org.jetbrains.kotlin.gradle.model
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.io.File
/**
* Represents a source set for a given kapt model.
* @see Kapt
*/
public interface KaptSourceSet {
interface KaptSourceSet {
/**
* Possible source set types.
*/
enum KaptSourceSetType {
enum class KaptSourceSetType {
PRODUCTION,
TEST
}
@@ -28,38 +26,33 @@ public interface KaptSourceSet {
*
* @return the source set name.
*/
@NotNull
String getName();
val name: String
/**
* Return the type of the source set.
*
* @return the type of the source set.
*/
@NotNull
KaptSourceSetType getType();
val type: KaptSourceSetType
/**
* Return generated sources directory.
*
* @return generated sources directory.
*/
@NotNull
File getGeneratedSourcesDirectory();
val generatedSourcesDirectory: File
/**
* Return Kotlin generated sources directory.
*
* @return Kotlin generated sources directory.
*/
@NotNull
File getGeneratedKotlinSourcesDirectory();
val generatedKotlinSourcesDirectory: File
/**
* Return Kotlin generated classes directory.
*
* @return Kotlin generated classes directory.
*/
@NotNull
File getGeneratedClassesDirectory();
}
val generatedClassesDirectory: File
}
@@ -3,16 +3,13 @@
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.model;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
package org.jetbrains.kotlin.gradle.model
/**
* Entry point for Kotlin Android Extensions models.
* Represents the description of Android only features. Provided by 'kotlin-android-extensions' plugin.
*/
public interface KotlinAndroidExtension {
interface KotlinAndroidExtension {
/**
* Return a number representing the version of this API.
@@ -20,28 +17,26 @@ public interface KotlinAndroidExtension {
*
* @return the version of this model.
*/
long getModelVersion();
val modelVersion: Long
/**
* Returns the module (Gradle project) name.
*
* @return the module name.
*/
@NotNull
String getName();
val name: String
/**
* Indicate the use of experimental features.
*
* @return if experimental features are used.
*/
boolean isExperimental();
val isExperimental: Boolean
/**
* Return the default cache implementation.
*
* @return the default cache implementation.
*/
@Nullable
String getDefaultCacheImplementation();
}
val defaultCacheImplementation: String?
}
@@ -3,30 +3,26 @@
* 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;
package org.jetbrains.kotlin.gradle.model
/**
* Entry point for the model of Kotlin Projects.
* Plugins 'kotlin', 'kotlin-platform-jvm', 'kotlin2js', 'kotlin-platform-js' and 'kotlin-platform-common' can produce this model.
*/
public interface KotlinProject {
interface KotlinProject {
/**
* Possible Kotlin project types.
*/
enum ProjectType {
enum class ProjectType {
/** Indicator of platform plugin id 'kotlin-platform-jvm' or 'kotlin'. */
/** Indicator of platform plugin id 'kotlin-platform-jvm' or 'kotlin'. */
PLATFORM_JVM,
/** Indicator of platform plugin id 'kotlin-platform-js' or 'kotlin2js'. */
/** Indicator of platform plugin id 'kotlin-platform-js' or 'kotlin2js'. */
PLATFORM_JS,
/** Indicator of platform plugin id 'kotlin-platform-common'. */
/** Indicator of platform plugin id 'kotlin-platform-common'. */
PLATFORM_COMMON
}
@@ -36,53 +32,47 @@ public interface KotlinProject {
*
* @return the version of this model.
*/
long getModelVersion();
val modelVersion: Long
/**
* Returns the module (Gradle project) name.
*
* @return the module name.
*/
@NotNull
String getName();
val name: String
/**
* Return the Kotlin version.
*
* @return the Kotlin version.
*/
@NotNull
String getKotlinVersion();
val kotlinVersion: String
/**
* Return the type of the platform plugin applied.
*
* @return the type of the platform plugin applied. Possible values are defined in the enum.
*/
@NotNull
ProjectType getProjectType();
val projectType: ProjectType
/**
* Return all source sets used by Kotlin.
*
* @return all source sets.
*/
@NotNull
Collection<SourceSet> getSourceSets();
val sourceSets: Collection<SourceSet>
/**
* Return all modules (Gradle projects) registered as 'expectedBy' dependency.
*
* @return expectedBy dependencies.
*/
@NotNull
Collection<String> getExpectedByDependencies();
val expectedByDependencies: Collection<String>
/**
* Return an object containing a descriptor of the experimental features.
*
* @return experimental features.
*/
@NotNull
ExperimentalFeatures getExperimentalFeatures();
}
val experimentalFeatures: ExperimentalFeatures
}
@@ -3,17 +3,13 @@
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.model;
import org.jetbrains.annotations.NotNull;
import java.util.List;
package org.jetbrains.kotlin.gradle.model
/**
* Entry point for Kotlin No Arg models.
* Represents the description of annotations interpreted by 'kotlin-noarg' plugin.
*/
public interface NoArg {
interface NoArg {
/**
* Return a number representing the version of this API.
@@ -21,31 +17,28 @@ public interface NoArg {
*
* @return the version of this model.
*/
long getModelVersion();
val modelVersion: Long
/**
* Returns the module (Gradle project) name.
*
* @return the module name.
*/
@NotNull
String getName();
val name: String
/**
* Return the list of annotations.
*
* @return the list of annotations.
*/
@NotNull
List<String> getAnnotations();
val annotations: List<String>
/**
* Return the list of presets.
*
* @return the list of presets.
*/
@NotNull
List<String> getPresets();
val presets: List<String>
/**
* Return if should invoke initializers.
@@ -53,5 +46,5 @@ public interface NoArg {
*
* @return if initializers should be invoked.
*/
boolean isInvokeInitializers();
}
val isInvokeInitializers: Boolean
}
@@ -3,17 +3,13 @@
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.model;
import org.jetbrains.annotations.NotNull;
import java.util.List;
package org.jetbrains.kotlin.gradle.model
/**
* Entry point for Kotlin Sam With Receiver models.
* Represents the description of annotations interpreted by 'kotlin-sam-with-receiver' plugin.
*/
public interface SamWithReceiver {
interface SamWithReceiver {
/**
* Return a number representing the version of this API.
@@ -21,29 +17,26 @@ public interface SamWithReceiver {
*
* @return the version of this model.
*/
long getModelVersion();
val modelVersion: Long
/**
* Returns the module (Gradle project) name.
*
* @return the module name.
*/
@NotNull
String getName();
val name: String
/**
* Return the list of annotations.
*
* @return the list of annotations.
*/
@NotNull
List<String> getAnnotations();
val annotations: List<String>
/**
* Return the list of presets.
*
* @return the list of presets.
*/
@NotNull
List<String> getPresets();
}
val presets: List<String>
}
@@ -3,23 +3,20 @@
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.gradle.model;
package org.jetbrains.kotlin.gradle.model
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.Collection;
import java.io.File
/**
* Represents a source set for a given Kotlin Gradle project.
* @see KotlinProject
*/
public interface SourceSet {
interface SourceSet {
/**
* Possible source set types.
*/
enum SourceSetType {
enum class SourceSetType {
PRODUCTION,
TEST
}
@@ -29,62 +26,54 @@ public interface SourceSet {
*
* @return the source set name.
*/
@NotNull
String getName();
val name: String
/**
* Return the type of the source set.
*
* @return the type of the source set.
*/
@NotNull
SourceSetType getType();
val type: SourceSetType
/**
* Return the names of all friend source sets.
*
* @return friend source sets.
*/
@NotNull
Collection<String> getFriendSourceSets();
val friendSourceSets: Collection<String>
/**
* Return all Kotlin sources directories.
*
* @return all Kotlin sources directories.
*/
@NotNull
Collection<File> getSourceDirectories();
val sourceDirectories: Collection<File>
/**
* Return all Kotlin resources directories.
*
* @return all Kotlin resources directories.
*/
@NotNull
Collection<File> getResourcesDirectories();
val resourcesDirectories: Collection<File>
/**
* Return the classes output directory.
*
* @return the classes output directory.
*/
@NotNull
File getClassesOutputDirectory();
val classesOutputDirectory: File
/**
* Return the resources output directory.
*
* @return the resources output directory.
*/
@NotNull
File getResourcesOutputDirectory();
val resourcesOutputDirectory: File
/**
* Return an object containing all compiler arguments for this source set.
*
* @return compiler arguments for this source set.
*/
@NotNull
CompilerArguments getCompilerArguments();
}
val compilerArguments: CompilerArguments
}