1#!/bin/sh
2# Copyright 2019 Google LLC.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6cd "$(dirname "$0")/../.."
7
8set -e -x
9
10[ -f platform_tools/android/apps/skqp/src/main/assets/files.checksum       ] || exit 1
11[ -f platform_tools/android/apps/skqp/src/main/assets/skqp/rendertests.txt ] || exit 1
12[ -f platform_tools/android/apps/skqp/src/main/assets/skqp/unittests.txt   ] || exit 1
13
14python tools/skqp/gn_to_bp.py
15python tools/skqp/download_model
16python tools/skqp/setup_resources
17
18touch MODULE_LICENSE_BSD
19
20cat > platform_tools/android/apps/skqp/src/main/Android.mk <<- "EOM"
21	# Copyright 2019 Google LLC.
22	# Use of this source code is governed by a BSD-style license that can be
23	# found in the LICENSE file.
24	LOCAL_PATH:= $(call my-dir)
25	include $(CLEAR_VARS)
26	LOCAL_MODULE_TAGS := tests optional
27	LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
28	LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
29	LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
30	LOCAL_JNI_SHARED_LIBRARIES := libskqp_app
31	LOCAL_MULTILIB := both
32	LOCAL_USE_AAPT2 := true
33	LOCAL_STATIC_ANDROID_LIBRARIES := android-support-design
34	LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
35	LOCAL_SRC_FILES := $(call all-java-files-under, java)
36	LOCAL_PACKAGE_NAME := CtsSkQPTestCases
37	LOCAL_SDK_VERSION := test_current
38	include $(BUILD_CTS_PACKAGE)
39EOM
40
41cat > include/config/SkUserConfigManual.h <<- "EOM"
42	// Copyright 2019 Google LLC.
43	// Use of this source code is governed by a BSD-style license that can be
44	// found in the LICENSE file.
45	#ifndef SkUserConfigManual_DEFINED
46	#define SkUserConfigManual_DEFINED
47	// DON'T DEFINE THINGS HERE AS IT WILL RESULT IN DIFFERENCES WITH
48	// THE VERSION OF SKQP PUBLISHED ON SKIA.ORG
49	#endif // SkUserConfigManual_DEFINED
50EOM
51
52cat > platform_tools/android/apps/skqp/src/main/AndroidTest.xml <<- "EOM"
53	<?xml version="1.0" encoding="utf-8"?>
54	<!--
55	Copyright 2019 Google LLC.
56	Use of this source code is governed by a BSD-style license that can be
57	found in the LICENSE file.
58	-->
59	<configuration description="Config for CTS SkQP test cases">
60	<option name="test-suite-tag" value="cts" />
61	<option name="not-shardable" value="true" />
62	<option name="config-descriptor:metadata" key="component" value="uitoolkit" />
63	<option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
64	<option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
65	<target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
66	<option name="cleanup-apks" value="true" />
67	<option name="test-file-name" value="CtsSkQPTestCases.apk" />
68	</target_preparer>
69	<test class="com.android.tradefed.testtype.AndroidJUnitTest" >
70	<option name="package" value="org.skia.skqp" />
71	<option name="runtime-hint" value="7m" />
72	</test>
73	</configuration>
74EOM
75
76[ -f platform_tools/android/apps/skqp/src/main/assets/.gitignore ] && \
77    git rm platform_tools/android/apps/skqp/src/main/assets/.gitignore
78
79git add                                                       \
80    Android.bp                                                \
81    MODULE_LICENSE_BSD                                        \
82    include/config/SkUserConfig.h                             \
83    include/config/SkUserConfigManual.h                       \
84    platform_tools/android/apps/skqp/src/main/Android.mk      \
85    platform_tools/android/apps/skqp/src/main/AndroidTest.xml \
86    platform_tools/android/apps/skqp/src/main/assets
87