{"id":24983403,"url":"https://github.com/mozilla-mobile/gradle-apilint","last_synced_at":"2025-04-11T20:51:14.109Z","repository":{"id":33256290,"uuid":"155444429","full_name":"mozilla-mobile/gradle-apilint","owner":"mozilla-mobile","description":"Gradle Plugin that tracks the API of an Android library and helps maintain backward compatibility.","archived":false,"fork":false,"pushed_at":"2025-04-07T19:17:54.000Z","size":351,"stargazers_count":8,"open_issues_count":15,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-07T19:42:15.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mozilla-mobile.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-10-30T19:28:49.000Z","updated_at":"2025-04-07T18:57:21.000Z","dependencies_parsed_at":"2025-04-07T19:47:10.774Z","dependency_job_id":null,"html_url":"https://github.com/mozilla-mobile/gradle-apilint","commit_stats":null,"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla-mobile%2Fgradle-apilint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla-mobile%2Fgradle-apilint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla-mobile%2Fgradle-apilint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mozilla-mobile%2Fgradle-apilint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mozilla-mobile","download_url":"https://codeload.github.com/mozilla-mobile/gradle-apilint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248480512,"owners_count":21110936,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-04T09:14:11.773Z","updated_at":"2025-04-11T20:51:14.087Z","avatar_url":"https://github.com/mozilla-mobile.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# API Lint Gradle Plugin\nTracks the API of an Android library and helps maintain backward compatibility.\n\n## Tasks\nThe apilint plugin provies the following tasks.\n\n\u003ccode\u003e\u003cb\u003eapiLint\u003ci\u003eVariantName\u003c/i\u003e\u003c/b\u003e\u003c/code\u003e Checks that the current API is\nbackward compatible with the API specified in a file, by default located in\n`//api.txt`. This task also checks for various lints as specified in\n[apilint.py](apilint/src/main/resources/apilint.py).\n\n\u003ccode\u003e\u003cb\u003eapiUpdateFile\u003ci\u003eVariantName\u003c/i\u003e\u003c/b\u003e\u003c/code\u003e Updates the API file from\nthe local state of the project\n\n\u003ccode\u003e\u003cb\u003eapiChangelogCheck\u003ci\u003eVariantName\u003c/i\u003e\u003c/b\u003e\u003c/code\u003e Only if\n`apiLint.changelogFileName` is set. Checks that the changelog file is updated\nevery time the api.txt file changes.\n\n## Usage\n##### build.gradle\n```gradle\nbuildscript {\n    repositories {\n        maven {\n            url \"https://plugins.gradle.org/m2/\"\n        }\n    }\n    dependencies {\n        classpath 'org.mozilla.apilint:apilint:$apilintVersion'\n    }\n}\n\napply plugin: 'org.mozilla.apilint'\napiLint.packageFilter = 'org.your.package.api'\n```\n\nMake sure that the `apply plugin` line appears after the `com.android.library`\nplugin has been applied.\n\nThen run\n\u003cpre\u003e\n$ ./gradlew apiUpdateFile\u003ci\u003eVariantName\u003c/i\u003e\n\u003c/pre\u003e\n\nThis will create an API file that contains a description of your library's API,\nby default this file will be called `api.txt`.\n\nAfter you make changes to your code, run:\n\n\u003cpre\u003e\n$ ./gradlew apiLint\u003ci\u003eVariantName\u003c/i\u003e\n\u003c/pre\u003e\n\nto check that the API of your library did not change. You can always run\n\u003ccode\u003eapiUpdateFile\u003ci\u003eVariantName\u003c/i\u003e\u003c/code\u003e to update the API file (e.g. when\nadding new APIs).\n\n### Dependencies\n\nThe apilint plugin adds the following dependencies.\n\n| Task Name        | Depends on                                 |\n| ---------------- |:------------------------------------------:|\n| `check`          | \u003ccode\u003eapiLint\u003ci\u003eVariantName\u003c/i\u003e\u003c/code\u003e     |\n\n### Changelog\n\nOptionally, `apilint` can track your API changelog file and fail the build if\nthe changelog file has not been updated after an API change. To enable this\nfeature, add the following:\n\n##### build.gradle\n```gradle\napiLint.changelogFileName = 'CHANGELOG.md'\n```\n\nAnd then add the following line somewhere in your changelog file:\n\n##### CHANGELOG.md\n```markdown\n[api-version]: \u003capi-txt-sha1\u003e\n```\n\nwhere `\u003capi-txt-sha1\u003e` is the SHA1 of the current api file. You can obtain this\nvalue by running:\n\n\u003cpre\u003e\n$ ./gradlew apiChangelogCheck\u003ci\u003eVariantName\u003c/i\u003e\n\u003c/pre\u003e\n\nNow, whenever \u003ccode\u003e./gradlew apiLint\u003ci\u003eVariantName\u003c/i\u003e\u003c/code\u003e is invoked, it\nwill check that the changelog file version matches the generated api file\nversion.\n\n### Configuration\n\nThe apilint plugin can be configured using the gradle extension `apiLint`.\nDefault values are as follows\n\n##### build.gradle\n```gradle\napiLint {\n    packageFilter = '.'\n    apiOutputFileName = 'api.txt'\n    currentApiRelativeFilePath = 'api.txt'\n    jsonResultFileName = 'apilint-result.json'\n    skipClassesRegex = []\n    changelogFileName = null\n    lintFilters = null\n    allowedPackages = null\n    deprecationAnnotation = null\n    libraryVersion = null\n}\n```\n\n\u003ccode\u003e\u003cb\u003epackageFilter\u003c/b\u003e\u003c/code\u003e Filters packages that make up the api. By\ndefault all packages are included in the `api.txt` file.\n\n\u003ccode\u003e\u003cb\u003eapiOutputFileName\u003c/b\u003e\u003c/code\u003e Relative path to the `api.txt` file in\nthe source folder.\n\n\u003ccode\u003e\u003cb\u003ecurrentApiRelativeFilePath\u003c/b\u003e\u003c/code\u003e Relative path of the generated\n`api.txt` file in the build folder.\n\n\u003ccode\u003e\u003cb\u003ejsonResultFileName\u003c/b\u003e\u003c/code\u003e Relative path to the JSON file name that\ncontains the result of apilint.\n\n\u003ccode\u003e\u003cb\u003eskipClassesRegex\u003c/b\u003e\u003c/code\u003e Ignore classes which full path matches\nany regex contained in this array. E.g. `BuildConfig$` will match any class\nnamed `BuildConfig`, `^org.mozilla` will match any class in the package\n`org.mozilla`.\n\n\u003ccode\u003e\u003cb\u003echangelogFileName\u003c/b\u003e\u003c/code\u003e Relative path to the changelog file,\noptional. See also [Changelog](#changelog).\n\n\u003ccode\u003e\u003cb\u003elintFilters\u003c/b\u003e\u003c/code\u003e List of lints that fail the build, by default\nall lints can fail the build. Filters will match any error code that starts\nwith the string specified, e.g. `GV` will match `GV1`, `GV2`, ...\n\n\u003ccode\u003e\u003cb\u003eallowedPackages\u003c/b\u003e\u003c/code\u003e List of packages that are allowed in the\nAPI. If this list is set, apilint will check that every type mentioned in the\nAPI belongs to any of the packages listed. Adding a package implicitly allows\nall sub-packages too, so allowing package `a.b` will allow `a.b.c` too.\n\n\u003ccode\u003e\u003cb\u003edeprecationAnnotation\u003c/b\u003e\u003c/code\u003e Additional annotation that should be\npresent when a method is marked with `@Deprecated`. This annotation is expected\nto have a `String id` and a `int version` parameter, like so:\n\n```\npublic @interface DeprecationSchedule {\n    String id();\n    int version();\n}\n```\n\nwhere `version` indicates when the deprecated method is expected to be removed.\n\n\u003ccode\u003e\u003cb\u003elibraryVersion\u003c/b\u003e\u003c/code\u003e Integer that represents the current library\nversion, used by `deprecationAnnotation` to determine if a deprecated member\nshould be removed.\n\n## License\n\n```\nThis Source Code Form is subject to the terms of the Mozilla Public\nLicense, v. 2.0. If a copy of the MPL was not distributed with this\nfile, You can obtain one at http://mozilla.org/MPL/2.0/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozilla-mobile%2Fgradle-apilint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmozilla-mobile%2Fgradle-apilint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmozilla-mobile%2Fgradle-apilint/lists"}