Upgrade to android-components 0.11

Christian Sadilek 6 years ago
parent 5596105d4f
commit 45ff54d111

@ -31,9 +31,21 @@ android {
lintConfig file("${rootDir}/config/lint.xml")
}
flavorDimensions "abi"
flavorDimensions "channel", "abi"
productFlavors {
// GeckoView release channels
nightly {
dimension "channel"
}
beta {
dimension "channel"
}
production {
dimension "channel"
}
// Processor architecture
x86 {
dimension "abi"
}
@ -49,30 +61,84 @@ android {
}
repositories {
// GeckoView ARM
////////////////////////////////////////////////////////////////////////////////////////////
// GeckoView Nightly
////////////////////////////////////////////////////////////////////////////////////////////
// ARM
maven {
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"
}
// x86
maven {
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"
}
// aarch64
maven {
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.${rootProject.ext.gecko['nightlyDate']}.revision.${rootProject.ext.gecko['revision']}.mobile.android-api-16-opt/artifacts/public/android/maven"
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"
}
// GeckoView x86
////////////////////////////////////////////////////////////////////////////////////////////
// GeckoView Beta
////////////////////////////////////////////////////////////////////////////////////////////
// ARM
maven {
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.${rootProject.ext.gecko['nightlyDate']}.revision.${rootProject.ext.gecko['revision']}.mobile.android-x86-opt/artifacts/public/android/maven"
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-beta.revision.${geckoBeta['revision']}.mobile.android-api-16-opt/artifacts/public/android/maven"
}
// GeckoView aarch64
// x86
maven {
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-central.nightly.${rootProject.ext.gecko['nightlyDate']}.revision.${rootProject.ext.gecko['revision']}.mobile.android-aarch64-opt/artifacts/public/android/maven"
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-beta.revision.${geckoBeta['revision']}.mobile.android-x86-opt/artifacts/public/android/maven"
}
// aarch64
maven {
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-beta.revision.${geckoBeta['revision']}.mobile.android-aarch64-opt/artifacts/public/android/maven"
}
////////////////////////////////////////////////////////////////////////////////////////////
// GeckoView Release (60.0.2)
////////////////////////////////////////////////////////////////////////////////////////////
// ARM
maven {
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-release.revision.${geckoRelease['revision']}.mobile.android-api-16-opt/artifacts/public/android/maven"
}
// x86
maven {
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-release.revision.${geckoRelease['revision']}.mobile.android-x86-opt/artifacts/public/android/maven"
}
// aarch64
maven {
url "https://index.taskcluster.net/v1/task/gecko.v2.mozilla-release.revision.${geckoRelease['revision']}.mobile.android-aarch64-opt/artifacts/public/android/maven"
}
}
configurations {
nightlyArmImplementation {}
nightlyX86Implementation {}
nightlyAarch64Implementation {}
betaArmImplementation {}
betaX86Implementation {}
betaAarch64Implementation {}
productionArmImplementation {}
productionX86Implementation {}
productionAarch64Implementation {}
}
dependencies {
implementation "io.sentry:sentry-android:${rootProject.ext.dependencies['sentry']}"
implementation "org.mozilla.components:engine:${rootProject.ext.dependencies['mozillaComponents']}"
implementation "org.mozilla.components:engine-gecko:${rootProject.ext.dependencies['mozillaComponents']}"
implementation "org.mozilla.components:search:${rootProject.ext.dependencies['mozillaComponents']}"
implementation "org.mozilla.components:session:${rootProject.ext.dependencies['mozillaComponents']}"
implementation "org.mozilla.components:abstract-toolbar:${rootProject.ext.dependencies['mozillaComponents']}"
@ -89,9 +155,20 @@ dependencies {
implementation "org.mozilla.photon:icons:${rootProject.ext.dependencies['mozillaComponents']}"
implementation "org.mozilla.photon:progress:${rootProject.ext.dependencies['mozillaComponents']}"
armImplementation "org.mozilla:geckoview-nightly-armeabi-v7a:${rootProject.ext.gecko['version']}"
x86Implementation "org.mozilla:geckoview-nightly-x86:${rootProject.ext.gecko['version']}"
aarch64Implementation "org.mozilla:geckoview-nightly-arm64-v8a:${rootProject.ext.gecko['version']}"
nightlyImplementation "org.mozilla.components:engine-gecko-nightly:${rootProject.ext.dependencies['mozillaComponents']}"
nightlyArmImplementation "org.mozilla:geckoview-nightly-armeabi-v7a:${rootProject.ext.geckoNightly['version']}"
nightlyX86Implementation "org.mozilla:geckoview-nightly-x86:${rootProject.ext.geckoNightly['version']}"
nightlyAarch64Implementation "org.mozilla:geckoview-nightly-arm64-v8a:${rootProject.ext.geckoNightly['version']}"
betaImplementation "org.mozilla.components:engine-gecko-beta:${rootProject.ext.dependencies['mozillaComponents']}"
betaArmImplementation "org.mozilla:geckoview-beta-armeabi-v7a:${rootProject.ext.geckoBeta['version']}"
betaX86Implementation "org.mozilla:geckoview-beta-x86:${rootProject.ext.geckoBeta['version']}"
betaAarch64Implementation "org.mozilla:geckoview-beta-arm64-v8a:${rootProject.ext.geckoBeta['version']}"
productionImplementation "org.mozilla.components:engine-gecko:${rootProject.ext.dependencies['mozillaComponents']}"
productionArmImplementation "org.mozilla:geckoview-release-armeabi-v7a:${rootProject.ext.geckoRelease['version']}"
productionX86Implementation "org.mozilla:geckoview-release-x86:${rootProject.ext.geckoRelease['version']}"
productionAarch64Implementation "org.mozilla:geckoview-release-arm64-v8a:${rootProject.ext.geckoRelease['version']}"
implementation "com.android.support:appcompat-v7:${rootProject.ext.dependencies['supportLibraries']}"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${rootProject.ext.dependencies['kotlin']}"
@ -99,7 +176,6 @@ dependencies {
implementation "com.android.support.constraint:constraint-layout:${rootProject.ext.dependencies['constraintLayout']}"
testImplementation "junit:junit:${rootProject.ext.dependencies['junit']}"
}
// -------------------------------------------------------------------------------------------------

@ -0,0 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.samples.browser
import android.content.Context
import mozilla.components.browser.engine.gecko.GeckoEngine
import mozilla.components.concept.engine.Engine
import org.mozilla.geckoview.GeckoRuntime
object EngineProvider {
fun createEngine(applicationContext: Context): Engine {
val runtime = GeckoRuntime.getDefault(applicationContext)
return GeckoEngine(runtime)
}
}

@ -28,15 +28,15 @@ class MainActivity : AppCompatActivity() {
toolbarFeature = ToolbarFeature(
toolbar,
components.sessionProvider.sessionManager,
components.sessionManager,
components.sessionUseCases.loadUrl,
components.defaultSearchUseCase)
sessionFeature = SessionFeature(
components.sessionProvider,
components.sessionManager,
components.sessionUseCases,
components.engine,
engineView)
engineView,
components.sessionStorage)
lifecycle.addObserver(FeatureLifecycleObserver(sessionFeature, toolbarFeature))
}

@ -5,37 +5,41 @@
package mozilla.fenix.components
import android.content.Context
import android.widget.Toast
import kotlinx.coroutines.experimental.async
import mozilla.components.browser.engine.gecko.GeckoEngine
import mozilla.components.browser.menu.BrowserMenuBuilder
import mozilla.components.browser.menu.item.BrowserMenuItemToolbar
import mozilla.components.browser.search.SearchEngineManager
import mozilla.components.browser.session.Session
import mozilla.components.browser.session.SessionManager
import mozilla.components.browser.session.storage.DefaultSessionStorage
import mozilla.components.concept.engine.Engine
import mozilla.components.feature.search.SearchUseCases
import mozilla.components.feature.session.DefaultSessionStorage
import mozilla.components.feature.session.SessionProvider
import mozilla.components.feature.session.SessionUseCases
import mozilla.fenix.R
import org.mozilla.geckoview.GeckoRuntime
import org.mozilla.samples.browser.EngineProvider
/**
* Helper class for lazily instantiating components needed by the application.
*/
class Components(private val applicationContext: Context) {
// Engine
private val geckoRuntime by lazy {
GeckoRuntime.getDefault(applicationContext)
}
val engine : Engine by lazy { GeckoEngine(geckoRuntime) }
val engine: Engine by lazy { EngineProvider.createEngine(applicationContext) }
// Session
val sessionProvider : SessionProvider by lazy {
SessionProvider(Session("https://www.mozilla.org"), DefaultSessionStorage(applicationContext))
val sessionStorage by lazy { DefaultSessionStorage(applicationContext) }
val sessionManager by lazy {
SessionManager(engine).apply {
sessionStorage.restore(engine, this)
if (size == 0) {
val initialSession = Session("https://www.mozilla.org")
add(initialSession)
}
}
}
val sessionUseCases = SessionUseCases(sessionProvider, engine)
val sessionUseCases = SessionUseCases(sessionManager)
// Search
private val searchEngineManager by lazy {
@ -43,7 +47,7 @@ class Components(private val applicationContext: Context) {
async { load(applicationContext) }
}
}
private val searchUseCases = SearchUseCases(applicationContext, searchEngineManager, sessionProvider)
private val searchUseCases = SearchUseCases(applicationContext, searchEngineManager, sessionManager)
val defaultSearchUseCase = { searchTerms: String -> searchUseCases.defaultSearch.invoke(searchTerms) }
// Menu

@ -0,0 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.samples.browser
import android.content.Context
import mozilla.components.browser.engine.gecko.GeckoEngine
import mozilla.components.concept.engine.Engine
import org.mozilla.geckoview.GeckoRuntime
object EngineProvider {
fun createEngine(applicationContext: Context): Engine {
val runtime = GeckoRuntime.getDefault(applicationContext)
return GeckoEngine(runtime)
}
}

@ -0,0 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.samples.browser
import android.content.Context
import mozilla.components.browser.engine.gecko.GeckoEngine
import mozilla.components.concept.engine.Engine
object EngineProvider {
fun createEngine(applicationContext: Context): Engine {
return GeckoEngine(applicationContext)
}
}

@ -12,14 +12,27 @@ buildscript {
// Testing
junit: '4.12',
// Mozilla
mozillaComponents: '0.7'
mozillaComponents: '0.11'
]
ext.gecko = [
// Discover nightly builds: https://tools.taskcluster.net/index/gecko.v2.mozilla-central.nightly
nightlyDate: '2018.05.16',
revision: 'dedd25bfd2794eaba95225361f82c701e49c9339',
version: '62.0.20180516100458'
// Synchronized versions numbers of GeckoView (Nightly) artifacts.
ext.geckoNightly = [
// Discover nightly builds: https://tools.taskcluster.net/index/gecko.v2.mozilla-central.nightly
nightlyDate: '2018.06.21',
revision: 'e834d23a292972ab4250a8be00e6740c43e41db2',
version: '62.0.20180621100051'
]
// Synchronized versions numbers of GeckoView (Beta) artifacts.
ext.geckoBeta = [
// (61.0b14)
revision: '585281dde9604ddd197693ca5330f2b95987a181',
version: '61.0.20180614135649'
]
ext.geckoRelease = [
revision: 'a0b222c551f586904f51228c49149d9b6b7e2a81',
version: '60.0.2'
]
ext.build = [

Loading…
Cancel
Save