Commit 9f543f7e authored by akwizgran's avatar akwizgran

Create sources JAR and POM.

parent 6b72028f
Pipeline #1882 failed with stages
in 30 minutes and 37 seconds
......@@ -4,7 +4,7 @@ import sys
from shutil import move, copy, rmtree
from subprocess import check_call
from utils import REPO_DIR, get_sha256, fail, get_build_versions, get_final_file_name, get_version
from utils import REPO_DIR, get_sha256, fail, get_build_versions, get_tor_version, get_final_file_name, get_sources_file_name, get_pom_file_name, get_version
NDK_DIR = 'android-ndk'
......@@ -38,8 +38,28 @@ def main():
zip_name = get_final_file_name(versions)
check_call(['zip', '-D', '-X', zip_name] + file_list, cwd=REPO_DIR)
# create sources jar
external_dir = os.path.join(REPO_DIR, 'external')
check_call(['git', 'clean', '-dfx'], cwd=external_dir)
jar_files = []
for root, dirnames, filenames in os.walk(external_dir):
for f in filenames: jar_files.append(os.path.join(root, f))
for file in jar_files: reset_time(file, zip=True)
jar_name = get_sources_file_name(versions)
jar_path = os.path.abspath(os.path.join(REPO_DIR, jar_name))
rel_paths = [os.path.relpath(f, external_dir) for f in sorted(jar_files)]
check_call(['jar', 'cnf', jar_path] + rel_paths, cwd=external_dir)
# create POM file from template
tor_version = get_tor_version(versions)
pom_name = get_pom_file_name(versions)
with open('template.pom', 'rt') as infile:
with open(os.path.join(REPO_DIR, pom_name), 'wt') as outfile:
for line in infile:
outfile.write(line.replace('VERSION', tor_version))
# print hashes for debug purposes
for file in file_list + [zip_name]:
for file in file_list + [zip_name, jar_name, pom_name]:
sha256hash = get_sha256(os.path.join(REPO_DIR, file))
print("%s: %s" % (file, sha256hash))
......@@ -148,8 +168,10 @@ def build_arch(name):
check_call(['zip', '-X', name, 'tor'], cwd=REPO_DIR)
def reset_time(filename):
check_call(['touch', '--no-dereference', '-t', '197001010000.00', filename])
def reset_time(filename, zip=False):
if zip: timestamp = '198001010000.00'
else: timestamp = '197001010000.00'
check_call(['touch', '--no-dereference', '-t', timestamp, filename])
if __name__ == "__main__":
......
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>org.briarproject</groupId>
<artifactId>tor-android</artifactId>
<version>VERSION</version>
<url>https://github.com/n8fr8/tor-android</url>
<description>Repo for building Tor for Android.</description>
<licenses>
<license>
<name>BSD-3-clause</name>
<url>https://github.com/n8fr8/tor-android/blob/master/LICENSE</url>
</license>
</licenses>
<developers>
<developer>
<id>dingledine</id>
<name>Roger Dingledine</name>
<email>arma@mit.edu</email>
</developer>
<developer>
<id>mathewson</id>
<name>Nick Mathewson</name>
<email>nickm@torproject.org</email>
</developer>
<developer>
<id>torproject</id>
<name>Tor Project</name>
<email>frontdesk@rt.torproject.org</email>
</developer>
<developer>
<id>n8fr8</id>
<name>Nathan Freitas</name>
<email>nathan@guardianproject.info</email>
</developer>
</developers>
<scm>
<connection>scm:https://github.com/n8fr8/tor-android.git</connection>
<developerConnection>scm:git@github.com:n8fr8/tor-android.git</developerConnection>
<url>scm:https://github.com/n8fr8/tor-android</url>
</scm>
</project>
......@@ -38,5 +38,17 @@ def get_sha256(filename, block_size=65536):
return sha256.hexdigest()
def get_tor_version(versions):
return versions['tor'].split('-')[1]
def get_final_file_name(versions):
return 'tor-android-%s.zip' % versions['tor'].split('-')[1]
return 'tor-android-%s.zip' % get_tor_version(versions)
def get_sources_file_name(versions):
return 'tor-android-%s-sources.jar' % get_tor_version(versions)
def get_pom_file_name(versions):
return 'tor-android-%s.pom' % get_tor_version(versions)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment