Read input files after processing all the options (to make -nowarn: and -warnaserror: options that follow the file names work for warnings produced during input file reading).

This commit is contained in:
jfrijters 2012-04-12 09:02:17 +00:00
Родитель 65dad04a63
Коммит dd082628fc
1 изменённых файлов: 41 добавлений и 30 удалений

Просмотреть файл

@ -508,11 +508,13 @@ class IkvmcCompiler
void ContinueParseCommandLine(IEnumerator<string> arglist, List<CompilerOptions> targets, CompilerOptions options)
{
List<string> fileNames = new List<string>();
while(arglist.MoveNext())
{
string s = arglist.Current;
if(s == "{")
{
ReadFiles(fileNames);
nonleaf = true;
IkvmcCompiler nestedLevel = new IkvmcCompiler();
nestedLevel.manifestMainClass = manifestMainClass;
@ -949,36 +951,7 @@ class IkvmcCompiler
}
else
{
if(defaultAssemblyName == null)
{
try
{
defaultAssemblyName = new FileInfo(Path.GetFileName(s)).Name;
}
catch(ArgumentException)
{
// if the filename contains a wildcard (or any other invalid character), we ignore
// it as a potential default assembly name
}
}
string[] files = null;
try
{
string path = Path.GetDirectoryName(s);
files = Directory.GetFiles(path == "" ? "." : path, Path.GetFileName(s));
}
catch { }
if (files == null || files.Length == 0)
{
StaticCompiler.IssueMessage(Message.InputFileNotFound, s);
}
else
{
foreach (string f in files)
{
ProcessFile(null, f);
}
}
fileNames.Add(s);
}
if(options.targetIsModule && options.sharedclassloader != null)
{
@ -989,6 +962,7 @@ class IkvmcCompiler
{
return;
}
ReadFiles(fileNames);
if(options.assembly == null)
{
string basename = options.path == null ? defaultAssemblyName : new FileInfo(options.path).Name;
@ -1025,6 +999,43 @@ class IkvmcCompiler
targets.Add(options);
}
private void ReadFiles(List<string> fileNames)
{
foreach (string fileName in fileNames)
{
if (defaultAssemblyName == null)
{
try
{
defaultAssemblyName = new FileInfo(Path.GetFileName(fileName)).Name;
}
catch (ArgumentException)
{
// if the filename contains a wildcard (or any other invalid character), we ignore
// it as a potential default assembly name
}
}
string[] files = null;
try
{
string path = Path.GetDirectoryName(fileName);
files = Directory.GetFiles(path == "" ? "." : path, Path.GetFileName(fileName));
}
catch { }
if (files == null || files.Length == 0)
{
StaticCompiler.IssueMessage(Message.InputFileNotFound, fileName);
}
else
{
foreach (string f in files)
{
ProcessFile(null, f);
}
}
}
}
internal static bool TryParseVersion(string str, out Version version)
{
if (str.EndsWith(".*"))