Skip to content
This repository was archived by the owner on Aug 13, 2024. It is now read-only.
This repository was archived by the owner on Aug 13, 2024. It is now read-only.

Last modified of generated js files #303

Open
@StephanRepublika

Description

@StephanRepublika

Hi,

This is a great plugin, however, it recompiles and changes dates of every referenced TypeScript file almost always. That's not the problem, it's good to check more often than less.

But... the problem is the lastModified time of the generated JavaScript files, these files get a timestamp of the generated things. Even when nothing has changed.

Is it possible to change it so that it will set the lastModified time of the generated JavaScript files to the lastModified time of the TypeScript files?

Like this?

diff --git a/com.palantir.typescript/src/com/palantir/typescript/TypeScriptBuilder.java b/com.palantir.typescript/src/com/palantir/typescript/TypeScriptBuilder.java
index c12235f..8af44d5 100644
--- a/com.palantir.typescript/src/com/palantir/typescript/TypeScriptBuilder.java
+++ b/com.palantir.typescript/src/com/palantir/typescript/TypeScriptBuilder.java
@@ -300,10 +300,17 @@
String filePath = EclipseResources.getFilePath(eclipseFile);
File file = new File(filePath);

  •        IFile eclipseInputFile = EclipseResources.getFile(fileName);
    
  •        String inputFilePath = EclipseResources.getFilePath(eclipseInputFile);
    
  •        File inputFile = new File(inputFilePath);
    
  •        long lastModified = inputFile.lastModified();
    
    •    // write the file
         try {
             Files.createParentDirs(file);
             Files.write(outputFile.getText(), file, Charsets.UTF_8);
      
  •            file.setLastModified(lastModified);
         } catch (IOException e) {
             throw new RuntimeException(e);
         }
    

Kind regards,

Stephan van Loendersloot.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions