github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/java/libraries/retrofit2/build.gradle.mustache (about)

     1  apply plugin: 'idea'
     2  apply plugin: 'eclipse'
     3  
     4  group = '{{groupId}}'
     5  version = '{{artifactVersion}}'
     6  
     7  buildscript {
     8      repositories {
     9          maven { url "https://repo1.maven.org/maven2" }
    10          jcenter()
    11      }
    12      dependencies {
    13          classpath 'com.android.tools.build:gradle:2.3.+'
    14          classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
    15      }
    16  }
    17  
    18  repositories {
    19      jcenter()
    20  }
    21  
    22  
    23  if(hasProperty('target') && target == 'android') {
    24  
    25      apply plugin: 'com.android.library'
    26      apply plugin: 'com.github.dcendents.android-maven'
    27  
    28      android {
    29          compileSdkVersion 25
    30          buildToolsVersion '25.0.2'
    31          defaultConfig {
    32              minSdkVersion 14
    33              targetSdkVersion 25
    34          }
    35          compileOptions {
    36              {{#supportJava6}}
    37              sourceCompatibility JavaVersion.VERSION_1_6
    38              targetCompatibility JavaVersion.VERSION_1_6
    39              {{/supportJava6}}
    40              {{^supportJava6}}
    41              {{#java8}}
    42              sourceCompatibility JavaVersion.VERSION_1_8
    43              targetCompatibility JavaVersion.VERSION_1_8
    44              {{/java8}}
    45              {{^java8}}
    46              sourceCompatibility JavaVersion.VERSION_1_7
    47              targetCompatibility JavaVersion.VERSION_1_7
    48              {{/java8}}
    49              {{/supportJava6}}
    50          }
    51  
    52          // Rename the aar correctly
    53          libraryVariants.all { variant ->
    54              variant.outputs.each { output ->
    55                  def outputFile = output.outputFile
    56                  if (outputFile != null && outputFile.name.endsWith('.aar')) {
    57                      def fileName = "${project.name}-${variant.baseName}-${version}.aar"
    58                      output.outputFile = new File(outputFile.parent, fileName)
    59                  }
    60              }
    61          }
    62  
    63          dependencies {
    64              provided 'javax.annotation:jsr250-api:1.0'
    65          }
    66      }
    67  
    68      afterEvaluate {
    69          android.libraryVariants.all { variant ->
    70              def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
    71              task.description = "Create jar artifact for ${variant.name}"
    72              task.dependsOn variant.javaCompile
    73              task.from variant.javaCompile.destinationDir
    74              task.destinationDir = project.file("${project.buildDir}/outputs/jar")
    75              task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
    76              artifacts.add('archives', task);
    77          }
    78      }
    79  
    80      task sourcesJar(type: Jar) {
    81          from android.sourceSets.main.java.srcDirs
    82          classifier = 'sources'
    83      }
    84  
    85      artifacts {
    86          archives sourcesJar
    87      }
    88  
    89  } else {
    90  
    91      apply plugin: 'java'
    92      apply plugin: 'maven'
    93  
    94      {{#supportJava6}}
    95      sourceCompatibility = JavaVersion.VERSION_1_6
    96      targetCompatibility = JavaVersion.VERSION_1_6
    97      {{/supportJava6}}
    98      {{^supportJava6}}
    99      {{#java8}}
   100      sourceCompatibility = JavaVersion.VERSION_1_8
   101      targetCompatibility = JavaVersion.VERSION_1_8
   102      {{/java8}}
   103      {{^java8}}
   104      sourceCompatibility = JavaVersion.VERSION_1_7
   105      targetCompatibility = JavaVersion.VERSION_1_7
   106      {{/java8}}
   107      {{/supportJava6}}
   108  
   109      install {
   110          repositories.mavenInstaller {
   111              pom.artifactId = '{{artifactId}}'
   112          }
   113      }
   114  
   115      task execute(type:JavaExec) {
   116         main = System.getProperty('mainClass')
   117         classpath = sourceSets.main.runtimeClasspath
   118      }
   119  }
   120  
   121  ext {
   122      oltu_version = "1.0.1"
   123      retrofit_version = "2.3.0"
   124      {{#usePlayWS}}
   125      {{#play24}}
   126      jackson_version = "2.6.6"
   127      play_version = "2.4.11"
   128      {{/play24}}
   129      {{#play25}}
   130      jackson_version = "2.10.1"
   131      play_version = "2.5.14"
   132      {{/play25}}
   133      {{#play26}}
   134      jackson_version = "2.10.3"
   135      jackson_databind_version = "2.10.3"
   136      jackson_databind_nullable_version = "0.2.1"
   137      play_version = "2.6.7"
   138      {{/play26}}
   139      {{/usePlayWS}}
   140      swagger_annotations_version = "1.5.22"
   141      junit_version = "4.13"
   142      {{#useRxJava}}
   143      rx_java_version = "1.3.0"
   144      {{/useRxJava}}
   145      {{#useRxJava2}}
   146      rx_java_version = "2.1.1"
   147      {{/useRxJava2}}
   148      {{#joda}}
   149      jodatime_version = "2.9.9"
   150      {{/joda}}
   151      {{#threetenbp}}
   152      threetenbp_version = "1.4.0"
   153      {{/threetenbp}}
   154      json_fire_version = "1.8.0"
   155  }
   156  
   157  dependencies {
   158      compile "com.squareup.retrofit2:retrofit:$retrofit_version"
   159      compile "com.squareup.retrofit2:converter-scalars:$retrofit_version"
   160      compile "com.squareup.retrofit2:converter-gson:$retrofit_version"
   161      {{#useRxJava}}
   162      compile "com.squareup.retrofit2:adapter-rxjava:$retrofit_version"
   163      compile "io.reactivex:rxjava:$rx_java_version"
   164      {{/useRxJava}}
   165      {{#useRxJava2}}
   166      compile 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
   167      compile "io.reactivex.rxjava2:rxjava:$rx_java_version"
   168      {{/useRxJava2}}
   169      compile "io.swagger:swagger-annotations:$swagger_annotations_version"
   170      compile "com.google.code.findbugs:jsr305:3.0.2"
   171      compile ("org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version"){
   172          exclude group:'org.apache.oltu.oauth2' , module: 'org.apache.oltu.oauth2.common'
   173      }
   174      compile "io.gsonfire:gson-fire:$json_fire_version"
   175      {{#joda}}
   176      compile "joda-time:joda-time:$jodatime_version"
   177      {{/joda}}
   178      {{#threetenbp}}
   179      compile "org.threeten:threetenbp:$threetenbp_version"
   180      {{/threetenbp}}
   181      {{#usePlayWS}}
   182      {{#play26}}
   183      compile "com.typesafe.play:play-ahc-ws_2.12:$play_version"
   184      compile "javax.validation:validation-api:1.1.0.Final"
   185      {{/play26}}
   186      {{^play26}}
   187      compile "com.typesafe.play:play-java-ws_2.11:$play_version"
   188      {{/play26}}
   189      compile "com.squareup.retrofit2:converter-jackson:$retrofit_version"
   190      compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
   191      compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
   192      compile "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version"
   193      compile "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version"
   194      compile "com.fasterxml.jackson.datatype:jackson-datatype-{{^java8}}joda{{/java8}}{{#java8}}jsr310{{/java8}}:$jackson_version"
   195      {{/usePlayWS}}
   196  
   197      testCompile "junit:junit:$junit_version"
   198  }