Class ProjectExtsKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final Directory getProtoDataWorkingDir()
      final File getProtocOutputDir()
      final Path getGeneratedDir()
      final static File generatedDir(Project $self, SourceSet sourceSet, String language) Obtains the generated directory for the given sourceSet and a language.
      final static Boolean hasJava(Project $self) Tells if this project can deal with Java code.
      final static Boolean hasKotlin(Project $self) Tells if this project can deal with Kotlin code.
      final static Boolean hasCompileTask(Project $self, Language language) Tells if this project has a compile task for the given language.
      final static Boolean hasJavaOrKotlin(Project $self) Verifies if the project can deal with Java or Kotlin code.
      final static JavaCompile javaCompileFor(Project $self, SourceSet sourceSet) Attempts to obtain the Java compilation Gradle task for the given source set.
      final static KotlinCompile<?> kotlinCompileFor(Project $self, SourceSet sourceSet) Attempts to obtain the Kotlin compilation Gradle task for the given source set.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • generatedDir

         final static File generatedDir(Project $self, SourceSet sourceSet, String language)

        Obtains the generated directory for the given sourceSet and a language.

        If the language is not given, the returned directory is the root directory for the source set.

      • hasJava

         final static Boolean hasJava(Project $self)

        Tells if this project can deal with Java code.

        Returns:

        true if java plugin is installed, false otherwise.

      • hasKotlin

         final static Boolean hasKotlin(Project $self)

        Tells if this project can deal with Kotlin code.

        Returns:

        true if any of the tasks starts with "compile" and ends with "Kotlin".

      • hasCompileTask

         final static Boolean hasCompileTask(Project $self, Language language)

        Tells if this project has a compile task for the given language.

      • hasJavaOrKotlin

         final static Boolean hasJavaOrKotlin(Project $self)

        Verifies if the project can deal with Java or Kotlin code.

        The current Protobuf support of Kotlin is based on Java codegen. Therefore, it is likely that Java would be enabled in the project for Kotlin proto code to be generated. Though, it may change someday, and Kotlin support for Protobuf would be self-sufficient. This method assumes such a case when it checks the presence of Kotlin compilation tasks.

      • javaCompileFor

         final static JavaCompile javaCompileFor(Project $self, SourceSet sourceSet)

        Attempts to obtain the Java compilation Gradle task for the given source set.

        Typically, the task is named by a pattern: compile<SourceSet name>Java, or just compileJava if the source set name is "main". If the task does not fit this described pattern, this method will not find it.

      • kotlinCompileFor

         final static KotlinCompile<?> kotlinCompileFor(Project $self, SourceSet sourceSet)

        Attempts to obtain the Kotlin compilation Gradle task for the given source set.

        Typically, the task is named by a pattern: compile<SourceSet name>Kotlin, or just compileKotlin if the source set name is "main". If the task does not fit this described pattern, this method will not find it.