Skip to content

Commit 767a1f2

Browse files
abby-sergzxxxz
authored andcommitted
Issue 6982 - improve projects structure to simplify embedding on android
1 parent 5659703 commit 767a1f2

9 files changed

Lines changed: 81 additions & 68 deletions

.travis/android-script.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ ABP_TARGET_ARCHES=("arm" "arm64" "ia32")
99
for ABP_TARGET_ARCH in "${ABP_TARGET_ARCHES[@]}"
1010
do
1111
export ABP_TARGET_ARCH=${ABP_TARGET_ARCH}
12+
# ensure that one can build libadblockplus.a without having binaries of V8
13+
bash .travis/prepare-v8-headers.sh
14+
make GYP_FILE=libadblockplus.gyp APP_MODULES=adblockplus
15+
# build tests
1216
make get-prebuilt-v8
13-
make all
17+
make
18+
# build abpshell
19+
make GYP_FILE=abpshell.gyp
1420
done

.travis/prepare-prebuilt-v8.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@
33
set -x
44
set -e
55

6-
if [[ ! -d "third_party/prebuilt-v8/include" ]]; then
7-
wget ${URL_PREFIX}include.7z -O third_party/v8-include.7z
8-
7z x third_party/v8-include.7z -othird_party/prebuilt-v8
9-
fi
6+
bash "${BASH_SOURCE%/*}/prepare-v8-headers.sh"
107

118
PREBUILT_V8_ARCHIVE=${TARGET_OS}-${ABP_TARGET_ARCH}-${Configuration}.tar.xz
129

.travis/prepare-v8-headers.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -x
4+
set -e
5+
6+
if [[ ! -d "third_party/prebuilt-v8/include" ]]; then
7+
wget ${URL_PREFIX}include.7z -O third_party/v8-include.7z
8+
7z x third_party/v8-include.7z -othird_party/prebuilt-v8
9+
fi

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ clean:
8787
$(RM) -r ${BUILD_DIR} docs
8888

8989
ifeq ($(TARGET_OS),android)
90-
SUB_ACTION ?= installed_modules
90+
GYP_FILE ?= tests.gyp
9191
all: ensure_dependencies
9292
GYP_DEFINES="${GYP_PARAMETERS}" \
93-
python ./make_gyp_wrapper.py --depth=. -f make-android -Ilibadblockplus.gypi --generator-output=${BUILD_DIR} -Gandroid_ndk_version=r16b libadblockplus.gyp
94-
$(ANDROID_NDK_ROOT)/ndk-build -C ${BUILD_DIR} ${SUB_ACTION} \
93+
python ./make_gyp_wrapper.py --depth=. -f make-android -Ilibadblockplus.gypi --generator-output=${BUILD_DIR} -Gandroid_ndk_version=r16b ${GYP_FILE}
94+
$(ANDROID_NDK_ROOT)/ndk-build -C ${BUILD_DIR} installed_modules \
9595
BUILDTYPE=Release \
9696
APP_ABI=$(ANDROID_ABI) \
9797
APP_PLATFORM=${ANDROID_PLATFORM_LEVEL} \
@@ -108,7 +108,7 @@ ifdef CXX
108108
CXX_PARAM:=CXX=${CXX}
109109
endif
110110
all: ensure_dependencies
111-
GYP_DEFINES="${GYP_PARAMETERS}" third_party/gyp/gyp --depth=. -f make -I libadblockplus.gypi --generator-output=${BUILD_DIR} libadblockplus.gyp
111+
GYP_DEFINES="${GYP_PARAMETERS}" third_party/gyp/gyp --depth=. -f make -I libadblockplus.gypi --generator-output=${BUILD_DIR} abpshell.gyp tests.gyp
112112
$(MAKE) -C ${BUILD_DIR} ${SUB_ACTION} ${CXX_PARAM}
113113

114114
endif

shell/shell.gyp renamed to abpshell.gyp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
'libadblockplus.gyp:libadblockplus'
77
],
88
'sources': [
9-
'src/Main.cpp',
10-
'src/Command.cpp',
11-
'src/GcCommand.cpp',
12-
'src/HelpCommand.cpp',
13-
'src/FiltersCommand.cpp',
14-
'src/MatchesCommand.cpp',
15-
'src/PrefsCommand.cpp',
16-
'src/SubscriptionsCommand.cpp'
9+
'shell/src/Main.cpp',
10+
'shell/src/Command.cpp',
11+
'shell/src/GcCommand.cpp',
12+
'shell/src/HelpCommand.cpp',
13+
'shell/src/FiltersCommand.cpp',
14+
'shell/src/MatchesCommand.cpp',
15+
'shell/src/PrefsCommand.cpp',
16+
'shell/src/SubscriptionsCommand.cpp'
1717
],
1818
'msvs_settings': {
1919
'VCLinkerTool': {

appveyor.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ before_build:
4949
if "%Platform%"=="x64" set arch="x64"
5050
5151
build_script:
52-
- cmd: msbuild "build/%arch%/libadblockplus.sln" /m /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
52+
- cmd: msbuild "build/%arch%/tests.sln" /m /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
53+
- cmd: msbuild "build/%arch%/abpshell.sln" /m /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
5354
- sh: make
5455
test_script:
5556
- cmd: build\%arch%\%Configuration%\tests.exe --gtest_output=xml:tests.xml

createsolution.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ python ensure_dependencies.py
66

77
mkdir build\ia32\shell
88
mkdir build\x64\shell
9-
python msvs_gyp_wrapper.py --depth=build\ia32 -f msvs -G msvs_version=2017 -I libadblockplus.gypi --generator-output=build\ia32 -Dtarget_arch=ia32 -Dhost_arch=ia32 libadblockplus.gyp
10-
python msvs_gyp_wrapper.py --depth=build\x64 -f msvs -G msvs_version=2017 -I libadblockplus.gypi --generator-output=build\x64 -Dtarget_arch=x64 -Dhost_arch=x64 libadblockplus.gyp
9+
python msvs_gyp_wrapper.py --depth=build\ia32 -f msvs -G msvs_version=2017 -I libadblockplus.gypi --generator-output=build\ia32 -Dtarget_arch=ia32 -Dhost_arch=ia32 abpshell.gyp tests.gyp
10+
python msvs_gyp_wrapper.py --depth=build\x64 -f msvs -G msvs_version=2017 -I libadblockplus.gypi --generator-output=build\x64 -Dtarget_arch=x64 -Dhost_arch=x64 abpshell.gyp tests.gyp
1111
popd

libadblockplus.gyp

Lines changed: 13 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
}
1414
}
1515
]],
16-
'includes': ['v8.gypi', 'shell/shell.gyp'],
16+
'includes': ['v8.gypi'],
1717
'targets': [{
1818
'target_name': 'libadblockplus',
1919
'type': '<(library)',
@@ -61,16 +61,19 @@
6161
'include_dirs': ['include'],
6262
'conditions': [[
6363
'OS=="win"', {
64+
'link_settings': {
65+
'libraries': [
66+
'<@(libv8_libs)',
67+
'-lwinmm'
68+
],
69+
},
6470
'msvs_settings': {
6571
'VCLinkerTool': {
6672
'AdditionalLibraryDirectories': ['<(libv8_lib_dir)'],
6773
}
6874
}
6975
}
70-
]],
71-
},
72-
'conditions': [
73-
['OS=="linux" or OS=="mac"', {
76+
], ['OS=="linux" or OS=="mac"', {
7477
'link_settings': {
7578
'libraries': [
7679
'<@(libv8_libs)'
@@ -79,19 +82,14 @@
7982
'<(libv8_lib_dir)'
8083
]
8184
}
82-
}],
83-
['OS=="win"', {
84-
'link_settings': {
85-
'libraries': [
86-
'<@(libv8_libs)',
87-
'-lwinmm'
88-
],
89-
},
90-
}],
91-
['OS=="android"', {
85+
}], ['OS=="android"', {
9286
'user_libraries': [
9387
'<@(libv8_libs)'
9488
],
89+
}]],
90+
},
91+
'conditions': [
92+
['OS=="android"', {
9593
'standalone_static_library': 1, # disable thin archives
9694
}],
9795
['have_curl==1',
@@ -185,38 +183,5 @@
185183
'--after', '<@(load_after_files)',
186184
]
187185
}]
188-
},
189-
{
190-
'target_name': 'tests',
191-
'type': 'executable',
192-
'xcode_settings': {},
193-
'dependencies': [
194-
'googletest.gyp:googletest_main',
195-
'libadblockplus'
196-
],
197-
'sources': [
198-
'test/AsyncExecutor.cpp',
199-
'test/BaseJsTest.h',
200-
'test/BaseJsTest.cpp',
201-
'test/AppInfoJsObject.cpp',
202-
'test/ConsoleJsObject.cpp',
203-
'test/DefaultFileSystem.cpp',
204-
'test/FileSystemJsObject.cpp',
205-
'test/FilterEngine.cpp',
206-
'test/GlobalJsObject.cpp',
207-
'test/JsEngine.cpp',
208-
'test/JsValue.cpp',
209-
'test/Notification.cpp',
210-
'test/Prefs.cpp',
211-
'test/ReferrerMapping.cpp',
212-
'test/UpdateCheck.cpp',
213-
'test/WebRequest.cpp'
214-
],
215-
'msvs_settings': {
216-
'VCLinkerTool': {
217-
'SubSystem': '1', # Console
218-
'EntryPointSymbol': 'mainCRTStartup',
219-
},
220-
},
221186
}]
222187
}

tests.gyp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
'targets': [{
3+
'target_name': 'tests',
4+
'type': 'executable',
5+
'xcode_settings': {},
6+
'dependencies': [
7+
'googletest.gyp:googletest_main',
8+
'libadblockplus.gyp:libadblockplus'
9+
],
10+
'sources': [
11+
'test/AsyncExecutor.cpp',
12+
'test/BaseJsTest.h',
13+
'test/BaseJsTest.cpp',
14+
'test/AppInfoJsObject.cpp',
15+
'test/ConsoleJsObject.cpp',
16+
'test/DefaultFileSystem.cpp',
17+
'test/FileSystemJsObject.cpp',
18+
'test/FilterEngine.cpp',
19+
'test/GlobalJsObject.cpp',
20+
'test/JsEngine.cpp',
21+
'test/JsValue.cpp',
22+
'test/Notification.cpp',
23+
'test/Prefs.cpp',
24+
'test/ReferrerMapping.cpp',
25+
'test/UpdateCheck.cpp',
26+
'test/WebRequest.cpp'
27+
],
28+
'msvs_settings': {
29+
'VCLinkerTool': {
30+
'SubSystem': '1', # Console
31+
'EntryPointSymbol': 'mainCRTStartup',
32+
},
33+
},
34+
}]
35+
}

0 commit comments

Comments
 (0)