1 | @echo off |
---|
2 | setlocal |
---|
3 | rem | Compiles all the students' games. |
---|
4 | rem | The students' directories should be the subdirectories of |
---|
5 | rem | the current directory. |
---|
6 | |
---|
7 | set DefaultFrameworkDir=%WINDIR%\Microsoft.NET\Framework |
---|
8 | |
---|
9 | if not defined FrameworkDir ( |
---|
10 | set FrameworkDir=%DefaultFrameworkDir% |
---|
11 | ) |
---|
12 | |
---|
13 | if not exist %FrameworkDir%\v3.5 ( |
---|
14 | ECHO. |
---|
15 | ECHO. |
---|
16 | echo .NET Framework 3.5 required. |
---|
17 | ECHO. |
---|
18 | ECHO. |
---|
19 | goto end |
---|
20 | ) |
---|
21 | |
---|
22 | set msbuild=%FrameworkDir%\v3.5\MSBuild.exe |
---|
23 | |
---|
24 | if not exist lib\jypeli2.dll ( |
---|
25 | echo lib path expected which contains jypeli2.dll |
---|
26 | goto end |
---|
27 | ) |
---|
28 | |
---|
29 | set root=%CD% |
---|
30 | set pelit=%root%\pelit |
---|
31 | set lib=%root%\lib |
---|
32 | set build=%msbuild% /t:Build /p:Configuration=Release /p:"ReferencePath=%lib%" |
---|
33 | set copy_dir=xcopy /S /Q /I /Y |
---|
34 | |
---|
35 | if exist %pelit%\NUL rd /S /Q %pelit% |
---|
36 | mkdir %pelit% |
---|
37 | |
---|
38 | for /D %%d in (*) do ( |
---|
39 | |
---|
40 | mkdir "%pelit%\%%d" |
---|
41 | |
---|
42 | for /D %%e in (%%d\*) do ( |
---|
43 | pushd %%e |
---|
44 | |
---|
45 | for %%p in (*.csproj) do ( |
---|
46 | rem | We have at least one project file in the directory, |
---|
47 | rem | let's build it. |
---|
48 | |
---|
49 | %build% "%%p" > NUL |
---|
50 | |
---|
51 | if errorlevel 1 ( |
---|
52 | echo DOES NOT BUILD: %%e |
---|
53 | ) |
---|
54 | |
---|
55 | rem We don't need these. |
---|
56 | if exist "bin\x86\Release\*.pdb" del /F /Q "bin\x86\Release\*.pdb" |
---|
57 | if exist "bin\x86\Release\Jypeli2.xml" del /F /Q "bin\x86\Release\Jypeli2.xml" |
---|
58 | |
---|
59 | %copy_dir% bin\x86\Release "%pelit%\%%e" > NUL |
---|
60 | ) |
---|
61 | |
---|
62 | rem | In case someone has "Create directory for solution" set |
---|
63 | for /D %%f in (*) do ( |
---|
64 | pushd %%f |
---|
65 | |
---|
66 | for %%p in (*.csproj) do ( |
---|
67 | %build% "%%p" > NUL |
---|
68 | |
---|
69 | if errorlevel 1 ( |
---|
70 | echo DOES NOT BUILD: %%e |
---|
71 | ) |
---|
72 | |
---|
73 | rem We don't need these. |
---|
74 | if exist "bin\x86\Release\*.pdb" del /F /Q "bin\x86\Release\*.pdb" |
---|
75 | if exist "bin\x86\Release\Jypeli2.xml" del /F /Q "bin\x86\Release\Jypeli2.xml" |
---|
76 | |
---|
77 | %copy_dir% bin\x86\Release "%pelit%\%%e" > NUL |
---|
78 | ) |
---|
79 | |
---|
80 | popd |
---|
81 | ) |
---|
82 | |
---|
83 | popd |
---|
84 | ) |
---|
85 | ) |
---|
86 | |
---|
87 | echo. |
---|
88 | echo Tehtiin hakemisto pelit |
---|
89 | |
---|
90 | :end |
---|
91 | endlocal |
---|