Skip to content

Commit

Permalink
chore(java): add api compat check (#1335)
Browse files Browse the repository at this point in the history
  • Loading branch information
aallam authored Feb 27, 2023
1 parent 69aa997 commit d7b03ae
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/.cache_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.0.17
0.0.18
4 changes: 4 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ jobs:
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language == 'javascript' && contains(matrix.client.toRun,'algoliasearch') }}
run: cd ${{ matrix.client.path }} && yarn workspace algoliasearch test

- name: Run Java 'algoliasearch' public API validation
if: ${{ steps.cache.outputs.cache-hit != 'true' && matrix.client.language == 'java' }}
run: cd ${{ matrix.client.path }} && ./gradlew :api:japicmp

- name: Remove previous CTS output
run: rm -rf ${{ matrix.client.testsToDelete }} || true

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ dist

generators/bin

**/java/bin/
39 changes: 39 additions & 0 deletions clients/algoliasearch-client-java-2/api/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// This package is to check the public API (binary) compatibility of the latest
// published release with `algoliasearch-client-java` package.

import me.champeau.gradle.japicmp.JapicmpTask

plugins {
id 'java-library'
id 'me.champeau.gradle.japicmp' version '0.4.1'
}

repositories {
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" }
mavenCentral()
}

def baselineConfig = configurations.register('baseline')
def latestConfig = configurations.register('latest')

dependencies {
baseline('com.algolia:algoliasearch-client-java:4.+') {
transitive = false
}
latest(projects.algoliasearchCore)
}

def japicmp = tasks.register('japicmp', JapicmpTask) {
dependsOn tasks.findByName("jar")
oldClasspath.setFrom(baselineConfig)
newClasspath.setFrom(latestConfig)
onlyBinaryIncompatibleModified.set(true)
failOnModification.set(true)
txtOutputFile.set(file("$buildDir/reports/japi.txt"))
ignoreMissingClasses.set(true)
includeSynthetic.set(true)
}

tasks.findByName('check').configure {
dependsOn japicmp
}
3 changes: 3 additions & 0 deletions clients/algoliasearch-client-java-2/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
rootProject.name = "algoliasearch-client-java"

include(":algoliasearch-core")
include(":api")

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

0 comments on commit d7b03ae

Please sign in to comment.