Author: hpoussin
Date: Sat Sep 8 23:27:07 2007
New Revision: 28956
URL:
http://svn.reactos.org/svn/reactos?rev=28956&view=rev
Log:
Let ImportLibrary class use the FileLocation concept.
I disabled def files in codeblocks and msvc backends, someone will have to update them
Modified:
trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp
trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
trunk/reactos/tools/rbuild/module.cpp
trunk/reactos/tools/rbuild/rbuild.h
Modified: trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/codeb…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp Sat Sep 8 23:27:07 2007
@@ -653,10 +653,12 @@
fprintf ( OUT, "\t\t\t\t<ExtraCommands>\r\n" );
+#if 0
if ( module.type == StaticLibrary && module.importLibrary )
fprintf ( OUT, "\t\t\t\t\t<Add after=\"dlltool --dllname %s --def %s
--output-lib $exe_output; %s -U\" />\r\n",
module.importLibrary->dllname.c_str (), module.importLibrary->definition.c_str(),
module.mangledSymbols ? "" : "--kill-at" );
else if ( module.importLibrary != NULL )
fprintf ( OUT, "\t\t\t\t\t<Add after=\"dlltool --dllname %s --def %s
--output-lib "$(TARGET_OBJECT_DIR)lib$(TARGET_OUTPUT_BASENAME).a"
%s\" />\r\n", module.GetTargetName ().c_str(),
module.importLibrary->definition.c_str(), module.mangledSymbols ? "" :
"--kill-at" );
+#endif
for ( i = 0; i < resource_files.size(); i++ )
@@ -671,6 +673,7 @@
#endif
}
+#if 0
if ( dll )
{
if (IsWineModule( module ))
@@ -684,6 +687,7 @@
#endif
fprintf ( OUT, "\t\t\t\t\t<Mode after=\"always\" />\r\n" );
}
+#endif
fprintf ( OUT, "\t\t\t\t</ExtraCommands>\r\n" );
@@ -894,6 +898,6 @@
if ( module.importLibrary == NULL)
return false;
- size_t index = module.importLibrary->definition.rfind ( ".spec.def" );
+ size_t index = module.importLibrary->source->name.rfind ( ".spec.def"
);
return ( index != string::npos );
}
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Sat Sep 8 23:27:07 2007
@@ -2244,7 +2244,7 @@
if ( module.importLibrary == NULL)
return false;
- size_t index = module.importLibrary->definition.rfind ( ".spec.def" );
+ size_t index = module.importLibrary->source->name.rfind ( ".spec.def"
);
return ( index != string::npos );
}
@@ -2259,19 +2259,9 @@
else
directory = SourceDirectory;
- size_t pos = module.importLibrary->definition.find_last_of ( "/\\" );
- if ( pos == string::npos )
- {
- return new FileLocation ( directory,
- module.GetBasePath (),
- module.importLibrary->definition );
- }
-
- string dir = module.importLibrary->definition.substr ( 0, pos );
- string name = module.importLibrary->definition.substr ( pos + 1);
- return new FileLocation ( directory,
- NormalizeFilename ( module.GetBasePath () + sSep + dir ),
- name );
+ return new FileLocation ( directory,
+ module.importLibrary->source->relative_path,
+ module.importLibrary->source->name );
}
else
return new FileLocation ( SourceDirectory, "tools" + sSep +
"rbuild", "empty.def" );
Modified: trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/msvc.cpp Sat Sep 8 23:27:07 2007
@@ -374,6 +374,7 @@
{
if (module.HasImportLibrary ())
{
+#if 0
string modulename = module.GetBasePath ();
string file = module.importLibrary->definition;
size_t pos = file.find (".def");
@@ -383,6 +384,7 @@
}
modulename += DEF_SSEP + file;
out.push_back (modulename);
+#endif
}
}
Modified: trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msvc/…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp Sat Sep 8 23:27:07 2007
@@ -436,8 +436,10 @@
fprintf ( OUT, "\t\t\t\tDataExecutionPrevention=\"0\"\r\n" );
}
+#if 0
if (module.importLibrary != NULL)
fprintf ( OUT, "\t\t\t\tModuleDefinitionFile=\"%s\"\r\n",
module.importLibrary->definition.c_str());
+#endif
fprintf ( OUT, "\t\t\t\tAdditionalDependencies=\"" );
bool use_msvcrt_lib = false;
for ( i = 0; i < libraries.size(); i++ )
Modified: trunk/reactos/tools/rbuild/module.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/module.cpp?re…
==============================================================================
--- trunk/reactos/tools/rbuild/module.cpp (original)
+++ trunk/reactos/tools/rbuild/module.cpp Sat Sep 8 23:27:07 2007
@@ -719,7 +719,7 @@
e.location,
"Only one <importlibrary> is valid per module" );
}
- importLibrary = new ImportLibrary ( e, *this );
+ importLibrary = new ImportLibrary ( project, e, *this );
subs_invalid = true;
}
else if ( e.name == "if" )
@@ -1577,35 +1577,43 @@
}
-ImportLibrary::ImportLibrary ( const XMLElement& _node,
- const Module& _module )
- : node (_node),
- module (_module)
-{
- const XMLAttribute* att = _node.GetAttribute ( "basename", false );
- if (att != NULL)
- basename = att->value;
- else
- basename = module.name;
-
- att = _node.GetAttribute ( "dllname", false );
- if (att != NULL)
- dllname = att->value;
- else
- {
- if ( _module.type == StaticLibrary )
- {
- throw XMLInvalidBuildFileException (
- node.location,
- "<importlibrary> dllname attribute required." );
- }
-
- dllname = "";
- }
-
- att = _node.GetAttribute ( "definition", true );
- assert (att);
- definition = FixSeparator(att->value);
+ImportLibrary::ImportLibrary ( const Project& project,
+ const XMLElement& node,
+ const Module& module )
+ : XmlNode ( project, node ),
+ module (module)
+{
+ const XMLAttribute* dllname = node.GetAttribute ( "dllname", false );
+ const XMLAttribute* definition = node.GetAttribute ( "definition", true );
+ assert ( definition );
+
+ if ( dllname )
+ this->dllname = dllname->value;
+ else if ( module.type == StaticLibrary )
+ throw XMLInvalidBuildFileException (
+ node.location,
+ "<importlibrary> dllname attribute required." );
+
+ DirectoryLocation directory = SourceDirectory;
+ size_t index = definition->value.rfind ( ".spec.def" );
+ if ( index != string::npos )
+ directory = IntermediateDirectory;
+
+ index = definition->value.find_last_of ( "/\\" );
+ if ( index == string::npos )
+ {
+ source = new FileLocation ( directory,
+ module.GetBasePath (),
+ definition->value );
+ }
+ else
+ {
+ string dir = definition->value.substr ( 0, index );
+ string name = definition->value.substr ( index + 1);
+ source = new FileLocation ( directory,
+ NormalizeFilename ( module.GetBasePath () + sSep + dir ),
+ name );
+ }
}
Modified: trunk/reactos/tools/rbuild/rbuild.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev=…
==============================================================================
--- trunk/reactos/tools/rbuild/rbuild.h (original)
+++ trunk/reactos/tools/rbuild/rbuild.h Sat Sep 8 23:27:07 2007
@@ -542,19 +542,16 @@
void ProcessXML();
};
-class ImportLibrary
-{
-public:
- const XMLElement& node;
+class ImportLibrary : public XmlNode
+{
+public:
const Module& module;
- std::string basename;
- std::string definition;
std::string dllname;
-
- ImportLibrary ( const XMLElement& _node,
+ FileLocation *source;
+
+ ImportLibrary ( const Project& project,
+ const XMLElement& node,
const Module& module );
-
- void ProcessXML ();
};