]> git.proxmox.com Git - mirror_edk2.git/blob - Tools/Source/GenBuild/org/tianocore/build/id/PackageIdentification.java
Change to new XML Schema.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / id / PackageIdentification.java
1 package org.tianocore.build.id;
2 import java.io.File;
3
4 import org.tianocore.build.global.GlobalData;
5
6 public class PackageIdentification extends Identification{
7
8 //
9 // It is optional
10 //
11 private File spdFile;
12
13 public PackageIdentification(String guid, String version){
14 super(guid, version);
15 }
16
17 public PackageIdentification(String name, String guid, String version){
18 super(name, guid, version);
19 }
20
21 public PackageIdentification(String name, String guid, String version, String spdFilename){
22 super(name, guid, version);
23 this.spdFile = new File(spdFilename);
24 }
25
26 public PackageIdentification(String name, String guid, String version, File spdFile){
27 super(name, guid, version);
28 this.spdFile = spdFile;
29 }
30
31 public void setSpdFile(File spdFile) {
32 this.spdFile = spdFile;
33 }
34
35 public File getSpdFile() {
36 return spdFile;
37 }
38
39 public String toString(){
40 if (name == null) {
41 GlobalData.refreshPackageIdentification(this);
42 }
43 if (version == null || version.trim().equalsIgnoreCase("")) {
44 return "package [" + name + "]";
45 }
46 else {
47 return "package [" + name + " " + version + "]";
48 }
49 }
50
51 public String getPackageDir(){
52 prepareSpdFile();
53 return spdFile.getParent();
54 }
55
56 public String getPackageRelativeDir(){
57 prepareSpdFile();
58 return spdFile.getParent().substring(GlobalData.getWorkspacePath().length() + 1);
59 }
60
61 private void prepareSpdFile(){
62 if (spdFile == null) {
63 GlobalData.refreshPackageIdentification(this);
64 }
65 }
66
67 public String getName() {
68 if (name == null) {
69 GlobalData.refreshPackageIdentification(this);
70 }
71 return name;
72 }
73 }