diff --git a/.github/.cache_version b/.github/.cache_version index cd23180456..32786aa437 100644 --- a/.github/.cache_version +++ b/.github/.cache_version @@ -1 +1 @@ -0.0.17 +0.0.18 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index afd1140995..5073c54454 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -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 diff --git a/.gitignore b/.gitignore index 821ea6e9d9..c0a5592605 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ dist generators/bin +**/java/bin/ diff --git a/clients/algoliasearch-client-java-2/api/build.gradle b/clients/algoliasearch-client-java-2/api/build.gradle new file mode 100644 index 0000000000..104f22ac3e --- /dev/null +++ b/clients/algoliasearch-client-java-2/api/build.gradle @@ -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 +} diff --git a/clients/algoliasearch-client-java-2/settings.gradle b/clients/algoliasearch-client-java-2/settings.gradle index b60cb778ab..b39f066aa5 100644 --- a/clients/algoliasearch-client-java-2/settings.gradle +++ b/clients/algoliasearch-client-java-2/settings.gradle @@ -1,3 +1,6 @@ rootProject.name = "algoliasearch-client-java" include(":algoliasearch-core") +include(":api") + +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")