Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
3cb6e373
Commit
3cb6e373
authored
Apr 21, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update script
parent
ca1c69be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
17 deletions
+96
-17
script/code/move_buildconfig.py
+96
-17
No files found.
script/code/move_buildconfig.py
100644 → 100755
View file @
3cb6e373
...
@@ -6,11 +6,25 @@ import glob, os
...
@@ -6,11 +6,25 @@ import glob, os
import
sys
import
sys
def
getResValue
(
line
):
def
addToProperties
(
code
):
return
line
.
split
(
","
)[
2
]
.
replace
(
"
\\\"
"
,
""
)
.
replace
(
"'"
,
""
)
.
replace
(
" "
,
""
)
.
replace
(
")"
,
""
)
.
replace
(
"'
\n
"
,
""
)
path
=
"../../../gradle.properties"
with
open
(
path
,
"r"
,
encoding
=
"utf-8"
)
as
f
:
lines
=
f
.
readlines
()
with
open
(
path
,
"w"
,
encoding
=
"utf-8"
)
as
f_w
:
for
line
in
lines
:
if
code
in
line
:
line
=
"#"
+
line
if
"#MARK-END"
in
line
:
line
=
code
+
"
\n
"
+
line
f_w
.
write
(
line
)
def
needChange
(
code
,
line
):
return
code
in
line
and
"${"
not
in
line
def
addToProperties
(
line
):
def
getResValue
(
line
):
os
.
system
(
"./update_properties.py "
+
line
)
return
line
.
split
(
","
)[
2
]
.
replace
(
"
\\\"
"
,
""
)
.
replace
(
"
\"
"
,
""
)
.
replace
(
"'"
,
""
)
.
replace
(
" "
,
""
)
.
replace
(
")"
,
""
)
.
replace
(
"
\n
"
,
""
)
def
getStringFiled
(
key
,
value
):
def
getStringFiled
(
key
,
value
):
return
"
\t\t\t
buildConfigField 'String', '"
+
key
+
"', "
+
value
+
"
\n
"
return
"
\t\t\t
buildConfigField 'String', '"
+
key
+
"', "
+
value
+
"
\n
"
...
@@ -31,35 +45,100 @@ def move_config(path):
...
@@ -31,35 +45,100 @@ def move_config(path):
for
line
in
lines
:
for
line
in
lines
:
if
"product {"
in
line
:
if
"product {"
in
line
:
move_finished
+=
1
move_finished
+=
1
if
move_finished
==
1
and
"
{
"
in
line
:
if
move_finished
==
1
and
"
}
"
in
line
:
move_finished
+=
1
move_finished
+=
1
if
move_finished
>
1
:
if
move_finished
>
1
:
break
f_w
.
write
(
line
)
continue
# if "app_name_str" in line
:
if
needChange
(
"app_name_str"
,
line
)
:
#
addToProperties("app_name="+getResValue(line))
addToProperties
(
"app_name="
+
getResValue
(
line
))
#
line = getStringRes("app_name_str","\"${app_name}\"")
line
=
getStringRes
(
"app_name_str"
,
"
\"
${app_name}
\"
"
)
if
"LANGUAGE"
in
line
:
elif
needChange
(
"LANGUAGE"
,
line
)
:
if
line
.
startswith
(
"//"
):
if
line
.
startswith
(
"//"
):
line
=
""
line
=
""
else
:
else
:
addToProperties
(
"language=in"
)
addToProperties
(
"
\n
#语言 in / zh / en"
)
addToProperties
(
"language=
\"
in
\"
"
)
line
=
getStringFiled
(
"LANGUAGE"
,
"
\"
${language}
\"
"
)
line
=
getStringFiled
(
"LANGUAGE"
,
"
\"
${language}
\"
"
)
elif
"'color', 'main_color'"
in
line
:
elif
needChange
(
"main_color"
,
line
)
:
addToProperties
(
"main_color="
+
getResValue
(
line
))
addToProperties
(
"main_color="
+
getResValue
(
line
))
line
=
getColorRes
(
"main_color"
,
"
\"
${main_color}
\"
"
)
line
=
getColorRes
(
"main_color"
,
"
\"
${main_color}
\"
"
)
elif
"'color', 'main_text_color'"
in
line
:
elif
needChange
(
"main_text_color"
,
line
)
:
addToProperties
(
"main_text_color="
+
getResValue
(
line
))
addToProperties
(
"main_text_color="
+
getResValue
(
line
))
line
=
getColorRes
(
"main_text_color"
,
"
\"
${main_text_color}
\"
"
)
line
=
getColorRes
(
"main_text_color"
,
"
\"
${main_text_color}
\"
"
)
elif
"ZENDESK_URL"
in
line
:
elif
needChange
(
"FACEBOOK_APP_ID"
,
line
):
addToProperties
(
"ZENDESK_URL="
+
getResValue
(
line
))
addToProperties
(
"
\n
#Accoubt Kit"
)
line
=
getStringFiled
(
"ZENDESK_URL"
,
"
\"
${ZENDESK_URL}
\"
"
)
addToProperties
(
"facebook_app_id="
+
getResValue
(
line
))
line
=
getStringRes
(
"FACEBOOK_APP_ID"
,
"
\"
${facebook_app_id}
\"
"
)
elif
needChange
(
"ACCOUNT_KIT_CLIENT_TOKEN"
,
line
):
addToProperties
(
"account_kit_client_token="
+
getResValue
(
line
))
line
=
getStringRes
(
"ACCOUNT_KIT_CLIENT_TOKEN"
,
"
\"
${account_kit_client_token}
\"
"
)
elif
needChange
(
"ZENDESK_URL"
,
line
):
addToProperties
(
"
\n
#zendesk 客服"
)
addToProperties
(
"zendesk_url=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"ZENDESK_URL"
,
"
\"
${zendesk_url}
\"
"
)
elif
needChange
(
"ZENDESK_APP_ID"
,
line
):
addToProperties
(
"zendesk_app_id=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"ZENDESK_APP_ID"
,
"
\"
${zendesk_app_id}
\"
"
)
elif
needChange
(
"ZENDESK_CLIENT_ID"
,
line
):
addToProperties
(
"zendesk_client_id=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"ZENDESK_CLIENT_ID"
,
"
\"
${zendesk_client_id}
\"
"
)
elif
needChange
(
"APPSFLYER_DEV_KEY"
,
line
):
addToProperties
(
"
\n
#Appsflyer"
)
addToProperties
(
"appsflyer_key=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"APPSFLYER_DEV_KEY"
,
"
\"
${appsflyer_key}
\"
"
)
elif
needChange
(
"HOTLINE"
,
line
):
addToProperties
(
"
\n
#客服电话"
)
addToProperties
(
"hot_line=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"HOTLINE"
,
"
\"
${hot_line}
\"
"
)
elif
needChange
(
"API_BASE_URL"
,
line
):
addToProperties
(
"
\n
#server"
)
addToProperties
(
"base_url=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"API_BASE_URL"
,
"
\"
${base_url}
\"
"
)
elif
needChange
(
"HARVESTER_IP"
,
line
):
addToProperties
(
"harvest_ip=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"HARVESTER_IP"
,
"
\"
${harvest_ip}
\"
"
)
elif
needChange
(
"HARVESTER_PORT"
,
line
):
addToProperties
(
"harvest_port="
+
getResValue
(
line
))
line
=
"
\t\t\t
buildConfigField 'int', 'HARVESTER_PORT',
\"
${harvest_port}
\"\n
"
elif
needChange
(
"GATEWAY_HOST_G0"
,
line
):
addToProperties
(
"gateway_url=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"GATEWAY_HOST_G0"
,
"
\"
${gateway_url}
\"
"
)
elif
needChange
(
"GATEWAY_HOST_G1"
,
line
):
addToProperties
(
"gateway_ip=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"GATEWAY_HOST_G1"
,
"
\"
${gateway_ip}
\"
"
)
elif
needChange
(
"REPAYMENT_H5"
,
line
):
addToProperties
(
"repayment_h5=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"REPAYMENT_H5"
,
"
\"
${repayment_h5}
\"
"
)
elif
needChange
(
"ADMIN_HOST"
,
line
):
addToProperties
(
"admin_host=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"ADMIN_HOST"
,
"
\"
${admin_host}
\"
"
)
elif
needChange
(
"AGREEMENT_URL"
,
line
):
addToProperties
(
"agreement_url=
\"
"
+
getResValue
(
line
)
+
"
\"
"
)
line
=
getStringFiled
(
"AGREEMENT_URL"
,
"
\"
${agreement_url}
\"
"
)
f_w
.
write
(
line
)
f_w
.
write
(
line
)
return
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment