Skip to content

Commit

Permalink
Add Fortran lib support (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf authored Jan 26, 2024
1 parent cd6ef62 commit 93cebfe
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const buildlogspath = conanserverroot + '/buildslogs.db';
let compilernames = null;
let allRustLibrariesAndVersions = null;
let allCppLibrariesAndVersions = null;
let allFortranLibrariesAndVersions = null;

let availableLibrariesAndVersions = {};
let availableLibraryIds = [];
Expand Down Expand Up @@ -177,6 +178,18 @@ async function refreshCELibraries() {
console.error(err);
reject(err);
});

https.get(`${ceserverurl}/api/libraries/fortran`, { headers: { Accept: 'application/json' } }, (resp) => {
let data = '';
resp.on('data', (chunk) => data += chunk);
resp.on('end', () => {
allFortranLibrariesAndVersions = JSON.parse(data);
resolve(true);
});
}).on('error', (err) => {
console.error(err);
reject(err);
});
});
}

Expand Down Expand Up @@ -222,7 +235,12 @@ async function refreshConanLibraries(forceall) {
let ceLib = _.find(allCppLibrariesAndVersions, (lib) => lib.id === libraryId);
if (!ceLib) {
ceLib = _.find(allRustLibrariesAndVersions, (lib) => lib.id === libraryId);
if (ceLib) language = 'rust';
if (ceLib) {
language = 'rust'
} else {
ceLib = _.find(allFortranLibrariesAndVersions, (lib) => lib.id === libraryId);
if (ceLib) language = 'fortran';
}
}

if (!ceLib && forceall) ceLib = { name: libraryId, versions: {} };
Expand Down Expand Up @@ -310,6 +328,7 @@ function main() {
'/libraries.html',
'/libraries_rust.html',
'/libraries_cpp.html',
'/libraries_fortran.html',
'/compilerfailurerates.html',
'/failedbuilds.html',
'/usage.html',
Expand All @@ -322,6 +341,7 @@ function main() {
'/reinitialize',
'/libraries/cpp',
'/libraries/rust',
'/libraries/fortran',
'/libraries',
'/compilerfailurerates',
'/hasfailedbefore',
Expand Down Expand Up @@ -376,6 +396,16 @@ function main() {
});
res.send(filteredlibs);
})
.options('/libraries/fortran', libraryexpireheaders, async (req, res) => {
res.send();
})
.get('/libraries/fortran', libraryexpireheaders, async (req, res) => {
const filteredlibs = {};
_.each(availableLibrariesAndVersions, (lib, id) => {
if (lib.language === 'fortran') filteredlibs[id] = lib;
});
res.send(filteredlibs);
})
.options('/libraries', libraryexpireheaders, async (req, res) => {
res.send();
})
Expand Down

0 comments on commit 93cebfe

Please sign in to comment.