Skip to content

Commit 0216862

Browse files
authored
Ignore timestamp update errors like in strada (#1700)
1 parent ae01679 commit 0216862

File tree

7 files changed

+593
-15
lines changed

7 files changed

+593
-15
lines changed

internal/diagnostics/diagnostics_generated.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/diagnostics/extraDiagnosticMessages.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535
"category": "Message",
3636
"code": 6420
3737
},
38-
"Failed to update timestamp of file '{0}'.": {
39-
"category": "Message",
40-
"code": 5074
41-
},
4238
"Project '{0}' is out of date because it has errors.": {
4339
"category": "Message",
4440
"code": 6423

internal/execute/build/buildtask.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -661,16 +661,16 @@ func (t *buildTask) updateTimeStamps(orchestrator *Orchestrator, emittedFiles []
661661
verboseMessageReported = true
662662
}
663663
err := orchestrator.host.SetMTime(file, now)
664-
if err != nil {
665-
t.reportDiagnostic(ast.NewCompilerDiagnostic(diagnostics.Failed_to_update_timestamp_of_file_0, file))
666-
} else if file == buildInfoName {
667-
t.buildInfoEntryMu.Lock()
668-
if t.buildInfoEntry != nil {
669-
t.buildInfoEntry.mTime = now
664+
if err == nil {
665+
if file == buildInfoName {
666+
t.buildInfoEntryMu.Lock()
667+
if t.buildInfoEntry != nil {
668+
t.buildInfoEntry.mTime = now
669+
}
670+
t.buildInfoEntryMu.Unlock()
671+
} else if t.storeOutputTimeStamp(orchestrator) {
672+
orchestrator.host.storeMTime(file, now)
670673
}
671-
t.buildInfoEntryMu.Unlock()
672-
} else if t.storeOutputTimeStamp(orchestrator) {
673-
orchestrator.host.storeMTime(file, now)
674674
}
675675
}
676676

internal/execute/tsctests/tscbuild_test.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2062,6 +2062,65 @@ func TestBuildProgramUpdates(t *testing.T) {
20622062
cwd: "/user/username/projects/project",
20632063
commandLineArgs: []string{"--b", "-i", "-w"},
20642064
},
2065+
{
2066+
subScenario: "when root is source from project reference",
2067+
files: FileMap{
2068+
"/home/src/workspaces/project/lib/tsconfig.json": stringtestutil.Dedent(`
2069+
{
2070+
"compilerOptions": {
2071+
"composite": true,
2072+
"outDir": "./dist"
2073+
}
2074+
}`),
2075+
"/home/src/workspaces/project/lib/foo.ts": `export const FOO: string = 'THEFOOEXPORT';`,
2076+
"/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(`
2077+
{
2078+
"references": [ { "path": "./lib" } ]
2079+
}`),
2080+
"/home/src/workspaces/project/index.ts": `import { FOO } from "./lib/foo";`,
2081+
},
2082+
commandLineArgs: []string{"--b"},
2083+
edits: []*tscEdit{
2084+
{
2085+
caption: "dts doesnt change",
2086+
edit: func(sys *testSys) {
2087+
sys.appendFile("/home/src/workspaces/project/lib/foo.ts", "const Bar = 10;")
2088+
},
2089+
},
2090+
},
2091+
cwd: "/home/src/workspaces/project",
2092+
},
2093+
{
2094+
subScenario: "when root is source from project reference with composite",
2095+
files: FileMap{
2096+
"/home/src/workspaces/project/lib/tsconfig.json": stringtestutil.Dedent(`
2097+
{
2098+
"compilerOptions": {
2099+
"composite": true,
2100+
"outDir": "./dist"
2101+
}
2102+
}`),
2103+
"/home/src/workspaces/project/lib/foo.ts": `export const FOO: string = 'THEFOOEXPORT';`,
2104+
"/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(`
2105+
{
2106+
"compilerOptions": {
2107+
"composite": true,
2108+
},
2109+
"references": [ { "path": "./lib" } ]
2110+
}`),
2111+
"/home/src/workspaces/project/index.ts": `import { FOO } from "./lib/foo";`,
2112+
},
2113+
commandLineArgs: []string{"--b"},
2114+
edits: []*tscEdit{
2115+
{
2116+
caption: "dts doesnt change",
2117+
edit: func(sys *testSys) {
2118+
sys.appendFile("/home/src/workspaces/project/lib/foo.ts", "const Bar = 10;")
2119+
},
2120+
},
2121+
},
2122+
cwd: "/home/src/workspaces/project",
2123+
},
20652124
}
20662125
for _, test := range testCases {
20672126
test.run(t, "programUpdates")

0 commit comments

Comments
 (0)