2 This file is to define ModuleIdentification class.
4 Copyright (c) 2006, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 package org
.tianocore
.build
.id
;
18 import org
.tianocore
.build
.global
.GlobalData
;
20 This class is used to identify a module with Module Guid, Module Version,
21 Package Guid, Package Version.
25 public class ModuleIdentification
extends Identification
{
27 private PackageIdentification packageId
;
31 private String moduleType
;
33 private boolean isLibrary
= false;
37 @param version Version
39 public ModuleIdentification(String guid
, String version
){
45 @param version Version
46 @param packageId Package Identification
48 public ModuleIdentification(String guid
, String version
, PackageIdentification packageId
){
50 this.packageId
= packageId
;
56 @param version Version
58 public ModuleIdentification(String name
, String guid
, String version
){
59 super(name
, guid
, version
);
65 @param version Version
66 @param packageId PackageIdentification
68 public ModuleIdentification(String name
, String guid
, String version
, PackageIdentification packageId
){
69 super(name
, guid
, version
);
70 this.packageId
= packageId
;
74 @return boolean is this module is library
76 public boolean isLibrary() {
83 public void setLibrary(boolean isLibrary
) {
84 this.isLibrary
= isLibrary
;
90 public File
getMsaFile() {
96 @return Module relative path to package
98 public String
getModuleRelativePath() {
100 if (msaFile
.getParent().length() == packageId
.getPackageDir().length()) {
103 return msaFile
.getParent().substring(packageId
.getPackageDir().length() + 1);
106 private void prepareMsaFile(){
107 if (msaFile
== null) {
108 GlobalData
.refreshModuleIdentification(this);
113 @param msaFile Set Msa File
115 public void setMsaFile(File msaFile
) {
116 this.msaFile
= msaFile
;
119 public boolean equals(Object obj
) {
120 if (obj
instanceof ModuleIdentification
) {
121 ModuleIdentification id
= (ModuleIdentification
)obj
;
122 if (guid
.equalsIgnoreCase(id
.getGuid()) && packageId
.equals(id
.getPackage())) {
123 if (version
== null || id
.version
== null) {
126 else if (version
.trim().equalsIgnoreCase("") || id
.version
.trim().equalsIgnoreCase("")){
129 else if (version
.equalsIgnoreCase(id
.version
)) {
136 return super.equals(obj
);
140 public String
toString(){
142 GlobalData
.refreshModuleIdentification(this);
144 if (version
== null || version
.trim().equalsIgnoreCase("")) {
145 return "Module [" + name
+ "] in " + packageId
;
148 return "Module [" + name
+ " " + version
+ "] in " + packageId
;
153 @param packageId set package identification
155 public void setPackage(PackageIdentification packageId
) {
156 this.packageId
= packageId
;
160 @return get package identification
162 public PackageIdentification
getPackage() {
167 @return get module type
169 public String
getModuleType() {
170 if (moduleType
== null) {
171 GlobalData
.refreshModuleIdentification(this);
177 @param moduleType set module type
179 public void setModuleType(String moduleType
) {
180 this.moduleType
= moduleType
;
183 public String
getName() {
185 GlobalData
.refreshModuleIdentification(this);