{"id":13734010,"url":"https://github.com/ksoichiro/gradle-android-git","last_synced_at":"2025-04-12T05:36:44.617Z","repository":{"id":19922844,"uuid":"23189143","full_name":"ksoichiro/gradle-android-git","owner":"ksoichiro","description":"Gradle plugin for Android apps to manage Git dependency (gag)","archived":false,"fork":false,"pushed_at":"2014-10-26T01:37:05.000Z","size":552,"stargazers_count":22,"open_issues_count":5,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T01:02:47.413Z","etag":null,"topics":["android","git","gradle","gradle-plugin"],"latest_commit_sha":null,"homepage":"","language":"Groovy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ksoichiro.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-08-21T13:59:30.000Z","updated_at":"2021-03-29T19:50:01.000Z","dependencies_parsed_at":"2022-08-21T13:11:13.755Z","dependency_job_id":null,"html_url":"https://github.com/ksoichiro/gradle-android-git","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksoichiro%2Fgradle-android-git","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksoichiro%2Fgradle-android-git/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksoichiro%2Fgradle-android-git/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksoichiro%2Fgradle-android-git/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksoichiro","download_url":"https://codeload.github.com/ksoichiro/gradle-android-git/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248524854,"owners_count":21118615,"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","git","gradle","gradle-plugin"],"created_at":"2024-08-03T03:00:51.703Z","updated_at":"2025-04-12T05:36:44.591Z","avatar_url":"https://github.com/ksoichiro.png","language":"Groovy","funding_links":[],"categories":["Plugins"],"sub_categories":["Android application development"],"readme":"# gag (gradle-android-git)\n\n[![Build Status](https://travis-ci.org/ksoichiro/gradle-android-git.svg?branch=master)](https://travis-ci.org/ksoichiro/gradle-android-git)\n[![Maven Central](http://img.shields.io/maven-central/v/com.github.ksoichiro/gradle-android-git.svg)](https://github.com/ksoichiro/gradle-android-git/releases/latest)\n\nThis is a Gradle plugin to manage Android dependency using Git.\nUsually, libraries are versioned with group, name and version numbers and you can download from Maven Central repository or jcenter.  \nBut sometimes you might want to use not versioned library.  \nThis project enables you to manage those libraries\nin your Android app build process.\n\n## With this plugin...\n\n* You don't have to upload your library jars/aars to external Maven repository servers\n\n* You will be noticed when to update the dependencies\n\n    * Like CocoaPod, Bundler, you can specify library's version with Git commit hash or tags.\n    * When you have to update, your build will fails.\n    * If you want to upgrade, just execute 1 command.\n\n* You can develop Android library with other apps\n\n    * Like CocoaPod, you can choose dependency's origin from remote repositories or local path.\n\n## Usage\n\nTo use this plugin:\n\n1. Create your `gagconfig.gradle`, `gag.gradle` and execute `update` (see \"Setting up gagconfig.gradle/gag.gradle\" section below)\n1. Edit your `build.gradle` (see \"Setting up build.gradle\" section below)\n1. Build your app (see \"Build your app\" section below)\n\n### Setting up gagconfig.gradle/gag.gradle\n\nAt first, write `gagconfig.gradle` (or whatever you like) like following contents.  \nThis includes dependencies definitions.  \nYou must add this file to your VCS.  \nIf you want to update dependencies or add new dependency, only this file should be updated.\n\n```groovy\ngit {\n    directory = \".gag\"\n    gitDependencies {\n        // Use older version by commit hash (Detached HEAD)\n        repo location: 'https://github.com/ksoichiro/AndroidFormEnhancer.git', name: 'afe', libraryProject: 'androidformenhancer', groupId: 'com.github.ksoichiro', artifactId: 'androidformenhancer', commit: '5a9492f45fd0f97289001a7398d04c59b846af40'\n\n        // Use older version by tag (Detached HEAD)\n        repo location: 'https://github.com/ksoichiro/SimpleAlertDialog-for-Android.git', name: 'sad', libraryProject: 'simplealertdialog', groupId: 'com.github.ksoichiro', artifactId: 'simplealertdialog', tag: 'v1.1.1'\n\n        // Closure style configuration\n        repo {\n            location = 'https://github.com/JakeWharton/ActionBarSherlock.git'\n            name = 'abs'\n            libraryProject = 'actionbarsherlock'\n            groupId = 'com.actionbarsherlock'\n            artifactId = 'actionbarsherlock'\n            commit = '4a79d536af872339899a90d6dc743aa57745474b'\n            // If the project does not contain gradle wrapper,\n            // gag will generate with `gradleVersion` version.\n            gradleVersion = '1.6'\n        }\n    }\n}\n```\n\nThen, create `gag.gradle` (or whatever you like).  \nThis script uses `gagconfig.gradle`.  \n\n```groovy\nbuildscript {\n    repositories {\n        mavenCentral()\n        // If you want to use Sonatype repository, enable this:\n        // maven {\n        //     url uri('https://oss.sonatype.org/service/local/repositories/releases/content/')\n        // }\n    }\n    dependencies {\n        classpath 'com.github.ksoichiro:gradle-android-git:0.1.+'\n    }\n}\n\napply plugin: 'gag'\napply from: 'gagconfig.gradle'\n\ndefaultTasks 'update'\n```\n\nAfter that, execute this:\n\n```sh\n$ ./gradlew -b gag.gradle\nor\n$ ./gradlew -b gag.gradle update\n```\n\nThis will clone all the repositories, check out, assemble and upload archive to `.gag/.repo`.\n\n`.gag` directory is just a working directory, so you must add `.gag/` to your `.gitignore`.\n\n### Setting up build.gradle\n\nYour `build.gradle` doesn't look so different.  \nJust edit your `repositories` and `dependencies` to use `.gag/.repo` contents.\n\n```groovy\nbuildscript {\n    repositories {\n        mavenCentral()\n        // If you want to use Sonatype repository, enable this:\n        // maven {\n        //     url uri('https://oss.sonatype.org/service/local/repositories/releases/content/')\n        // }\n    }\n    dependencies {\n        classpath 'com.android.tools.build:gradle:0.12.+'\n        classpath 'com.github.ksoichiro:gradle-android-git:0.1.+'\n    }\n}\n\napply plugin: 'com.android.application'\napply plugin: 'gag'\napply from: 'gagconfig.gradle'\n\nandroid {\n    compileSdkVersion 19\n    buildToolsVersion \"19.1.0\"\n    defaultConfig {\n        minSdkVersion 8\n    }\n}\n\n// Add repository generated by gag.\nrepositories {\n    maven {\n        url uri('.gag/.repo')\n    }\n}\n\ndependencies {\n    compile 'com.android.support:support-v4:20.0.+'\n\n    // You can write dependencies in a groovy way\n    for (r in project.git.gitDependencies.repos) {\n        compile \"${r.groupId}:${r.artifactId}:${r.resolvedVersion}@aar\"\n    }\n\n    // Of course, you can write in a normal way\n    // compile 'com.github.ksoichiro:androidformenhancer:5a9492f45fd0f97289001a7398d04c59b846af40@aar'\n    // compile 'com.github.ksoichiro:simplealertdialog:v1.1.1@aar'\n    // compile 'com.actionbarsherlock:actionbarsherlock:4a79d536af872339899a90d6dc743aa57745474b@aar'\n}\n```\n\n### Build your app\n\nBuild your app as you always do.  \nFor example:\n\n```sh\n$ ./gradlew installDebug\n```\n\nOf course, you can build your app from Android Studio.\n\nIf somebody in your team updated dependencies with new commit hash or tags, your build will fail because Gradle can't resolve new dependencies.  \nIf you see that kind of errors, just `update`:\n\n```sh\n$ ./gradlew -b gag.gradle\nor\n$ ./gradlew -b gag.gradle update\n```\n\nIf you like Android Studio, select `gag.gradle` from the project tree on the left side,\n\n![](images/gradle1.png)\n\nand `Run` it.\n\n![](images/gradle2.png)\n\n## Prerequisites\n\n* Mac OS X / Windows 7\n* Gradle wrapper in your project\n* Gradle `\u003e=` 1.12\n* Android Studio `\u003e=` 0.8.0 (using Android Studio is optional)\n* Git repositories(dependencies) must be configured with Gradle\n* Git repositories(dependencies) must be public. Currently, authentication is not supported.\n\n## Configuration\n\n### git\n\n`git` closure is the main configuration.  \nThis defines dependencies (and other meta data in the future).\n\n### gitDependencies\n\n`gitDependencies` includes Git repositories definition.  \nThis is also a closure.\n\n### repo\n\n`repo` is the Git repository configuration.  \nEach parameters will be passed to git command, so local path and remote URL will be resolved.\n\n#### location\n\nRepository location.  \nThis can be a local file path, remote git URL, or whatever `git` can recognize.\n\n#### name\n\nName of the dependency.  \nThe dependency is cloned with this name.\n\n#### libraryProject\n\nThe name of the Android library sub-project in the repository.\n\n#### groupId\n\nMaven `groupId`.  \nThis is not the public `groupId`.  \nYou can use anything if it doesn't conflict with your other dependencies.\n\n#### artifactId\n\nMaven `artifactId`.\nIts meaning is the same as the `groupId`.  \nIt's not necessary to match to the public `artifactId`.\n\n#### branch\n\nDefault value is `master`.\n\n#### commit / tag\n\nTarget version identified with commit or tag.  \n\n#### gradleVersion\n\nGradle wrapper version to build Android library project.  \nThis parameter is only used when the target dependency repository doesn't include gradle wrapper.\n\nTo generate wrapper, gag uses host project's gradle wrapper.\n\n## Samples\n\nSee `samples/consumer` directory.  \nThis is an Android app project configured with Gradle.\n\n## License\n\nCopyright (c) 2014 Soichiro Kashima  \nLicensed under MIT license.  \nSee the bundled [LICENSE](https://github.com/ksoichiro/gradle-android-git/blob/master/LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksoichiro%2Fgradle-android-git","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksoichiro%2Fgradle-android-git","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksoichiro%2Fgradle-android-git/lists"}