Skip to content

Commit

Permalink
Change the file path to canonicalPath
Browse files Browse the repository at this point in the history
  • Loading branch information
linisme committed Jan 17, 2018
1 parent 52076d7 commit fe60547
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ task zipNativeArchive(type: Zip) {
from project.zipTree("build/libs/$archivesBaseName-${version}.jar")
include "META-INF/**"
include "net/**"
from "${project.rootProject.file("devso").path}"
from "${project.rootProject.file("devso").canonicalPath}"
include "src/main/**"
include "CMakeLists.txt"
exclude "src/main/cpp/include/extern-keys.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ class CMakeListsBuilder {
List<String> lines = new ArrayList<>()
lines.add("# Auto-Generated By Cipher.so - 林帅斌([email protected])\n\n")
lines.add("cmake_minimum_required(VERSION 3.4.1)\n\n")
lines.add("add_subdirectory(${StringUtils.convertToUnix(new File(cipherCMakePath).parentFile.path)} cipher.out)\n\n")
lines.add("add_subdirectory(${StringUtils.convertToUnix(new File(cipherCMakePath).parentFile.canonicalPath)} cipher.out)\n\n")
if (originCMakePath != null) {
lines.add("add_subdirectory(${StringUtils.convertToUnix(new File(originCMakePath).parentFile.path)} origin.out)\n\n")
lines.add("add_subdirectory(${StringUtils.convertToUnix(new File(originCMakePath).parentFile.canonicalPath)} origin.out)\n\n")
}
lines
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class CipherSoPlugin implements Plugin<Project> {
it.dependsOn copyNativeArchiveTask
it.dependsOn generateCipherSoExternTask
}
def outputDir = new File("${project.buildDir}/generated/source/cipher.so/${variant.name}")
def outputDir = new File(project.buildDir, "/generated/source/cipher.so/${variant.name}")
def generateJavaClientTask = project.tasks.create("generate${StringUtils.capitalize(variant.name)}JavaClient", GenerateJavaClientFileTask)
generateJavaClientTask.configure {
it.keyExts = keys
Expand Down Expand Up @@ -90,11 +90,11 @@ class CipherSoPlugin implements Plugin<Project> {
project.afterEvaluate {
unzipNativeArchive(project)
def android = project.extensions.findByType(AppExtension)
originCmakeListPath = android.externalNativeBuild.cmake.path?.path
originCmakeListPath = android.externalNativeBuild.cmake.path?.canonicalPath
File targetFile = generateCMakeListsFile(project, originCmakeListPath)
android.externalNativeBuild {
cmake {
path targetFile.path
path targetFile.canonicalPath
}
}
createTasks(project, android)
Expand All @@ -115,7 +115,7 @@ class CipherSoPlugin implements Plugin<Project> {

private static def getNativeArchiveFile(Project project) {
if (project.rootProject.subprojects.find { it.name == "devso" } != null) {
return project.rootProject.file("devso").path
return project.rootProject.file("devso").canonicalPath
} else {
def archiveZip = findNativeArchiveFromBuildscript(project)
if (archiveZip == null) {
Expand All @@ -142,13 +142,13 @@ class CipherSoPlugin implements Plugin<Project> {

private
static File generateCMakeListsFile(Project project, String originCMakeListsPath) {
def outputDir = new File("${project.buildDir.path}/cipher.so/cmake")
def outputDir = new File(project.buildDir, "/cipher.so/cmake")
if (!outputDir.exists()) {
outputDir.mkdirs()
}
def targetFile = new File(outputDir, "CMakeLists.txt")
def writer = new FileWriter(targetFile)
new CMakeListsBuilder("${project.buildDir.path}/cipher.so/CMakeLists.txt").setOriginCMakePath(originCMakeListsPath).build().each {
new CMakeListsBuilder("${project.buildDir.canonicalPath}/cipher.so/CMakeLists.txt").setOriginCMakePath(originCMakeListsPath).build().each {
writer.append(it)
}
writer.flush()
Expand Down

0 comments on commit fe60547

Please sign in to comment.