Skip to content

Commit 9d0f14a

Browse files
authored
Merge pull request #282 from mhbkb/workflow_adapt_iscustomized
Adapt tasks to use require source build/isCustomized.
2 parents 356df8a + 1270690 commit 9d0f14a

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/tasks/action/pip/PipInstallAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ private List<String> prepareCommandLine(PackageInfo packageInfo, List<String> ex
133133

134134
private boolean appendCachedWheel(PackageInfo packageInfo, Optional<File> cachedWheel, List<String> commandLine) {
135135
if (!packageSettings.requiresSourceBuild(packageInfo)) {
136-
cachedWheel = wheelCache.findWheel(packageInfo.getName(), packageInfo.getVersion(), pythonDetails);
136+
// TODO: Check whether project layer cache exists.
137+
138+
if (!cachedWheel.isPresent() && !packageSettings.isCustomized(packageInfo)) {
139+
cachedWheel = wheelCache.findWheel(packageInfo.getName(), packageInfo.getVersion(), pythonDetails);
140+
}
137141
}
138142

139143
if (cachedWheel.isPresent()) {

pygradle-plugin/src/main/groovy/com/linkedin/gradle/python/tasks/action/pip/PipWheelAction.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,22 @@ void doPipOperation(PackageInfo packageInfo, List<String> extraArgs) {
104104
* always build these locally.
105105
*/
106106
private boolean doesWheelExist(PackageInfo packageInfo) {
107-
Optional<File> wheel = wheelCache.findWheel(packageInfo.getName(), packageInfo.getVersion(), pythonDetails);
108-
if (wheel.isPresent()) {
109-
File wheelFile = wheel.get();
110-
111-
try {
112-
FileUtils.copyFile(wheelFile, new File(wheelExtension.getWheelCache(), wheelFile.getName()));
113-
} catch (IOException e) {
114-
throw new UncheckedIOException(e);
107+
if (!packageSettings.isCustomized(packageInfo)) {
108+
Optional<File> wheel = wheelCache.findWheel(packageInfo.getName(), packageInfo.getVersion(), pythonDetails);
109+
if (wheel.isPresent()) {
110+
File wheelFile = wheel.get();
111+
112+
try {
113+
FileUtils.copyFile(wheelFile, new File(wheelExtension.getWheelCache(), wheelFile.getName()));
114+
} catch (IOException e) {
115+
throw new UncheckedIOException(e);
116+
}
117+
118+
if (PythonHelpers.isPlainOrVerbose(project)) {
119+
logger.lifecycle("Skipping {}, in wheel cache {}", packageInfo.toShortHand(), wheelFile);
120+
}
121+
return true;
115122
}
116-
117-
if (PythonHelpers.isPlainOrVerbose(project)) {
118-
logger.lifecycle("Skipping {}, in wheel cache {}", packageInfo.toShortHand(), wheelFile);
119-
}
120-
return true;
121123
}
122124

123125
ConfigurableFileTree tree = project.fileTree(wheelExtension.getWheelCache(), action -> {

0 commit comments

Comments
 (0)