diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index e47ed0f0..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,108 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlin-parcelize' -apply plugin: 'kotlin-kapt' - -android { - compileSdkVersion 33 - - defaultConfig { - applicationId "com.fingerprintjs.android.playground" - minSdkVersion 21 - targetSdkVersion 33 - versionCode Integer.parseInt(project.VERSION_CODE) - versionName project.VERSION_NAME - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - signingConfigs { - release { - def keystoreProperties = new Properties() - def keystorePropsFile = file("keystore/keystore_config") - - if (keystorePropsFile.exists()) { - file("keystore/keystore_config").withInputStream { keystoreProperties.load(it) } - storeFile file("$keystoreProperties.storeFile") - storePassword "$keystoreProperties.storePassword" - keyAlias "$keystoreProperties.keyAlias" - keyPassword "$keystoreProperties.keyPassword" - } else { - storeFile file("release.jks") - storePassword System.getenv('KEYSTORE_PASSWORD') - keyAlias System.getenv('RELEASE_SIGN_KEY_ALIAS') - keyPassword System.getenv('RELEASE_SIGN_KEY_PASSWORD') - } - } - releaseDummySign { - storeFile file("release_dummy.jks") - storePassword "password" - keyAlias "key0" - keyPassword "password" - } - } - - buildTypes { - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.release - } - // build release app locally using a dummy signature - releaseDummySign { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - signingConfig signingConfigs.releaseDummySign - matchingFallbacks = ['release'] - } - // same as previous, but also profileable - // when changing the name of the following build type, don't forget to update src/{this_build_type} dir - releaseDummySignProfileable { - initWith(buildTypes.releaseDummySign) - } - } - namespace 'com.fingerprintjs.android.playground' - - applicationVariants.all { variant -> - variant.outputs.all { - outputFileName = "Playground-${variant.name}-${variant.versionName}.apk" - } - } - - - buildFeatures { - compose true - } - - composeOptions { - kotlinCompilerExtensionVersion = "1.4.7" - } -} - -dependencies { - implementation project(":fingerprint") - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'com.google.android.material:material:1.9.0' - implementation 'androidx.core:core-ktx:1.10.0' - implementation 'androidx.appcompat:appcompat:1.6.1' - - def composeBom = platform('androidx.compose:compose-bom:2022.11.00') - implementation composeBom - androidTestImplementation composeBom - implementation 'androidx.compose.material3:material3' - implementation 'androidx.compose.ui:ui-tooling-preview' - debugImplementation 'androidx.compose.ui:ui-tooling' - implementation 'androidx.compose.material:material-icons-extended' - implementation 'androidx.activity:activity-compose:1.7.1' - implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1' - implementation "androidx.navigation:navigation-compose:2.5.3" - implementation 'androidx.core:core-splashscreen:1.0.1' - - implementation "com.google.accompanist:accompanist-pager:0.27.0" - - implementation 'com.google.dagger:dagger:2.44' - kapt 'com.google.dagger:dagger-compiler:2.44' - - implementation 'com.google.code.gson:gson:2.10' -} diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..e6a5a6bc --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,102 @@ +import com.android.build.gradle.internal.api.BaseVariantOutputImpl + +plugins { + id("com.android.application") + id("kotlin-android") + id("kotlin-parcelize") + id("kotlin-kapt") +} + +android { + compileSdk = 33 + + defaultConfig { + applicationId = "com.fingerprintjs.android.playground" + minSdk = 21 + targetSdk = 33 + versionCode = Integer.parseInt(project.property("VERSION_CODE") as String) + versionName = project.property("VERSION_NAME") as String + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + signingConfigs { + create("release") { + storeFile = file("release.jks") + storePassword = System.getenv("KEYSTORE_PASSWORD") + keyAlias = System.getenv("RELEASE_SIGN_KEY_ALIAS") + keyPassword = System.getenv("RELEASE_SIGN_KEY_PASSWORD") + } + + create("releaseDummySign") { + storeFile = file("release_dummy.jks") + storePassword = "password" + keyAlias = "key0" + keyPassword = "password" + } + } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + signingConfig = signingConfigs.getByName("release") + } + // build release app locally using a dummy signature + create("releaseDummySign") { + isMinifyEnabled = true + proguardFiles (getDefaultProguardFile ("proguard-android-optimize.txt"), "proguard-rules.pro") + signingConfig = signingConfigs.getByName("releaseDummySign") + setMatchingFallbacks("release") + } + // same as previous, but also profileable + // when changing the name of the following build type, don't forget to update src/{this_build_type} dir + create("releaseDummySignProfileable") { + initWith(buildTypes.getByName("releaseDummySign")) + } + } + + namespace = "com.fingerprintjs.android.playground" + + applicationVariants.all { + val variant = this + this.outputs.all { + (this as? BaseVariantOutputImpl)?.outputFileName = "Playground-${variant.name}-${variant.versionName}.apk" + } + } + + buildFeatures { + compose = true + } + + composeOptions { + kotlinCompilerExtensionVersion = "1.4.7" + } +} + +dependencies { + implementation(project(":fingerprint")) + implementation("org.jetbrains.kotlin:kotlin-stdlib:${Constants.kotlinVersion}") + implementation("com.google.android.material:material:1.9.0") + implementation("androidx.core:core-ktx:1.10.0") + implementation("androidx.appcompat:appcompat:1.6.1") + + val composeBom = platform("androidx.compose:compose-bom:2022.11.00") + implementation(composeBom) + androidTestImplementation(composeBom) + implementation("androidx.compose.material3:material3") + implementation("androidx.compose.ui:ui-tooling-preview") + debugImplementation("androidx.compose.ui:ui-tooling") + implementation("androidx.compose.material:material-icons-extended") + implementation("androidx.activity:activity-compose:1.7.1") + implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1") + implementation("androidx.navigation:navigation-compose:2.5.3") + implementation("androidx.core:core-splashscreen:1.0.1") + + implementation("com.google.accompanist:accompanist-pager:0.27.0") + + implementation("com.google.dagger:dagger:2.44") + kapt("com.google.dagger:dagger-compiler:2.44") + + implementation("com.google.code.gson:gson:2.10") +} diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 31972bcf..00000000 --- a/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -buildscript { - ext.kotlin_version = "1.8.21" - repositories { - google() - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..cc78206b --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,16 @@ +buildscript { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + dependencies { + classpath("com.android.tools.build:gradle:7.4.2") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Constants.kotlinVersion}") + classpath("com.github.dcendents:android-maven-gradle-plugin:2.1") + } +} + +task("clean") { + delete(rootProject.buildDir) +} diff --git a/buildSrc/.gitignore b/buildSrc/.gitignore new file mode 100644 index 00000000..12eb6a96 --- /dev/null +++ b/buildSrc/.gitignore @@ -0,0 +1,2 @@ +/.gradle +/build diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 00000000..876c922b --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() +} diff --git a/buildSrc/src/main/kotlin/Constants.kt b/buildSrc/src/main/kotlin/Constants.kt new file mode 100644 index 00000000..1949eda1 --- /dev/null +++ b/buildSrc/src/main/kotlin/Constants.kt @@ -0,0 +1,3 @@ +object Constants { + const val kotlinVersion = "1.8.21" +} diff --git a/fingerprint/build.gradle b/fingerprint/build.gradle deleted file mode 100644 index 92121fcb..00000000 --- a/fingerprint/build.gradle +++ /dev/null @@ -1,76 +0,0 @@ -plugins { - id 'com.android.library' - id 'kotlin-android' - id 'maven-publish' -} - -group='com.github.fingerprintjs' - -def libraryOutputName(String variantName) { - "fingerprint-android-${project.VERSION_NAME}-${variantName}.aar" -} - -publishing { - publications { - fpRelease(MavenPublication) { - groupId = 'com.github.fingerprintjs' - artifactId = "fingerprint-android" - version = project.VERSION_NAME - afterEvaluate { - from components.release - } - } - } -} - -android { - compileSdkVersion 33 - - defaultConfig { - minSdkVersion 21 - targetSdkVersion 33 - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - } - - - lint { - abortOnError true - warningsAsErrors true - } - - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - - namespace 'com.fingerprintjs.android.fingerprint' - - libraryVariants.all { variant -> - variant.outputs.all { output -> - if (outputFileName.endsWith('.aar')) { - outputFileName = libraryOutputName(variant.name) - } - } - } -} - -tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { - if (!it.name.contains("Test")) { - kotlinOptions.freeCompilerArgs += "-Xexplicit-api=warning" - } -} - -dependencies { - implementation fileTree(dir: "libs", include: ["*.jar"]) - implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'androidx.appcompat:appcompat:1.6.1' - testImplementation 'junit:junit:4.13.2' - testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0" - androidTestImplementation'androidx.test.ext:junit-ktx:1.1.5' - androidTestImplementation 'androidx.test:runner:1.5.2' -} \ No newline at end of file diff --git a/fingerprint/build.gradle.kts b/fingerprint/build.gradle.kts new file mode 100644 index 00000000..9a868c8f --- /dev/null +++ b/fingerprint/build.gradle.kts @@ -0,0 +1,80 @@ +import com.android.build.gradle.internal.api.BaseVariantOutputImpl + +plugins { + id("com.android.library") + id("kotlin-android") + id("maven-publish") +} + +group = "com.github.fingerprintjs" + +fun libraryOutputName(variantName: String): String { + return "fingerprint-android-${project.property("VERSION_NAME")}-${variantName}.aar" +} + +publishing { + publications { + create("fpRelease") { + groupId = "com.github.fingerprintjs" + artifactId = "fingerprint-android" + version = project.property("VERSION_NAME") as String + afterEvaluate { + from(components["release"]) + } + } + } +} + +android { + compileSdk = 33 + + defaultConfig { + minSdk = 21 + targetSdk = 33 + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + } + + lint { + abortOnError = true + warningsAsErrors = true + } + + buildTypes { + release { + isMinifyEnabled = true + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + + namespace = "com.fingerprintjs.android.fingerprint" + + libraryVariants.all { + val variantName = this.name + this.outputs.all { + (this as? BaseVariantOutputImpl)?.apply { + if (this.outputFileName.endsWith(".aar")) { + this.outputFileName = libraryOutputName(variantName) + } + } + } + } +} + +tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java) { + if (!this.name.contains("Test")) { + kotlinOptions.freeCompilerArgs += "-Xexplicit-api=warning" + } +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib:${Constants.kotlinVersion}") + implementation("androidx.appcompat:appcompat:1.6.1") + testImplementation("junit:junit:4.13.2") + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0") + androidTestImplementation("androidx.test.ext:junit-ktx:1.1.5") + androidTestImplementation("androidx.test:runner:1.5.2") +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 9e06a952..00000000 --- a/settings.gradle +++ /dev/null @@ -1,3 +0,0 @@ -include ':fingerprint' -include ':app' -rootProject.name = "Fingerprint-Android" \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..4f0102ca --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,11 @@ +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} + +include (":fingerprint") +include (":app") +rootProject.name = "Fingerprint-Android" \ No newline at end of file