github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/java/libraries/retrofit/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      sourceCompatibility = JavaVersion.VERSION_1_7
    95      targetCompatibility = JavaVersion.VERSION_1_7
    96  
    97      install {
    98          repositories.mavenInstaller {
    99              pom.artifactId = '{{artifactId}}'
   100          }
   101      }
   102  
   103      task execute(type:JavaExec) {
   104         main = System.getProperty('mainClass')
   105         classpath = sourceSets.main.runtimeClasspath
   106      }
   107  }
   108  
   109  ext {
   110      okhttp_version = "2.7.5"
   111      oltu_version = "1.0.1"
   112      retrofit_version = "1.9.0"
   113      swagger_annotations_version = "1.5.21"
   114      junit_version = "4.13"
   115      jodatime_version = "2.9.3"
   116      {{#threetenbp}}
   117      threetenbp_version = "1.4.0"
   118      {{/threetenbp}}
   119  }
   120  
   121  dependencies {
   122      compile "com.squareup.okhttp:okhttp:$okhttp_version"
   123      compile "com.google.code.findbugs:jsr305:3.0.2"
   124      compile "com.squareup.retrofit:retrofit:$retrofit_version"
   125      compile "io.swagger:swagger-annotations:$swagger_annotations_version"
   126      compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version"
   127      compile "joda-time:joda-time:$jodatime_version"
   128      {{#threetenbp}}
   129      compile "org.threeten:threetenbp:$threetenbp_version"
   130      {{/threetenbp}}
   131      testCompile "junit:junit:$junit_version"
   132  }