-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdca3c6
commit c788085
Showing
11 changed files
with
109 additions
and
232 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,43 @@ | ||
|
||
import { Path } from './Imports.js'; | ||
import { fromFileUrl , dirname } | ||
from 'https://deno.land/[email protected]/path/mod.ts'; | ||
|
||
import { ensureDir , emptyDir , walk } | ||
from 'https://deno.land/[email protected]/fs/mod.ts' | ||
|
||
export { join } | ||
from 'https://deno.land/[email protected]/path/mod.ts'; | ||
|
||
export async function discover(path,options){ | ||
|
||
const files = []; | ||
export function folder ( meta ){ | ||
return dirname(fromFileUrl(meta.url)); | ||
} | ||
|
||
|
||
try { | ||
export async function prepare ({ empty , path }){ | ||
|
||
const action = (empty) | ||
? emptyDir | ||
: ensureDir ; | ||
|
||
await action(path); | ||
} | ||
|
||
for await (const dir of Deno.readDir(path)){ | ||
|
||
const { name , isFile , isDirectory } = dir; | ||
export async function discover ({ extension , subfolders , path }){ | ||
|
||
const filepath = Path.join(path,name); | ||
const paths = []; | ||
|
||
switch(true){ | ||
case isFile: | ||
if(name.endsWith(options.extension)) | ||
files.push(filepath); | ||
continue; | ||
case isDirectory: | ||
files.push(... await discover(filepath,options)); | ||
continue; | ||
} | ||
} | ||
} catch (e) { | ||
console.error(e); | ||
const options = { | ||
maxDepth : subfolders ? Math.Infinity : 1 , | ||
includeDirs : false , | ||
includeFiles : true , | ||
followSymlinks : false , | ||
exts : [ extension ] | ||
} | ||
|
||
return files; | ||
for await (const entry of walk(path,options)) | ||
paths.push(entry.path); | ||
|
||
return paths; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
import { green , dim , blue } | ||
from 'https://deno.land/[email protected]/fmt/colors.ts' | ||
|
||
|
||
export function prettyPath ( path , options = {} ){ | ||
|
||
const { | ||
folderColor = green , | ||
separator = dim(blue('/')) | ||
} = options; | ||
|
||
|
||
if(path.startsWith('file:')) | ||
path = path.slice(7); | ||
|
||
|
||
return path | ||
.split('/') | ||
.map((folder) => folderColor(folder)) | ||
.join(separator); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
|
||
import { Files , Path } from './Imports.js'; | ||
import { dirname , join } | ||
from 'https://deno.land/[email protected]/path/mod.ts'; | ||
|
||
import { ensureDir } | ||
from 'https://deno.land/[email protected]/fs/mod.ts' | ||
|
||
|
||
const { run , writeFile , remove } = Deno; | ||
const { join , dirname } = Path; | ||
const { ensureDir } = Files; | ||
|
||
|
||
export default async function gcc(options = {}){ | ||
export async function gcc ( options = {} ){ | ||
|
||
const { buildFolder } = options; | ||
const { paths , names } = options; | ||
|
||
const GCC = join(buildFolder,'GCC.sh'); | ||
const GCC = join(paths.build,'GCC.sh'); | ||
|
||
const encoder = new TextEncoder(); | ||
const data = encoder.encode(`g++ $@`); | ||
|
@@ -20,47 +23,55 @@ export default async function gcc(options = {}){ | |
'./GCC.sh' , | ||
'-std=c++20' , | ||
'-fmodules-ts' | ||
]; | ||
] | ||
|
||
|
||
const { verbose } = options; | ||
|
||
if(verbose) | ||
parameters.push(`-v`); | ||
|
||
|
||
const { language } = options; | ||
|
||
if(language) | ||
parameters.push(`-x ${ language }`); | ||
|
||
|
||
const { compileObject } = options; | ||
|
||
if(compileObject) | ||
parameters.push('-c'); | ||
|
||
|
||
const { compileAssembly } = options; | ||
|
||
if(compileAssembly) | ||
parameters.push('-S'); | ||
|
||
|
||
const { onlyPreprocess } = options; | ||
|
||
if(onlyPreprocess) | ||
parameters.push('-E'); | ||
|
||
|
||
const { other } = options; | ||
|
||
if(other) | ||
parameters.push(...other); | ||
|
||
const { executable } = options; | ||
|
||
const { executable } = names; | ||
|
||
if(executable) | ||
parameters.push(`-o${ join(buildFolder,executable) }`); | ||
parameters.push(`-o${ join(paths.build,executable) }`); | ||
|
||
let { modules , main } = options; | ||
const { input } = paths; | ||
const { main } = names; | ||
|
||
if(modules && main){ | ||
parameters.push(...[...modules.filter(file => !file.endsWith(main)),modules.find((file) => file.endsWith(main))]); | ||
if(input && main){ | ||
parameters.push(...[...input.filter(file => !file.endsWith(main)),input.find((file) => file.endsWith(main))]); | ||
} | ||
|
||
|
||
|
@@ -69,7 +80,7 @@ export default async function gcc(options = {}){ | |
|
||
const process = await run({ | ||
cmd : parameters , | ||
cwd : buildFolder , | ||
cwd : paths.build , | ||
stdout : 'piped' , | ||
stderr : 'piped' | ||
}); | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.