File tree 1 file changed +13
-6
lines changed
plugin/src/test/groovy/com/nishtahir
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -41,24 +41,31 @@ class SimpleCargoProject {
41
41
}
42
42
43
43
def writeProject () {
44
- def cargoModule = this . class. classLoader. getResource(" rust/Cargo.toml" ). path
45
- cargoModule = new File (cargoModule). parent
44
+ def cargoModuleFile = new File (this . class. classLoader. getResource(" rust/Cargo.toml" ). path). parentFile
45
+ def targetDirectoryFile = new File (cargoModuleFile. parentFile, " target" )
46
+
47
+ // On Windows, path components are backslash-separated. We need to
48
+ // express the path as Groovy source, which means backslashes need to be
49
+ // escaped. The easiest way is to replace backslashes with forward
50
+ // slashes.
51
+ def module = cargoModuleFile. path. replace(" \\ " , " /" )
52
+ def targetDirectory = targetDirectoryFile. path. replace(" \\ " , " /" )
46
53
47
54
def targetStrings = targets. collect({" \" ${ it} \" " }). join(" , " )
48
55
49
56
file(' app/build.gradle' ) << """
50
57
cargo {
51
- module = "${ cargoModule } "
52
- targetDirectory = "${ cargoModule } /../target "
58
+ module = "${ module } "
59
+ targetDirectory = "${ targetDirectory } "
53
60
targets = [${ targetStrings} ]
54
61
libname = "rust"
55
62
}
56
63
""" . stripIndent()
57
64
58
65
file(' library/build.gradle' ) << """
59
66
cargo {
60
- module = "${ cargoModule } "
61
- targetDirectory = "${ cargoModule } /../target "
67
+ module = "${ module } "
68
+ targetDirectory = "${ targetDirectory } "
62
69
targets = [${ targetStrings} ]
63
70
libname = "rust"
64
71
}
You can’t perform that action at this time.
0 commit comments