Skip to content

Commit 00fea5b

Browse files
committed
Issue mozilla-mobile#246: Create separate engine-gecko variants based on release channel.
1 parent 1c6ab21 commit 00fea5b

File tree

35 files changed

+1337
-112
lines changed

35 files changed

+1337
-112
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,11 @@ High-level components for building browser(-like) apps.
9595

9696
* 🔵 [**Domains**](components/browser/domains/README.md) Localized and customizable domain lists for auto-completion in browsers.
9797

98-
* 🔴 [**Engine-Gecko**](components/browser/engine-gecko/README.md) - *Engine* implementation based on [GeckoView](https://wiki.mozilla.org/Mobile/GeckoView).
98+
* 🔴 [**Engine-Gecko**](components/browser/engine-gecko/README.md) - *Engine* implementation based on [GeckoView](https://wiki.mozilla.org/Mobile/GeckoView) (Release channel).
99+
100+
* 🔴 [**Engine-Gecko-Beta**](components/browser/engine-gecko-beta/README.md) - *Engine* implementation based on [GeckoView](https://wiki.mozilla.org/Mobile/GeckoView) (Beta channel).
101+
102+
* 🔴 [**Engine-Gecko-Nightly**](components/browser/engine-gecko/README.md) - *Engine* implementation based on [GeckoView](https://wiki.mozilla.org/Mobile/GeckoView) (Nightly channel).
99103

100104
* 🔴 [**Engine-System**](components/browser/engine-system/README.md) - *Engine* implementation based on the system's WebView.
101105

build.gradle

+64-6
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,26 @@ buildscript {
2626
version: '0.11'
2727
]
2828

29-
// Synchronized versions numbers of GeckoView artifacts.
30-
ext.gecko = [
29+
// Synchronized versions numbers of GeckoView (Nightly) artifacts.
30+
ext.geckoNightly = [
3131
// Discover nightly builds: https://tools.taskcluster.net/index/gecko.v2.mozilla-central.nightly
3232
nightlyDate: '2018.05.16',
3333
revision: 'dedd25bfd2794eaba95225361f82c701e49c9339',
3434
version: '62.0.20180516100458'
3535
]
3636

37+
// Synchronized versions numbers of GeckoView (Beta) artifacts.
38+
ext.geckoBeta = [
39+
// (61.0b14)
40+
revision: '585281dde9604ddd197693ca5330f2b95987a181',
41+
version: '61.0.20180614135649'
42+
]
43+
44+
ext.geckoRelease = [
45+
revision: 'a0b222c551f586904f51228c49149d9b6b7e2a81',
46+
version: '60.0.2'
47+
]
48+
3749
repositories {
3850
google()
3951
jcenter()
@@ -59,15 +71,61 @@ allprojects {
5971
google()
6072
jcenter()
6173

62-
// GeckoView repositories
74+
////////////////////////////////////////////////////////////////////////////////////////////
75+
// GeckoView Nightly
76+
////////////////////////////////////////////////////////////////////////////////////////////
77+
78+
// ARM
79+
maven {
80+
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.${geckoNightly['nightlyDate']}.revision.${geckoNightly['revision']}.mobile.android-api-16-opt/artifacts/public/android/maven"
81+
}
82+
83+
// x86
6384
maven {
64-
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.${gecko['nightlyDate']}.revision.${gecko['revision']}.mobile.android-api-16-opt/artifacts/public/android/maven"
85+
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.${geckoNightly['nightlyDate']}.revision.${geckoNightly['revision']}.mobile.android-x86-opt/artifacts/public/android/maven"
6586
}
87+
88+
// aarch64
6689
maven {
67-
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.${gecko['nightlyDate']}.revision.${gecko['revision']}.mobile.android-x86-opt/artifacts/public/android/maven"
90+
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.${geckoNightly['nightlyDate']}.revision.${geckoNightly['revision']}.mobile.android-aarch64-opt/artifacts/public/android/maven"
6891
}
92+
93+
////////////////////////////////////////////////////////////////////////////////////////////
94+
// GeckoView Beta
95+
////////////////////////////////////////////////////////////////////////////////////////////
96+
97+
// ARM
98+
maven {
99+
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-beta.revision.${geckoBeta['revision']}.mobile.android-api-16-opt/artifacts/public/android/maven"
100+
}
101+
102+
// x86
103+
maven {
104+
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-beta.revision.${geckoBeta['revision']}.mobile.android-x86-opt/artifacts/public/android/maven"
105+
}
106+
107+
// aarch64
108+
maven {
109+
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-beta.revision.${geckoBeta['revision']}.mobile.android-aarch64-opt/artifacts/public/android/maven"
110+
}
111+
112+
////////////////////////////////////////////////////////////////////////////////////////////
113+
// GeckoView Release (60.0.2)
114+
////////////////////////////////////////////////////////////////////////////////////////////
115+
116+
// ARM
117+
maven {
118+
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-release.revision.${geckoRelease['revision']}.mobile.android-api-16-opt/artifacts/public/android/maven"
119+
}
120+
121+
// x86
122+
maven {
123+
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-release.revision.${geckoRelease['revision']}.mobile.android-x86-opt/artifacts/public/android/maven"
124+
}
125+
126+
// aarch64
69127
maven {
70-
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.${gecko['nightlyDate']}.revision.${gecko['revision']}.mobile.android-aarch64-opt/artifacts/public/android/maven"
128+
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-release.revision.${geckoRelease['revision']}.mobile.android-aarch64-opt/artifacts/public/android/maven"
71129
}
72130
}
73131
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# [Android Components](../../../README.md) > Browser > Engine-Gecko
2+
3+
[*Engine*](../../concept/engine/README.md) implementation based on [GeckoView](https://wiki.mozilla.org/Mobile/GeckoView) (Beta channel).
4+
5+
## Usage
6+
7+
### Setting up the dependency
8+
9+
Use gradle to download the library from JCenter:
10+
11+
```Groovy
12+
implementation "org.mozilla.components:engine-gecko-beta:{latest-version}
13+
```
14+
15+
## License
16+
17+
This Source Code Form is subject to the terms of the Mozilla Public
18+
License, v. 2.0. If a copy of the MPL was not distributed with this
19+
file, You can obtain one at http://mozilla.org/MPL/2.0/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
apply plugin: 'com.android.library'
6+
apply plugin: 'kotlin-android'
7+
8+
android {
9+
compileSdkVersion rootProject.ext.build['compileSdkVersion']
10+
11+
defaultConfig {
12+
minSdkVersion rootProject.ext.build['minSdkVersion']
13+
targetSdkVersion rootProject.ext.build['targetSdkVersion']
14+
}
15+
16+
lintOptions {
17+
warningsAsErrors true
18+
abortOnError true
19+
}
20+
21+
buildTypes {
22+
release {
23+
minifyEnabled false
24+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
25+
}
26+
}
27+
}
28+
29+
dependencies {
30+
implementation project(':concept-engine')
31+
32+
// We only compile against the ARM artifact. We let the app decide which artifact to actually
33+
// use at runtime. As the Kotlin/Java API is the same for all ABIs it is not important which one
34+
// we import here.
35+
compileOnly "org.mozilla:geckoview-beta-armeabi-v7a:${rootProject.ext.geckoBeta['version']}"
36+
testImplementation "org.mozilla:geckoview-beta-armeabi-v7a:${rootProject.ext.geckoBeta['version']}"
37+
38+
implementation "org.jetbrains.kotlin:kotlin-stdlib:${rootProject.ext.dependencies['kotlin']}"
39+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${rootProject.ext.dependencies['coroutines']}"
40+
41+
testImplementation "junit:junit:${rootProject.ext.dependencies['junit']}"
42+
testImplementation "org.robolectric:robolectric:${rootProject.ext.dependencies['robolectric']}"
43+
testImplementation "org.mockito:mockito-core:${rootProject.ext.dependencies['mockito']}"
44+
testImplementation "com.android.support:appcompat-v7:${rootProject.ext.dependencies['supportLibraries']}"
45+
}
46+
47+
archivesBaseName = "engine-gecko-beta"
48+
49+
apply from: '../../../publish.gradle'
50+
ext.configurePublish(
51+
'org.mozilla.components',
52+
'engine-gecko-beta',
53+
'Engine implementation based on GeckoView (Beta channel).')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!-- This Source Code Form is subject to the terms of the Mozilla Public
2+
- License, v. 2.0. If a copy of the MPL was not distributed with this
3+
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
4+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
5+
package="mozilla.components.browser.engine.gecko" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* This Source Code Form is subject to the terms of the Mozilla Public
2+
* License, v. 2.0. If a copy of the MPL was not distributed with this
3+
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4+
5+
package mozilla.components.browser.engine.gecko
6+
7+
import android.content.Context
8+
import android.util.AttributeSet
9+
import mozilla.components.concept.engine.Engine
10+
import mozilla.components.concept.engine.EngineSession
11+
import mozilla.components.concept.engine.EngineView
12+
import org.mozilla.geckoview.GeckoRuntime
13+
14+
/**
15+
* Gecko-based implementation of Engine interface.
16+
*/
17+
class GeckoEngine(
18+
private val runtime: GeckoRuntime
19+
) : Engine {
20+
21+
/**
22+
* Create a new Gecko-based EngineView.
23+
*/
24+
override fun createView(context: Context, attrs: AttributeSet?): EngineView {
25+
return GeckoEngineView(context, attrs)
26+
}
27+
28+
/**
29+
* Create a new Gecko-based EngineSession.
30+
*/
31+
override fun createSession(): EngineSession {
32+
return GeckoEngineSession(runtime)
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package mozilla.components.browser.engine.gecko
2+
3+
/**
4+
* Exception type used for errors caught when interacting with Gecko.
5+
*/
6+
class GeckoEngineException(message: String) : RuntimeException(message)

0 commit comments

Comments
 (0)