You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2020/01/13 16:17:01 UTC

[tomcat-jakartaee-migration] tag 0.0.1 created (now dc69f8d)

This is an automated email from the ASF dual-hosted git repository.

markt pushed a change to tag 0.0.1
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git.


      at dc69f8d  (commit)
This tag includes the following new commits:

     new 31d728d  Fix various issues when doing a clean build
     new ca90f2a  Add a feature that updates the MANIFEST version info during migration
     new dc69f8d  Tag 0.0.1

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat-jakartaee-migration] 02/03: Add a feature that updates the MANIFEST version info during migration

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to tag 0.0.1
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit ca90f2ab5c6e9d01c2ff153198ec0a96c7d5a6fd
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jan 13 15:51:20 2020 +0000

    Add a feature that updates the MANIFEST version info during migration
---
 .../java/org/apache/tomcat/jakartaee/Info.java     | 54 ++++++++++++++++++++++
 .../org/apache/tomcat/jakartaee/Migration.java     | 18 ++++++++
 src/main/resources/info.properties                 | 16 +++++++
 3 files changed, 88 insertions(+)

diff --git a/src/main/java/org/apache/tomcat/jakartaee/Info.java b/src/main/java/org/apache/tomcat/jakartaee/Info.java
new file mode 100644
index 0000000..a8de1a0
--- /dev/null
+++ b/src/main/java/org/apache/tomcat/jakartaee/Info.java
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomcat.jakartaee;
+
+import java.io.IOException;
+import java.util.Properties;
+
+public class Info {
+
+    private static final String VERSION;
+
+    static {
+        Properties props = new Properties();
+
+        String version = null;
+        try {
+            props.load(Info.class.getClassLoader().getResourceAsStream("info.properties"));
+
+            version = props.getProperty("version");
+
+        } catch (IOException e) {
+            // Handled below
+        }
+
+        if (version == null) {
+            VERSION = "UNKNOWN";
+        } else {
+            VERSION = version;
+        }
+    }
+
+    public static String getVersion() {
+        return VERSION;
+    }
+
+
+    private Info() {
+        // Utility class. Hide default constructor.
+    }
+}
diff --git a/src/main/java/org/apache/tomcat/jakartaee/Migration.java b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
index 5950195..80fb2b1 100644
--- a/src/main/java/org/apache/tomcat/jakartaee/Migration.java
+++ b/src/main/java/org/apache/tomcat/jakartaee/Migration.java
@@ -24,6 +24,7 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.jar.Attributes;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarInputStream;
@@ -97,6 +98,7 @@ public class Migration {
                 JarOutputStream jarOs = new JarOutputStream(new NonClosingOutputStream(dest))) {
             Manifest manifest = jarIs.getManifest();
             if (manifest != null) {
+                updateVersion(manifest);
                 JarEntry manifestEntry = new JarEntry(JarFile.MANIFEST_NAME);
                 jarOs.putNextEntry(manifestEntry);
                 manifest.write(jarOs);
@@ -129,6 +131,22 @@ public class Migration {
     }
 
 
+    private void updateVersion(Manifest manifest) {
+        updateVersion(manifest.getMainAttributes());
+        for (Attributes attributes : manifest.getEntries().values()) {
+            updateVersion(attributes);
+        }
+    }
+
+
+    private void updateVersion(Attributes attributes) {
+        if (attributes.containsKey(Attributes.Name.IMPLEMENTATION_VERSION)) {
+            String newValue = attributes.get(Attributes.Name.IMPLEMENTATION_VERSION) + "-" + Info.getVersion();
+            attributes.put(Attributes.Name.IMPLEMENTATION_VERSION, newValue);
+        }
+    }
+
+
     public static void main(String[] args) {
         if (args.length != 2) {
             usage();
diff --git a/src/main/resources/info.properties b/src/main/resources/info.properties
new file mode 100644
index 0000000..2ba48b9
--- /dev/null
+++ b/src/main/resources/info.properties
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+version=migrated-${project.version}
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: [tomcat-jakartaee-migration] tag 0.0.1 created (now dc69f8d)

Posted by Mark Thomas <ma...@apache.org>.
On 13/01/2020 16:17, markt@apache.org wrote:
> This is an automated email from the ASF dual-hosted git repository.
> 
> markt pushed a change to tag 0.0.1
> in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git.
> 
> 
>       at dc69f8d  (commit)
> This tag includes the following new commits:
> 
>      new 31d728d  Fix various issues when doing a clean build
>      new ca90f2a  Add a feature that updates the MANIFEST version info during migration
>      new dc69f8d  Tag 0.0.1

I created this tag so we have a tag for the code I used to convert the
JSTL JARs used in Tomcat 10.

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat-jakartaee-migration] 03/03: Tag 0.0.1

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to tag 0.0.1
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit dc69f8d1bd28d24556de11e80fa9bd7e54a3908d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jan 13 16:16:35 2020 +0000

    Tag 0.0.1
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index 7c53547..11eab0f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -27,7 +27,7 @@
 
   <groupId>org.apache.tomcat</groupId>
   <artifactId>jakartaee-migration</artifactId>
-  <version>0.0.1-SNAPSHOT</version>
+  <version>0.0.1</version>
  
   <description>
     This tool is a work in progress.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[tomcat-jakartaee-migration] 01/03: Fix various issues when doing a clean build

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to tag 0.0.1
in repository https://gitbox.apache.org/repos/asf/tomcat-jakartaee-migration.git

commit 31d728d82cf2b1f4afc571d6e7e814576988ee00
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jan 13 15:05:29 2020 +0000

    Fix various issues when doing a clean build
---
 pom.xml                     | 4 ----
 src/assembly/bin.xml        | 3 ++-
 src/main/scripts/migrate.sh | 5 +----
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/pom.xml b/pom.xml
index d2e65e7..7c53547 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,10 +79,6 @@
         <directory>src/main/resources</directory>
         <filtering>true</filtering>
       </resource>
-      <resource>
-        <directory>src/main/scripot</directory>
-        <targetPath>bin</targetPath>
-      </resource>
     </resources>   
     <plugins>
       <plugin>
diff --git a/src/assembly/bin.xml b/src/assembly/bin.xml
index 79f13c0..6397296 100644
--- a/src/assembly/bin.xml
+++ b/src/assembly/bin.xml
@@ -17,7 +17,8 @@
       </includes>
     </fileSet>
     <fileSet>
-      <directory>${project.build.directpry}/bin</directory>
+      <directory>${project.basedir}/src/main/scripts</directory>
+      <outputDirectory>bin</outputDirectory>
       <includes>
         <include>*.sh</include>
       </includes>
diff --git a/src/main/scripts/migrate.sh b/src/main/scripts/migrate.sh
index 3d3004f..4f8826b 100644
--- a/src/main/scripts/migrate.sh
+++ b/src/main/scripts/migrate.sh
@@ -1,7 +1,4 @@
 #!/bin/sh
 
-# Assumes current layout of Maven's target directory
-cd ..
-
 # Assumes java is on the path
-java -cp lib/* org.apache.tomcat.jakartaee.Migration "$@"
+java -cp "../lib/*" org.apache.tomcat.jakartaee.Migration "$@"


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org