|
| 1 | +apply plugin: 'idea' |
| 2 | +apply plugin: 'eclipse' |
| 3 | + |
| 4 | +group = 'co.permify' |
| 5 | +version = '0.0.1' |
| 6 | + |
| 7 | +buildscript { |
| 8 | + repositories { |
| 9 | + mavenCentral() |
| 10 | + } |
| 11 | + dependencies { |
| 12 | + classpath 'com.android.tools.build:gradle:2.3.+' |
| 13 | + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' |
| 14 | + } |
| 15 | +} |
| 16 | + |
| 17 | +repositories { |
| 18 | + mavenCentral() |
| 19 | +} |
| 20 | + |
| 21 | +if(hasProperty('target') && target == 'android') { |
| 22 | + |
| 23 | + apply plugin: 'com.android.library' |
| 24 | + apply plugin: 'com.github.dcendents.android-maven' |
| 25 | + |
| 26 | + android { |
| 27 | + compileSdkVersion 25 |
| 28 | + buildToolsVersion '25.0.2' |
| 29 | + defaultConfig { |
| 30 | + minSdkVersion 14 |
| 31 | + targetSdkVersion 25 |
| 32 | + } |
| 33 | + |
| 34 | + compileOptions { |
| 35 | + sourceCompatibility JavaVersion.VERSION_1_8 |
| 36 | + targetCompatibility JavaVersion.VERSION_1_8 |
| 37 | + } |
| 38 | + |
| 39 | + // Rename the aar correctly |
| 40 | + libraryVariants.all { variant -> |
| 41 | + variant.outputs.each { output -> |
| 42 | + def outputFile = output.outputFile |
| 43 | + if (outputFile != null && outputFile.name.endsWith('.aar')) { |
| 44 | + def fileName = "${project.name}-${variant.baseName}-${version}.aar" |
| 45 | + output.outputFile = new File(outputFile.parent, fileName) |
| 46 | + } |
| 47 | + } |
| 48 | + } |
| 49 | + |
| 50 | + dependencies { |
| 51 | + provided "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + afterEvaluate { |
| 56 | + android.libraryVariants.all { variant -> |
| 57 | + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar |
| 58 | + task.description = "Create jar artifact for ${variant.name}" |
| 59 | + task.dependsOn variant.javaCompile |
| 60 | + task.from variant.javaCompile.destinationDirectory |
| 61 | + task.destinationDirectory = project.file("${project.buildDir}/outputs/jar") |
| 62 | + task.archiveFileName = "${project.name}-${variant.baseName}-${version}.jar" |
| 63 | + artifacts.add('archives', task); |
| 64 | + } |
| 65 | + } |
| 66 | + |
| 67 | + task sourcesJar(type: Jar) { |
| 68 | + from android.sourceSets.main.java.srcDirs |
| 69 | + archiveClassifier = 'sources' |
| 70 | + } |
| 71 | + |
| 72 | + artifacts { |
| 73 | + archives sourcesJar |
| 74 | + } |
| 75 | + |
| 76 | +} else { |
| 77 | + |
| 78 | + apply plugin: 'java' |
| 79 | + apply plugin: 'maven-publish' |
| 80 | + |
| 81 | + sourceCompatibility = JavaVersion.VERSION_1_8 |
| 82 | + targetCompatibility = JavaVersion.VERSION_1_8 |
| 83 | + |
| 84 | + publishing { |
| 85 | + repositories { |
| 86 | + maven { |
| 87 | + name = "GitHubPackages" |
| 88 | + url = "https://maven.pkg.github.com/permify/permify-java" |
| 89 | + credentials { |
| 90 | + username = System.getenv("GITHUB_ACTOR") |
| 91 | + password = System.getenv("GITHUB_TOKEN") |
| 92 | + } |
| 93 | + } |
| 94 | + } |
| 95 | + publications { |
| 96 | + maven(MavenPublication) { |
| 97 | + artifactId = 'permify' |
| 98 | + from components.java |
| 99 | + } |
| 100 | + } |
| 101 | + } |
| 102 | + |
| 103 | + task execute(type:JavaExec) { |
| 104 | + mainClass = System.getProperty('mainClass') |
| 105 | + classpath = sourceSets.main.runtimeClasspath |
| 106 | + } |
| 107 | + |
| 108 | + task sourcesJar(type: Jar, dependsOn: classes) { |
| 109 | + archiveClassifier = 'sources' |
| 110 | + from sourceSets.main.allSource |
| 111 | + } |
| 112 | + |
| 113 | + task javadocJar(type: Jar, dependsOn: javadoc) { |
| 114 | + archiveClassifier = 'javadoc' |
| 115 | + from javadoc.destinationDir |
| 116 | + } |
| 117 | + |
| 118 | + artifacts { |
| 119 | + archives sourcesJar |
| 120 | + archives javadocJar |
| 121 | + } |
| 122 | +} |
| 123 | + |
| 124 | +ext { |
| 125 | + spring_boot_version = "2.7.17" |
| 126 | + jakarta_annotation_version = "1.3.5" |
| 127 | + reactor_version = "3.4.34" |
| 128 | + reactor_netty_version = "1.0.39" |
| 129 | + jackson_version = "2.17.1" |
| 130 | + jackson_databind_version = "2.17.1" |
| 131 | + jackson_databind_nullable_version = "0.2.6" |
| 132 | + junit_version = "5.10.2" |
| 133 | +} |
| 134 | + |
| 135 | +dependencies { |
| 136 | + implementation "com.google.code.findbugs:jsr305:3.0.2" |
| 137 | + implementation "io.projectreactor:reactor-core:$reactor_version" |
| 138 | + implementation "org.springframework.boot:spring-boot-starter-webflux:$spring_boot_version" |
| 139 | + implementation "io.projectreactor.netty:reactor-netty-http:$reactor_netty_version" |
| 140 | + implementation "com.fasterxml.jackson.core:jackson-core:$jackson_version" |
| 141 | + implementation "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" |
| 142 | + implementation "com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version" |
| 143 | + implementation "com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:$jackson_version" |
| 144 | + implementation "org.openapitools:jackson-databind-nullable:$jackson_databind_nullable_version" |
| 145 | + implementation "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" |
| 146 | + implementation "jakarta.annotation:jakarta.annotation-api:$jakarta_annotation_version" |
| 147 | + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version" |
| 148 | +} |
0 commit comments