1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-09-16 20:12:25 +02:00

Create base for compose project

This commit is contained in:
Allan Wang 2023-06-17 21:02:19 -07:00
parent 30670b14e7
commit 397844a767
No known key found for this signature in database
GPG Key ID: C93E3F9C679D7A56
13 changed files with 325 additions and 41 deletions

View File

@ -6,8 +6,6 @@
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
</value>
</option>
<option name="NAME_COUNT_TO_USE_STAR_IMPORT" value="2147483647" />
<option name="NAME_COUNT_TO_USE_STAR_IMPORT_FOR_MEMBERS" value="2147483647" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<codeStyleSettings language="XML">

View File

@ -3,6 +3,8 @@
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11">
<module name="Frost-for-Facebook.buildSrc" target="11" />
<module name="Frost-for-Facebook.buildSrc.main" target="11" />
<module name="Frost-for-Facebook.buildSrc.test" target="11" />
</bytecodeTargetLevel>
</component>
</project>

6
.idea/kotlinc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.8.21" />
</component>
</project>

View File

@ -13,7 +13,7 @@
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="14">
<list size="15">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
@ -28,12 +28,13 @@
<item index="11" class="java.lang.String" itemvalue="org.eclipse.jdt.annotation.Nullable" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.annotations.Nullable" />
<item index="13" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.Nullable" />
<item index="14" class="java.lang.String" itemvalue="org.jspecify.nullness.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="14">
<list size="15">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
@ -48,11 +49,12 @@
<item index="11" class="java.lang.String" itemvalue="io.reactivex.annotations.NonNull" />
<item index="12" class="java.lang.String" itemvalue="io.reactivex.rxjava3.annotations.NonNull" />
<item index="13" class="java.lang.String" itemvalue="lombok.NonNull" />
<item index="14" class="java.lang.String" itemvalue="org.jspecify.nullness.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="adopt-11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">

1
app-compose/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/build

241
app-compose/build.gradle Normal file
View File

@ -0,0 +1,241 @@
plugins {
id "com.android.application"
id "org.jetbrains.kotlin.android"
id "kotlin-kapt"
id "dagger.hilt.android.plugin"
id "com.google.devtools.ksp"
}
android {
compileSdk 33
defaultConfig {
applicationId "com.pitchedapps.frost"
minSdk 26
targetSdk 33
versionCode 1
versionName "1.0"
multiDexEnabled = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
// GeckoView
// https://bugzilla.mozilla.org/show_bug.cgi?id=1571175
// Replaces `android.bundle.enableUncompressedNativeLibs = false` in gradle.properties
packagingOptions {
jniLibs {
useLegacyPackaging = true
}
}
buildFeatures {
compose = true
}
composeOptions {
// https://developer.android.com/jetpack/androidx/releases/compose-compiler
kotlinCompilerExtensionVersion = "1.4.7"
}
buildTypes {
debug {
minifyEnabled false
shrinkResources false
applicationIdSuffix ".compose.debug"
versionNameSuffix "-compose-debug"
signingConfig signingConfigs.debug
resValue "string", "frost_name", "Frost Compose Debug"
resValue "string", "frost_web", "Frost Compose Web Debug"
// kotlinOptions.freeCompilerArgs += compilerArgs
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
androidTest.java.srcDirs += 'src/androidTest/kotlin'
main.assets.srcDirs += ['src/web/assets']
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = '17'
}
applicationVariants.configureEach { variant ->
variant.outputs.all {
outputFileName = "${project.APP_ID}-${variant.buildType.name}.apk"
}
}
namespace 'com.pitchedapps.frost'
def testKeystoreFile = file('../files/test.keystore')
def testPropFile = file('../files/test.properties')
def withTestSigning = testKeystoreFile.exists() && testPropFile.exists()
def releaseKeystoreFile = file('../files/release.keystore')
def releasePropFile = file('../files/release.properties')
def withReleaseSigning = releaseKeystoreFile.exists() && releasePropFile.exists()
signingConfigs {
debug {
storeFile file("../files/debug.keystore")
storePassword "debugKey"
keyAlias "debugKey"
keyPassword "debugKey"
}
if (withTestSigning) {
def testProps = new Properties()
testPropFile.withInputStream { testProps.load(it) }
test {
storeFile testKeystoreFile
storePassword testProps.getProperty('storePassword')
keyAlias testProps.getProperty('keyAlias')
keyPassword testProps.getProperty('keyPassword')
}
}
if (withReleaseSigning) {
def releaseProps = new Properties()
releasePropFile.withInputStream { releaseProps.load(it) }
release {
storeFile releaseKeystoreFile
storePassword releaseProps.getProperty('storePassword')
keyAlias releaseProps.getProperty('keyAlias')
keyPassword releaseProps.getProperty('keyPassword')
}
}
}
}
// Select the Glean from GeckoView.
// `service-sync-logins` requires Glean, which pulls in glean-native,
// but that's also provided by geckoview-omni, so now we need to select which one to use.
project.configurations.configureEach {
resolutionStrategy.capabilitiesResolution.withCapability("org.mozilla.telemetry:glean-native") {
def toBeSelected = candidates.find { it.id instanceof ModuleComponentIdentifier && it.id.module.contains('geckoview') }
if (toBeSelected != null) {
select(toBeSelected)
}
because 'use GeckoView Glean instead of standalone Glean'
}
}
dependencies {
implementation "androidx.core:core-ktx:1.10.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1"
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "com.google.android.material:material:1.9.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.multidex:multidex:2.0.1"
testImplementation "junit:junit:4.13.2"
testImplementation "com.google.truth:truth:1.1.3"
testImplementation "org.json:json:20220320"
androidTestImplementation "androidx.test.ext:junit:1.1.5"
androidTestImplementation "androidx.test.espresso:espresso-core:3.5.1"
def hilt = "2.43.2"
implementation "com.google.dagger:hilt-android:${hilt}"
kapt "com.google.dagger:hilt-android-compiler:${hilt}"
testImplementation "com.google.dagger:hilt-android:${hilt}"
kaptTest "com.google.dagger:hilt-android-compiler:${hilt}"
def flogger = "0.7.1"
implementation "com.google.flogger:flogger:${flogger}"
implementation "com.google.flogger:flogger-system-backend:${flogger}"
def moshi = "1.14.0"
implementation "com.squareup.moshi:moshi-kotlin:${moshi}"
implementation "com.squareup.moshi:moshi-adapters:${moshi}"
ksp "com.squareup.moshi:moshi-kotlin-codegen:${moshi}"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1"
// https://maven.mozilla.org/?prefix=maven2/org/mozilla/geckoview/geckoview-beta/
def geckoviewChannel = "beta"
def geckoviewVersion = "105.0.20220908185813"
// implementation "org.mozilla.geckoview:geckoview-${geckoviewChannel}:${geckoviewVersion}"
// https://maven.mozilla.org/maven2/org/mozilla/components/browser-engine-gecko/maven-metadata.xml
// https://github.com/mozilla-mobile/reference-browser/blob/master/buildSrc/src/main/java/AndroidComponents.kt
// https://nightly.maven.mozilla.org/maven2/org/mozilla/components/browser-engine-gecko/maven-metadata.xml
def mozillaAndroidComponents = "116.0.20230617040331"
implementation "org.mozilla.components:browser-engine-gecko:${mozillaAndroidComponents}"
implementation "org.mozilla.components:browser-domains:${mozillaAndroidComponents}"
implementation "org.mozilla.components:browser-icons:${mozillaAndroidComponents}"
implementation "org.mozilla.components:browser-menu:${mozillaAndroidComponents}"
implementation "org.mozilla.components:browser-session-storage:${mozillaAndroidComponents}"
implementation "org.mozilla.components:browser-state:${mozillaAndroidComponents}"
implementation "org.mozilla.components:browser-toolbar:${mozillaAndroidComponents}"
implementation "org.mozilla.components:concept-engine:${mozillaAndroidComponents}"
implementation "org.mozilla.components:concept-menu:${mozillaAndroidComponents}"
implementation "org.mozilla.components:concept-storage:${mozillaAndroidComponents}"
implementation "org.mozilla.components:concept-toolbar:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-app-links:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-addons:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-autofill:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-awesomebar:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-contextmenu:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-downloads:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-findinpage:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-logins:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-media:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-prompts:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-push:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-session:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-sitepermissions:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-tabs:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-toolbar:${mozillaAndroidComponents}"
implementation "org.mozilla.components:feature-webnotifications:${mozillaAndroidComponents}"
implementation "org.mozilla.components:support-ktx:${mozillaAndroidComponents}"
implementation "org.mozilla.components:support-webextensions:${mozillaAndroidComponents}"
implementation "org.mozilla.components:ui-autocomplete:${mozillaAndroidComponents}"
implementation "org.mozilla.components:compose-engine:${mozillaAndroidComponents}"
implementation "org.mozilla.components:lib-state:${mozillaAndroidComponents}"
// Compose
def composeVersion = "1.4.3"
implementation("androidx.compose.ui:ui:${composeVersion}")
implementation("androidx.activity:activity-compose:1.7.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
// Tooling support (Previews, etc.)
implementation("androidx.compose.ui:ui-tooling:${composeVersion}")
// Foundation (Border, Background, Box, Image, Scroll, shapes, animations, etc.)
implementation("androidx.compose.foundation:foundation:${composeVersion}")
// Material Design
implementation("androidx.compose.material:material:${composeVersion}")
// Material design icons
implementation("androidx.compose.material:material-icons-core:${composeVersion}")
implementation("androidx.compose.material:material-icons-extended:${composeVersion}")
}
configurations {
configureEach {
// https://stackoverflow.com/q/69817925
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
}
}

21
app-compose/proguard-rules.pro vendored Normal file
View File

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

View File

@ -1,37 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath kau.Plugins.android
classpath kau.Plugins.kotlin
classpath kau.Plugins.spotless
classpath kau.Plugins.dexCount
classpath kau.Plugins.hilt
classpath kau.Plugins.gitVersion
classpath('com.google.dagger:hilt-android-gradle-plugin:2.43.2')
}
wrapper.setDistributionType(Wrapper.DistributionType.ALL)
}
task generateChangelogMd() {
def changelog = kau.ChangelogGenerator.generate("${project.rootDir}/app/src/main/res/xml/frost_changelog.xml", "${project.rootDir}/docs/Changelog.md")
// If we have no changelog, something is wrong
def entry = changelog[0]
def whatsNewFile = new File("${project.rootDir}/app/src/main/play/en-US/whatsnew")
if (!whatsNewFile.exists()) {
// Throw exceptions so that moving this file will require us to update the script
throw new RuntimeException("Whatsnew file not found")
}
whatsNewFile.withWriter { writer ->
writer.write(entry.version)
writer.write("\n")
entry.items.each {
writer.write("\n* ${it}")
}
}
}
plugins {
id 'com.android.application' version '8.0.2' apply false
id 'com.android.library' version '8.0.2' apply false
id 'org.jetbrains.kotlin.android' version '1.8.21' apply false
// https://mvnrepository.com/artifact/com.google.devtools.ksp/com.google.devtools.ksp.gradle.plugin
id 'com.google.devtools.ksp' version '1.8.21-1.0.11' apply false
}
tasks.register('clean', Delete) {
delete rootProject.buildDir
}

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@ -1,3 +1,35 @@
include(":app", ":gradle-plugin")
import java.net.URI
project(":gradle-plugin").projectDir = file("buildSrc")
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
name = "Mozilla Nightly"
url = URI("https://nightly.maven.mozilla.org/maven2")
content {
// Always fetch components from the snapshots repository
includeGroup("org.mozilla.components")
}
}
maven {
name = "Mozilla"
url = URI("https://maven.mozilla.org/maven2")
content {
// Never fetch components from here. We always want to use snapshots.
excludeGroup("org.mozilla.components")
}
}
}
}
include(":app-compose")