{"id":14979930,"url":"https://github.com/uber/okbuck","last_synced_at":"2025-05-14T10:07:50.561Z","repository":{"id":42463866,"uuid":"43598554","full_name":"uber/okbuck","owner":"uber","description":"OkBuck is a gradle plugin that lets developers utilize the Buck build system on a gradle project.","archived":false,"fork":false,"pushed_at":"2025-03-21T18:05:42.000Z","size":17740,"stargazers_count":1537,"open_issues_count":25,"forks_count":171,"subscribers_count":2144,"default_branch":"master","last_synced_at":"2025-04-13T00:39:18.441Z","etag":null,"topics":["android","buck","gradle","gradle-plugin","watchman"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uber.png","metadata":{"files":{"readme":"README-zh.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2015-10-03T12:36:22.000Z","updated_at":"2025-04-04T04:45:25.000Z","dependencies_parsed_at":"2023-10-14T16:32:17.509Z","dependency_job_id":"7a3df505-f04d-451e-aa07-9e18b1d76297","html_url":"https://github.com/uber/okbuck","commit_stats":{"total_commits":1111,"total_committers":51,"mean_commits":"21.784313725490197","dds":0.6165616561656165,"last_synced_commit":"6f6a72b23d84bb70e49028cf7177377631d2bbe4"},"previous_names":[],"tags_count":228,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fokbuck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fokbuck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fokbuck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uber%2Fokbuck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uber","download_url":"https://codeload.github.com/uber/okbuck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650414,"owners_count":21139671,"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":["android","buck","gradle","gradle-plugin","watchman"],"created_at":"2024-09-24T14:00:57.014Z","updated_at":"2025-04-13T00:39:39.253Z","avatar_url":"https://github.com/uber.png","language":"Java","readme":"# OkBuck\n\n## 基本配置\n工程根目录的`build.gradle`文件中加入配置：\n\n```gradle\nbuildscript {\n    repositories {\n        jcenter()\n    }\n    dependencies {\n        classpath 'com.uber:okbuck:0.54.3'\n    }\n}\n\napply plugin: 'com.uber.okbuck'\n```\n\n大部分情况下, 上述配置就完成了。OkBuck托管在jcenter，所以 `jcenter()`\n必须加入到 `buildscript` 和 `allprojects` 的 `repositories` 列表中，\n而且必须在 `apply plugin` 部分之前。\n\n应用 OkBuck 插件之后，工程内将会产生两个 gradle task，`okbuck` 和 `buckWrapper`\n\n+  `okbuck` 将会生成 BUCK 配置文件\n+  `buckWrapper` buck wrapper 类似于 gradle wrapper, 利用它 OkBuck 可以进行更聪明地为我们服务\n\n我们非常建议大家使用 `buckWrapper`，即执行：`./gradlew buckWrapper`。\n\n可以执行 `./buckw targets` 命令查看所有可以 build 的目标, 而生成的 `.buckconfig.local`\n文件中会指定多个 alias, 例如 `appDevDebug`，`appProdRelease`，`another-appDebug`\n等，根据它们可以确定 BUCK build 的命令，例如 `./buckw build appDevDebug` 等。\n\n## 自定义配置\n```gradle\nokbuck {\n    buildToolVersion = \"24.0.2\"\n    target = \"android-24\"\n    linearAllocHardLimit = [\n            app: 16 * 1024 * 1024\n    ]\n    primaryDexPatterns = [\n            app: [\n                    '^com/uber/okbuck/example/AppShell^',\n                    '^com/uber/okbuck/example/BuildConfig^',\n                    '^android/support/multidex/',\n                    '^com/facebook/buck/android/support/exopackage/',\n                    '^com/squareup/leakcanary/LeakCanary^',\n            ]\n    ]\n    exopackage = [\n            appDebug: true\n    ]\n    appLibDependencies = [\n            'appProd': [\n                    'buck-android-support',\n                    'com.android.support:multidex',\n                    'libraries/javalibrary:main',\n                    'libraries/common:paidRelease',\n            ],\n            'appDev': [\n                    'buck-android-support',\n                    'com.android.support:multidex',\n                    'libraries/javalibrary:main',\n                    'libraries/common:freeDebug',\n            ]\n    ]\n    annotationProcessors = [\n            \"local-apt-dependency\": ['com.okbuck.apt.ExampleProcessor']\n    ]\n    buckProjects = project.subprojects\n    extraBuckOpts = [\n        'appDebug', [\n            \"binary\": [\"trim_resource_ids = True\"]\n        ]\n    ]\n\n    wrapper {\n        repo = 'https://github.com/facebook/buck.git'\n    }\n}\n```\n\n## 详细解释\n+  `buildToolVersion`指定Android SDK Build-tools版本，默认为`24.0.2`\n+  `target`指定Android target sdk版本，可以运行`\u003csdk home\u003e/tools/android list targets --compact`\n获得，默认为`android-24`\n+  `linearAllocHardLimit`和`primaryDexPatterns`都是map，用来配置BUCK multidex的\nlinearAllocHardLimit和primaryDexPatterns部分，更多详细关于multidex配置的说明，请参阅\n[multidex wiki](https://github.com/uber/okbuck/wiki/Multidex-Configuration-Guide)，\n如果未使用multidex（未在`build.gradle`文件中开启），可以忽略这两个参数\n+  `exopackage`和`appLibDependencies`都是map，用来配置BUCK exopackage，\n更多详细关于exopackage配置的说明，请参阅[exopackage wiki](https://github.com/uber/okbuck/wiki/Exopackage-Configuration-Guide)，\n如果未使用exopackage，可以忽略这三个参数\n+ `annotationProcessors` 用来声明项目中的注解处理器, key 为 module 路径, value 为注解处理器类的全名。\n+  `buckProjects` 用于控制哪些 module 将使用 BUCK 进行构建, 默认是项目中的所有 module\n+ 上述配置 map 的 key, 可以按照以下规则设置:\n - 指定 module 名字, 就能为所有的 flavor 以及 build type 设置, 例如: `app`\n - 指定 module 名字以及 flavor 名字, 就能为指定 flavor 的所有 build type 设置, 例如: 'appDemo'\n - 指定 module 名字以及 build type 的名字, 就能为指定 build type 的所有 flavor 设置, 例如: 'appDebug'\n - 指定 module 名字, flavor 名字以及 build type 的名字, 例如: 'appDemoRelease'\n\n## Troubleshooting\n如果遇到任何问题，请[提一个issue](https://github.com/uber/okbuck/issues/new)，如果能提供错误日志，就是极好的了。\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Fokbuck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuber%2Fokbuck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuber%2Fokbuck/lists"}