@@ -5,7 +5,7 @@ import { addExeExt } from "patha"
5
5
import { installAptPack } from "setup-apt"
6
6
import { installBrewPack } from "setup-brew"
7
7
import { setupGraphviz } from "../graphviz/graphviz.js"
8
- import { type InstallationInfo , type PackageInfo , setupBin } from "../utils/setup/setupBin.js"
8
+ import { type PackageInfo , setupBin } from "../utils/setup/setupBin.js"
9
9
import { setupChocoPack } from "../utils/setup/setupChocoPack.js"
10
10
import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
11
11
import { getVersion } from "../versions/versions.js"
@@ -90,33 +90,7 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
90
90
return installationInfo
91
91
}
92
92
case "linux" : {
93
- let installationInfo : InstallationInfo
94
- if ( version === "" || isArch ( ) || hasDnf ( ) ) {
95
- if ( isArch ( ) ) {
96
- installationInfo = await setupPacmanPack ( "doxygen" , version )
97
- } else if ( hasDnf ( ) ) {
98
- return setupDnfPack ( [ { name : "doxygen" , version } ] )
99
- } else if ( isUbuntu ( ) ) {
100
- installationInfo = await installAptPack ( [ { name : "doxygen" , version } ] )
101
- } else {
102
- throw new Error ( "Unsupported linux distributions" )
103
- }
104
- } else if ( isUbuntu ( ) ) {
105
- try {
106
- // doxygen on stable Ubuntu repositories is very old. So, we use get the binary from the website itself
107
- installationInfo = await setupBin ( "doxygen" , version , getDoxygenPackageInfo , setupDir , arch )
108
- try {
109
- await installAptPack ( [ { name : "libclang-cpp9" } ] )
110
- } catch ( err ) {
111
- info ( `Failed to download libclang-cpp9 that might be needed for running doxygen. ${ err } ` )
112
- }
113
- } catch ( err ) {
114
- notice ( `Failed to download doxygen binary. ${ err } . Falling back to apt-get.` )
115
- installationInfo = await installAptPack ( [ { name : "doxygen" } ] )
116
- }
117
- } else {
118
- throw new Error ( "Unsupported linux distributions" )
119
- }
93
+ const installationInfo = await setupLinuxDoxygen ( version , setupDir , arch )
120
94
await setupGraphviz ( getVersion ( "graphviz" , undefined , await ubuntuVersion ( ) ) , "" , arch )
121
95
return installationInfo
122
96
}
@@ -125,6 +99,35 @@ export async function setupDoxygen(version: string, setupDir: string, arch: stri
125
99
}
126
100
}
127
101
}
102
+ async function setupLinuxDoxygen ( version : string , setupDir : string , arch : string ) {
103
+ try {
104
+ if ( isArch ( ) ) {
105
+ return await setupPacmanPack ( "doxygen" , version )
106
+ } else if ( hasDnf ( ) ) {
107
+ return setupDnfPack ( [ { name : "doxygen" , version } ] )
108
+ } else if ( isUbuntu ( ) ) {
109
+ return await installAptPack ( [ { name : "doxygen" , version, fallBackToLatest : false } ] )
110
+ } else {
111
+ throw new Error ( "Unsupported linux distributions" )
112
+ }
113
+ } catch {
114
+ // fallback to setupBin if the installation failed
115
+ try {
116
+ const installationInfo = await setupBin ( "doxygen" , version , getDoxygenPackageInfo , setupDir , arch )
117
+ if ( isUbuntu ( ) ) {
118
+ try {
119
+ await installAptPack ( [ { name : "libclang-cpp-dev" } ] )
120
+ } catch ( err ) {
121
+ info ( `Failed to download libclang-cpp-dev that might be needed for running doxygen. ${ err } ` )
122
+ }
123
+ }
124
+ return installationInfo
125
+ } catch ( err ) {
126
+ notice ( `Failed to download doxygen binary. ${ err } . Falling back to installing the latest version from apt-get.` )
127
+ return installAptPack ( [ { name : "doxygen" } ] )
128
+ }
129
+ }
130
+ }
128
131
129
132
async function activateWinDoxygen ( ) {
130
133
switch ( process . platform ) {
0 commit comments