Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PoroCYon
Shader_Minifier
Commits
25604baf
Commit
25604baf
authored
Jun 03, 2018
by
Laurent Le Brun
Browse files
Update test directory
+ fix testing in release mode
parent
73dda2b4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Checker/Checker.fsproj
View file @
25604baf
...
...
@@ -25,6 +25,7 @@
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DocumentationFile>
bin\Debug\Checker.XML
</DocumentationFile>
<Prefer32Bit>
true
</Prefer32Bit>
<StartWorkingDirectory>
../../..
</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
...
...
@@ -36,6 +37,7 @@
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DocumentationFile>
bin\Release\Checker.XML
</DocumentationFile>
<Prefer32Bit>
true
</Prefer32Bit>
<StartWorkingDirectory>
..\..\..
</StartWorkingDirectory>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion
Condition=
"'$(MinimumVisualStudioVersion)' == ''"
>
11
</MinimumVisualStudioVersion>
...
...
Checker/main.fs
View file @
25604baf
...
...
@@ -19,9 +19,9 @@ let testCompile content =
printfn
"compilation failed: %s"
info
false
let
m
inify
content
=
Ast
.
targetOutput
<-
Ast
.
T
ext
content
|>
main
.
minify
"input"
|>
Printer
.
print
let
doM
inify
content
=
Ast
.
targetOutput
<-
Ast
.
t
ext
()
main
.
minify
(
"input"
,
content
)
|>
Printer
.
print
let
check
(
file
:
string
)
=
try
...
...
@@ -30,7 +30,7 @@ let check (file: string) =
printfn
"Invalid input file '%s'"
file
false
else
let
minified
=
m
inify
content
+
"
\n
"
let
minified
=
doM
inify
content
+
"
\n
"
if
not
(
testCompile
minified
)
then
printfn
"Minification broke the file '%s'"
file
printfn
"%s"
minified
...
...
@@ -43,13 +43,13 @@ let check (file: string) =
false
let
inputs
=
[
@
"
..
\
..
\
..
\
t
ests
\
unit
\b
locks.frag"
@
"
..
\
..
\
..
\
t
ests
\
unit
\
hexa.frag"
@
"
..
\
..
\
..
\
t
ests
\
unit
\
inline.frag"
@
"
..
\
..
\
..
\
t
ests
\
unit
\
keyword_prefix.frag"
@
"
..
\
..
\
..
\
t
ests
\
unit
\
commas.frag"
@
"
..
\
..
\
..
\
t
ests
\
unit
\n
umbers.frag"
@
"
..
\
..
\
..
\
t
ests
\
unit
\
array.frag"
@
"tests
\
unit
\b
locks.frag"
@
"tests
\
unit
\
hexa.frag"
@
"tests
\
unit
\
inline.frag"
@
"tests
\
unit
\
keyword_prefix.frag"
@
"tests
\
unit
\
commas.frag"
@
"tests
\
unit
\n
umbers.frag"
@
"tests
\
unit
\
array.frag"
]
[<
EntryPoint
>]
...
...
src/ast.fs
View file @
25604baf
...
...
@@ -5,6 +5,8 @@ open System.IO
type
targetOutput
=
Text
|
CHeader
|
CList
|
JS
|
Nasm
let
text
()
=
Text
let
version
=
"1.1.6"
// Shader Minifer version
let
debugMode
=
false
...
...
src/main.fs
View file @
25604baf
...
...
@@ -52,7 +52,7 @@ let readFile file =
else
new
StreamReader
(
file
)
stream
.
ReadToEnd
()
let
minify
filename
(
content
:
string
)
=
let
minify
(
filename
,
content
:
string
)
=
vprintf
"Input file size is: %d
\n
"
(
content
.
Length
)
let
code
=
Parse
.
runParser
filename
content
vprintf
"File parsed. "
;
printSize
code
...
...
@@ -72,7 +72,7 @@ let minify filename (content: string) =
let
minifyFile
file
=
let
content
=
readFile
file
let
filename
=
if
file
=
""
then
"stdin"
else
file
minify
filename
content
minify
(
filename
,
content
)
let
run
files
=
let
fail
(
exn
:
exn
)
s
=
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment