Skip to content

用于Android客户端无埋点数据采集的Gradle插件(Gradle Plugin for Codelessly Data Acquisition on Android Platform)

Notifications You must be signed in to change notification settings

nailperry-zd/Codeless-Gradle-Plugin-Repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Codeless-Gradle-Plugin-Repo

该仓库为LazierTracker工程的buildsrc插件对应的远程maven仓库

发布插件到github远程maven仓库

参考链接:

Android Studio 将github作为远程maven仓库

1. 打开插件源码buildsrcbuild.gradle

apply plugin: 'maven'
uploadArchives{
    repositories.mavenDeployer {
        // maven savePath
        def deployPath = file('/Users/nailperry/Desktop/Gradle_Plugin_Repo')
        repository(url:"file:https://${deployPath.absolutePath}")
        pom.project{
            groupId "com.codeless"
            artifactId "codeless-gradle-plugin"
            version "0.0.1"
        }
    }
}

这里面groupId可以填包名,artifactId可以填module名称,version是当前module的版本,可以填1.0 (这三个参数都可以自己决定,这个最后影响的是调用这个远程库的时候compile里面所要填写的值,比如按照图片的参数来的话,最后使用的时候得写 classpath 'com.codeless:codeless-gradle-plugin:0.0.1'

2. 然后打开终端,cd到该gradle文件所在的目录,运行输入命令:

gradle uploadArchives

3. 发布插件到github远程maven仓库

本地文件夹/Users/nailperry/Desktop/Gradle_Plugin_Repo即为一个本地maven仓库,将该本地maven仓库上传到github即得到一个远程maven仓库。

集成github远程maven仓库中的插件

1. Gradle集成

projectbuild.grade中添加maven地址和classpath

buildscript {
repositories {
    jcenter()
    maven {
        url "https://raw.githubusercontent.com/nailperry-zd/Codeless-Gradle-Plugin-Repo/master"
    }
}
dependencies {
    ...
    classpath 'com.codeless:codeless-gradle-plugin:0.0.1'
    ...
}

}

appbuild.grade中添加

// 引用远程maven仓库的插件
apply plugin: 'com.codeless'

2. 自定义参数

appbuild.grade中添加如下代码,各配置项的含义请参考英文注释

codelessConfig {
    //this will determine the name of this plugin transform, no practical use.
    pluginName = 'myPluginTest'
    //turn this on to make it print help content, default value is true
    showHelp = true
    //this flag will decide whether the log of the modifying process be printed or not, default value is false
    keepQuiet = false
    //this is a kit feature of the plugin, set it true to see the time consume of this build
    watchTimeConsume = false

    //this is the most important part, 3rd party JAR packages that want our plugin to inject;
    //our plugin will inject package defined in 'AndroidManifest.xml' and 'butterknife.internal.butterknife.internal.DebouncingOnClickListener' by default.
    //structure is like ['butterknife.internal','com.a.c'], type is HashSet<String>.
    //You can also specify the name of the class;
    //example: ['com.xxx.xxx.BaseFragment']
    targetPackages = []
}

About

用于Android客户端无埋点数据采集的Gradle插件(Gradle Plugin for Codelessly Data Acquisition on Android Platform)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published