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 ...@@ -4,7 +4,7 @@ import sys
from shutil import move, copy, rmtree from shutil import move, copy, rmtree
from subprocess import check_call 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' NDK_DIR = 'android-ndk'
...@@ -38,8 +38,28 @@ def main(): ...@@ -38,8 +38,28 @@ def main():
zip_name = get_final_file_name(versions) zip_name = get_final_file_name(versions)
check_call(['zip', '-D', '-X', zip_name] + file_list, cwd=REPO_DIR) 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 # 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)) sha256hash = get_sha256(os.path.join(REPO_DIR, file))
print("%s: %s" % (file, sha256hash)) print("%s: %s" % (file, sha256hash))
...@@ -148,8 +168,10 @@ def build_arch(name): ...@@ -148,8 +168,10 @@ def build_arch(name):
check_call(['zip', '-X', name, 'tor'], cwd=REPO_DIR) check_call(['zip', '-X', name, 'tor'], cwd=REPO_DIR)
def reset_time(filename): def reset_time(filename, zip=False):
check_call(['touch', '--no-dereference', '-t', '197001010000.00', filename]) if zip: timestamp = '198001010000.00'
else: timestamp = '197001010000.00'
check_call(['touch', '--no-dereference', '-t', timestamp, filename])
if __name__ == "__main__": if __name__ == "__main__":
<?xml version="1.0" encoding="UTF-8"?>
<description>Repo for building Tor for Android.</description>
<name>Roger Dingledine</name>
<name>Nick Mathewson</name>
<name>Tor Project</name>
<name>Nathan Freitas</name>
...@@ -38,5 +38,17 @@ def get_sha256(filename, block_size=65536): ...@@ -38,5 +38,17 @@ def get_sha256(filename, block_size=65536):
return sha256.hexdigest() return sha256.hexdigest()
def get_tor_version(versions):
return versions['tor'].split('-')[1]
def get_final_file_name(versions): def get_final_file_name(versions):
return '' % versions['tor'].split('-')[1] return '' % 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
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment