summaryrefslogtreecommitdiff
path: root/Tools/Java/Source
diff options
context:
space:
mode:
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-16 08:55:58 +0000
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-16 08:55:58 +0000
commit8270b34d9de8644edba8157839fdba0e113346d2 (patch)
tree5e3abcce896eaaf025369da2113f5453cc79c99e /Tools/Java/Source
parentedbacf2e5cf245287003b341ca814bfa17be604f (diff)
downloadedk2-platforms-8270b34d9de8644edba8157839fdba0e113346d2.tar.xz
Enhance MsaOwner.java
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1760 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Java/Source')
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java1
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/Guid.java11
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/MigrationTool.java9
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java29
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java56
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java5
6 files changed, 78 insertions, 33 deletions
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java
index f14184ab61..646158557b 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Database.java
@@ -49,7 +49,6 @@ public final class Database {
BufferedReader rd = new BufferedReader(new FileReader(DatabasePath + File.separator + filename));
String line;
String[] linecontext;
- Func lf;
if (rd.ready()) {
System.out.println("Found " + filename + ", Importing Package Guid Database.");
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Guid.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Guid.java
index e6fd4c3526..bbf79d8ca6 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/Guid.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/Guid.java
@@ -14,6 +14,8 @@ package org.tianocore.migration;
import java.util.regex.*;
+import org.tianocore.UsageTypes;
+
public class Guid {
Guid (String r8, String t, String n, String r9, String gv, String p) {
r8name = r8;
@@ -48,11 +50,14 @@ public class Guid {
if (MigrationTool.db.hasGuid(temp)) { // only changed guids registered, because both changed and not changed guids are included in database
type = MigrationTool.db.getGuidType(temp);
if (type.matches("Protocol")) {
- mi.protocols.add(temp);
+ mi.addProtocol(temp, UsageTypes.ALWAYS_CONSUMED);
+ //mi.protocols.add(temp);
} else if (type.matches("Ppi")) {
- mi.ppis.add(temp);
+ mi.addPpi(temp, UsageTypes.ALWAYS_CONSUMED);
+ //mi.ppis.add(temp);
} else if (type.matches("Guid")) {
- mi.guids.add(temp);
+ mi.addGuid(temp, UsageTypes.ALWAYS_CONSUMED);
+ //mi.guids.add(temp);
}
return temp;
}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MigrationTool.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
index 4e6b30c223..1ab5bbffb2 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
@@ -51,15 +51,10 @@ public class MigrationTool {
show(mi.hashnonlocalfunc, "nonlocal : ");
show(mi.hashr8only, "hashr8only : ");
}
-
new MsaWriter(mi).flush();
- mi.addProtocol("protocol", UsageTypes.ALWAYS_CONSUMED);
- mi.addGuid("guid", UsageTypes.ALWAYS_CONSUMED);
- mi.addLibraryClass("class", UsageTypes.ALWAYS_CONSUMED);
- mi.addPpi("ppi", UsageTypes.ALWAYS_CONSUMED);
- mi.getMsaOwner().flush(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + mi.modulename + ".___");
-
+ //mi.getMsaOwner().flush(MigrationTool.ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename + File.separator + mi.modulename + ".___");
+
if (MigrationTool.doCritic) {
Critic.fireAt(ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename);
}
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
index 48ecc56e56..69862f67a1 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
@@ -16,6 +16,7 @@ import java.io.*;
import java.util.*;
import org.tianocore.UsageTypes;
+import org.tianocore.SupportedArchitectures.Enum;
/*
Class ModuleInfo is built for scanning the source files, it contains all the needed
@@ -59,24 +60,40 @@ public final class ModuleInfo {
//-----------------------------------------------------------------------------------//
+ //addModuleType
+ //addGuidValue
+ //addModuleName
+
+ public final boolean addSourceFile (String filename, Enum en) {
+ localmodulesources.add(filename);
+ return msaowner.addSourceFile(filename, en);
+ }
+
public final boolean addProtocol (String proname, UsageTypes.Enum usage) {
- //protocols.add(proname);
+ protocols.add(proname);
return msaowner.addProtocol(proname, usage);
}
public final boolean addPpi (String ppiname, UsageTypes.Enum usage) {
- //ppis.add(ppiname);
+ ppis.add(ppiname);
return msaowner.addPpi(ppiname, usage);
}
public final boolean addGuid (String guidname, UsageTypes.Enum usage) {
- //guids.add(guidname);
+ guids.add(guidname);
return msaowner.addGuid(guidname, usage);
}
public final boolean addLibraryClass(String name, UsageTypes.Enum usage) {
- //hashrequiredr9libs.add(name);
- return msaowner.addLibraryClass(name, usage);
+ //
+ // This section is only for adding library classes, this functionality should be inside MsaOwner!!!
+ //
+ //if (!hashrequiredr9libs.contains(name)) {
+ msaowner.addLibraryClass(name, usage);
+ //}
+ //
+ hashrequiredr9libs.add(name);
+ return true;
}
//-----------------------------------------------------------------------------------//
@@ -93,7 +110,7 @@ public final class ModuleInfo {
String temp = null;
if (filepath.contains(".c") || filepath.contains(".C") || filepath.contains(".h") ||
filepath.contains(".H") || filepath.contains(".dxs") || filepath.contains(".uni")) {
- localmodulesources.add(filepath.replace(modulepath + File.separator, ""));
+ addSourceFile(filepath.replace(modulepath + File.separator, ""), null);
} else if (filepath.contains(".inf") || filepath.contains(".msa")) {
temp = filepath.replace(modulepath + File.separator, "");
if (!temp.contains(File.separator)) { // .inf in subdirectory is not regarded
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
index 5c2eaf0caf..7aa90da6ba 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
@@ -61,19 +61,35 @@ public class MsaOwner {
//-----------------------------msaheader-------------------------------------//
public final boolean addLibraryClass (String name, UsageTypes.Enum usage) {
- Iterator<LibraryClassDocument.LibraryClass> classit = libclassdefs.getLibraryClassList().iterator();
- while (classit.hasNext()) {
- if (classit.next().getKeyword() == name) {
- MigrationTool.ui.println ("Warning: Duplicate LibraryClass");
- return false;
+ /*
+ if (!libclassdefs.getLibraryClassList().contains(name)) {
+ LibraryClassDocument.LibraryClass classname;
+ classname = libclassdefs.addNewLibraryClass();
+ classname.setKeyword(name);
+ classname.setUsage(usage);
+ return true;
+ } else {
+ return false;
+ }
+ */
+ if (name == null) {
+ return false;
+ } else {
+ Iterator<LibraryClassDocument.LibraryClass> classit = libclassdefs.getLibraryClassList().iterator();
+ while (classit.hasNext()) {
+ if (classit.next().getKeyword().matches(name)) {
+ //MigrationTool.ui.println ("Warning: Duplicate LibraryClass");
+ return false;
+ }
}
- }
-
- LibraryClassDocument.LibraryClass classname;
- classname = libclassdefs.addNewLibraryClass();
- classname.setKeyword(name);
- classname.setUsage(usage);
- return true;
+
+ LibraryClassDocument.LibraryClass classname;
+ classname = libclassdefs.addNewLibraryClass();
+ classname.setKeyword(name);
+ classname.setUsage(usage);
+ return true;
+
+ }
}
public final boolean addGuid (String guidname, UsageTypes.Enum usage) {
@@ -84,7 +100,7 @@ public class MsaOwner {
Iterator<GuidsDocument.Guids.GuidCNames> guidit = guids.getGuidCNamesList().iterator();
while (guidit.hasNext()) {
if (guidit.next().getGuidCName() == guidname) {
- MigrationTool.ui.println ("Warning: Duplicate Guid");
+ //MigrationTool.ui.println ("Warning: Duplicate Guid");
return false;
}
}
@@ -105,7 +121,7 @@ public class MsaOwner {
Iterator<PPIsDocument.PPIs.Ppi> ppiit = ppis.getPpiList().iterator();
while (ppiit.hasNext()) {
if (ppiit.next().getPpiCName() == ppiname) {
- MigrationTool.ui.println ("Warning: Duplicate Ppi");
+ //MigrationTool.ui.println ("Warning: Duplicate Ppi");
return false;
}
}
@@ -150,7 +166,7 @@ public class MsaOwner {
Iterator<ProtocolsDocument.Protocols.Protocol> proit = protocols.getProtocolList().iterator();
while (proit.hasNext()) {
if (proit.next().getProtocolCName() == proname) {
- MigrationTool.ui.println ("Warning: Duplicate Protocol");
+ //MigrationTool.ui.println ("Warning: Duplicate Protocol");
return false;
}
}
@@ -375,6 +391,15 @@ public class MsaOwner {
}
//-----------------------------msaheader-------------------------------------//
+ private final void fullfill () throws Exception {
+ addCopyRight(null);
+ addVersion(null);
+ addAbstract(null);
+ addDescription(null);
+ addLicense(null);
+ addSpecification(null);
+ }
+
public final void flush(String outputpath) throws Exception {
XmlOptions options = new XmlOptions();
@@ -384,6 +409,7 @@ public class MsaOwner {
options.setUseDefaultNamespace();
BufferedWriter bw = new BufferedWriter(new FileWriter(outputpath));
+ fullfill();
msadoc.save(bw, options);
bw.flush();
bw.close();
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
index e37f7f46b2..843af37c90 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/SourceFileReplacer.java
@@ -17,6 +17,8 @@ import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.tianocore.UsageTypes;
+
public final class SourceFileReplacer implements Common.ForDoAll {
private static final SourceFileReplacer SFReplacer = new SourceFileReplacer();
private ModuleInfo mi;
@@ -297,7 +299,8 @@ public final class SourceFileReplacer implements Common.ForDoAll {
it = symbolSet.iterator();
while (it.hasNext()) {
r8thing = it.next();
- mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); // add a library here
+ mi.addLibraryClass(MigrationTool.db.getR9Lib(r8thing), UsageTypes.ALWAYS_CONSUMED);
+ //mi.hashrequiredr9libs.add(MigrationTool.db.getR9Lib(r8thing)); // add a library here
r8tor9 temp;
if ((r9thing = MigrationTool.db.getR9Func(r8thing)) != null) {