Fix gradle integration tests on Windows

Android Gradle Plugin 3.0 and 3.1 use aapt that does not handle
long paths on Windows. This commit uses shorter paths for the project
working directory on Windows.

Test: running integration tests on Windows
This commit is contained in:
Ivan Gavrilovic
2019-07-25 15:26:02 +01:00
committed by Alexey Tsvetkov
parent e74a00789d
commit de5335b17f
2 changed files with 8 additions and 2 deletions
+6 -1
View File
@@ -111,7 +111,12 @@ fun Project.projectTest(taskName: String = "test", parallel: Boolean = false, bo
(teamcity?.get("teamcity.build.tempDir") as? String)
?: System.getProperty("java.io.tmpdir")
systemTempRoot.let {
subProjectTempRoot = Files.createTempDirectory(File(systemTempRoot).toPath(), project.name + "Project_" + taskName + "_")
subProjectTempRoot = if (System.getProperty("os.name")!!.contains("Windows")) {
// Aapt2 from Android Gradle Plugin 3.2 and below does not handle long paths on Windows.
Files.createTempDirectory(File(systemTempRoot).toPath(), "")
} else {
Files.createTempDirectory(File(systemTempRoot).toPath(), project.name + "Project_" + taskName + "_")
}
systemProperty("java.io.tmpdir", subProjectTempRoot.toString())
}
}
@@ -33,7 +33,8 @@ abstract class BaseGradleIT {
@Before
fun setUp() {
workingDir = createTempDir("BaseGradleIT")
// Aapt2 from Android Gradle Plugin 3.2 and below does not handle long paths on Windows.
workingDir = createTempDir(if (isWindows) "" else "BaseGradleIT")
acceptAndroidSdkLicenses()
}