You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/05/04 14:03:01 UTC

[GitHub] jglick commented on a change in pull request #504: Skip CoS copying of class files when the target is already newer, such as from an external compilation

jglick commented on a change in pull request #504: Skip CoS copying of class files when the target is already newer, such as from an external compilation
URL: https://github.com/apache/incubator-netbeans/pull/504#discussion_r186091515
 
 

 ##########
 File path: java.source.base/src/org/netbeans/modules/java/source/usages/BuildArtifactMapperImpl.java
 ##########
 @@ -871,6 +890,38 @@ private boolean isUpdateResources(@NullAllowed final File targetFolder) {
             return new File(targetFolder, TAG_UPDATE_RESOURCES).exists();
         }
     }
+
+    private static boolean targetNewerThanSourceFile(File target, URL approximateSource) {
+        if (!"file".equals(approximateSource.getProtocol())) {
+            LOG.log(Level.FINER, "#227791: ignoring non-file-based source {0}", approximateSource);
+            return false;
+        }
+        if (!target.isFile()) {
+            LOG.log(Level.FINER, "#227791: {0} does not even exist", target);
+            return false;
+        }
+        long targetLastMod = target.lastModified();
+        File mockSrc;
+        try {
+            mockSrc = BaseUtilities.toFile(approximateSource.toURI());
+        } catch (URISyntaxException x) {
+            LOG.log(Level.FINER, "#227791: cannot convert " + approximateSource, x);
+            return false;
+        }
+        File src = new File(mockSrc.getParentFile(), mockSrc.getName().replaceFirst("([$].+)*[.]sig$", ".java"));
 
 Review comment:
   Here we are going from, say, `/prj/src/main/java/pkg/Outer$Inner.sig` (obviously not a real path; constructed at line 847) to `/prj/src/main/java/pkg/Outer.java` which we suspect is an actual file whose timestamp we could compare to that of the corresponding `/userdir/var/cache/index/s1234/java/15/classes/pkg/Outer$Inner.sig`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists