Skip to content

Commit

Permalink
updated gradle file
Browse files Browse the repository at this point in the history
  • Loading branch information
tanya732 committed Sep 16, 2024
1 parent 489a974 commit 230bf51
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 13 deletions.
37 changes: 37 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
plugins {
id 'java'
id 'jacoco'
id 'me.champeau.gradle.japicmp' version '0.2.9'
id 'java-gradle-plugin'
id "com.gradle.plugin-publish" version "0.12.0"
}

repositories {
jcenter()
google()
gradlePluginPortal()
mavenCentral()
}

import me.champeau.gradle.japicmp.JapicmpTask


apply from: rootProject.file('gradle/versioning.gradle')

version = getVersionFromFile()
Expand Down Expand Up @@ -37,6 +46,33 @@ compileTestJava {
options.compilerArgs << "-Xlint:deprecation" << "-Werror"
}

// Define or replace this method with the actual implementation
def getBaselineJar(Project project, String baselineVersion) {
file("${project.buildDir}/libs/${project.name}-${baselineVersion}.jar")
}

project.afterEvaluate {
def lib = project.extensions.findByName('oss')
if (lib?.baselineCompareVersion) {
project.configure(project) {
task('apiDiff', type: JapicmpTask, dependsOn: 'jar') {
oldClasspath = files(getBaselineJar(project, lib.baselineCompareVersion))
newClasspath = files(jar.archiveFile)
onlyModified = true
failOnModification = true
ignoreMissingClasses = true
htmlOutputFile = file("$buildDir/reports/apiDiff/apiDiff.html")
txtOutputFile = file("$buildDir/reports/apiDiff/apiDiff.txt")
doLast {
project.logger.quiet("Comparing against baseline version ${lib.baselineCompareVersion}")
}
}
}
} else {
project.logger.warn("The 'oss' extension or 'baselineCompareVersion' property is not defined.")
}
}

test {
testLogging {
events "skipped", "failed"
Expand All @@ -57,6 +93,7 @@ dependencies {
exclude group: 'com.squareup.okhttp3', module: 'okio'
}
implementation "com.squareup.okio:okio:3.5.0"
implementation "me.champeau.gradle:japicmp-gradle-plugin:0.2.9"

implementation "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
implementation "com.fasterxml.jackson.core:jackson-databind:2.15.0"
Expand Down
13 changes: 0 additions & 13 deletions gradle/maven-publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,4 @@ javadoc {
}
}

apply plugin: 'me.champeau.gradle.japicmp'
task('apiDiff', type: JapicmpTask, dependsOn: 'jar') {
oldClasspath = files(getBaselineJar(project, baselineVersion))
newClasspath = files(jar.archiveFile)
onlyModified = true
failOnModification = true
ignoreMissingClasses = true
htmlOutputFile = file("$buildDir/reports/apiDiff/apiDiff.html")
txtOutputFile = file("$buildDir/reports/apiDiff/apiDiff.txt")
doLast {
project.logger.quiet("Comparing against baseline version ${baselineVersion}")
}
}

0 comments on commit 230bf51

Please sign in to comment.