Skip to content

Commit

Permalink
chore: project update and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Oct 21, 2023
1 parent 8b3f4b8 commit 681b14b
Show file tree
Hide file tree
Showing 43 changed files with 829 additions and 403 deletions.
64 changes: 49 additions & 15 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const ignoreWarnings = new Set(['a11y-no-onchange', 'a11y-label-has-associated-control', 'a11y-autofocus']);
const ignoreWarnings = ['a11y-no-onchange', 'a11y-label-has-associated-control', 'illegal-attribute-character'];
module.exports = {
extends: ['plugin:prettier/recommended'],
globals: { gVars: true, SENTRY_DSN: true, SENTRY_PREFIX: true, PRODUCTION: true, OWM_KEY: true, __ANDROID__: true, __IOS__: true, LatLonKeys: true, DEV_LOG: true },
extends: ['plugin:prettier/recommended', 'plugin:@typescript-eslint/recommended-type-checked', 'plugin:svelte/recommended'],
env: {
es6: true,
node: true
Expand All @@ -9,32 +10,61 @@ module.exports = {
parser: '@typescript-eslint/parser',

parserOptions: {
ecmaVersion: 2019,
ecmaVersion: 2021,
sourceType: 'module',
project: ['tsconfig.eslint.json'],
// extraFileExtensions: ['.svelte'],
warnOnUnsupportedTypeScriptVersion: false,
project: 'tsconfig.eslint.json',
extraFileExtensions: ['.svelte'],
tsconfigRootDir: __dirname
},
globals: { gVars: true, SENTRY_DSN: true, SENTRY_PREFIX: true, PRODUCTION: true, OWM_KEY: true },
plugins: ['prettier', 'svelte3', '@typescript-eslint'],
plugins: ['prettier', '@typescript-eslint'],
overrides: [
{ files: ['*.svelte'], processor: 'svelte3/svelte3' },
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
sourceType: 'module',
ecmaVersion: 2021,
parser: '@typescript-eslint/parser'
},
rules: {
'no-undef': 'off',
'svelte/sort-attributes': 'warn',
'svelte/no-inner-declarations': 'off',
'svelte/valid-compile': [
'error',
{
ignoreWarnings: true
}
]
}
},
{
files: '*.ts',
rules: {
'eslint-plugin-svelte3/parse-error': 'off',
// 'eslint-plugin-svelte/parse-error': 'off',
'no-undef': 'off'
}
}
],
settings: {
'svelte3/ignore-warnings': (w) => ignoreWarnings.has(w && w.code),
'svelte3/typescript': true // load TypeScript as peer dependency
svelte: {
ignoreWarnings
}
},
rules: {
'prettier/prettier': 'warn',
'eslint-plugin-svelte3/invalid-binding': 'off',
'svelte/no-inner-declarations': 'off',
'prettier/prettier': [
'warn',
{
// parser: 'typescript'
}
],
'@typescript-eslint/unbound-method': 'off',
'no-duplicate-imports': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',
'@typescript-eslint/adjacent-overload-signatures': 'off',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/await-thenable': 'error',
Expand All @@ -48,7 +78,12 @@ module.exports = {
accessibility: 'explicit'
}
],
'@typescript-eslint/no-misused-promises': 'off',
'@typescript-eslint/no-unsafe-argument': 'off',
'@typescript-eslint/no-unsafe-call': 'off',
'@typescript-eslint/indent': 'off',
'@typescript-eslint/require-await': 'off',
'@typescript-eslint/ban-ts-comment': 'warn',
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/member-delimiter-style': 'error',
'@typescript-eslint/member-ordering': 'off',
Expand Down Expand Up @@ -146,7 +181,6 @@ module.exports = {
'no-constant-condition': 'error',
'no-control-regex': 'off',
'no-debugger': 'error',
'no-duplicate-imports': 'error',
'no-empty': 'off',
'no-eval': 'off',
'no-extra-semi': 'off',
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ yarn-error.log*
.idea
.cloud
.project
.yarn
tmp/
typings/

Expand Down
10 changes: 9 additions & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@
"semi": true,
"tabWidth": 4,
"singleQuote": true,
"trailingComma": "none"
"parser": "typescript",
"trailingComma": "none",
"plugins": [
"prettier-plugin-svelte"
],
"svelteSortOrder": "options-styles-scripts-markup",
"svelteStrictMode": false,
"svelteBracketNewLine": false,
"svelteIndentScriptAndStyle": true
}
77 changes: 45 additions & 32 deletions App_Resources/Android/app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
project.ext.abiCodes = ['armeabi':1, 'armeabi-v7a':2, 'arm64-v8a':3, 'x86':4, 'x86_64':5]
def BUILD_TOOLS_PATH = "$rootDir/build-tools"

apply plugin: "androidx.baselineprofile"
apply plugin: "org.jetbrains.kotlin.android"

android {
// we only enable split if specified as an arg or if in debug and abiFilters is used(through cli)
def splitEnabled = (gradle.startParameter.taskNames.contains("assembleDebug") && project.hasProperty('abiFilters')) || project.hasProperty('splitEnabled');
Expand Down Expand Up @@ -41,13 +44,13 @@ android {
path "src/main/cpp/CMakeLists.txt"
}
}
kotlin {
jvmToolchain(17)
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
// kotlinOptions {
// jvmTarget = JavaVersion.VERSION_11
// }
lintOptions {
// disable("LintError")
checkReleaseBuilds false
Expand Down Expand Up @@ -82,11 +85,11 @@ android {
release {
// Enables code shrinking, obfuscation, and optimization for only
// your project's release build type.
// minifyEnabled true
minifyEnabled true

// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
// shrinkResources true
shrinkResources true

// Disables PNG crunching for the release build type.
crunchPngs false
Expand All @@ -95,10 +98,10 @@ android {
// Includes the default ProGuard rules files that are packaged with
// the Android Gradle plugin. To learn more, go to the section about
// R8 configuration files.
// def absolutePathToAppResources = getAppResourcesPath()
// proguardFiles getDefaultProguardFile(
// 'proguard-android-optimize.txt'),
// "$BUILD_TOOLS_PATH/proguard-rules.pro"
def absolutePathToAppResources = getAppResourcesPath()
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
"$BUILD_TOOLS_PATH/proguard-rules.pro"

debuggable false
jniDebuggable false
Expand All @@ -107,6 +110,13 @@ android {
debug {
multiDexEnabled true;
}
benchmark {
initWith release
proguardFiles("../benchmark/benchmark-rules.pro")
signingConfig signingConfigs.debug
matchingFallbacks = ['release']
debuggable false
}
}
packagingOptions {
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
Expand All @@ -128,23 +138,23 @@ android {
// }
}

// task createProguard {
// dependsOn 'buildMetadata'
// doLast {
// exec {
// workingDir "$USER_PROJECT_ROOT"
// commandLine 'node', 'scripts/createProguard.js'
// }
// }
// }
// tasks.whenTaskAdded({ DefaultTask currentTask ->
// if (currentTask =~ /buildMetadata/) {
// currentTask.finalizedBy(createProguard)
// }
// if (currentTask =~ /minify.*WithR8/) {
// currentTask.dependsOn(createProguard)
// }
// })
task createProguard {
dependsOn 'buildMetadata'
doLast {
exec {
workingDir "$USER_PROJECT_ROOT"
commandLine 'node', 'scripts/createProguard.js'
}
}
}
project.tasks.configureEach {
if (name =~ /buildMetadata/) {
it.finalizedBy(createProguard)
}
if (name =~ /minify(Debug|Release)WithR8/) {
it.dependsOn(createProguard)
}
}

android.applicationVariants.all { variant ->
if (project.hasProperty('splitEnabled')) {
Expand All @@ -160,16 +170,19 @@ android.applicationVariants.all { variant ->
}
}
dependencies {
def computeKotlinVersion = { -> project.hasProperty("kotlinVersion") ? kotlinVersion : "${ns_default_kotlin_version}" }
def kotlinVersion = computeKotlinVersion()
def androidxVersion = project.hasProperty("androidxVersion") ? project.androidxVersion : "1.2.0"
implementation "androidx.core:core-ktx:$androidxVersion"
implementation 'com.otaliastudios:cameraview:2.7.2'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'androidx.core:core-splashscreen:1.0.1'
constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.10") {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion") {
because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10") {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") {
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
}
}
implementation "androidx.profileinstaller:profileinstaller:1.3.1"
baselineProfile project(':benchmark')
}
9 changes: 5 additions & 4 deletions App_Resources/Android/before-plugins.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
ext {
compileSdk = 34
targetSdk = 34
androidBuildToolsVersion = "7.3.0"
buildToolsVersion = "33.0.1"
androidxVersion = "1.12.0"
kotlinVersion = "1.9.10"
androidBuildToolsVersion = "8.2.0-beta06"
buildToolsVersion = "34.0.0"
androidxVersion = "1.11.0-beta02"
androidXAppCompat = "1.6.1"
androidXAppCompatVersion = "1.6.1"
androidXFragment = "1.6.1"
androidXTransition = "1.4.1"
androidXRecyclerViewVersion = "1.3.1"
androidxViewPager2Version = "1.1.0-beta02"
androidXSwipeRefreshLayoutViewVersion = "1.2.0-alpha01"
androidXMaterial = "1.9.0"
androidXMaterial = "1.10.0"
androidXBrowser = "1.6.0"
androidXPreferenceVersion = "1.2.1"
okHttpVersion = "4.10.0"
Expand Down
1 change: 1 addition & 0 deletions App_Resources/Android/benchmark/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
1 change: 1 addition & 0 deletions App_Resources/Android/benchmark/benchmark-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-dontobfuscate
101 changes: 101 additions & 0 deletions App_Resources/Android/benchmark/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import com.android.build.api.dsl.ManagedVirtualDevice


plugins {
id 'com.android.test'
id 'org.jetbrains.kotlin.android'
}

android {
namespace 'com.akylas.weather.benchmark'
compileSdk 34

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
defaultConfig {
minSdk 24
targetSdk 34

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

kotlin {
jvmToolchain(17)
}

buildTypes {
// This benchmark buildType is used for benchmarking, and should function like your
// release build (for example, with minification on). It's signed with a debug key
// for easy local/CI testing.
benchmark {
debuggable = true
signingConfig = debug.signingConfig
matchingFallbacks = ["debug"]
}
}

testOptions {
managedDevices {
devices {
pixel2Api31(ManagedVirtualDevice) {
device = "Pixel 2"
apiLevel = 31
systemImageSource = "aosp"
}
}
}
}

targetProjectPath = ":app"
experimentalProperties["android.experimental.self-instrumenting"] = true
}

dependencies {
implementation 'androidx.test.ext:junit:1.1.5'
implementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.test.uiautomator:uiautomator:2.2.0'
implementation 'androidx.benchmark:benchmark-macro-junit4:1.2.0-rc02'
}

androidComponents {
beforeVariants(selector().all()) {
enable = buildType == "benchmark"
}
}


// duplicated from app. should be refactored
def externalRuntimeExists = !findProject(':runtime').is(null)
def pluginDependencies

repositories {
// used for local *.AAR files
pluginDependencies = nativescriptDependencies.collect {
"$rootDir/${it.directory}/$PLATFORMS_ANDROID"
}

// some plugins may have their android dependencies in a /libs subdirectory
pluginDependencies.addAll(nativescriptDependencies.collect {
"$rootDir/${it.directory}/$PLATFORMS_ANDROID/libs"
})

if (!externalRuntimeExists) {
pluginDependencies.add("$rootDir/app/libs/runtime-libs")
}

def appResourcesPath = getAppResourcesPath()
def localAppResourcesLibraries = "$appResourcesPath/Android/libs"

pluginDependencies.add(localAppResourcesLibraries)

if (pluginDependencies.size() > 0) {

flatDir {
dirs pluginDependencies
}
}

mavenCentral()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<manifest />
Loading

0 comments on commit 681b14b

Please sign in to comment.