mirror of https://github.com/acidanthera/audk.git
implement MsaOwner.java partly
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1608 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
c084fb6e57
commit
5c55f71cc9
|
@ -32,13 +32,9 @@ public class MigrationTool {
|
||||||
private static String startpath = null;
|
private static String startpath = null;
|
||||||
|
|
||||||
private static final void mainFlow(ModuleInfo mi) throws Exception {
|
private static final void mainFlow(ModuleInfo mi) throws Exception {
|
||||||
|
|
||||||
ModuleReader.aimAt(mi);
|
ModuleReader.aimAt(mi);
|
||||||
|
|
||||||
//MigrationTool.ui.yesOrNo("go on replace?");
|
|
||||||
SourceFileReplacer.fireAt(mi); // some adding library actions are taken here,so it must be put before "MsaWriter"
|
SourceFileReplacer.fireAt(mi); // some adding library actions are taken here,so it must be put before "MsaWriter"
|
||||||
|
|
||||||
//MigrationTool.ui.yesOrNo("go on show?");
|
|
||||||
// show result
|
// show result
|
||||||
if (MigrationTool.printModuleInfo) {
|
if (MigrationTool.printModuleInfo) {
|
||||||
MigrationTool.ui.println("\nModule Information : ");
|
MigrationTool.ui.println("\nModule Information : ");
|
||||||
|
@ -54,9 +50,7 @@ public class MigrationTool {
|
||||||
show(mi.hashr8only, "hashr8only : ");
|
show(mi.hashr8only, "hashr8only : ");
|
||||||
}
|
}
|
||||||
|
|
||||||
//MigrationTool.ui.yesOrNo("go on msawrite?");
|
|
||||||
new MsaWriter(mi).flush();
|
new MsaWriter(mi).flush();
|
||||||
//MigrationTool.ui.yesOrNo("go on critic?");
|
|
||||||
|
|
||||||
if (MigrationTool.doCritic) {
|
if (MigrationTool.doCritic) {
|
||||||
Critic.fireAt(ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename);
|
Critic.fireAt(ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename);
|
||||||
|
|
|
@ -15,8 +15,6 @@ package org.tianocore.migration;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import org.tianocore.ModuleSurfaceAreaDocument;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Class ModuleInfo is built for scanning the source files, it contains all the needed
|
Class ModuleInfo is built for scanning the source files, it contains all the needed
|
||||||
information and all the temporary data.
|
information and all the temporary data.
|
||||||
|
@ -30,8 +28,7 @@ public final class ModuleInfo {
|
||||||
public final String modulepath;
|
public final String modulepath;
|
||||||
public final String temppath;
|
public final String temppath;
|
||||||
|
|
||||||
//private MsaOwner msaowner = new MsaWriter(this);
|
private MsaOwner msaowner = new MsaOwner();
|
||||||
//public ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.newInstance();
|
|
||||||
|
|
||||||
public String modulename = null;
|
public String modulename = null;
|
||||||
public String guidvalue = null;
|
public String guidvalue = null;
|
||||||
|
|
|
@ -1,5 +1,169 @@
|
||||||
package org.tianocore.migration;
|
package org.tianocore.migration;
|
||||||
|
|
||||||
public interface MsaOwner {
|
import org.tianocore.*;
|
||||||
public void addSourceFiles(String filename, int arch);
|
|
||||||
|
public class MsaOwner {
|
||||||
|
public static final String COPYRIGHT = "Copyright (c) 2006, Intel Corporation";
|
||||||
|
public static final String VERSION = "1.0";
|
||||||
|
public static final String ABSTRACT = "Component name for module ";
|
||||||
|
public static final String DESCRIPTION = "FIX ME!";
|
||||||
|
public static final String LICENSE = "All rights reserved.\n" +
|
||||||
|
" This software and associated documentation (if any) is furnished\n" +
|
||||||
|
" under a license and may only be used or copied in accordance\n" +
|
||||||
|
" with the terms of the license. Except as permitted by such\n" +
|
||||||
|
" license, no part of this software or documentation may be\n" +
|
||||||
|
" reproduced, stored in a retrieval system, or transmitted in any\n" +
|
||||||
|
" form or by any means without the express written consent of\n" +
|
||||||
|
" Intel Corporation.";
|
||||||
|
public static final String SPECIFICATION = "FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052";
|
||||||
|
|
||||||
|
private ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.newInstance();
|
||||||
|
|
||||||
|
private ModuleSurfaceAreaDocument.ModuleSurfaceArea msa = null;
|
||||||
|
private MsaHeaderDocument.MsaHeader msaheader = null;
|
||||||
|
private LicenseDocument.License license = null;
|
||||||
|
private ModuleDefinitionsDocument.ModuleDefinitions md = null;
|
||||||
|
private SourceFilesDocument.SourceFiles sourcefiles = null; //found local .h files are not written
|
||||||
|
private GuidsDocument.Guids guids = null;
|
||||||
|
private ProtocolsDocument.Protocols protocols = null;
|
||||||
|
private PPIsDocument.PPIs ppis = null;
|
||||||
|
private PackageDependenciesDocument.PackageDependencies pd = null;
|
||||||
|
private LibraryClassDefinitionsDocument.LibraryClassDefinitions libclassdefs = null;
|
||||||
|
private ExternsDocument.Externs externs = null;
|
||||||
|
|
||||||
|
//-----------------------------msaheader-------------------------------------//
|
||||||
|
public final boolean addSpecification (String specification) {
|
||||||
|
if (msaheader.getSpecification() == null) {
|
||||||
|
if (specification == null) {
|
||||||
|
msaheader.setSpecification(SPECIFICATION);
|
||||||
|
} else {
|
||||||
|
msaheader.setSpecification(specification);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
MigrationTool.ui.println ("Warning: Duplicate Specification");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean addLicense (String licensecontent) {
|
||||||
|
if (msaheader.getLicense() == null) {
|
||||||
|
license = msaheader.addNewLicense();
|
||||||
|
if (licensecontent == null) {
|
||||||
|
license.setStringValue(LICENSE);
|
||||||
|
} else {
|
||||||
|
license.setStringValue(licensecontent);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
MigrationTool.ui.println ("Warning: Duplicate License");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean addDescription (String description) {
|
||||||
|
if (msaheader.getDescription() == null) {
|
||||||
|
if (description == null) {
|
||||||
|
msaheader.setDescription(DESCRIPTION);
|
||||||
|
} else {
|
||||||
|
msaheader.setDescription(description);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
MigrationTool.ui.println ("Warning: Duplicate Description");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean addAbstract (String abs) {
|
||||||
|
if (msaheader.getAbstract() == null) {
|
||||||
|
if (abs == null) {
|
||||||
|
msaheader.setAbstract(ABSTRACT + msaheader.getModuleName());
|
||||||
|
} else {
|
||||||
|
msaheader.setVersion(abs);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
MigrationTool.ui.println ("Warning: Duplicate Abstract");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean addVersion (String version) {
|
||||||
|
if (msaheader.getVersion() == null) {
|
||||||
|
if (version == null) {
|
||||||
|
msaheader.setVersion(VERSION);
|
||||||
|
} else {
|
||||||
|
msaheader.setVersion(version);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
MigrationTool.ui.println ("Warning: Duplicate Version");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean addCopyRight (String copyright) {
|
||||||
|
if (msaheader.getCopyright() == null) {
|
||||||
|
if (copyright == null) {
|
||||||
|
msaheader.setCopyright(COPYRIGHT);
|
||||||
|
} else {
|
||||||
|
msaheader.setCopyright(copyright);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
MigrationTool.ui.println ("Warning: Duplicate CopyRight");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean addModuleType (String moduletype) {
|
||||||
|
if (msaheader.getModuleType() == null) {
|
||||||
|
msaheader.setModuleType(ModuleTypeDef.Enum.forString(moduletype));
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
MigrationTool.ui.println ("Warning: Duplicate ModuleType");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean addGuidValue (String guidvalue) {
|
||||||
|
if (msaheader.getGuidValue() == null) {
|
||||||
|
msaheader.setGuidValue(guidvalue);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
MigrationTool.ui.println ("Warning: Duplicate GuidValue");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public final boolean addModuleName (String modulename) {
|
||||||
|
if (msaheader.getModuleName() == null) {
|
||||||
|
msaheader.setModuleName(modulename);
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
MigrationTool.ui.println ("Warning: Duplicate ModuleName");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-----------------------------msaheader-------------------------------------//
|
||||||
|
|
||||||
|
public final void addSourceFiles (String filename, int arch) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private final MsaOwner init () {
|
||||||
|
msa = msadoc.addNewModuleSurfaceArea();
|
||||||
|
msaheader = msa.addNewMsaHeader();
|
||||||
|
md = msa.addNewModuleDefinitions();
|
||||||
|
sourcefiles = msa.addNewSourceFiles();
|
||||||
|
pd = msa.addNewPackageDependencies();
|
||||||
|
libclassdefs = msa.addNewLibraryClassDefinitions();
|
||||||
|
externs = msa.addNewExterns();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final MsaOwner initNewMsaOwner() {
|
||||||
|
return new MsaOwner().init();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -19,10 +19,9 @@ import org.tianocore.*;
|
||||||
import org.tianocore.SupportedArchitectures.Enum;
|
import org.tianocore.SupportedArchitectures.Enum;
|
||||||
import org.apache.xmlbeans.*;
|
import org.apache.xmlbeans.*;
|
||||||
|
|
||||||
public class MsaWriter implements MsaOwner {
|
public class MsaWriter {
|
||||||
MsaWriter(ModuleInfo moduleinfo) {
|
MsaWriter(ModuleInfo moduleinfo) {
|
||||||
mi = moduleinfo;
|
mi = moduleinfo;
|
||||||
//msadoc = mi.msadoc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModuleInfo mi;
|
private ModuleInfo mi;
|
||||||
|
@ -207,14 +206,6 @@ public class MsaWriter implements MsaOwner {
|
||||||
bw.close();
|
bw.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------MsaOwner---------------------------------//
|
|
||||||
|
|
||||||
public void addSourceFiles(String filename, int arch) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//---------------------------MsaOwner---------------------------------//
|
|
||||||
|
|
||||||
public static final void parse(String msafile) throws Exception {
|
public static final void parse(String msafile) throws Exception {
|
||||||
ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.parse(msafile);
|
ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.parse(msafile);
|
||||||
flush("c:\\temp.msa", msadoc);
|
flush("c:\\temp.msa", msadoc);
|
||||||
|
|
Loading…
Reference in New Issue