Gradle命名约定:何时使用'myProj'和何时使用':myProj'?

时间:2015-11-11 13:25:04

标签: android gradle android-gradle

我想了解gradle中的命名约定以及对语义和功能的影响。

我见过这样的例子:

import 'myProj'
project(':myProj').projectDir = new File(...)

和其他人一样:

import ':myProj'
project(':myProj').projectDir = new File(...)

前缀:的含义是什么?何时必须使用它?

1 个答案:

答案 0 :(得分:2)

不同之处在于,如果没有 var link = userLink + '/games/' + $scope.currentGame; ref.child(link).once('value', function(snapshot) { var game = snapshot.val(); var startTime = Date.parse(game.started); var timeNow = Date.now(); var timeLapsed = (timeNow - startTime); var mydate = new Date(timeLapsed); var humandate = mydate.getUTCHours()+ " hours, " + mydate.getUTCMinutes()+ " minutes and " + mydate.getUTCSeconds()+ " second(s)"; console.log(humandate); console.log( mydate.getUTCHours()) var timeVar = document.getElementById('timer'), seconds = mydate.getUTCSeconds(), minutes = mydate.getUTCMinutes(), hours = mydate.getUTCHours(), time; function add() { seconds++; if (seconds >= 60) { seconds = 0; minutes++; if (minutes >= 60) { minutes = 0; hours++; } } timeVar.textContent = (hours ? (hours > 9 ? hours : "0" + hours) : "00") + ":" + (minutes ? (minutes > 9 ? minutes : "0" + minutes) : "00") + ":" + (seconds > 9 ? seconds : "0" + seconds); timer(); } function timer() { var time = setTimeout(add, 1000); } timer(); }); 您的名称,而使用:则会使用路径。这同样适用于任务,因此请查看here

当您在第一级引用项目/任务时,如果您使用:则没有区别。但是如果你需要从项目的根目录调用一个定义了几个级别的任务,你需要提供完整的路径。就是这样。