All Projects → Kotlin → Binary Compatibility Validator

Kotlin / Binary Compatibility Validator

Licence: apache-2.0
Public API management tool

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Binary Compatibility Validator

Chn Eolinker Ams Lite 4.0 For Php
中国最大的在线API管理平台EOLINKER 旗下API管理系统开源精简版,适合个人以及微型团队使用。
Stars: ✭ 869 (+347.94%)
Mutual labels:  api-management
Mcw Modern Cloud Apps
MCW Modern cloud apps
Stars: ✭ 90 (-53.61%)
Mutual labels:  api-management
Mockbin
Mock, Test & Track HTTP Requests and Response for Microservices
Stars: ✭ 1,782 (+818.56%)
Mutual labels:  api-management
Food Delivery Application
This android application is a food delivery application. It uses various layouts and a nice GUI.
Stars: ✭ 27 (-86.08%)
Mutual labels:  api-management
Tyk Kubernetes
Tyk + Kubernetes integration (guide).
Stars: ✭ 63 (-67.53%)
Mutual labels:  api-management
Apisix Docker
the docker for Apache APISIX
Stars: ✭ 119 (-38.66%)
Mutual labels:  api-management
Parallec
Fast Parallel Async HTTP/SSH/TCP/UDP/Ping Client Java Library. Aggregate 100,000 APIs & send anywhere in 20 lines of code. Ping/HTTP Calls 8000 servers in 12 seconds. (Akka) www.parallec.io
Stars: ✭ 777 (+300.52%)
Mutual labels:  api-management
Otoroshi
Lightweight api management on top of a modern http reverse proxy
Stars: ✭ 177 (-8.76%)
Mutual labels:  api-management
Microgateway
IBM API Connect Microgateway framework, built on Node.js & Nginx
Stars: ✭ 1,131 (+482.99%)
Mutual labels:  api-management
Api Umbrella
Open source API management platform
Stars: ✭ 1,735 (+794.33%)
Mutual labels:  api-management
Fusio
Open source API management platform
Stars: ✭ 946 (+387.63%)
Mutual labels:  api-management
Gravitee Gateway
Gravitee.io - API Management - OpenSource API Gateway
Stars: ✭ 1,123 (+478.87%)
Mutual labels:  api-management
Istio Workshop
In this workshop, you'll learn how to install and configure Istio, an open source framework for connecting, securing, and managing microservices, on Google Kubernetes Engine, Google’s hosted Kubernetes product. You will also deploy an Istio-enabled multi-service application
Stars: ✭ 120 (-38.14%)
Mutual labels:  api-management
Kong
🦍 The Cloud-Native API Gateway
Stars: ✭ 30,838 (+15795.88%)
Mutual labels:  api-management
Appkernel
API development made easy: a smart Python 3 API framework
Stars: ✭ 152 (-21.65%)
Mutual labels:  api-management
Nei Toolkit
NEI 接口文档管理平台配套自动化工具
Stars: ✭ 781 (+302.58%)
Mutual labels:  api-management
Wicked.haufe.io
An API Management system based on Mashape Kong
Stars: ✭ 110 (-43.3%)
Mutual labels:  api-management
Kanali
A Kubernetes Native API Management Solution
Stars: ✭ 192 (-1.03%)
Mutual labels:  api-management
Tree Gateway
This is a full featured and free API Gateway
Stars: ✭ 160 (-17.53%)
Mutual labels:  api-management
Enroute
EnRoute Universal Gateway: Cloud Native API gateway with OpenAPI support and free L7 rate-limiting built on Envoy proxy
Stars: ✭ 126 (-35.05%)
Mutual labels:  api-management

JetBrains incubator project Apache license

Binary compatibility validator

The tool allows to dump binary API of a Kotlin library that is public in sense of Kotlin visibilities and ensures that the public binary API wasn't changed in a way that make this change binary incompatible.

Contents

Setup

Binary compatibility validator is a Gradle plugin that can be added to your build in the following way:

  • in build.gradle.kts
plugins {
    id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.5.0"
}
  • in build.gradle
plugins {
    id 'org.jetbrains.kotlinx.binary-compatibility-validator' version '0.5.0'
}

It is enough to apply the plugin only to the root project build file; all sub-projects will be configured automatically.

Tasks

The plugin provides two tasks:

  • apiDump — builds the project and dumps its public API in project api subfolder. API is dumped in a human-readable format. If API dump already exists, it will be overwritten.
  • apiCheck — builds the project and checks that project's public API is the same as golden value in project api subfolder. This task is automatically inserted into check pipeline, so both build and check tasks will start checking public API upon their execution.

Optional parameters

Binary compatibility validator can be additionally configured with the following DSL:

Groovy

apiValidation {
    /**
     * Packages that are excluded from public API dumps even if they
     * contain public API. 
     */
    ignoredPackages += ["kotlinx.coroutines.internal"]

    /**
     * Sub-projects that are excluded from API validation 
     */
    ignoredProjects += ["benchmarks", "examples"]

    /**
     * Classes (fully qualified) that are excluded from public API dumps even if they
     * contain public API.
     */
    ignoredClasses += ["com.company.BuildConfig"]

    /**
     * Set of annotations that exclude API from being public.
     * Typically, it is all kinds of `@InternalApi` annotations that mark 
     * effectively private API that cannot be actually private for technical reasons.
     */
    nonPublicMarkers += ["my.package.MyInternalApiAnnotation"]

    /**
     * Flag to programmatically disable compatibility validator
     */
    validationDisabled = true
}

Kotlin

apiValidation {
    /**
     * Packages that are excluded from public API dumps even if they
     * contain public API.
     */
    ignoredPackages.add("kotlinx.coroutines.internal")

    /**
     * Sub-projects that are excluded from API validation
     */
    ignoredProjects.addAll(listOf("benchmarks", "examples"))

    /**
     * Classes (fully qualified) that are excluded from public API dumps even if they
     * contain public API.
     */
    ignoredClasses.add("com.company.BuildConfig")
    
    /**
     * Set of annotations that exclude API from being public.
     * Typically, it is all kinds of `@InternalApi` annotations that mark
     * effectively private API that cannot be actually private for technical reasons.
     */
    nonPublicMarkers.add("my.package.MyInternalApiAnnotation")

    /**
     * Flag to programmatically disable compatibility validator
     */
    validationDisabled = false
}

Workflow

When starting to validate your library public API, we recommend the following workflow:

  • Preparation phase (one-time action):

    • As the first step, apply the plugin, configure it and execute apiDump.
    • Validate your public API manually.
    • Commit .api files to your VCS.
    • At this moment, default check task will validate public API along with test run and will fail the build if API differs.
  • Regular workflow

    • When doing code changes that do not imply any changes in public API, no additional actions should be performed. check task on your CI will validate everything.
    • When doing code changes that imply changes in public API, whether it is a new API or adjustments in existing one, check task will start to fail. apiDump should be executed manually, the resulting diff in .api file should be verified: only signatures you expected to change should be changed.
    • Commit the resulting .api diff along with code changes.

What constitutes the public API

Classes

A class is considered to be effectively public if all of the following conditions are met:

  • it has public or protected JVM access (ACC_PUBLIC or ACC_PROTECTED)
  • it has one of the following visibilities in Kotlin:
    • no visibility (means no Kotlin declaration corresponds to this compiled class)
    • public
    • protected
    • internal, only in case if the class is annotated with PublishedApi
  • it isn't a local class
  • it isn't a synthetic class with mappings for when tableswitches ($WhenMappings)
  • it contains at least one effectively public member, in case if the class corresponds to a kotlin file with top-level members or a multifile facade
  • in case if the class is a member in another class, it is contained in the effectively public class
  • in case if the class is a protected member in another class, it is contained in the non-final class

Members

A member of the class (i.e. a field or a method) is considered to be effectively public if all of the following conditions are met:

  • it has public or protected JVM access (ACC_PUBLIC or ACC_PROTECTED)

  • it has one of the following visibilities in Kotlin:

    • no visibility (means no Kotlin declaration corresponds to this class member)
    • public
    • protected
    • internal, only in case if the class is annotated with PublishedApi

    Note that Kotlin visibility of a field exposed by lateinit property is the visibility of its setter.

  • in case if the member is protected, it is contained in non-final class

  • it isn't a synthetic access method for a private field

What makes an incompatible change to the public binary API

Class changes

For a class a binary incompatible change is:

  • changing the full class name (including package and containing classes)
  • changing the superclass, so that the class no longer has the previous superclass in the inheritance chain
  • changing the set of implemented interfaces so that the class no longer implements interfaces it had implemented before
  • changing one of the following access flags:
    • ACC_PUBLIC, ACC_PROTECTED, ACC_PRIVATE — lessening the class visibility
    • ACC_FINAL — making non-final class final
    • ACC_ABSTRACT — making non-abstract class abstract
    • ACC_INTERFACE — changing class to interface and vice versa
    • ACC_ANNOTATION — changing annotation to interface and vice versa

Class member changes

For a class member a binary incompatible change is:

  • changing its name
  • changing its descriptor (erased return type and parameter types for methods); this includes changing field to method and vice versa
  • changing one of the following access flags:
    • ACC_PUBLIC, ACC_PROTECTED, ACC_PRIVATE — lessening the member visibility
    • ACC_FINAL — making non-final field or method final
    • ACC_ABSTRACT — making non-abstract method abstract
    • ACC_STATIC — changing instance member to static and vice versa

Building the project locally

In order to build and run tests in the project in IDE, two prerequisites are required:

  • Java 11 or above in order to use the latest ASM
  • All build actions in the IDE should be delegated to Gradle
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].