Merge pull request #972 from dbhowell/gradle-use-dependencies-list

Use dependencies.list file instead of npm for build.gradle
This commit is contained in:
blagoev 2017-04-20 23:58:48 +03:00 committed by GitHub
commit 8d3b4aca95
1 changed files with 19 additions and 7 deletions

View File

@ -31,17 +31,14 @@ import org.apache.tools.ant.filters.ReplaceTokens
// We download various C++ open-source dependencies into downloads.
// We then copy both the downloaded code and our custom makefiles and headers into third-party-ndk.
// After that we build native code from src/main/jni with module path pointing at third-party-ndk.
def npmExecutable = 'npm';
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
npmExecutable = 'npm.cmd'
}
ext.coreVersion = "$npmExecutable --silent run get-core-version".execute().text.trim()
ext.syncVersion = "$npmExecutable --silent run get-sync-version".execute().text.trim()
ext.coreVersion = getDependenciesVersion("REALM_CORE_VERSION").trim()
ext.syncVersion = getDependenciesVersion("REALM_SYNC_VERSION").trim()
def currentVersion = getDependenciesVersion("VERSION").trim()
println "Realm Core Version: $ext.coreVersion"
println "Realm Sync Version: $ext.syncVersion"
def currentVersion = "$npmExecutable --silent run get-version".execute().text.trim()
def downloadsDir = new File("$projectDir/downloads")
def jscDownloadDir = new File("$projectDir/src/main/jni/jsc")
def coreDownloadDir = new File("$projectDir/src/main/jni")
@ -95,6 +92,21 @@ task prepareRealmCore(dependsOn: downloadRealmCore, type:Copy) {
}
}
def getDependenciesVersion(keyName) {
def inputFile = new File(buildscript.sourceFile.getParent() + "/../../dependencies.list")
def line
inputFile.withReader { reader ->
while ((line = reader.readLine())!=null) {
def (key, value) = line.tokenize('=')
if (keyName == key) {
return value
}
}
throw new GradleException("${keyName} not found in dependencies.list.")
}
}
def getNdkBuildName() {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
return "ndk-build.cmd"