Skip to content

Commit 6fee592

Browse files
committed
remove some code
1 parent fbd877c commit 6fee592

File tree

12 files changed

+50
-273
lines changed

12 files changed

+50
-273
lines changed

.clangd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ CompileFlags:
77
- -I${workspaceFolder}/mupdf/include
88
- -I${workspaceFolder}/src
99
- -I${workspaceFolder}/src/utils
10+
- -DUNICODE
11+
- -DWIN32
12+
- -D_WIN32
13+
- -D_CRT_SECURE_NO_WARNINGS
14+
- -DWINVER=0x0a00
15+
- -D_WIN32_WINNT=0x0a00
16+
- -DPRE_RELEASE_VER=3.3
1017

1118
If:
1219
PathExclude:

do/build.go

Lines changed: 0 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -81,107 +81,6 @@ func createPdbLzsa(dir string) error {
8181
return createLzsaFromFiles("SumatraPDF.pdb.lzsa", dir, pdbFiles)
8282
}
8383

84-
// build, sign, upload latest pre-release build
85-
func buildSignAndUploadPreRelease() {
86-
if !isGithubMyMasterBranch() {
87-
logf("buildSignAndUploadPreRelease: skipping build because not on master branch\n")
88-
return
89-
}
90-
ver := getPreReleaseVer()
91-
logf("buildSignAndUploadPreRelease: ver: %s\n", ver)
92-
isClean := isGitClean(".")
93-
if !isClean {
94-
logf("will not upload because git is not clean\n")
95-
}
96-
verifyBuildNotInStorageMust(newMinioR2Client(), buildTypePreRel, ver)
97-
verifyBuildNotInStorageMust(newMinioBackblazeClient(), buildTypePreRel, ver)
98-
99-
detectSigntoolPathMust()
100-
detectMakeAppxPathMust()
101-
genHTMLDocsForApp()
102-
103-
setBuildConfigPreRelease()
104-
defer revertBuildConfig()
105-
106-
msbuildPath := detectMsbuildPathMust()
107-
dirDst := filepath.Join("out", "artifacts", ver)
108-
if !isClean {
109-
dirDst += "-dirty"
110-
}
111-
must(os.RemoveAll(dirDst))
112-
113-
build := func(plat *Platform) {
114-
prefix := "SumatraPDF-prerel-" + plat.suffix
115-
srcDstFileNames := getFileNamesWithPrefix(prefix)
116-
117-
slnPath := filepath.Join("vs2022", "SumatraPDF.sln")
118-
buildDir := plat.outDir
119-
config := "Release"
120-
// when !isClean we assume it's interactive testing so we don't
121-
// re-build from scratch because it's time consuming
122-
if isClean {
123-
os.RemoveAll(buildDir)
124-
}
125-
126-
p := fmt.Sprintf(`/p:Configuration=%s;Platform=%s`, config, plat.vsplatform)
127-
t := `/t:test_util`
128-
runExeLoggedMust(msbuildPath, slnPath, t, p, `/m`)
129-
// can't run arm binaries in x86 CI
130-
if plat.vsplatform != kVSPlatformArm64 {
131-
runTestUtilMust(buildDir)
132-
}
133-
134-
t = `/t:SumatraPDF;SumatraPDF-dll;PdfFilter;PdfPreview`
135-
runExeLoggedMust(msbuildPath, slnPath, t, p, `/m`)
136-
err := createPdbZip(buildDir)
137-
must(err)
138-
err = createPdbLzsa(buildDir)
139-
must(err)
140-
141-
// copy to dest dir
142-
for _, file := range srcDstFileNames {
143-
srcPath := filepath.Join(buildDir, file[0])
144-
dstName := file[1]
145-
dstPath := filepath.Join(dirDst, dstName)
146-
copyFile2Must(dstPath, srcPath, true)
147-
}
148-
}
149-
150-
for _, plat := range platforms {
151-
build(plat)
152-
}
153-
154-
// sign all files in one swoop
155-
// build can take a long time and signing rquires user interaction
156-
// so wait for user to press enter
157-
waitForEnter("\nPress enter to sign and upload the builds")
158-
err := signExesInDir(dirDst)
159-
if err != nil {
160-
os.RemoveAll(dirDst)
161-
must(err)
162-
}
163-
164-
// create SumatraPDF-{prefix}.zip with SumatraPDF-{prefix}.exe inside
165-
// this must happen after signing
166-
for _, plat := range platforms {
167-
prefix := "SumatraPDF-prerel-" + plat.suffix
168-
nameInZip := fmt.Sprintf("SumatraPDF-prerel-%s-%s.exe", ver, plat.suffix)
169-
zipPath := filepath.Join(dirDst, fmt.Sprintf("%s.zip", prefix))
170-
exePath := filepath.Join(dirDst, fmt.Sprintf("%s.exe", prefix))
171-
err = createExeZipWithGoWithName(dirDst, exePath, zipPath, nameInZip)
172-
must(err)
173-
}
174-
175-
manifestPath := filepath.Join(dirDst, "SumatraPDF-prerel-manifest.txt")
176-
createManifestMust(manifestPath)
177-
178-
if !isClean {
179-
logf("buildSignAndUploadPreRelease: will skip upload because git is not clean\n")
180-
uploadDryRun = true
181-
}
182-
uploadToStorage(buildTypePreRel, ver, dirDst)
183-
}
184-
18584
// func copyBuiltFiles(dstDir string, srcDir string, prefix string) {
18685
// files := getFileNamesWithPrefix(prefix)
18786
// for _, f := range files {
@@ -391,57 +290,6 @@ func addZipFile(w *zip.Writer, path string) error {
391290
return addZipFileWithName(w, path, nameInZip)
392291
}
393292

394-
func createExeZipWithGoWithName(dir, exePath, zipPath, nameInZip string) error {
395-
f, err := os.Create(zipPath)
396-
if err != nil {
397-
return err
398-
}
399-
defer func() {
400-
err = f.Close()
401-
}()
402-
zw := zip.NewWriter(f)
403-
err = addZipFileWithName(zw, exePath, nameInZip)
404-
if err != nil {
405-
return err
406-
}
407-
err = zw.Close()
408-
if err != nil {
409-
return err
410-
}
411-
return err
412-
}
413-
414-
// func createExeZipWithPigz(dir string) {
415-
// srcFile := "SumatraPDF.exe"
416-
// srcPath := filepath.Join(dir, srcFile)
417-
// panicIf(!fileExists(srcPath), "file '%s' doesn't exist\n", srcPath)
418-
419-
// // this is the file that pigz.exe will create
420-
// dstFileTmp := "SumatraPDF.exe.zip"
421-
// dstPathTmp := filepath.Join(dir, dstFileTmp)
422-
// removeFileMust(dstPathTmp)
423-
424-
// // this is the file we want at the end
425-
// dstFile := "SumatraPDF.zip"
426-
// dstPath := filepath.Join(dir, dstFile)
427-
// removeFileMust(dstPath)
428-
429-
// wd, err := os.Getwd()
430-
// must(err)
431-
// pigzExePath := filepath.Join(wd, "bin", "pigz.exe")
432-
// panicIf(!fileExists(pigzExePath), "file '%s' doesn't exist\n", pigzExePath)
433-
// cmd := exec.Command(pigzExePath, "-11", "--keep", "--zip", srcFile)
434-
// // in pigz we don't control the name of the file created inside so
435-
// // so when we run pigz the current directory is the same as
436-
// // the directory with the file we're compressing
437-
// cmd.Dir = dir
438-
// runCmdMust(cmd)
439-
440-
// panicIf(!fileExists(dstPathTmp), "file '%s' doesn't exist\n", dstPathTmp)
441-
// err = os.Rename(dstPathTmp, dstPath)
442-
// must(err)
443-
// }
444-
445293
var pdbFiles = []string{"libmupdf.pdb", "SumatraPDF-dll.pdb", "SumatraPDF.pdb"}
446294

447295
func createPdbZip(dir string) error {
@@ -575,47 +423,6 @@ func buildPreRelease(plat *Platform) {
575423
buildAll("Release", plat.vsplatform, plat.outDir)
576424
}
577425

578-
// TODO:
579-
func buildRelease() {
580-
panic("FIXME")
581-
582-
// make sure we can sign the executables, early exit if missing
583-
detectSigntoolPathMust()
584-
genHTMLDocsForApp()
585-
586-
ver := getVerForBuildType(buildTypeRel)
587-
s := fmt.Sprintf("buidling release version %s", ver)
588-
defer makePrintDuration(s)()
589-
590-
verifyBuildNotInStorageMust(newMinioR2Client(), buildTypeRel, ver)
591-
verifyBuildNotInStorageMust(newMinioBackblazeClient(), buildTypeRel, ver)
592-
593-
removeReleaseBuilds()
594-
setBuildConfigRelease()
595-
defer revertBuildConfig()
596-
597-
// build("Release", kPlatformNameIntel32)
598-
// nameInZip := fmt.Sprintf("SumatraPDF-%s-32.exe", ver)
599-
// createExeZipWithGoWithName(rel32Dir, nameInZip)
600-
601-
// build("Release", kPlatformNameIntel64)
602-
// nameInZip = fmt.Sprintf("SumatraPDF-%s-64.exe", ver)
603-
// createExeZipWithGoWithName(rel64Dir, nameInZip)
604-
605-
// build("Release", kPlatformNameArm64)
606-
// nameInZip = fmt.Sprintf("SumatraPDF-%s-arm64.exe", ver)
607-
// createExeZipWithGoWithName(relArm64Dir, nameInZip)
608-
609-
// createManifestMust(ver)
610-
611-
// dstDir := filepath.Join("out", "artifacts", "rel-"+ver)
612-
// prefix := fmt.Sprintf("SumatraPDF-%s", ver)
613-
// copyBuiltFiles(dstDir, rel32Dir, prefix)
614-
// copyBuiltFiles(dstDir, rel64Dir, prefix+"-64")
615-
// copyBuiltFiles(dstDir, relArm64Dir, prefix+"-arm64")
616-
// copyBuiltManifest(dstDir, ver, prefix)
617-
}
618-
619426
func detectVersionsCodeQL() {
620427
//ver := getGitLinearVersionMust()
621428
ver := 16648 // we don't have git history in codeql checkout

do/check_accesskyes.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,14 @@ func extractAccesskeyGroups(path string) map[string]*accessGroup {
6464
}
6565
} else if isAltGroupStartOrEnd(line) {
6666
panicIf(group == nil, "Can't use ACCESSKEY_ALTERNATIVE outside of group")
67-
if line[2] == '[' {
67+
switch line[2] {
68+
case '[':
6869
panicIf(line[25] != ' ', "Typo?")
6970
panicIf(group.inAltGroup, "Nested ACCESSKEY_ALTERNATIVE isn't supported")
7071
group.inAltGroup = true
71-
} else if line[2] == '|' {
72+
case '|':
7273
panicIf(!group.inAltGroup, "Unexpected ACCESSKEY_ALTERNATIVE alternative")
73-
} else {
74+
default:
7475
panicIf(!group.inAltGroup, "Unexpected ACCESSKEY_ALTERNATIVE end")
7576
group.inAltGroup = false
7677
}

do/gen_docs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const h1BreadcrumbsEnd = `</div>
4848
</div>
4949
`
5050

51-
func renderFirstH1(w io.Writer, h *ast.Heading, entering bool, seenFirstH1 *bool) {
51+
func renderFirstH1(w io.Writer, _ *ast.Heading, entering bool, seenFirstH1 *bool) {
5252
if entering {
5353
io.WriteString(w, h1BreadcrumbsStart)
5454
} else {
@@ -104,7 +104,7 @@ func genCsvTableHTML(records [][]string, noHeader bool) string {
104104
return strings.Join(lines, "\n")
105105
}
106106

107-
func renderCodeBlock(w io.Writer, cb *ast.CodeBlock, entering bool) {
107+
func renderCodeBlock(w io.Writer, cb *ast.CodeBlock, _ bool) {
108108
csvContent := bytes.TrimSpace(cb.Literal)
109109
// os.WriteFile("temp.csv", csvContent, 0644)
110110
r := csv.NewReader(bytes.NewReader(csvContent))
@@ -117,7 +117,7 @@ func renderCodeBlock(w io.Writer, cb *ast.CodeBlock, entering bool) {
117117
io.WriteString(w, s)
118118
}
119119

120-
func renderColumns(w io.Writer, columns *Columns, entering bool) {
120+
func renderColumns(w io.Writer, _ *Columns, entering bool) {
121121
if entering {
122122
io.WriteString(w, `<div class="doc-columns">`)
123123
} else {

do/main.go

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -221,41 +221,35 @@ func Main() {
221221
)
222222

223223
var (
224-
flgBuildLogview bool
225-
flgBuildNo int
226-
flgBuildPreRelease bool
227-
flgBuildRelease bool
228-
flgBuildSmoke bool
229-
flgBuildCodeQL bool
230-
flgCheckAccessKeys bool
231-
flgCIBuild bool
232-
flgCIDailyBuild bool
233-
flgClangFormat bool
234-
flgClean bool
235-
flgDiff bool
236-
flgGenDocs bool
237-
flgGenSettings bool
238-
flgGenWebsiteDocs bool
239-
flgRunLogView bool
240-
flgRegenPremake bool
241-
flgRunTests bool
242-
flgTransDownload bool
243-
flgTriggerCodeQL bool
244-
flgUpdateGoDeps bool
245-
flgUpdateVer string
246-
flgUpload bool
247-
flgWc bool
248-
flgBuildSignUploadPreRelease bool
224+
flgBuildLogview bool
225+
flgBuildNo int
226+
flgBuildSmoke bool
227+
flgBuildCodeQL bool
228+
flgCheckAccessKeys bool
229+
flgCIBuild bool
230+
flgCIDailyBuild bool
231+
flgClangFormat bool
232+
flgClean bool
233+
flgDiff bool
234+
flgGenDocs bool
235+
flgGenSettings bool
236+
flgGenWebsiteDocs bool
237+
flgRunLogView bool
238+
flgRegenPremake bool
239+
flgRunTests bool
240+
flgTransDownload bool
241+
flgTriggerCodeQL bool
242+
flgUpdateGoDeps bool
243+
flgUpdateVer string
244+
flgUpload bool
245+
flgWc bool
249246
)
250247

251248
{
252249
flag.BoolVar(&flgRegenPremake, "premake", false, "regenerate premake*.lua files")
253250
flag.BoolVar(&flgCIBuild, "ci", false, "run CI steps")
254251
flag.BoolVar(&flgCIDailyBuild, "ci-daily", false, "run CI daily steps")
255252
flag.BoolVar(&flgBuildSmoke, "build-smoke", false, "run smoke build (installer for 64bit release)")
256-
flag.BoolVar(&flgBuildSignUploadPreRelease, "build-sign-upload-pre-rel", false, "build, sign and upload pre-release")
257-
flag.BoolVar(&flgBuildPreRelease, "build-pre-rel", false, "build pre-release")
258-
flag.BoolVar(&flgBuildRelease, "build-release", false, "build release")
259253
flag.BoolVar(&flgBuildCodeQL, "build-codeql", false, "build for codeql")
260254
//flag.BoolVar(&flgBuildLzsa, "build-lzsa", false, "build MakeLZSA.exe")
261255
flag.BoolVar(&flgUpload, "upload", false, "upload the build to s3 and do spaces")
@@ -399,17 +393,6 @@ func Main() {
399393
opts.upload = true
400394
}
401395

402-
if flgBuildSignUploadPreRelease {
403-
buildSignAndUploadPreRelease()
404-
return
405-
}
406-
407-
if flgBuildRelease {
408-
// only when building locally, not on GitHub CI
409-
opts.verifyTranslationUpToDate = true
410-
opts.doCleanCheck = true
411-
opts.releaseBuild = true
412-
}
413396
//opts.doCleanCheck = false // for ad-hoc testing
414397

415398
ensureBuildOptionsPreRequesites(opts)
@@ -458,21 +441,6 @@ func Main() {
458441
return
459442
}
460443

461-
if flgBuildRelease {
462-
// TODO: must fix signing and upload
463-
buildRelease()
464-
return
465-
}
466-
467-
// this one is typically for me to build locally, so build all projects
468-
// to build less use -build-smoke
469-
if flgBuildPreRelease {
470-
cleanReleaseBuilds()
471-
genHTMLDocsForApp()
472-
buildPreRelease(platform32)
473-
return
474-
}
475-
476444
if flgUpdateVer != "" {
477445
ensureAllUploadCreds()
478446
updateAutoUpdateVer(flgUpdateVer)

0 commit comments

Comments
 (0)