在gradle-5.1.1上代替TaskInternal execute()有什么用?

时间:2019-05-16 07:40:54

标签: gradle groovy android-gradle crashlytics google-fabric

我在 public static void dfs(int [] [] adjMatrix, int startingV,int n) { boolean [] visited = new boolean[n]; Stack<Integer> s = new Stack<Integer>(); s.push(startingV); while(!s.isEmpty()) { int vertex = s.pop(); if(visited[vertex]==false) { System.out.print("\n"+(v)); visited[vertex]=true; } for ( int i = 0; i < n; i++) { if((adjMatrix[vertex][i] == true) && (visited[i] == false)) { s.push(vertex); visited[I]=true; System.out.print(" " + i); vertex = i; } } } 处的自定义任务:

gradle-4.10.1

但是在task fabricUploadApkDevelop(group: "fabric", dependsOn: ['assembleDevDebug']) { doLast { //fabric gradle task `assembleRelease crashlyticsUploadDistributionDevDevelop` and options: def task = tasks.getByName("crashlyticsUploadDistributionDevDebug") task.ext.betaDistributionGroupAliases = "develop" task.ext.betaDistributionNotifications = true task.ext.betaDistributionReleaseNotesFilePath = "${project.rootDir}/app/build/outputs/apk/dev/debug/releaseNotes.txt" task.execute() } }

gradle-5.1.1被删除,所以现在我无法运行TaskInternal.execute(),如何更改自定义任务?或者如何通过终端通过参数运行任务task.execute()

我尝试使用:

crashlyticsUploadDistributionDevDebug

但是 //gradle 5.x task fabricUploadApkDevelop(group: "fabric") { ext.betaDistributionGroupAliases = "develop" ext.betaDistributionNotifications = true ext.betaDistributionReleaseNotesFilePath = "${project.rootDir}/app/build/outputs/apk/dev/debug/releaseNotes.txt" doLast { ext.betaDistributionGroupAliases = "develop" ext.betaDistributionNotifications = true ext.betaDistributionReleaseNotesFilePath = "${project.rootDir}/app/build/outputs/apk/dev/debug/releaseNotes.txt" } finalizedBy 'crashlyticsUploadDistributionDevDebug' } 任务没有参数...

1 个答案:

答案 0 :(得分:1)

Fabric / Crashlytics Gradle插件的来源似乎未公开可用(我自己从未使用过),否则我会在那儿检查一下。但是考虑到您的Gradle 4工作示例并通过我的香草Gradle眼镜查看了这个问题,我希望以下内容可以/可以用于Gradle 5:

project.afterEvaluate {
    crashlyticsUploadDistributionDevDebug.doFirst {
        ext.betaDistributionGroupAliases = "develop"
        ext.betaDistributionNotifications = true
        ext.betaDistributionReleaseNotesFilePath = "${project.rootDir}/app/build/outputs/apk/dev/debug/releaseNotes.txt"
    }
}

task fabricUploadApkDevelop(group: "fabric") {
    dependsOn 'crashlyticsUploadDistributionDevDebug'
}

我什至希望会有更好的方法来做,但是由于我自己无法测试,所以我想安全地玩。让我知道它是否有效!