summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
Diffstat (limited to 'Tools')
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java1
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java34
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java12
-rw-r--r--Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java16
4 files changed, 52 insertions, 11 deletions
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
index aa19522e02..48ecc56e56 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleInfo.java
@@ -36,6 +36,7 @@ public final class ModuleInfo {
public String guidvalue = null;
public String moduletype = null;
public String entrypoint = null;
+ public String license = null;
public final Set<String> localmodulesources = new HashSet<String>(); //contains both .c and .h
public final Set<String> preprocessedccodes = new HashSet<String>();
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
index 09d426282f..0f1df7b593 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/ModuleReader.java
@@ -26,7 +26,7 @@ public final class ModuleReader implements Common.ForDoAll {
private static final Pattern ptninfequation = Pattern.compile("([^\\s]*)\\s*=\\s*([^\\s]*)");
private static final Pattern ptnsection = Pattern.compile("\\[([^\\[\\]]*)\\]([^\\[\\]]*)\\n", Pattern.MULTILINE);
private static final Pattern ptnfilename = Pattern.compile("[^\\s]+");
-
+
public final void ModuleScan() throws Exception {
Common.toDoAll(mi.modulepath, ModuleInfo.class.getMethod("enroll", String.class), mi, null, Common.FILE);
@@ -72,7 +72,36 @@ public final class ModuleReader implements Common.ForDoAll {
}
}
}
-
+ private final String extractLicense(String wholeline) throws Exception {
+ String tempLine;
+ String license = null;
+
+ BufferedReader rd = new BufferedReader(new StringReader(wholeline));
+ while ((tempLine = rd.readLine()) != null) {
+ if (tempLine.contains("#")) {
+ if (tempLine.contains("Copyright")) {
+ //
+ // Find license info.
+ //
+ license = "";
+ while ((tempLine = rd.readLine())!= null) {
+ if (!tempLine.contains("#") ||
+ tempLine.contains("Module Name:") ||
+ tempLine.contains("Abstract:")) {
+ //
+ // We assume license ends here.
+ //
+ break;
+ }
+ license += " " + tempLine.replaceAll("\\s*[#]\\s*(.*)", "$1\n");
+ }
+ break;
+ }
+ }
+ }
+ return license;
+ }
+
private final void readInf(String name) throws Exception {
System.out.println("\nParsing INF file: " + name);
String wholeline;
@@ -81,6 +110,7 @@ public final class ModuleReader implements Common.ForDoAll {
Matcher mtrfilename;
wholeline = Common.file2string(mi.modulepath + File.separator + name);
+ mi.license = extractLicense(wholeline);
mtrsection = ptnsection.matcher(wholeline);
while (mtrsection.find()) {
if (mtrsection.group(1).matches("defines")) {
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
index 65873a3c69..9217857fc6 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaOwner.java
@@ -1,3 +1,15 @@
+/** @file
+
+ Copyright (c) 2006, Intel Corporation
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+ **/
package org.tianocore.migration;
import java.io.BufferedWriter;
diff --git a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
index 132d6c3bc5..af8646f792 100644
--- a/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
+++ b/Tools/Java/Source/MigrationTools/org/tianocore/migration/MsaWriter.java
@@ -100,18 +100,16 @@ public class MsaWriter {
msaheader.setModuleType(ModuleTypeDef.Enum.forString(mi.moduletype = Query("Guid Value Not Found! Please Input Guid Value")));
}
- msaheader.setCopyright("Copyright (c) 2006, Intel Corporation");
+ msaheader.setCopyright("Copyright (c) 2006, Intel Corporation. All right reserved.");
msaheader.setVersion("1.0");
msaheader.setAbstract("Component name for module " + mi.modulename);
msaheader.setDescription("FIX ME!");
- msaheader.addNewLicense().setStringValue("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.");
+
+ if (mi.license == null) {
+ mi.license = "FIX ME!";
+ MigrationTool.ui.println ("Fail to extract license info in inf file");
+ }
+ msaheader.addNewLicense().setStringValue(mi.license);
msaheader.setSpecification("FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052");
List<Enum> arch = new ArrayList<Enum>();