Skip to content

Commit 4310249

Browse files
authored
Merge pull request #688 from rupesh-kumar-lpu/resolutionGradlewDistError
Resolves 'gradlew dist' Errors on execution of command consecutively
2 parents 71d2348 + 85d6d7b commit 4310249

File tree

3 files changed

+65
-26
lines changed

3 files changed

+65
-26
lines changed

core/build.gradle

+21-8
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,29 @@ compileJava.doFirst {
5858
}
5959

6060
build.doLast {
61-
// Copying core jar as zip inside the mode folder
62-
Files.copy(file("${buildDir}/libs/core.jar").toPath(),
61+
62+
// Need to check the existance of the files before using as the files
63+
// will get generated only if Task :core:jar is not being skipped
64+
// Task :core:jar will be skipped if source files are unchanged or jar task is UP-TO-DATE
65+
66+
if(file("${buildDir}/libs/core.jar").exists()){
67+
// Copying core jar as zip inside the mode folder
68+
Files.copy(file("${buildDir}/libs/core.jar").toPath(),
6369
file("${coreZipPath}").toPath(), REPLACE_EXISTING)
70+
}
6471
// Renaming artifacts for maven publishing
65-
Files.move(file("${buildDir}/libs/core.jar").toPath(),
66-
file("$buildDir/libs/processing-core-${modeVersion}.jar").toPath(), REPLACE_EXISTING);
67-
Files.move(file("${buildDir}/libs/core-sources.jar").toPath(),
68-
file("$buildDir/libs/processing-core-${modeVersion}-sources.jar").toPath(), REPLACE_EXISTING);
69-
Files.move(file("${buildDir}/libs/core.jar.MD5").toPath(),
70-
file("$buildDir/libs/processing-core-${modeVersion}.jar.md5").toPath(), REPLACE_EXISTING);
72+
if(file("${buildDir}/libs/core.jar").exists()){
73+
Files.move(file("${buildDir}/libs/core.jar").toPath(),
74+
file("$buildDir/libs/processing-core-${modeVersion}.jar").toPath(), REPLACE_EXISTING);
75+
}
76+
if(file("${buildDir}/libs/core-sources.jar").exists()){
77+
Files.move(file("${buildDir}/libs/core-sources.jar").toPath(),
78+
file("$buildDir/libs/processing-core-${modeVersion}-sources.jar").toPath(), REPLACE_EXISTING);
79+
}
80+
if(file("${buildDir}/libs/core.jar.MD5").exists()){
81+
Files.move(file("${buildDir}/libs/core.jar.MD5").toPath(),
82+
file("$buildDir/libs/processing-core-${modeVersion}.jar.md5").toPath(), REPLACE_EXISTING);
83+
}
7184
}
7285

7386
ext {

mode/libraries/ar/build.gradle

+22-9
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,28 @@ build.doLast {
6161
// Copying ar jar to library folder
6262
File arJar = file("library/ar.jar")
6363
arJar.mkdirs();
64-
Files.copy(file("$buildDir/libs/ar.jar").toPath(),
65-
arJar.toPath(), REPLACE_EXISTING);
64+
65+
// Need to check the existance of the files before using as the files
66+
// will get generated only if Task ':mode:libraries:ar:jar' is not being skipped
67+
// Task ':mode:libraries:ar:jar' will be skipped if source files are unchanged or jar task is UP-TO-DATE
68+
69+
if(file("$buildDir/libs/ar.jar").exists()){
70+
Files.copy(file("$buildDir/libs/ar.jar").toPath(),
71+
arJar.toPath(), REPLACE_EXISTING);
72+
}
6673
// Renaming artifacts for maven publishing
67-
Files.move(file("$buildDir/libs/ar.jar").toPath(),
68-
file("$buildDir/libs/processing-ar-${arLibVersion}.jar").toPath(), REPLACE_EXISTING);
69-
Files.move(file("$buildDir/libs/ar-sources.jar").toPath(),
70-
file("$buildDir/libs/processing-ar-${arLibVersion}-sources.jar").toPath(), REPLACE_EXISTING);
71-
Files.move(file("$buildDir/libs/ar.jar.MD5").toPath(),
72-
file("$buildDir/libs/processing-ar-${arLibVersion}.jar.md5").toPath(), REPLACE_EXISTING);
74+
if(file("$buildDir/libs/ar.jar").exists()){
75+
Files.move(file("$buildDir/libs/ar.jar").toPath(),
76+
file("$buildDir/libs/processing-ar-${arLibVersion}.jar").toPath(), REPLACE_EXISTING);
77+
}
78+
if(file("$buildDir/libs/ar-sources.jar").exists()){
79+
Files.move(file("$buildDir/libs/ar-sources.jar").toPath(),
80+
file("$buildDir/libs/processing-ar-${arLibVersion}-sources.jar").toPath(), REPLACE_EXISTING);
81+
}
82+
if(file("$buildDir/libs/ar.jar.MD5").exists()){
83+
Files.move(file("$buildDir/libs/ar.jar.MD5").toPath(),
84+
file("$buildDir/libs/processing-ar-${arLibVersion}.jar.md5").toPath(), REPLACE_EXISTING);
85+
}
7386
}
7487

7588
ext {
@@ -81,4 +94,4 @@ ext {
8194
libDependencies = [[group: 'org.p5android', name: 'processing-core', version: modeVersion],
8295
[group: 'com.google.ar', name: 'core', version: garVersion]]
8396
}
84-
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
97+
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"

mode/libraries/vr/build.gradle

+22-9
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,28 @@ build.doLast {
6161
// Copying vr jar to library folder
6262
File vrJar = file("library/vr.jar")
6363
vrJar.mkdirs();
64-
Files.copy(file("$buildDir/libs/vr.jar").toPath(),
65-
vrJar.toPath(), REPLACE_EXISTING);
64+
65+
// Need to check the existance of the files before using as the files
66+
// will get generated only if Task ':mode:libraries:vr:jar' is not being skipped
67+
// Task ':mode:libraries:vr:jar' will be skipped if source files are unchanged or jar task is UP-TO-DATE
68+
69+
if(file("$buildDir/libs/vr.jar").exists()){
70+
Files.copy(file("$buildDir/libs/vr.jar").toPath(),
71+
vrJar.toPath(), REPLACE_EXISTING);
72+
}
6673
// Renaming artifacts for maven publishing
67-
Files.move(file("$buildDir/libs/vr.jar").toPath(),
68-
file("$buildDir/libs/processing-vr-${vrLibVersion}.jar").toPath(), REPLACE_EXISTING);
69-
Files.move(file("$buildDir/libs/vr-sources.jar").toPath(),
70-
file("$buildDir/libs/processing-vr-${vrLibVersion}-sources.jar").toPath(), REPLACE_EXISTING);
71-
Files.move(file("$buildDir/libs/vr.jar.MD5").toPath(),
72-
file("$buildDir/libs/processing-vr-${vrLibVersion}.jar.md5").toPath(), REPLACE_EXISTING);
74+
if(file("$buildDir/libs/vr.jar").exists()){
75+
Files.move(file("$buildDir/libs/vr.jar").toPath(),
76+
file("$buildDir/libs/processing-vr-${vrLibVersion}.jar").toPath(), REPLACE_EXISTING);
77+
}
78+
if(file("$buildDir/libs/vr-sources.jar").exists()){
79+
Files.move(file("$buildDir/libs/vr-sources.jar").toPath(),
80+
file("$buildDir/libs/processing-vr-${vrLibVersion}-sources.jar").toPath(), REPLACE_EXISTING);
81+
}
82+
if(file("$buildDir/libs/vr.jar.MD5").exists()){
83+
Files.move(file("$buildDir/libs/vr.jar.MD5").toPath(),
84+
file("$buildDir/libs/processing-vr-${vrLibVersion}.jar.md5").toPath(), REPLACE_EXISTING);
85+
}
7386
}
7487

7588
ext {
@@ -82,4 +95,4 @@ ext {
8295
[group: 'com.google.vr', name: 'sdk-base', version: gvrVersion],
8396
[group: 'com.google.vr', name: 'sdk-audio', version: gvrVersion]]
8497
}
85-
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"
98+
apply from: "${rootProject.projectDir}/scripts/publish-module.gradle"

0 commit comments

Comments
 (0)