Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
go-reproducer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
briar
go-reproducer
Commits
0b702989
Verified
Commit
0b702989
authored
6 years ago
by
Torsten Grote
Browse files
Options
Downloads
Patches
Plain Diff
Add code for packaging for jcenter
parent
23e1d973
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#2523
failed
6 years ago
Stage: build
Stage: test
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+3
-1
3 additions, 1 deletion
.gitignore
build-obfs4proxy.py
+55
-11
55 additions, 11 deletions
build-obfs4proxy.py
template-android.pom
+32
-0
32 additions, 0 deletions
template-android.pom
template.pom
+32
-0
32 additions, 0 deletions
template.pom
utils.py
+29
-5
29 additions, 5 deletions
utils.py
with
151 additions
and
17 deletions
.gitignore
+
3
−
1
View file @
0b702989
...
...
@@ -4,5 +4,7 @@
/jni
/android-ndk
/android-ndk.zip
/obfs4proxy_*.zip
/obfs4proxy*.zip
/obfs4proxy*.pom
/obfs4proxy*.jar
/obfs4
\ No newline at end of file
This diff is collapsed.
Click to expand it.
build-obfs4proxy.py
+
55
−
11
View file @
0b702989
#!/usr/bin/env python3
from
glob
import
glob
import
os
from
glob
import
glob
from
shutil
import
move
,
rmtree
from
subprocess
import
check_call
from
utils
import
get_build_versions
,
ex
,
get_sha256
,
fail
,
zip_file
from
utils
import
get_build_versions
,
ex
,
get_sha256
,
fail
,
zip_files
,
get_final_file_name
,
\
get_sources_file_name
,
get_pom_file_name
,
reset_time
,
get_obfs4_version
NDK_DIR
=
'
android-ndk
'
REPO_DIR
=
'
obfs4
'
...
...
@@ -24,12 +25,17 @@ def main():
# Install dependencies (of git HEAD)
ex
([
'
go
'
,
'
get
'
,
'
-d
'
,
versions
[
'
obfs4
'
][
'
got-get
'
]])
# Build for various Android versions
# Build for various Android versions
and create package
build_android
()
# Build for 64-bit Linux
# Build for 64-bit Linux
and create package
build_linux
()
# Package both builds
package_android
(
versions
)
print
()
package_linux
(
versions
)
def
setup_android_ndk
(
versions
):
if
os
.
path
.
isdir
(
NDK_DIR
):
...
...
@@ -124,22 +130,60 @@ def build_android_arch(env, tool, ndk_arch, pie):
ex
([
'
%s/bin/%s-strip
'
%
(
toolchain
,
tool
),
'
-D
'
,
'
obfs4proxy
'
])
pie_suffix
=
'
_pie
'
if
pie
else
''
zip_file
(
'
obfs4proxy
'
,
'
obfs4proxy_%s%s.zip
'
%
(
ndk_arch
,
pie_suffix
))
zip_file
s
([
'
obfs4proxy
'
]
,
'
obfs4proxy_%s%s.zip
'
%
(
ndk_arch
,
pie_suffix
))
os
.
remove
(
'
obfs4proxy
'
)
def
build_linux
():
ex
([
'
go
'
,
'
build
'
,
'
-o
'
,
'
obfs4proxy
'
]
+
glob
(
SOURCE
))
ex
([
'
strip
'
,
'
-D
'
,
'
obfs4proxy
'
])
zip_file
(
'
obfs4proxy
'
,
'
obfs4proxy_linux-x86_64.zip
'
)
zip_file
s
([
'
obfs4proxy
'
]
,
'
obfs4proxy_linux-x86_64.zip
'
)
os
.
remove
(
'
obfs4proxy
'
)
def
get_source_files
():
files
=
[]
for
file_name
in
glob
(
SOURCE
):
print
(
file_name
)
return
files
def
package_android
(
versions
):
file_list
=
[
'
obfs4proxy_arm.zip
'
,
'
obfs4proxy_arm_pie.zip
'
,
'
obfs4proxy_x86.zip
'
,
'
obfs4proxy_x86_pie.zip
'
]
package
(
versions
,
file_list
,
android
=
True
)
def
package_linux
(
versions
):
file_list
=
[
'
obfs4proxy_linux-x86_64.zip
'
]
package
(
versions
,
file_list
,
android
=
False
)
def
package
(
versions
,
file_list
,
android
):
zip_file
=
get_final_file_name
(
versions
,
android
)
zip_files
(
file_list
,
zip_file
)
jar_file
=
create_sources_jar
(
versions
)
pom_file
=
create_pom_file
(
versions
,
android
)
# print hashes for debug purposes
for
file
in
file_list
+
[
jar_file
,
pom_file
,
zip_file
]:
sha256hash
=
get_sha256
(
file
)
print
(
"
%s: %s
"
%
(
file
,
sha256hash
))
def
create_sources_jar
(
versions
):
check_call
([
'
git
'
,
'
clean
'
,
'
-dfx
'
],
cwd
=
REPO_DIR
)
jar_files
=
glob
(
SOURCE
)
for
file
in
jar_files
:
reset_time
(
file
)
jar_file
=
get_sources_file_name
(
versions
)
jar_path
=
os
.
path
.
abspath
(
jar_file
)
check_call
([
'
jar
'
,
'
cf
'
,
jar_path
]
+
jar_files
)
return
jar_file
def
create_pom_file
(
versions
,
android
=
False
):
tor_version
=
get_obfs4_version
(
versions
)
pom_file
=
get_pom_file_name
(
versions
,
android
)
template
=
'
template-android.pom
'
if
android
else
'
template.pom
'
with
open
(
template
,
'
rt
'
)
as
infile
:
with
open
(
pom_file
,
'
wt
'
)
as
outfile
:
for
line
in
infile
:
outfile
.
write
(
line
.
replace
(
'
VERSION
'
,
tor_version
))
return
pom_file
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
template-android.pom
0 → 100644
+
32
−
0
View file @
0b702989
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.briarproject
</groupId>
<artifactId>
obfs4proxy-android
</artifactId>
<version>
VERSION
</version>
<url>
https://torproject.org
</url>
<description>
Repo for building obfs4proxy for Android.
</description>
<licenses>
<license>
<name>
BSD-3-clause
</name>
<url>
https://gitweb.torproject.org/pluggable-transports/obfs4.git/tree/LICENSE
</url>
</license>
</licenses>
<developers>
<developer>
<id>
yawning
</id>
<name>
Yawning Angel
</name>
<email>
yawning at torproject dot org
</email>
</developer>
<developer>
<id>
torproject
</id>
<name>
Tor Project
</name>
<email>
frontdesk@rt.torproject.org
</email>
</developer>
</developers>
<scm>
<connection>
scm:https://git.torproject.org/pluggable-transports/obfs4.git
</connection>
<developerConnection>
scm:git@gitweb.torproject.org/pluggable-transports/obfs4.git
</developerConnection>
<url>
scm:https://gitweb.torproject.org/pluggable-transports/obfs4.git
</url>
</scm>
</project>
This diff is collapsed.
Click to expand it.
template.pom
0 → 100644
+
32
−
0
View file @
0b702989
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.briarproject
</groupId>
<artifactId>
obfs4proxy
</artifactId>
<version>
VERSION
</version>
<url>
https://torproject.org
</url>
<description>
Repo for building obfs4proxy for Linux.
</description>
<licenses>
<license>
<name>
BSD-3-clause
</name>
<url>
https://gitweb.torproject.org/pluggable-transports/obfs4.git/tree/LICENSE
</url>
</license>
</licenses>
<developers>
<developer>
<id>
yawning
</id>
<name>
Yawning Angel
</name>
<email>
yawning at torproject dot org
</email>
</developer>
<developer>
<id>
torproject
</id>
<name>
Tor Project
</name>
<email>
frontdesk@rt.torproject.org
</email>
</developer>
</developers>
<scm>
<connection>
scm:https://git.torproject.org/pluggable-transports/obfs4.git
</connection>
<developerConnection>
scm:git@gitweb.torproject.org/pluggable-transports/obfs4.git
</developerConnection>
<url>
scm:https://gitweb.torproject.org/pluggable-transports/obfs4.git
</url>
</scm>
</project>
This diff is collapsed.
Click to expand it.
utils.py
+
29
−
5
View file @
0b702989
...
...
@@ -4,8 +4,6 @@ import sys
from
collections
import
OrderedDict
from
subprocess
import
check_call
REPO_DIR
=
'
tor-android
'
def
get_version
():
if
len
(
sys
.
argv
)
>
2
:
...
...
@@ -42,6 +40,32 @@ def get_sha256(filename, block_size=65536):
return
sha256
.
hexdigest
()
def
zip_file
(
file_name
,
zip_name
):
ex
([
'
touch
'
,
'
--no-dereference
'
,
'
-t
'
,
'
197001010000.00
'
,
file_name
])
ex
([
'
zip
'
,
'
-X
'
,
zip_name
,
file_name
])
def
reset_time
(
file_name
):
check_call
([
'
touch
'
,
'
--no-dereference
'
,
'
-t
'
,
'
197001010000.00
'
,
file_name
])
def
zip_files
(
files
,
zip_name
):
for
file_name
in
files
:
reset_time
(
file_name
)
ex
([
'
zip
'
,
'
-D
'
,
'
-X
'
,
zip_name
]
+
files
)
def
get_obfs4_version
(
versions
):
return
versions
[
'
obfs4
'
][
'
tag
'
].
split
(
'
-
'
)[
1
]
def
get_file_suffix
(
versions
,
android
=
False
):
version
=
get_obfs4_version
(
versions
)
return
"
%s-%s
"
%
(
"
android
"
,
version
)
if
android
else
version
def
get_final_file_name
(
versions
,
android
=
False
):
return
'
obfs4proxy-%s.zip
'
%
get_file_suffix
(
versions
,
android
)
def
get_sources_file_name
(
versions
,
android
=
False
):
return
'
obfs4proxy-%s-sources.jar
'
%
get_file_suffix
(
versions
,
android
)
def
get_pom_file_name
(
versions
,
android
=
False
):
return
'
obfs4proxy-%s.pom
'
%
get_file_suffix
(
versions
,
android
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment