Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build android sdk with android-10 #782

Merged
merged 3 commits into from
Mar 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,38 @@ jobs:
key: Libs-{{ .Revision }}
paths:
- lib
build_api10:
working_directory: ~/code
docker:
- image: circleci/android:api-27-alpha
environment:
JVM_OPTS: -Xmx3200m
steps:
- checkout
- generate_gradle_wrapper
- run:
name: download android-10
command:
sudo yes | sdkmanager "platforms;android-10"
- run:
name: install python3-pip
command: |
sudo apt-get update
sudo apt-get -y install python3-pip
- run:
name: install json parser
command: sudo pip3 install demjson
- run:
name: update code for api10
command: |
python3 CircleciScripts/replace_android10.py "$(pwd)"
rm aws-android-sdk-core/src/main/java/com/amazonaws/internal/keyvaluestore/KeyProvider18.java
rm aws-android-sdk-core/src/main/java/com/amazonaws/internal/keyvaluestore/KeyProvider23.java
cat aws-android-sdk-core/src/main/java/com/amazonaws/internal/keyvaluestore/AWSKeyValueStore.java
- run:
name: build the whole project
command: |
bash gradlew :aws-android-sdk-core:build -x test

unittest:
working_directory: ~/code
Expand Down Expand Up @@ -640,6 +672,7 @@ workflows:
build_test:
jobs:
- build
- build_api10
sunchunqiang marked this conversation as resolved.
Show resolved Hide resolved
- unittest
- pre_integrationtest:
filters:
Expand Down Expand Up @@ -921,6 +954,12 @@ workflows:
ignore: /.*/
tags:
only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/
- build_api10:
filters:
branches:
ignore: /.*/
tags:
only: /^(release|beta)_v[0-9]+.[0-9]+.[0-9]+$/
- unittest:
filters:
branches:
Expand Down Expand Up @@ -1199,6 +1238,7 @@ workflows:
requires:
- unittest
- post_integrationtest
- build_api10
filters:
branches:
ignore: /.*/
Expand Down
44 changes: 44 additions & 0 deletions CircleciScripts/replace_android10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from utils import replacefiles
import demjson
import sys
import re
import os
root = sys.argv[1]

replaces = [
{
"match" : 'android-23',
sunchunqiang marked this conversation as resolved.
Show resolved Hide resolved
"replace" : 'android-10',
"files" : [
"aws-android-sdk-core/build.gradle"
]
} ,
{
"match" : 'android-23.jar',
"replace" : 'android-10.jar',
"files" : [
"aws-android-sdk-core/build.gradle"
]
} ,
]
replacefiles(root, replaces)




AWSKeyValueStoreFile = os.path.join(root,"aws-android-sdk-core/src/main/java/com/amazonaws/internal/keyvaluestore/AWSKeyValueStore.java")
newcontent = ""
with open(AWSKeyValueStoreFile, 'r') as myfile:
content = myfile.read()
pattern = r'//@apiLevel23Start[\s\S]*?//@apiLevel23End'
repl = r""
newcontent = re.sub(pattern, repl, content)


pattern = r'//@apiLevel18Start[\s\S]*?//@apiLevel18End'
repl = r""
newcontent = re.sub(pattern, repl, newcontent)
with open(AWSKeyValueStoreFile,"w") as myfile:
myfile.write(newcontent)