This repository has been archived by the owner on Nov 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android App Bundles - Add test cases for dynamic feature modules (#2609)
* Prepared test data for dynamic feature module. Each feature has some distinctly unique characteristics: 1. kotlin -> Feature written in Kotlin and will be available on-demand 2. java -> Feature written in Java and will be available conditionally for minsdk=21 and maxSdk=24 3. native -> Feature written in Java using JNI and will be available on-demand 4. initialInstall -> Feature written in Java and will be available at install-time * Setup workspace with kotlinc path
- Loading branch information
Showing
40 changed files
with
568 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
.../facebook/buck/android/testdata/android_project/apps/dynamic_features/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<manifest xmlns:android='http://schemas.android.com/apk/res/android' package='com.example' | ||
android:versionCode="1" android:versionName="1.0" xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:dist="http://schemas.android.com/apk/distribution"> | ||
|
||
<!-- To remove multiple dist:module related tags, we are required to use removeAll merge rule marker. | ||
This change will no longer be required once ManifestMerger tool is updated from Buck source code. --> | ||
<dist:module tools:node="removeAll"/> | ||
|
||
<application | ||
android:icon='@drawable/app_icon' | ||
android:label='@string/app_name'> | ||
</application> | ||
</manifest> |
38 changes: 38 additions & 0 deletions
38
test/com/facebook/buck/android/testdata/android_project/apps/dynamic_features/BUCK.fixture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
android_bundle( | ||
name = "app_dynamic_features", | ||
# Configurations needed for dynamic features: Start | ||
application_module_configs = { | ||
"kotlin": ["//kotlin/com/sample/dynamic_features/on_demand:src_release"], | ||
"java": ["//java/com/sample/dynamic_features/conditional:src_release"], | ||
"native": ["//native/dynamic_features/on_demand:src_release"], | ||
"initialInstall": ["//java/com/sample/dynamic_features/at_install:src_release"], | ||
}, | ||
application_modules_with_manifest = { | ||
"kotlin", | ||
"java", | ||
"native", | ||
"initialInstall" | ||
}, | ||
module_manifest_skeleton = "ModuleManifest.xml", | ||
use_dynamic_feature = True, | ||
use_split_dex = True, | ||
# Configurations needed for dynamic features: End | ||
bundle_config_file = "bundle-config.json", | ||
cpu_filters = [ | ||
"x86", | ||
], | ||
keystore = "//keystores:debug", | ||
manifest_skeleton = "AndroidManifest.xml", | ||
package_type = "debug", | ||
primary_dex_patterns = [ | ||
"/MyApplication^", | ||
], | ||
deps = [ | ||
"//java/com/sample/app:app", | ||
"//res/com/sample/dynamic_features/base:base", | ||
"//kotlin/com/sample/dynamic_features/on_demand:src_release", | ||
"//java/com/sample/dynamic_features/conditional:src_release", | ||
"//native/dynamic_features/on_demand:src_release", | ||
"//java/com/sample/dynamic_features/at_install:src_release", | ||
], | ||
) |
5 changes: 5 additions & 0 deletions
5
...m/facebook/buck/android/testdata/android_project/apps/dynamic_features/ModuleManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example" | ||
split="${split}" android:versionCode="1"/> |
21 changes: 21 additions & 0 deletions
21
...m/facebook/buck/android/testdata/android_project/apps/dynamic_features/bundle-config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"compression": {}, | ||
"optimizations": { | ||
"splits_config": { | ||
"split_dimension": [ | ||
{ | ||
"value": "ABI", | ||
"negate": false | ||
}, | ||
{ | ||
"value": "SCREEN_DENSITY", | ||
"negate": true | ||
}, | ||
{ | ||
"value": "LANGUAGE", | ||
"negate": true | ||
} | ||
] | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
.../testdata/android_project/java/com/sample/dynamic_features/at_install/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<manifest xmlns:android='http://schemas.android.com/apk/res/android' | ||
xmlns:dist="http://schemas.android.com/apk/distribution" | ||
package='com.example' | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
|
||
<application> | ||
<activity | ||
android:exported='true' | ||
android:name='com.sample.dynamic_features.at_install.AtInstallFeatureActivity'/> | ||
</application> | ||
|
||
<!-- Configure at-install delivery --> | ||
<dist:module | ||
dist:instant="false" | ||
dist:title="@string/title_initial_install"> | ||
<dist:delivery> | ||
<dist:install-time/> | ||
</dist:delivery> | ||
<dist:fusing dist:include="true"/> | ||
</dist:module> | ||
|
||
</manifest> |
34 changes: 34 additions & 0 deletions
34
...android_project/java/com/sample/dynamic_features/at_install/AtInstallFeatureActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2014-present Facebook, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. You may obtain | ||
* a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package com.sample.dynamic_features.at_install; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.widget.TextView; | ||
import com.sample.initialInstall.R; | ||
|
||
public class AtInstallFeatureActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.layout_initial_install); | ||
|
||
TextView tv = (TextView) findViewById(R.id.initial_install_text_view); | ||
tv.setText(R.string.initial_install_text); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...android/testdata/android_project/java/com/sample/dynamic_features/at_install/BUCK.fixture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
android_library( | ||
name = "src_release", | ||
srcs = glob(["*.java"]), | ||
manifest = "AndroidManifest.xml", | ||
visibility = [ | ||
"PUBLIC", | ||
], | ||
deps = [ | ||
"//res/com/sample/dynamic_features/at_install:initialInstall", | ||
], | ||
) |
31 changes: 31 additions & 0 deletions
31
...testdata/android_project/java/com/sample/dynamic_features/conditional/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<manifest xmlns:android='http://schemas.android.com/apk/res/android' | ||
xmlns:dist="http://schemas.android.com/apk/distribution" | ||
package='com.example' | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
|
||
<application> | ||
<activity | ||
android:exported='true' | ||
android:name='com.sample.dynamic_features.conditional.ConditionalJavaFeatureActivity'/> | ||
</application> | ||
|
||
<!-- Configure conditional delivery --> | ||
<dist:module | ||
dist:instant="false" | ||
dist:title="@string/title_java"> | ||
<dist:delivery> | ||
<dist:install-time> | ||
<dist:conditions> | ||
<!-- If you specify conditions, as described in the steps | ||
below, the IDE includes them here. --> | ||
<dist:min-sdk dist:value="21"/> | ||
<dist:max-sdk dist:value="24"/> | ||
</dist:conditions> | ||
</dist:install-time> | ||
</dist:delivery> | ||
<dist:fusing dist:include="true"/> | ||
</dist:module> | ||
|
||
</manifest> |
11 changes: 11 additions & 0 deletions
11
...ndroid/testdata/android_project/java/com/sample/dynamic_features/conditional/BUCK.fixture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
android_library( | ||
name = "src_release", | ||
srcs = glob(["*.java"]), | ||
manifest = "AndroidManifest.xml", | ||
visibility = [ | ||
"PUBLIC", | ||
], | ||
deps = [ | ||
"//res/com/sample/dynamic_features/conditional:java", | ||
], | ||
) |
34 changes: 34 additions & 0 deletions
34
..._project/java/com/sample/dynamic_features/conditional/ConditionalJavaFeatureActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright 2014-present Facebook, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. You may obtain | ||
* a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
package com.sample.dynamic_features.conditional; | ||
|
||
import android.app.Activity; | ||
import android.os.Bundle; | ||
import android.widget.TextView; | ||
import com.sample.java.R; | ||
|
||
public class ConditionalJavaFeatureActivity extends Activity { | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.layout_conditional_install); | ||
|
||
TextView tv = (TextView) findViewById(R.id.conditional_java_text_view); | ||
tv.setText(R.string.conditional_java_text); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...testdata/android_project/kotlin/com/sample/dynamic_features/on_demand/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<manifest xmlns:android='http://schemas.android.com/apk/res/android' | ||
xmlns:dist="http://schemas.android.com/apk/distribution" | ||
package='com.example' | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
|
||
<application> | ||
<activity | ||
android:exported='true' | ||
android:name='com.sample.dynamic_features.on_demand.OnDemandKotlinFeatureActivity'/> | ||
</application> | ||
|
||
<!-- Configure on demand delivery --> | ||
<dist:module | ||
dist:instant="false" | ||
dist:title="@string/title_kotlin"> | ||
<dist:delivery> | ||
<dist:on-demand/> | ||
</dist:delivery> | ||
<dist:fusing dist:include="true"/> | ||
</dist:module> | ||
|
||
</manifest> |
14 changes: 14 additions & 0 deletions
14
...ndroid/testdata/android_project/kotlin/com/sample/dynamic_features/on_demand/BUCK.fixture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
android_library( | ||
name = "src_release", | ||
srcs = glob([ | ||
"OnDemandKotlinFeatureActivity.kt", | ||
]), | ||
manifest = "AndroidManifest.xml", | ||
language = "KOTLIN", | ||
visibility = [ | ||
"PUBLIC", | ||
], | ||
deps = [ | ||
"//res/com/sample/dynamic_features/on_demand/kotlin:kotlin", | ||
], | ||
) |
Oops, something went wrong.