]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java
Restructuring for better separation of Tool packages.
[mirror_edk2.git] / Tools / Java / Source / GenBuild / org / tianocore / build / id / PlatformIdentification.java
diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java b/Tools/Java/Source/GenBuild/org/tianocore/build/id/PlatformIdentification.java
new file mode 100644 (file)
index 0000000..7c66965
--- /dev/null
@@ -0,0 +1,113 @@
+/** @file\r
+This file is to define  PlatformIdentification class.\r
+\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution.  The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+**/\r
+\r
+package org.tianocore.build.id;\r
+import java.io.File;\r
+\r
+import org.tianocore.build.global.GlobalData;\r
+\r
+/**\r
+  This class is used to identify a platform. \r
+\r
+  @since GenBuild 1.0\r
+**/\r
+public class PlatformIdentification extends Identification{\r
+    \r
+    ///\r
+    /// FPD file\r
+    ///\r
+    private File fpdFile;\r
+    \r
+    /**\r
+      @param guid Guid\r
+      @param version Version\r
+    **/\r
+    public PlatformIdentification(String guid, String version){\r
+        super(guid, version);\r
+    }\r
+    \r
+    /**\r
+      @param name Name\r
+      @param guid Guid\r
+      @param version Version\r
+    **/\r
+    public PlatformIdentification(String name, String guid, String version){\r
+        super(name, guid, version);\r
+    }\r
+    \r
+    /**\r
+      @param name Name\r
+      @param guid Guid\r
+      @param version Version\r
+      @param fpdFilename Fpd File Name\r
+    **/\r
+    public PlatformIdentification(String name, String guid, String version, String fpdFilename){\r
+        super(name, guid, version);\r
+        this.fpdFile = new File(fpdFilename);\r
+    }\r
+    \r
+    /**\r
+      @param name Name\r
+      @param guid Guid\r
+      @param version Version\r
+      @param fpdFile Fpd File\r
+    **/\r
+    public PlatformIdentification(String name, String guid, String version, File fpdFile){\r
+        super(name, guid, version);\r
+        this.fpdFile = fpdFile;\r
+    }\r
+    \r
+    public String toString(){\r
+        return "Platform " + name + "["+guid+"]";\r
+    }\r
+\r
+    /**\r
+     Set FPD file. \r
+      @param fpdFile FPD File\r
+    **/\r
+    public void setFpdFile(File fpdFile) {\r
+        this.fpdFile = fpdFile;\r
+    }\r
+\r
+    /**\r
+      Get FPD file. \r
+      @return Fpd File\r
+    **/\r
+    public File getFpdFile() {\r
+        return fpdFile;\r
+    }\r
+    \r
+    /**\r
+      Get FPD relative file to workspace. \r
+      @return Fpd Relative file. \r
+    **/\r
+    public String getRelativeFpdFile (){\r
+        String relativeDir = fpdFile.getPath().substring(GlobalData.getWorkspacePath().length());\r
+        if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
+            relativeDir = relativeDir.substring(1);\r
+        }\r
+        return relativeDir;\r
+    }\r
+    \r
+    /**\r
+      Get Platform relative directory to workspace. \r
+      @return Platform relative directory\r
+    **/\r
+    public String getPlatformRelativeDir(){\r
+        String relativeDir = fpdFile.getParent().substring(GlobalData.getWorkspacePath().length());\r
+        if(relativeDir.startsWith("\\") || relativeDir.startsWith("/")) {\r
+            relativeDir = relativeDir.substring(1);\r
+        }\r
+        return relativeDir;\r
+    }\r
+}
\ No newline at end of file