summaryrefslogtreecommitdiff
path: root/Tools/Source/MigrationTools
diff options
context:
space:
mode:
authoralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-25 08:54:58 +0000
committeralfred <alfred@6f19259b-4bc3-4df7-8a09-765794883524>2006-09-25 08:54:58 +0000
commit5c55f71cc90ff2c6be6f83c385818710cef93eec (patch)
tree6cd115068d31a2dbb3dd7cc9af8809f983f3e0c7 /Tools/Source/MigrationTools
parentc084fb6e57ef3c470c95bbd8dcdfe205ba0b2337 (diff)
downloadedk2-5c55f71cc90ff2c6be6f83c385818710cef93eec.zip
edk2-5c55f71cc90ff2c6be6f83c385818710cef93eec.tar.gz
edk2-5c55f71cc90ff2c6be6f83c385818710cef93eec.tar.bz2
implement MsaOwner.java partly
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1608 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/MigrationTools')
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java6
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java5
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/MsaOwner.java170
-rw-r--r--Tools/Source/MigrationTools/org/tianocore/migration/MsaWriter.java11
4 files changed, 169 insertions, 23 deletions
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
index cb1e886..ee3b36f 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/MigrationTool.java
@@ -32,13 +32,9 @@ public class MigrationTool {
private static String startpath = null;
private static final void mainFlow(ModuleInfo mi) throws Exception {
-
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"
- //MigrationTool.ui.yesOrNo("go on show?");
// show result
if (MigrationTool.printModuleInfo) {
MigrationTool.ui.println("\nModule Information : ");
@@ -54,9 +50,7 @@ public class MigrationTool {
show(mi.hashr8only, "hashr8only : ");
}
- //MigrationTool.ui.yesOrNo("go on msawrite?");
new MsaWriter(mi).flush();
- //MigrationTool.ui.yesOrNo("go on critic?");
if (MigrationTool.doCritic) {
Critic.fireAt(ModuleInfoMap.get(mi) + File.separator + "Migration_" + mi.modulename);
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
index b6cd633..cf42d9c 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
@@ -15,8 +15,6 @@ package org.tianocore.migration;
import java.io.*;
import java.util.*;
-import org.tianocore.ModuleSurfaceAreaDocument;
-
/*
Class ModuleInfo is built for scanning the source files, it contains all the needed
information and all the temporary data.
@@ -30,8 +28,7 @@ public final class ModuleInfo {
public final String modulepath;
public final String temppath;
- //private MsaOwner msaowner = new MsaWriter(this);
- //public ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.newInstance();
+ private MsaOwner msaowner = new MsaOwner();
public String modulename = null;
public String guidvalue = null;
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MsaOwner.java b/Tools/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
index 4cc133e..f63e8e1 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
@@ -1,5 +1,169 @@
package org.tianocore.migration;
-public interface MsaOwner {
- public void addSourceFiles(String filename, int arch);
-}
+import org.tianocore.*;
+
+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();
+ }
+} \ No newline at end of file
diff --git a/Tools/Source/MigrationTools/org/tianocore/migration/MsaWriter.java b/Tools/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
index 2da3c98..5aeca7f 100644
--- a/Tools/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
+++ b/Tools/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
@@ -19,10 +19,9 @@ import org.tianocore.*;
import org.tianocore.SupportedArchitectures.Enum;
import org.apache.xmlbeans.*;
-public class MsaWriter implements MsaOwner {
+public class MsaWriter {
MsaWriter(ModuleInfo moduleinfo) {
mi = moduleinfo;
- //msadoc = mi.msadoc;
}
private ModuleInfo mi;
@@ -206,15 +205,7 @@ public class MsaWriter implements MsaOwner {
bw.flush();
bw.close();
}
-
- //---------------------------MsaOwner---------------------------------//
-
- public void addSourceFiles(String filename, int arch) {
-
- }
- //---------------------------MsaOwner---------------------------------//
-
public static final void parse(String msafile) throws Exception {
ModuleSurfaceAreaDocument msadoc = ModuleSurfaceAreaDocument.Factory.parse(msafile);
flush("c:\\temp.msa", msadoc);