这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions gradle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
id "de.undercouch.download" version "3.4.3"
}

@Field def slurper = new JsonSlurper()
def slurper = new JsonSlurper()

def ensure_property(def obj, String keyname, List candidates, Integer default_value_index = 0)
{
Expand Down Expand Up @@ -168,7 +168,7 @@ class ExecutionResult
//! @param command is a string consists of executable command and its parameters.
//! @param working_dir is the working directory for the executable.
//! @param env_vars is environment variables as a list of key:value pair. this parameter may be nil.
@Field def execute_may_fail = { String command, def working_dir = ".", Map env_vars = [:] ->
def execute_may_fail = { String command, def working_dir = ".", Map env_vars = [:] ->
if(isWindows()) {
command = "cmd /c chcp 65001 > nul & " + command.toString()
}
Expand Down Expand Up @@ -213,7 +213,7 @@ class ExecutionResult
}

//! similar to execute_may_fail but this function fails if the command finished with an exit value of non zero.
@Field def execute = { String params, def working_dir = ".", Map env_vars = [:] ->
def execute = { String params, def working_dir = ".", Map env_vars = [:] ->
def result = execute_may_fail(params, working_dir, env_vars)
assert result.succeeded(), "undesirable exit value ${result.exitValue()}"
return result
Expand All @@ -227,14 +227,14 @@ task update_submodules {

// 指定したディレクトリが存在しなければ作成し、成功か失敗かをbooleanで返す
// 存在する場合は何もせずにtrueを返す
@Field def mkdirs_if_needed = { def path ->
def mkdirs_if_needed = { def path ->
def f = file(path)
if(f.exists()) { return true }

return f.mkdirs()
}

@Field def createCacheParam = { File cache_dir, String archive_name, String build_config, String hash ->
def createCacheParam = { File cache_dir, String archive_name, String build_config, String hash ->
def getOsName = { return isWindows() ? "win" : "mac" }
return [
getOsName: getOsName,
Expand All @@ -256,14 +256,14 @@ task update_submodules {
// boolean store(def param)
// }

@Field def createNullCacheStrategy = {
def createNullCacheStrategy = {
return [
fetch: { def param -> return false },
store: { def param -> return false },
]
}

@Field def createAzureCacheStrategy = {
def createAzureCacheStrategy = {
def getAzureStorageAccount = {
return getenv("AZURE_STORAGE_ACCOUNT").toString()
}
Expand Down Expand Up @@ -384,12 +384,12 @@ task update_submodules {
]
}

@Field def get_hash = { String submodule_name ->
def get_hash = { String submodule_name ->
def result = execute("git rev-parse HEAD", file("../ext/${submodule_name}"))
return result.text.trim()
}

@Field def get_cache_strategy = {
def get_cache_strategy = {
def st = createAzureCacheStrategy()
if(st) {
println "Use AzureCacheStrategy"
Expand All @@ -405,7 +405,7 @@ task update_submodules {

// 指定したディレクトリのキャッシュが有効なときはそれを使用し、
// キャッシュがないときはビルドを行う
@Field def build_if_needed = { String archive_name, File cache_dir, String hash, Closure do_build ->
def build_if_needed = { String archive_name, File cache_dir, String hash, Closure do_build ->
def cache = get_cache_strategy()

def param = createCacheParam(cache_dir, archive_name, project.config, hash)
Expand Down
2 changes: 1 addition & 1 deletion gradle/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip