Procházet zdrojové kódy

Merge pull request #19642 from overleaf/jdt-latexmkrc-ce

feat: add latexmkrc for server-ce
GitOrigin-RevId: 0d7385808a6a0b98d0a759ce0e329e6b9f578f35
Jimmy Domagala-Tang před 1 rokem
rodič
revize
7add11a190

+ 4 - 0
server-ce/Dockerfile

@@ -82,6 +82,10 @@ RUN chmod +x /overleaf/bin/flush-history-queues
 ADD server-ce/bin/force-history-resyncs /overleaf/bin/force-history-resyncs
 RUN chmod +x /overleaf/bin/force-history-resyncs
 
+# Copy Latexmkrc
+# -----------------------
+COPY server-ce/config/latexmkrc /usr/local/share/latexmk/LatexMk
+
 # File that controls open|closed status of the site
 # -------------------------------------------------
 ENV SITE_MAINTENANCE_FILE "/etc/overleaf/site_status"

+ 3 - 0
server-ce/config/latexmkrc

@@ -0,0 +1,3 @@
+# equivalent to -gt option. Used to prevent latexmk from skipping recompilation
+# of output.log and output.pdf
+$go_mode = 3;

+ 33 - 9
server-ce/test/sandboxed-compiles.spec.ts

@@ -16,7 +16,7 @@ describe('SandboxedCompiles', function () {
     ALL_TEX_LIVE_DOCKER_IMAGE_NAMES: '2023,2022',
   }
 
-  describe('enabled in Server Pro', () => {
+  describe('enabled in Server Pro', function () {
     if (isExcludedBySharding('PRO_CUSTOM_2')) return
     startWith({
       pro: true,
@@ -28,7 +28,7 @@ describe('SandboxedCompiles', function () {
       login('user@example.com')
     })
 
-    it('should offer TexLive images and switch the compiler', () => {
+    it('should offer TexLive images and switch the compiler', function () {
       cy.visit('/project')
       createProject('sandboxed')
       const recompile = throttledRecompile()
@@ -58,10 +58,11 @@ describe('SandboxedCompiles', function () {
 
     checkSyncTeX()
     checkXeTeX()
+    checkRecompilesAfterErrors()
   })
 
   function checkSyncTeX() {
-    describe('SyncTeX', () => {
+    describe('SyncTeX', function () {
       let projectName: string
       beforeEach(function () {
         projectName = `Project ${uuid()}`
@@ -81,7 +82,7 @@ describe('SandboxedCompiles', function () {
         })
       })
 
-      it('should sync to code', () => {
+      it('should sync to code', function () {
         cy.log('navigate to \\maketitle using double click in PDF')
         cy.get('.pdf-viewer').within(() => {
           cy.findByText(projectName).dblclick()
@@ -112,7 +113,7 @@ describe('SandboxedCompiles', function () {
         cy.get('.cm-activeLine').should('have.text', '\\section{Section B}')
       })
 
-      it('should sync to pdf', () => {
+      it('should sync to pdf', function () {
         cy.log('zoom in')
         cy.findByText('45%').click()
         cy.findByText('400%').click()
@@ -150,8 +151,25 @@ describe('SandboxedCompiles', function () {
     })
   }
 
+  function checkRecompilesAfterErrors() {
+    it('recompiles even if there are Latex errors', function () {
+      login('user@example.com')
+      cy.visit('/project')
+      createProject('test-project')
+      const recompile = throttledRecompile()
+      cy.findByText('\\maketitle').parent().click()
+      cy.findByText('\\maketitle')
+        .parent()
+        .type('\n\\fakeCommand{} \n\\section{{}Test Section}')
+      recompile()
+      recompile()
+      cy.get('.pdf-viewer').should('contain.text', 'Test Section')
+      cy.get('.logs-pane').should('not.contain.text', 'No PDF')
+    })
+  }
+
   function checkXeTeX() {
-    it('should be able to use XeLaTeX', () => {
+    it('should be able to use XeLaTeX', function () {
       cy.visit('/project')
       createProject('XeLaTeX')
       const recompile = throttledRecompile()
@@ -181,7 +199,11 @@ describe('SandboxedCompiles', function () {
   }
 
   function checkUsesDefaultCompiler() {
-    it('should not offer TexLive images and use default compiler', () => {
+    beforeEach(function () {
+      login('user@example.com')
+    })
+
+    it('should not offer TexLive images and use default compiler', function () {
       cy.visit('/project')
       createProject('sandboxed')
       cy.log('wait for compile')
@@ -198,7 +220,7 @@ describe('SandboxedCompiles', function () {
     })
   }
 
-  describe('disabled in Server Pro', () => {
+  describe('disabled in Server Pro', function () {
     if (isExcludedBySharding('PRO_DEFAULT_2')) return
     startWith({ pro: true })
     ensureUserExists({ email: 'user@example.com' })
@@ -209,9 +231,10 @@ describe('SandboxedCompiles', function () {
     checkUsesDefaultCompiler()
     checkSyncTeX()
     checkXeTeX()
+    checkRecompilesAfterErrors()
   })
 
-  describe.skip('unavailable in CE', () => {
+  describe.skip('unavailable in CE', function () {
     if (isExcludedBySharding('CE_CUSTOM_1')) return
     startWith({ pro: false, vars: enabledVars, resetData: true })
     ensureUserExists({ email: 'user@example.com' })
@@ -222,5 +245,6 @@ describe('SandboxedCompiles', function () {
     checkUsesDefaultCompiler()
     checkSyncTeX()
     checkXeTeX()
+    checkRecompilesAfterErrors()
   })
 })