diff --git a/.circleci/config.yml b/.circleci/config.yml index 94d8dfcc..f730f02d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,12 +3,68 @@ version: 2.1 orbs: android: circleci/android@1.0.3 +commands: + write-keystore-files: + steps: + - run: + name: Write Wisefy release keystore + command: echo "$WISEFY_RELEASE_KEYSTORE" | base64 --decode > keystores/wisefy-release.jks + - run: + name: Write Wisefy sample release keystore + command: echo "$WISEFY_SAMPLE_RELEASE_KEYSTORE" | base64 --decode > keystores/wisefy-sample-release.jks + import-gpg-key: + steps: + - run: + name: Write Wisefy GPG Key + command: echo -e $GPG_KEY > wisefy-gpg-key.asc + - run: + name: Import GPG Key + command: gpg --import --no-tty --batch --yes wisefy-gpg-key.asc + publish-to-maven-local: + steps: + - run: + name: Publish wisefy:core to Maven Local + command: ./gradlew wisefy:core:publishToMavenLocal + - run: + name: Pulblish wisefy:accesspoints to Maven Local + command: ./gradlew wisefy:accesspoints:publishToMavenLocal + - run: + name: Pulblish wisefy:addnetwork to Maven Local + command: ./gradlew wisefy:addnetwork:publishToMavenLocal + - run: + name: Pulblish wisefy:networkconnection to Maven Local + command: ./gradlew wisefy:networkconnection:publishToMavenLocal + - run: + name: Pulblish wisefy:networkinfo to Maven Local + command: ./gradlew wisefy:networkinfo:publishToMavenLocal + - run: + name: Pulblish wisefy:removenetwork to Maven Local + command: ./gradlew wisefy:removenetwork:publishToMavenLocal + - run: + name: Pulblish wisefy:savednetworks to Maven Local + command: ./gradlew wisefy:savednetworks:publishToMavenLocal + - run: + name: Pulblish wisefy:signal to Maven Local + command: ./gradlew wisefy:signal:publishToMavenLocal + - run: + name: Pulblish wisefy:wifi to Maven Local + command: ./gradlew wisefy:wifi:publishToMavenLocal + - run: + name: Pulblish wisefy to Maven Local + command: ./gradlew wisefy:publishToMavenLocal + - run: + name: Pulblish wisefy:ktx to Maven Local + command: ./gradlew wisefy:ktx:publishToMavenLocal + jobs: - static-analysis: + build-and-test: executor: name: android/android-machine steps: - checkout + - write-keystore-files + - import-gpg-key + - publish-to-maven-local - run: name: Run lint command: ./gradlew lintDebug @@ -21,21 +77,14 @@ jobs: - run: name: Run CPD command: ./gradlew cpdCheck - - build: - executor: - name: android/android-machine - steps: - - checkout - run: - name: Assemble debug build + name: Assemble debug build command: ./gradlew assembleDebug - run: name: Assemble release build command: ./gradlew assembleRelease workflows: - ci: + wisefy-ci-cd: jobs: - - static-analysis - - build + - build-and-test diff --git a/.gitignore b/.gitignore index 051ba5a8..f325d4a8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ /.idea/libraries/* /.idea/codestyles/* keystore.properties +*.jks diff --git a/README.md b/README.md index f57878f9..7f3a24a8 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,8 @@ A Wifi configuration and util library built in Kotlin for Android. [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-WiseFy-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/6011) [![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23230-blue.svg)](http://androidweekly.net/issues/issue-230) +[![CircleCI](https://dl.circleci.com/status-badge/img/gh/isuPatches/android-wisefy/tree/develop.svg?style=svg)](https://dl.circleci.com/status-badge/redirect/gh/isuPatches/android-wisefy/tree/develop) + - [Installation](#installation) - [KTX Artifact](#ktx-artifact) - [5.0 Rewrite](#50-rewrite) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 927f730c..168cb5b6 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -4,7 +4,6 @@ import com.isupatches.android.wisefy.build.Versions import com.isupatches.android.wisefy.build.compose import com.isupatches.android.wisefy.build.dagger import com.isupatches.android.wisefy.build.navigation -import java.util.* plugins { id("com.android.application") @@ -13,12 +12,6 @@ plugins { id("dagger.hilt.android.plugin") } -val keystoreProperties: Properties = Properties() -val keystoreFile: File = rootProject.file("keystore.properties") -if (keystoreFile.exists()) { - keystoreFile.inputStream().use { keystoreProperties.load(it) } -} - android { namespace = "com.isupatches.android.wisefy.sample" testNamespace = "com.isupatches.android.wisefy.sample.test" @@ -39,25 +32,19 @@ android { } signingConfigs { - getByName("debug") { - storeFile = file(keystoreProperties.getProperty("app.debug.keystore_location")) - keyAlias = keystoreProperties.getProperty("app.debug.key_alias") - storePassword = System.getenv("APP_DEBUG_PASSWORD") ?: keystoreProperties.getProperty("app.debug.password") - keyPassword = System.getenv("APP_DEBUG_PASSWORD") ?: keystoreProperties.getProperty("app.debug.password") - } - create("release") { - storeFile = file(keystoreProperties.getProperty("app.release.keystore_location")) - keyAlias = keystoreProperties.getProperty("app.release.key_alias") - storePassword = keystoreProperties.getProperty("app.release.password") - keyPassword = keystoreProperties.getProperty("app.release.password") + storeFile = File("$rootDir/keystores/wisefy-sample-release.jks") + keyAlias = System.getenv("WISEFY_SAMPLE_RELEASE_KEY_ALIAS") + storePassword = System.getenv("WISEFY_SAMPLE_RELEASE_PASSWORD") + keyPassword = System.getenv("WISEFY_SAMPLE_RELEASE_PASSWORD") } } buildTypes { debug { applicationIdSuffix = ".debug" - isTestCoverageEnabled = true + enableUnitTestCoverage = true + enableAndroidTestCoverage = true isMinifyEnabled = false isShrinkResources = false proguardFiles( @@ -65,11 +52,11 @@ android { "$rootDir/proguard/r8-app-debug.pro" ) testProguardFile(file("$rootDir/proguard/r8-app-test.pro")) - signingConfig = signingConfigs.getByName("debug") } release { - isTestCoverageEnabled = false + enableUnitTestCoverage = false + enableAndroidTestCoverage = false isMinifyEnabled = false isShrinkResources = false proguardFiles( diff --git a/buildSrc/src/main/java/com/isupatches/android/wisefy/build/BuildVersions.kt b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/BuildVersions.kt index e23521d4..0543f81a 100644 --- a/buildSrc/src/main/java/com/isupatches/android/wisefy/build/BuildVersions.kt +++ b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/BuildVersions.kt @@ -16,7 +16,7 @@ package com.isupatches.android.wisefy.build object BuildVersions { - const val BUILD_TOOLS: String = "33.0.0-rc4" + const val BUILD_TOOLS: String = "33.0.1" const val COMPILE_SDK: Int = 33 const val TARGET_SDK: Int = 33 diff --git a/buildSrc/src/main/java/com/isupatches/android/wisefy/build/plugins/BaseGraldleModulePlugin.kt b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/plugins/BaseGraldleModulePlugin.kt index f00e70ab..edbf1ac7 100644 --- a/buildSrc/src/main/java/com/isupatches/android/wisefy/build/plugins/BaseGraldleModulePlugin.kt +++ b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/plugins/BaseGraldleModulePlugin.kt @@ -21,9 +21,7 @@ import com.isupatches.android.wisefy.build.Dependencies import com.isupatches.android.wisefy.build.DependencyConstants.IMPLEMENTATION import com.isupatches.android.wisefy.build.Versions import java.io.File -import java.io.FileInputStream import java.util.Locale -import java.util.Properties import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project @@ -44,12 +42,6 @@ class BaseGradleModulePlugin : Plugin { target.configure { - val keystorePropertiesFile = target.file("../keystore.properties") - val keystoreProperties = Properties() - if (keystorePropertiesFile.exists()) { - keystoreProperties.load(FileInputStream(keystorePropertiesFile)) - } - compileSdk = BuildVersions.COMPILE_SDK buildToolsVersion = BuildVersions.BUILD_TOOLS @@ -63,18 +55,11 @@ class BaseGradleModulePlugin : Plugin { } signingConfigs { - create("debug${target.name.capitalize(Locale.ROOT)}") { - storeFile = File(System.getenv("WISEFY_DEBUG_KEYSTORE_LOCATION") ?: keystoreProperties["wisefy.debug.keystore_location"].toString()) - storePassword = System.getenv("WISEFY_DEBUG_PASSWORD") ?: keystoreProperties["wisefy.debug.password"].toString() - keyPassword = System.getenv("WISEFY_DEBUG_PASSWORD") ?: keystoreProperties["wisefy.debug.password"].toString() - keyAlias = System.getenv("WISEFY_DEBUG_KEY_ALIAS") ?: keystoreProperties["wisefy.debug.key_alias"].toString() - } - create("release${target.name.capitalize(Locale.ROOT)}") { - storeFile = File(System.getenv("WISEFY_RELEASE_KEYSTORE_LOCATION") ?: keystoreProperties["wisefy.release.keystore_location"].toString()) - storePassword = System.getenv("WISEFY_RELEASE_PASSWORD") ?: keystoreProperties["wisefy.release.password"].toString() - keyPassword = System.getenv("WISEFY_RELEASE_PASSWORD") ?: keystoreProperties["wisefy.release.password"].toString() - keyAlias = System.getenv("WISEFY_RELEASE_KEY_ALIAS") ?: keystoreProperties["wisefy.release.key_alias"].toString() + storeFile = File("${target.rootDir}/keystores/wisefy-release.jks") + keyAlias = System.getenv("WISEFY_RELEASE_KEY_ALIAS") + storePassword = System.getenv("WISEFY_RELEASE_PASSWORD") + keyPassword = System.getenv("WISEFY_RELEASE_PASSWORD") } } @@ -90,7 +75,6 @@ class BaseGradleModulePlugin : Plugin { ) testProguardFile("${target.rootDir}/proguard/r8-lib-test.pro") consumerProguardFile("${target.rootDir}/proguard/r8-lib-consumer.pro") - signingConfig = signingConfigs.getByName("debug${target.name.capitalize(Locale.ROOT)}") } release { diff --git a/buildSrc/src/main/java/com/isupatches/android/wisefy/build/plugins/PublishingPlugin.kt b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/plugins/PublishingPlugin.kt index c1cc84fa..63b1add8 100644 --- a/buildSrc/src/main/java/com/isupatches/android/wisefy/build/plugins/PublishingPlugin.kt +++ b/buildSrc/src/main/java/com/isupatches/android/wisefy/build/plugins/PublishingPlugin.kt @@ -16,6 +16,7 @@ package com.isupatches.android.wisefy.build.plugins import com.android.build.gradle.LibraryExtension +import com.isupatches.android.wisefy.build.PublishingConstants import java.io.File import java.net.URI import java.util.Properties @@ -74,7 +75,9 @@ class PublishingPlugin : Plugin { publishing { singleVariant("debug") { withSourcesJar() - withJavadocJar() + if (System.getenv("GENERATE_DOCS_FOR_DEBUG_PUBLICATIONS") != null) { + withJavadocJar() + } } singleVariant("release") { @@ -88,7 +91,7 @@ class PublishingPlugin : Plugin { configure { publications { create("debug") { - groupId = com.isupatches.android.wisefy.build.PublishingConstants.GROUP_ID + groupId = PublishingConstants.GROUP_ID artifactId = project.name version = project.version.toString() @@ -120,7 +123,7 @@ class PublishingPlugin : Plugin { } create("release") { - groupId = com.isupatches.android.wisefy.build.PublishingConstants.GROUP_ID + groupId = PublishingConstants.GROUP_ID artifactId = project.name version = project.version.toString() diff --git a/keystores/.keep b/keystores/.keep new file mode 100644 index 00000000..e69de29b