Fix EDKT143.
Add the feature of inserting Xml Comments before ModuleSA elements and library instance elements. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1115 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
0543618356
commit
82dcbb45c7
|
@ -286,6 +286,13 @@ public class FpdFileContents {
|
||||||
maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleInfo);
|
maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cursor.push();
|
||||||
|
cursor.toPrevToken();
|
||||||
|
if (cursor.isComment()) {
|
||||||
|
cursor.removeXml();
|
||||||
|
}
|
||||||
|
cursor.pop();
|
||||||
cursor.removeXml();
|
cursor.removeXml();
|
||||||
if (getFrameworkModulesCount() == 0) {
|
if (getFrameworkModulesCount() == 0) {
|
||||||
cursor.toParent();
|
cursor.toParent();
|
||||||
|
@ -448,10 +455,13 @@ public class FpdFileContents {
|
||||||
while(li.hasNext()) {
|
while(li.hasNext()) {
|
||||||
PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();
|
PcdCodedDocument.PcdCoded.PcdEntry msaPcd = (PcdCodedDocument.PcdCoded.PcdEntry)li.next();
|
||||||
ModuleSADocument.ModuleSA moduleSA = getModuleSA(moduleKey);
|
ModuleSADocument.ModuleSA moduleSA = getModuleSA(moduleKey);
|
||||||
|
if (moduleSA.getPcdBuildDefinition() != null) {
|
||||||
XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();
|
XmlCursor cursor = moduleSA.getPcdBuildDefinition().newCursor();
|
||||||
if (cursor.toFirstChild()) {
|
if (cursor.toFirstChild()) {
|
||||||
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)cursor.getObject();
|
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor
|
||||||
if (msaPcd.getCName().equals(pcdData.getCName()) && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {
|
.getObject();
|
||||||
|
if (msaPcd.getCName().equals(pcdData.getCName())
|
||||||
|
&& msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {
|
||||||
|
|
||||||
maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleKey);
|
maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(), moduleKey);
|
||||||
cursor.removeXml();
|
cursor.removeXml();
|
||||||
|
@ -459,8 +469,10 @@ public class FpdFileContents {
|
||||||
}
|
}
|
||||||
while (cursor.toNextSibling()) {
|
while (cursor.toNextSibling()) {
|
||||||
pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor.getObject();
|
pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData) cursor.getObject();
|
||||||
if (msaPcd.getCName().equals(pcdData.getCName()) && msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {
|
if (msaPcd.getCName().equals(pcdData.getCName())
|
||||||
maintainDynPcdMap(pcdData.getCName()+" "+pcdData.getTokenSpaceGuidCName(), moduleKey);
|
&& msaPcd.getTokenSpaceGuidCName().equals(pcdData.getTokenSpaceGuidCName())) {
|
||||||
|
maintainDynPcdMap(pcdData.getCName() + " " + pcdData.getTokenSpaceGuidCName(),
|
||||||
|
moduleKey);
|
||||||
cursor.removeXml();
|
cursor.removeXml();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -468,6 +480,7 @@ public class FpdFileContents {
|
||||||
}
|
}
|
||||||
cursor.dispose();
|
cursor.dispose();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
|
@ -513,13 +526,23 @@ public class FpdFileContents {
|
||||||
for (int j = 0; j < i; ++j) {
|
for (int j = 0; j < i; ++j) {
|
||||||
cursor.toNextSibling();
|
cursor.toNextSibling();
|
||||||
}
|
}
|
||||||
|
cursor.push();
|
||||||
|
cursor.toPrevToken();
|
||||||
|
if (cursor.isComment()) {
|
||||||
cursor.removeXml();
|
cursor.removeXml();
|
||||||
}
|
}
|
||||||
|
cursor.pop();
|
||||||
|
cursor.removeXml();
|
||||||
|
if (getLibraryInstancesCount(key) == 0) {
|
||||||
|
cursor.toParent();
|
||||||
|
cursor.removeXml();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cursor.dispose();
|
cursor.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void genLibraryInstance(String mg, String mv, String pg, String pv, String key) {
|
public void genLibraryInstance(ModuleIdentification libMi, String key) {
|
||||||
ModuleSADocument.ModuleSA msa = getModuleSA(key);
|
ModuleSADocument.ModuleSA msa = getModuleSA(key);
|
||||||
if (msa == null){
|
if (msa == null){
|
||||||
msa = getfpdFrameworkModules().addNewModuleSA();
|
msa = getfpdFrameworkModules().addNewModuleSA();
|
||||||
|
@ -529,7 +552,26 @@ public class FpdFileContents {
|
||||||
libs = msa.addNewLibraries();
|
libs = msa.addNewLibraries();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String mn = libMi.getName();
|
||||||
|
String mg = libMi.getGuid();
|
||||||
|
String mv = libMi.getVersion();
|
||||||
|
String pn = libMi.getPackage().getName();
|
||||||
|
String pg = libMi.getPackage().getGuid();
|
||||||
|
String pv = libMi.getPackage().getVersion();
|
||||||
LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();
|
LibrariesDocument.Libraries.Instance instance = libs.addNewInstance();
|
||||||
|
XmlCursor cursor = instance.newCursor();
|
||||||
|
try{
|
||||||
|
String comment = "Pkg: " + pn + " Mod: " + mn
|
||||||
|
+ " Path: " + GlobalData.getMsaFile(libMi).getPath();
|
||||||
|
cursor.insertComment(comment);
|
||||||
|
}
|
||||||
|
catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
cursor.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
instance.setModuleGuid(mg);
|
instance.setModuleGuid(mg);
|
||||||
instance.setModuleVersion(mv);
|
instance.setModuleVersion(mv);
|
||||||
instance.setPackageGuid(pg);
|
instance.setPackageGuid(pg);
|
||||||
|
@ -776,6 +818,18 @@ public class FpdFileContents {
|
||||||
private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {
|
private ModuleSADocument.ModuleSA genModuleSA (ModuleIdentification mi, String arch) {
|
||||||
PackageIdentification pi = GlobalData.getPackageForModule(mi);
|
PackageIdentification pi = GlobalData.getPackageForModule(mi);
|
||||||
ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();
|
ModuleSADocument.ModuleSA msa = getfpdFrameworkModules().addNewModuleSA();
|
||||||
|
XmlCursor cursor = msa.newCursor();
|
||||||
|
try{
|
||||||
|
String comment = "Mod: " + mi.getName() + " Type: " + mi.getModuleType() + " Path: "
|
||||||
|
+ GlobalData.getMsaFile(mi).getPath();
|
||||||
|
cursor.insertComment(comment);
|
||||||
|
}
|
||||||
|
catch(Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
cursor.dispose();
|
||||||
|
}
|
||||||
msa.setModuleGuid(mi.getGuid());
|
msa.setModuleGuid(mi.getGuid());
|
||||||
msa.setModuleVersion(mi.getVersion());
|
msa.setModuleVersion(mi.getVersion());
|
||||||
msa.setPackageGuid(pi.getGuid());
|
msa.setPackageGuid(pi.getGuid());
|
||||||
|
|
|
@ -328,7 +328,7 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||||
//
|
//
|
||||||
// remove pcd information of instance from current ModuleSA
|
// remove pcd information of instance from current ModuleSA
|
||||||
//
|
//
|
||||||
ffc.removePcdData(key, mi);
|
ffc.removePcdData(moduleKey, mi);
|
||||||
//
|
//
|
||||||
// remove class produced by this instance and add back these produced class to be bound.
|
// remove class produced by this instance and add back these produced class to be bound.
|
||||||
//
|
//
|
||||||
|
@ -1018,12 +1018,13 @@ public class FpdModuleSA extends JDialog implements ActionListener {
|
||||||
model3.getValueAt(row, 2) + " " +
|
model3.getValueAt(row, 2) + " " +
|
||||||
model3.getValueAt(row, 3) + " " +
|
model3.getValueAt(row, 3) + " " +
|
||||||
model3.getValueAt(row, 4);
|
model3.getValueAt(row, 4);
|
||||||
ffc.genLibraryInstance(model3.getValueAt(row, 1)+"", model3.getValueAt(row, 2)+"", model3.getValueAt(row, 3)+"", model3.getValueAt(row, 4)+"", moduleKey);
|
ModuleIdentification libMi = getModuleId(instanceValue);
|
||||||
|
ffc.genLibraryInstance(libMi, moduleKey);
|
||||||
//
|
//
|
||||||
// Add pcd information of selected instance to current moduleSA
|
// Add pcd information of selected instance to current moduleSA
|
||||||
//
|
//
|
||||||
try{
|
try{
|
||||||
ffc.addFrameworkModulesPcdBuildDefs(getModuleId(instanceValue), null, ffc.getModuleSA(moduleKey));
|
ffc.addFrameworkModulesPcdBuildDefs(libMi, null, ffc.getModuleSA(moduleKey));
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage());
|
JOptionPane.showMessageDialog(frame, "PCD Insertion Fail. " + exception.getMessage());
|
||||||
|
|
Loading…
Reference in New Issue