From 3ccef72f8e56fb38402454c4c2346a16451555e4 Mon Sep 17 00:00:00 2001 From: Felix Sidokhine <felix.sidokhine@savoirfairelinux.com> Date: Wed, 22 Jul 2020 12:52:03 +0300 Subject: [PATCH] added script and maven goals to generate versions file removed useless json file Change-Id: Iddc76c361491ea09f72147afae8973b230f1e279 --- .gitignore | 3 ++- ad-connector/pom.xml | 23 +++++++++++++++++++++++ authentication-module/pom.xml | 23 +++++++++++++++++++++++ generate-versions.py | 32 ++++++++++++++++++++++++++++++++ jams-ca/pom.xml | 23 +++++++++++++++++++++++ jams-launcher/pom.xml | 1 - jams-server/pom.xml | 23 +++++++++++++++++++++++ ldap-connector/pom.xml | 23 +++++++++++++++++++++++ pom.xml | 8 ++++++++ versions.json | 27 +++++++++++++++++++++++++++ 10 files changed, 184 insertions(+), 2 deletions(-) create mode 100644 generate-versions.py create mode 100644 versions.json diff --git a/.gitignore b/.gitignore index a07e4314..1f5834ac 100644 --- a/.gitignore +++ b/.gitignore @@ -91,4 +91,5 @@ target/ testdb/ tomcat.*/ /jams -userguide/site \ No newline at end of file +userguide/site +versions.json \ No newline at end of file diff --git a/ad-connector/pom.xml b/ad-connector/pom.xml index a3d1db25..36286b00 100644 --- a/ad-connector/pom.xml +++ b/ad-connector/pom.xml @@ -72,6 +72,29 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>exec-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <version>${maven.exec.version}</version> + <executions> + <execution> + <id>Generate Version File</id> + <phase>package</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable>python</executable> + <arguments> + <argument>../generate-versions.py</argument> + <argument>net.jami.jams.ad.connector.ADConnector</argument> + <argument>${revision}</argument> + <argument>libs/${project.artifactId}.jar</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/authentication-module/pom.xml b/authentication-module/pom.xml index 8488c454..bb759504 100644 --- a/authentication-module/pom.xml +++ b/authentication-module/pom.xml @@ -84,6 +84,29 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>exec-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <version>${maven.exec.version}</version> + <executions> + <execution> + <id>Generate Version File</id> + <phase>package</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable>python</executable> + <arguments> + <argument>../generate-versions.py</argument> + <argument>net.jami.jams.authmodule.UserAuthenticationModule</argument> + <argument>${revision}</argument> + <argument>libs/${project.artifactId}.jar</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/generate-versions.py b/generate-versions.py new file mode 100644 index 00000000..695366da --- /dev/null +++ b/generate-versions.py @@ -0,0 +1,32 @@ +import json +import sys +import hashlib +import os + +os.chdir("..") + +className = sys.argv[1] +version = sys.argv[2] +try: + filename = sys.argv[3].split("/")[1] +except: + filename = sys.argv[3] + +try: + f = open("versions.json", "r") + map = json.loads(f.read()) +except: + map = {} +map[className] = {} +map[className]['version'] = version +map[className]['filename'] = filename +md5_hash = hashlib.md5() +a_file = open("jams/" + sys.argv[3], "rb") +content = a_file.read() +md5_hash.update(content) +digest = md5_hash.hexdigest() +map[className]['md5'] = digest +f = open("versions.json", "w") +f.write(json.dumps(map,indent=4)) +f.close() + diff --git a/jams-ca/pom.xml b/jams-ca/pom.xml index b8c66b9a..482c7763 100644 --- a/jams-ca/pom.xml +++ b/jams-ca/pom.xml @@ -61,6 +61,29 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>exec-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <version>${maven.exec.version}</version> + <executions> + <execution> + <id>Generate Version File</id> + <phase>package</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable>python</executable> + <arguments> + <argument>../generate-versions.py</argument> + <argument>net.jami.jams.ca.JamsCA</argument> + <argument>${revision}</argument> + <argument>libs/${project.artifactId}.jar</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/jams-launcher/pom.xml b/jams-launcher/pom.xml index 28447696..80b71c72 100644 --- a/jams-launcher/pom.xml +++ b/jams-launcher/pom.xml @@ -62,7 +62,6 @@ </execution> </executions> </plugin> - </plugins> </build> diff --git a/jams-server/pom.xml b/jams-server/pom.xml index bf10b0d3..bc4202db 100644 --- a/jams-server/pom.xml +++ b/jams-server/pom.xml @@ -189,6 +189,29 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>exec-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <version>${maven.exec.version}</version> + <executions> + <execution> + <id>Generate Version File</id> + <phase>package</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable>python</executable> + <arguments> + <argument>../generate-versions.py</argument> + <argument>net.jami.jams.server.Server</argument> + <argument>${revision}</argument> + <argument>${project.artifactId}.jar</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/ldap-connector/pom.xml b/ldap-connector/pom.xml index 8fa16a8f..46acc9bb 100644 --- a/ldap-connector/pom.xml +++ b/ldap-connector/pom.xml @@ -85,6 +85,29 @@ </execution> </executions> </plugin> + <plugin> + <artifactId>exec-maven-plugin</artifactId> + <groupId>org.codehaus.mojo</groupId> + <version>${maven.exec.version}</version> + <executions> + <execution> + <id>Generate Version File</id> + <phase>package</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable>python</executable> + <arguments> + <argument>../generate-versions.py</argument> + <argument>net.jami.jams.ldap.connector.LDAPConnector</argument> + <argument>${revision}</argument> + <argument>libs/${project.artifactId}.jar</argument> + </arguments> + </configuration> + </execution> + </executions> + </plugin> </plugins> </build> diff --git a/pom.xml b/pom.xml index 955ffde5..e52a5f69 100644 --- a/pom.xml +++ b/pom.xml @@ -134,6 +134,14 @@ <version>${maven.clean.version}</version> <configuration> <filesets> + <fileset> + <directory>.</directory> + <includes> + <include>**/*.tmp</include> + <include>**/*.log</include> + <include>**/versions.json</include> + </includes> + </fileset> <fileset> <directory>jams/</directory> <includes> diff --git a/versions.json b/versions.json new file mode 100644 index 00000000..9916d141 --- /dev/null +++ b/versions.json @@ -0,0 +1,27 @@ +{ + "net.jami.jams.ad.connector.ADConnector": { + "version": "2.0", + "filename": "ad-connector.jar", + "md5": "bd362666285da485a316e93f934b66a7" + }, + "net.jami.jams.authmodule.UserAuthenticationModule": { + "version": "2.0", + "filename": "authentication-module.jar", + "md5": "da9f724c4162593cf80f6c6e7260c1b2" + }, + "net.jami.jams.server.Server": { + "version": "2.0", + "md5": "ae811d245d4e10b45f4530a08fce3c8e", + "filename": "jams-server.jar" + }, + "net.jami.jams.ca.JamsCA": { + "version": "2.0", + "md5": "fbcb88fbe485c2803cc388b4a33da752", + "filename": "cryptoengine.jar" + }, + "net.jami.jams.ldap.connector.LDAPConnector": { + "version": "2.0", + "md5": "366361cb125966f86ea7b2192ee9c10c", + "filename": "ldap-connector.jar" + } +} \ No newline at end of file -- GitLab