From 3bd91211259f4af28a2bb74bf2f6375ecfbcfcdf Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Thu, 12 Sep 2024 19:05:46 +0530 Subject: [PATCH 01/12] removed oss-library-gradle-plugin with maven-publish --- .github/actions/maven-publish/action.yml | 9 +- .github/workflows/java-release.yml | 6 +- build.gradle | 35 ++------ gradle.properties | 21 +++++ gradle/maven-publish.gradle | 101 +++++++++++++++++++++++ gradle/versioning.gradle | 17 ++++ settings.gradle | 3 - 7 files changed, 149 insertions(+), 43 deletions(-) create mode 100644 gradle.properties create mode 100644 gradle/maven-publish.gradle create mode 100644 gradle/versioning.gradle diff --git a/.github/actions/maven-publish/action.yml b/.github/actions/maven-publish/action.yml index 33336593..2e0c5412 100644 --- a/.github/actions/maven-publish/action.yml +++ b/.github/actions/maven-publish/action.yml @@ -1,6 +1,8 @@ name: Publish release to Java inputs: + java-version: + required: true ossr-username: required: true ossr-token: @@ -9,12 +11,7 @@ inputs: required: true signing-password: required: true - java-version: - required: true - is-android: - required: true - version: - required: true + runs: using: composite diff --git a/.github/workflows/java-release.yml b/.github/workflows/java-release.yml index 6795ffa0..cc38e928 100644 --- a/.github/workflows/java-release.yml +++ b/.github/workflows/java-release.yml @@ -6,9 +6,7 @@ on: java-version: required: true type: string - is-android: - required: true - type: string + secrets: ossr-username: required: true @@ -70,8 +68,6 @@ jobs: - uses: ./.github/actions/maven-publish with: java-version: ${{ inputs.java-version }} - is-android: ${{ inputs.is-android }} - version: ${{ steps.get_version.outputs.version }} ossr-username: ${{ secrets.ossr-username }} ossr-token: ${{ secrets.ossr-token }} signing-key: ${{ secrets.signing-key }} diff --git a/build.gradle b/build.gradle index c91c8fcc..3939aea0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,44 +1,18 @@ plugins { id 'java' id 'jacoco' - id 'com.auth0.gradle.oss-library.java' } repositories { mavenCentral() } +apply from: rootProject.file('gradle/versioning.gradle') + +version = getVersionFromFile() group = 'com.auth0' logger.lifecycle("Using version ${version} for ${name} group $group") -def signingKey = findProperty('signingKey') -def signingKeyPwd = findProperty('signingPassword') - -oss { - name 'auth0' - repository 'auth0-java' - organization 'auth0' - description 'Java client library for the Auth0 platform.' - baselineCompareVersion '2.0.0' - testInJavaVersions = [8, 11, 17] - skipAssertSigningConfiguration true - - developers { - auth0 { - displayName = 'Auth0' - email = 'oss@auth0.com' - } - lbalmaceda { - displayName = 'Luciano Balmaceda' - email = 'luciano.balmaceda@auth0.com' - } - } -} - -signing { - useInMemoryPgpKeys(signingKey, signingKeyPwd) -} - jacocoTestReport { reports { xml.enabled = true @@ -105,3 +79,6 @@ dependencies { } } } + +//apply from: rootProject.file('gradle/jacoco.gradle') +apply from: rootProject.file('gradle/maven-publish.gradle') diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..69714a96 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,21 @@ +GROUP=com.auth0 +POM_ARTIFACT_ID=auth0 +VERSION_NAME=2.12.0 + +POM_NAME=auth0-java +POM_DESCRIPTION=Java client library for the Auth0 platform +POM_PACKAGING=jar + +POM_URL=https://github.com/auth0/auth0-java +POM_SCM_URL=https://github.com/auth0/auth0-java + +POM_SCM_CONNECTION=scm:git:https://github.com/auth0/auth0-java.git +POM_SCM_DEV_CONNECTION=scm:git:https://github.com/auth0/auth0-java.git + +POM_LICENCE_NAME=The MIT License (MIT) +POM_LICENCE_URL=https://raw.githubusercontent.com/auth0/auth0-java/master/LICENSE +POM_LICENCE_DIST=repo + +POM_DEVELOPER_ID=auth0 +POM_DEVELOPER_NAME=Auth0 +POM_DEVELOPER_EMAIL=oss@auth0.com diff --git a/gradle/maven-publish.gradle b/gradle/maven-publish.gradle new file mode 100644 index 00000000..1b22a1c2 --- /dev/null +++ b/gradle/maven-publish.gradle @@ -0,0 +1,101 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +task('sourcesJar', type: Jar, dependsOn: classes) { + archiveClassifier = 'sources' + from sourceSets.main.allSource +} + +task('javadocJar', type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.getDestinationDir() +} +tasks.withType(Javadoc).configureEach { + javadocTool = javaToolchains.javadocToolFor { + // Use latest JDK for javadoc generation + languageVersion = JavaLanguageVersion.of(17) + } +} + +javadoc { + // Specify the Java version that the project will use + options.addStringOption('-release', "8") +} +artifacts { + archives sourcesJar, javadocJar +} + + +final releaseRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" +final snapshotRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/" + +publishing { + publications { + mavenJava(MavenPublication) { + + groupId = GROUP + artifactId = POM_ARTIFACT_ID + version = getVersionName() + + //artifact("$buildDir/libs/${project.name}-${version}.jar") + artifact sourcesJar + artifact javadocJar + + from components.java + + pom { + name = POM_NAME + packaging = POM_PACKAGING + description = POM_DESCRIPTION + url = POM_URL + + licenses { + license { + name = POM_LICENCE_NAME + url = POM_LICENCE_URL + distribution = POM_LICENCE_DIST + } + } + + developers { + developer { + id = POM_DEVELOPER_ID + name = POM_DEVELOPER_NAME + email = POM_DEVELOPER_EMAIL + } + } + + scm { + url = POM_SCM_URL + connection = POM_SCM_CONNECTION + developerConnection = POM_SCM_DEV_CONNECTION + } + } + } + } + repositories { + maven { + name = "sonatype" + url = version.endsWith('SNAPSHOT') ? snapshotRepositoryUrl : releaseRepositoryUrl + credentials { + username = System.getenv("MAVEN_USERNAME") + password = System.getenv("MAVEN_PASSWORD") + } + } + } +} + +signing { + def signingKey = System.getenv("SIGNING_KEY") + def signingPassword = System.getenv("SIGNING_PASSWORD") + useInMemoryPgpKeys(signingKey, signingPassword) + + sign publishing.publications.mavenJava +} + +javadoc { + if(JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } +} + diff --git a/gradle/versioning.gradle b/gradle/versioning.gradle new file mode 100644 index 00000000..9a8dae58 --- /dev/null +++ b/gradle/versioning.gradle @@ -0,0 +1,17 @@ +def getVersionFromFile() { + def versionFile = rootProject.file('.version') + return versionFile.text.readLines().first().trim() +} + +def isSnapshot() { + return hasProperty('isSnapshot') ? isSnapshot.toBoolean() : true +} + +def getVersionName() { + return isSnapshot() ? project.version+"-SNAPSHOT" : project.version +} + +ext { + getVersionName = this.&getVersionName + getVersionFromFile = this.&getVersionFromFile +} diff --git a/settings.gradle b/settings.gradle index ed6821be..a32c80c4 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,9 +2,6 @@ pluginManagement { repositories { gradlePluginPortal() } - plugins { - id 'com.auth0.gradle.oss-library.java' version '0.18.0' - } } rootProject.name = 'auth0' From 489a974d25fe15031e4ff6b2800f08455aebf925 Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Fri, 13 Sep 2024 11:10:57 +0530 Subject: [PATCH 02/12] added apiDiff related changes --- gradle/maven-publish.gradle | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gradle/maven-publish.gradle b/gradle/maven-publish.gradle index 1b22a1c2..5092c44f 100644 --- a/gradle/maven-publish.gradle +++ b/gradle/maven-publish.gradle @@ -99,3 +99,17 @@ 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}") + } +} + From 230bf510315860e2385802dbbb9d9dcfece2f947 Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Mon, 16 Sep 2024 09:43:31 +0530 Subject: [PATCH 03/12] updated gradle file --- build.gradle | 37 +++++++++++++++++++++++++++++++++++++ gradle/maven-publish.gradle | 13 ------------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 3939aea0..0e5c2e31 100644 --- a/build.gradle +++ b/build.gradle @@ -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() @@ -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" @@ -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" diff --git a/gradle/maven-publish.gradle b/gradle/maven-publish.gradle index 5092c44f..234639c4 100644 --- a/gradle/maven-publish.gradle +++ b/gradle/maven-publish.gradle @@ -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}") - } -} From 59e0144fecdc2cbee6561a41ded4bc8bb3477c2b Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Mon, 16 Sep 2024 09:50:42 +0530 Subject: [PATCH 04/12] removed oss extension --- build.gradle | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/build.gradle b/build.gradle index 0e5c2e31..b57ff2da 100644 --- a/build.gradle +++ b/build.gradle @@ -47,29 +47,19 @@ compileTestJava { } // 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.") +def baselineJarPath = file("$buildDir/libs/baseline-version.jar") + + +task('apiDiff', type: JapicmpTask, dependsOn: 'jar') { + oldClasspath = files(baselineJarPath) + 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}") } } From 59e888b319c2382957b0937c701233fa5c9401d5 Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Mon, 16 Sep 2024 10:07:43 +0530 Subject: [PATCH 05/12] defined baselineJarPath --- build.gradle | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index b57ff2da..a735a9bd 100644 --- a/build.gradle +++ b/build.gradle @@ -47,8 +47,7 @@ compileTestJava { } // Define or replace this method with the actual implementation -def baselineJarPath = file("$buildDir/libs/baseline-version.jar") - +def baselineJarPath = file("$rootDir/libs/baseline-version.jar") task('apiDiff', type: JapicmpTask, dependsOn: 'jar') { oldClasspath = files(baselineJarPath) @@ -59,7 +58,7 @@ task('apiDiff', type: JapicmpTask, dependsOn: 'jar') { htmlOutputFile = file("$buildDir/reports/apiDiff/apiDiff.html") txtOutputFile = file("$buildDir/reports/apiDiff/apiDiff.txt") doLast { - project.logger.quiet("Comparing against baseline version ${lib.baselineCompareVersion}") + project.logger.quiet("Comparing against manually specified baseline JAR at ${baselineJarPath}") } } From 675be6665a976b8d71fd07bae45bfbc84e391577 Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Mon, 16 Sep 2024 11:46:20 +0530 Subject: [PATCH 06/12] changed new classPath --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a735a9bd..c62d0b19 100644 --- a/build.gradle +++ b/build.gradle @@ -51,7 +51,7 @@ def baselineJarPath = file("$rootDir/libs/baseline-version.jar") task('apiDiff', type: JapicmpTask, dependsOn: 'jar') { oldClasspath = files(baselineJarPath) - newClasspath = files(jar.archiveFile) + newClasspath = files(tasks.named('jar').get().archiveFile) onlyModified = true failOnModification = true ignoreMissingClasses = true From 7f654c2971c0f50b232b84106aff532b762021a9 Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Mon, 16 Sep 2024 12:59:45 +0530 Subject: [PATCH 07/12] added baseLine version --- build.gradle | 70 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 57 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index c62d0b19..7175f1c9 100644 --- a/build.gradle +++ b/build.gradle @@ -46,22 +46,66 @@ compileTestJava { options.compilerArgs << "-Xlint:deprecation" << "-Werror" } -// Define or replace this method with the actual implementation -def baselineJarPath = file("$rootDir/libs/baseline-version.jar") - -task('apiDiff', type: JapicmpTask, dependsOn: 'jar') { - oldClasspath = files(baselineJarPath) - newClasspath = files(tasks.named('jar').get().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 manually specified baseline JAR at ${baselineJarPath}") + +//baselineCompareVersion '2.0.0' +//testInJavaVersions = [8, 11, 17] +//skipAssertSigningConfiguration true +// +//// Define or replace this method with the actual implementation +//def baselineJarPath = file("$rootDir/libs/baseline-version.jar") +// +//task('apiDiff', type: JapicmpTask, dependsOn: 'jar') { +// oldClasspath = files(baselineJarPath) +// newClasspath = files(tasks.named('jar').get().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 manually specified baseline JAR at ${baselineJarPath}") +// } +//} + + +project.afterEvaluate { + def baselineVersion = '2.0.0' + testInJavaVersions = [8, 11, 17] + if (!baselineVersion) { + return + } + project.configure(project) { + 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}") + } + } } } +private static File getBaselineJar(Project project, String baselineVersion) { + // Use detached configuration: https://github.com/square/okhttp/blob/master/build.gradle#L270 + def group = project.group + try { + def baseline = "${project.group}:${project.name}:$baselineVersion" + project.group = 'virtual_group_for_japicmp' + def dependency = project.dependencies.create(baseline + "@jar") + return project.configurations.detachedConfiguration(dependency).files.find { + it.name == "${project.name}-${baselineVersion}.jar" + } + } finally { + project.group = group + } +} + + test { testLogging { events "skipped", "failed" From c7adfc0104ec011e137cd4e17d80248902879a4e Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Mon, 16 Sep 2024 19:22:49 +0530 Subject: [PATCH 08/12] added com.google.guava --- build.gradle | 89 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/build.gradle b/build.gradle index 7175f1c9..780fb0c1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,21 +1,31 @@ + +buildscript { + repositories { + jcenter() + } + + dependencies { + // https://github.com/melix/japicmp-gradle-plugin/issues/36 + classpath 'com.google.guava:guava:28.2-jre' + } +} + + 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" +// id 'java-gradle-plugin' +// id "com.gradle.plugin-publish" version "0.12.0" } repositories { - jcenter() - google() - gradlePluginPortal() +// jcenter() +// google() +// gradlePluginPortal() mavenCentral() } -import me.champeau.gradle.japicmp.JapicmpTask - - apply from: rootProject.file('gradle/versioning.gradle') version = getVersionFromFile() @@ -46,38 +56,44 @@ compileTestJava { options.compilerArgs << "-Xlint:deprecation" << "-Werror" } - -//baselineCompareVersion '2.0.0' -//testInJavaVersions = [8, 11, 17] -//skipAssertSigningConfiguration true -// -//// Define or replace this method with the actual implementation -//def baselineJarPath = file("$rootDir/libs/baseline-version.jar") -// -//task('apiDiff', type: JapicmpTask, dependsOn: 'jar') { -// oldClasspath = files(baselineJarPath) -// newClasspath = files(tasks.named('jar').get().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 manually specified baseline JAR at ${baselineJarPath}") -// } -//} - +import me.champeau.gradle.japicmp.JapicmpTask project.afterEvaluate { - def baselineVersion = '2.0.0' - testInJavaVersions = [8, 11, 17] - if (!baselineVersion) { - return + + def versions = project.ext.testInJavaVersions + println "All Test will be running in ${versions}" + for (pluginJavaTestVersion in versions) { + def taskName = "testInJava-${pluginJavaTestVersion}" + tasks.register(taskName, Test) { + def versionToUse = taskName.split("-").getAt(1) as Integer + description = "Runs unit tests on Java version ${versionToUse}." + println "Test will be running in ${versionToUse}" + group = 'verification' + javaLauncher.set(javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(versionToUse) + }) + shouldRunAfter(tasks.named('test')) + } + tasks.named('check') { + dependsOn(taskName) + } } + project.configure(project) { + def baselineVersion = project.ext.baselineCompareVersion + println "baselineVersion ${baselineVersion}" + task('apiDiff', type: JapicmpTask, dependsOn: 'jar') { + def baselineJarFile = getBaselineJar(project, baselineVersion) + def currentJarFile = tasks.jar.archiveFile.get().asFile + + println "Baseline JAR: ${baselineJarFile}" + println "Current JAR: ${currentJarFile}" + oldClasspath = files(getBaselineJar(project, baselineVersion)) + println "oldClasspath ${oldClasspath}" newClasspath = files(jar.archiveFile) + println "newClasspath ${newClasspath}" onlyModified = true failOnModification = true ignoreMissingClasses = true @@ -95,6 +111,7 @@ private static File getBaselineJar(Project project, String baselineVersion) { def group = project.group try { def baseline = "${project.group}:${project.name}:$baselineVersion" + println "baseline ${baseline}" project.group = 'virtual_group_for_japicmp' def dependency = project.dependencies.create(baseline + "@jar") return project.configurations.detachedConfiguration(dependency).files.find { @@ -118,6 +135,9 @@ ext { okhttpVersion = '4.11.0' hamcrestVersion = '2.2' jupiterVersion = '5.9.3' + + baselineCompareVersion = '2.0.0' + testInJavaVersions = [8, 11, 17] } dependencies { @@ -126,7 +146,8 @@ 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 "me.champeau.gradle:japicmp-gradle-plugin:0.2.9" +// implementation 'com.google.guava:guava:30.0-jre' implementation "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}" implementation "com.fasterxml.jackson.core:jackson-databind:2.15.0" From cb092f6386ea75fa764c53dbdfa3b1b3a29b06fe Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Wed, 18 Sep 2024 12:42:57 +0530 Subject: [PATCH 09/12] removed commented lines from workflow --- build.gradle | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/build.gradle b/build.gradle index 780fb0c1..df041f58 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,9 @@ - buildscript { repositories { jcenter() } dependencies { - // https://github.com/melix/japicmp-gradle-plugin/issues/36 classpath 'com.google.guava:guava:28.2-jre' } } @@ -15,14 +13,9 @@ 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() } @@ -146,8 +139,6 @@ 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.google.guava:guava:30.0-jre' implementation "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}" implementation "com.fasterxml.jackson.core:jackson-databind:2.15.0" @@ -171,5 +162,4 @@ dependencies { } } -//apply from: rootProject.file('gradle/jacoco.gradle') apply from: rootProject.file('gradle/maven-publish.gradle') From 33a67fa2a4dfd387a6d71fd24ed90cd20cdd9925 Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Thu, 19 Sep 2024 13:12:51 +0530 Subject: [PATCH 10/12] removed print statements from build.gradle file --- build.gradle | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/build.gradle b/build.gradle index df041f58..d8d43df8 100644 --- a/build.gradle +++ b/build.gradle @@ -4,6 +4,7 @@ buildscript { } dependencies { + // https://github.com/melix/japicmp-gradle-plugin/issues/36 classpath 'com.google.guava:guava:28.2-jre' } } @@ -54,7 +55,6 @@ import me.champeau.gradle.japicmp.JapicmpTask project.afterEvaluate { def versions = project.ext.testInJavaVersions - println "All Test will be running in ${versions}" for (pluginJavaTestVersion in versions) { def taskName = "testInJava-${pluginJavaTestVersion}" tasks.register(taskName, Test) { @@ -74,19 +74,9 @@ project.afterEvaluate { project.configure(project) { def baselineVersion = project.ext.baselineCompareVersion - println "baselineVersion ${baselineVersion}" - task('apiDiff', type: JapicmpTask, dependsOn: 'jar') { - def baselineJarFile = getBaselineJar(project, baselineVersion) - def currentJarFile = tasks.jar.archiveFile.get().asFile - - println "Baseline JAR: ${baselineJarFile}" - println "Current JAR: ${currentJarFile}" - oldClasspath = files(getBaselineJar(project, baselineVersion)) - println "oldClasspath ${oldClasspath}" newClasspath = files(jar.archiveFile) - println "newClasspath ${newClasspath}" onlyModified = true failOnModification = true ignoreMissingClasses = true @@ -104,7 +94,6 @@ private static File getBaselineJar(Project project, String baselineVersion) { def group = project.group try { def baseline = "${project.group}:${project.name}:$baselineVersion" - println "baseline ${baseline}" project.group = 'virtual_group_for_japicmp' def dependency = project.dependencies.create(baseline + "@jar") return project.configurations.detachedConfiguration(dependency).files.find { From 5645355da9f809cdb7e2b5077eb97a0ec92e4fbf Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Thu, 19 Sep 2024 16:18:15 +0530 Subject: [PATCH 11/12] updated com.google.guava version --- build.gradle | 8 ++++---- gradle/maven-publish.gradle | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index d8d43df8..21a25440 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { dependencies { // https://github.com/melix/japicmp-gradle-plugin/issues/36 - classpath 'com.google.guava:guava:28.2-jre' + classpath 'com.google.guava:guava:31.1-jre' } } @@ -23,7 +23,7 @@ repositories { apply from: rootProject.file('gradle/versioning.gradle') version = getVersionFromFile() -group = 'com.auth0' +group = GROUP logger.lifecycle("Using version ${version} for ${name} group $group") jacocoTestReport { @@ -60,7 +60,7 @@ project.afterEvaluate { tasks.register(taskName, Test) { def versionToUse = taskName.split("-").getAt(1) as Integer description = "Runs unit tests on Java version ${versionToUse}." - println "Test will be running in ${versionToUse}" + project.logger.quiet("Test will be running in ${versionToUse}") group = 'verification' javaLauncher.set(javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(versionToUse) @@ -119,7 +119,7 @@ ext { jupiterVersion = '5.9.3' baselineCompareVersion = '2.0.0' - testInJavaVersions = [8, 11, 17] + testInJavaVersions = [8, 11, 17, 21] } dependencies { diff --git a/gradle/maven-publish.gradle b/gradle/maven-publish.gradle index 234639c4..60474d52 100644 --- a/gradle/maven-publish.gradle +++ b/gradle/maven-publish.gradle @@ -37,7 +37,6 @@ publishing { artifactId = POM_ARTIFACT_ID version = getVersionName() - //artifact("$buildDir/libs/${project.name}-${version}.jar") artifact sourcesJar artifact javadocJar From e6b1bb0358a193c3a39a7575d5fba416f934dafd Mon Sep 17 00:00:00 2001 From: tanya-sinha_atko Date: Fri, 20 Sep 2024 15:48:56 +0530 Subject: [PATCH 12/12] added pom config --- gradle/maven-publish.gradle | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gradle/maven-publish.gradle b/gradle/maven-publish.gradle index 60474d52..beb5f464 100644 --- a/gradle/maven-publish.gradle +++ b/gradle/maven-publish.gradle @@ -7,7 +7,7 @@ task('sourcesJar', type: Jar, dependsOn: classes) { } task('javadocJar', type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' + archiveClassifier = 'javadoc' from javadoc.getDestinationDir() } tasks.withType(Javadoc).configureEach { @@ -37,11 +37,10 @@ publishing { artifactId = POM_ARTIFACT_ID version = getVersionName() + artifact("$buildDir/libs/${project.name}-${version}.jar") artifact sourcesJar artifact javadocJar - from components.java - pom { name = POM_NAME packaging = POM_PACKAGING @@ -69,6 +68,17 @@ publishing { connection = POM_SCM_CONNECTION developerConnection = POM_SCM_DEV_CONNECTION } + + pom.withXml { + def dependenciesNode = asNode().appendNode('dependencies') + + project.configurations.implementation.allDependencies.each { + def dependencyNode = dependenciesNode.appendNode('dependency') + dependencyNode.appendNode('groupId', it.group) + dependencyNode.appendNode('artifactId', it.name) + dependencyNode.appendNode('version', it.version) + } + } } } }