From ff63341b634c20b9b657554e383300009deb845a Mon Sep 17 00:00:00 2001 From: cioccarellia Date: Sat, 23 Jul 2022 00:07:15 +0200 Subject: [PATCH] Kevlar 1.0.0! - Changed gradle publishing plugin to `io.github.gradle-nexus.publish-plugin` and s01 sonatype repository support; - Updated all references for the new (and horrible) group id `io.github.kevlar-kt` across code, settings and documentation; - Removed useless run configs; - Added script to automatize deployment, so I can keep my mental sanity; - Downgraded gradle version to 7.4.2 for stability with AGP. --- .github/ISSUE_TEMPLATE/Bug_report.md | 1 - .github/ISSUE_TEMPLATE/Feature_request.md | 1 - .../_complex_numbers__assemble_debug_aar.xml | 23 --- ..._complex_numbers__assemble_release_aar.xml | 23 --- .../_complex_numbers__test.xml | 23 --- .../_project__dependencyUpdates.xml | 23 --- .idea/runConfigurations/_project__test.xml | 23 --- .../_remote__closeAndReleaseRepository.xml | 21 --- .../_remote__closeRepository.xml | 21 --- ...ReleasePublicationToSonatypeRepository.xml | 21 --- .../_remote__releaseRepository.xml | 21 --- .idea/runConfigurations/_sample__test.xml | 23 --- antipiracy/build.gradle | 12 +- build.gradle | 8 +- .../modules/antipiracy/implementation.md | 6 +- .../pages/modules/integrity/implementation.md | 6 +- docs/pages/modules/rooting/implementation.md | 6 +- .../overview/dependencies_integration.md | 18 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- integrity/build.gradle | 15 +- publish_all.sh | 20 +++ rooting/build.gradle | 13 +- .../publish-module-antipiracy.gradle | 84 ++++++++++ .../publish-module-integrity.gradle | 84 ++++++++++ .../publishing/publish-module-rooting.gradle | 84 ++++++++++ scripts/publishing/publish-root.gradle | 52 ++++++ .../publishing/publish_mavencentral.gradle | 149 ------------------ showcase/build.gradle | 20 ++- 28 files changed, 381 insertions(+), 422 deletions(-) delete mode 100755 .github/ISSUE_TEMPLATE/Bug_report.md delete mode 100755 .github/ISSUE_TEMPLATE/Feature_request.md delete mode 100755 .idea/runConfigurations/_complex_numbers__assemble_debug_aar.xml delete mode 100755 .idea/runConfigurations/_complex_numbers__assemble_release_aar.xml delete mode 100755 .idea/runConfigurations/_complex_numbers__test.xml delete mode 100755 .idea/runConfigurations/_project__dependencyUpdates.xml delete mode 100755 .idea/runConfigurations/_project__test.xml delete mode 100755 .idea/runConfigurations/_remote__closeAndReleaseRepository.xml delete mode 100755 .idea/runConfigurations/_remote__closeRepository.xml delete mode 100755 .idea/runConfigurations/_remote__publishReleasePublicationToSonatypeRepository.xml delete mode 100755 .idea/runConfigurations/_remote__releaseRepository.xml delete mode 100755 .idea/runConfigurations/_sample__test.xml create mode 100644 publish_all.sh create mode 100644 scripts/publishing/publish-module-antipiracy.gradle create mode 100644 scripts/publishing/publish-module-integrity.gradle create mode 100644 scripts/publishing/publish-module-rooting.gradle create mode 100644 scripts/publishing/publish-root.gradle delete mode 100755 scripts/publishing/publish_mavencentral.gradle diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md deleted file mode 100755 index 6885bd3..0000000 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ /dev/null @@ -1 +0,0 @@ -# Bug Report \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md deleted file mode 100755 index 6945813..0000000 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ /dev/null @@ -1 +0,0 @@ -# Feature Request \ No newline at end of file diff --git a/.idea/runConfigurations/_complex_numbers__assemble_debug_aar.xml b/.idea/runConfigurations/_complex_numbers__assemble_debug_aar.xml deleted file mode 100755 index 9aa37a7..0000000 --- a/.idea/runConfigurations/_complex_numbers__assemble_debug_aar.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - true - true - false - - - \ No newline at end of file diff --git a/.idea/runConfigurations/_complex_numbers__assemble_release_aar.xml b/.idea/runConfigurations/_complex_numbers__assemble_release_aar.xml deleted file mode 100755 index 9ee0e49..0000000 --- a/.idea/runConfigurations/_complex_numbers__assemble_release_aar.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - true - true - false - - - \ No newline at end of file diff --git a/.idea/runConfigurations/_complex_numbers__test.xml b/.idea/runConfigurations/_complex_numbers__test.xml deleted file mode 100755 index 1605831..0000000 --- a/.idea/runConfigurations/_complex_numbers__test.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - true - true - false - - - \ No newline at end of file diff --git a/.idea/runConfigurations/_project__dependencyUpdates.xml b/.idea/runConfigurations/_project__dependencyUpdates.xml deleted file mode 100755 index daac670..0000000 --- a/.idea/runConfigurations/_project__dependencyUpdates.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - true - true - false - - - \ No newline at end of file diff --git a/.idea/runConfigurations/_project__test.xml b/.idea/runConfigurations/_project__test.xml deleted file mode 100755 index 6b33477..0000000 --- a/.idea/runConfigurations/_project__test.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - true - true - false - - - \ No newline at end of file diff --git a/.idea/runConfigurations/_remote__closeAndReleaseRepository.xml b/.idea/runConfigurations/_remote__closeAndReleaseRepository.xml deleted file mode 100755 index d9d5d74..0000000 --- a/.idea/runConfigurations/_remote__closeAndReleaseRepository.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - true - - - \ No newline at end of file diff --git a/.idea/runConfigurations/_remote__closeRepository.xml b/.idea/runConfigurations/_remote__closeRepository.xml deleted file mode 100755 index f434901..0000000 --- a/.idea/runConfigurations/_remote__closeRepository.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - true - - - \ No newline at end of file diff --git a/.idea/runConfigurations/_remote__publishReleasePublicationToSonatypeRepository.xml b/.idea/runConfigurations/_remote__publishReleasePublicationToSonatypeRepository.xml deleted file mode 100755 index cf644ff..0000000 --- a/.idea/runConfigurations/_remote__publishReleasePublicationToSonatypeRepository.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - true - - - \ No newline at end of file diff --git a/.idea/runConfigurations/_remote__releaseRepository.xml b/.idea/runConfigurations/_remote__releaseRepository.xml deleted file mode 100755 index 901b316..0000000 --- a/.idea/runConfigurations/_remote__releaseRepository.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - true - - - \ No newline at end of file diff --git a/.idea/runConfigurations/_sample__test.xml b/.idea/runConfigurations/_sample__test.xml deleted file mode 100755 index 4a5945b..0000000 --- a/.idea/runConfigurations/_sample__test.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - true - true - false - - - \ No newline at end of file diff --git a/antipiracy/build.gradle b/antipiracy/build.gradle index a146fd1..d911dfc 100755 --- a/antipiracy/build.gradle +++ b/antipiracy/build.gradle @@ -36,7 +36,7 @@ ext.module_name = "antipiracy" project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates( // PUBLISH_GROUP_ID - "com.kevlar", + "io.github.kevlar-kt", // PUBLISH_ARTIFACT_ID "antipiracy", @@ -45,7 +45,7 @@ project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates( "1.0.0", // PUBLISH_ARTIFACT_DESC - "Antipiracy", + "Kevlar Antipiracy", // PUBLISH_ARTIFACT_WEBSITE "https://github.com/kevlar-kt/kevlar" @@ -54,9 +54,6 @@ project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates( // Android library script apply from: rootProject.file("scripts/commons/library_config.gradle") -// TODO Turn on and run release script to publish library. Turn off afterward. -// apply from: rootProject.file("scripts/publishing/publish_mavencentral.gradle") - /** * Library versioning @@ -96,4 +93,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { //'-opt-in=kotlin.RequiresOptIn', ] } -} \ No newline at end of file +} + +// Publishing file +apply from: "${rootDir}/scripts/publishing/publish-module-antipiracy.gradle" \ No newline at end of file diff --git a/build.gradle b/build.gradle index 9fbc7cc..6206b12 100755 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ apply from: rootProject.file("scripts/custom/versions.gradle") -apply plugin: 'io.codearte.nexus-staging' +apply plugin: 'io.github.gradle-nexus.publish-plugin' buildscript { ext { @@ -18,7 +18,7 @@ buildscript { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.github.ben-manes:gradle-versions-plugin:0.42.0" classpath 'com.google.dagger:hilt-android-gradle-plugin:2.42' - classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0" + classpath 'io.github.gradle-nexus:publish-plugin:1.1.0' } } @@ -43,4 +43,6 @@ subprojects { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } -} \ No newline at end of file +} + +apply from: "${rootDir}/scripts/publishing/publish-root.gradle" \ No newline at end of file diff --git a/docs/pages/modules/antipiracy/implementation.md b/docs/pages/modules/antipiracy/implementation.md index fc02c0d..202f2d5 100644 --- a/docs/pages/modules/antipiracy/implementation.md +++ b/docs/pages/modules/antipiracy/implementation.md @@ -8,7 +8,7 @@ A working example for the antipiracy module can be found in the github repositor ``` java dependencies { - implementation "com.github.kevlar-kt:antipiracy:1.0.0" + implementation "io.github.kevlar-kt:antipiracy:1.0.0" } ``` @@ -16,7 +16,7 @@ A working example for the antipiracy module can be found in the github repositor ``` kotlin dependencies { - implementation("com.github.kevlar-kt:antipiracy:1.0.0") + implementation("io.github.kevlar-kt:antipiracy:1.0.0") } ``` @@ -24,7 +24,7 @@ A working example for the antipiracy module can be found in the github repositor ``` xml - com.github.kevlar-kt + io.github.kevlar-kt antipiracy 1.0.0 pom diff --git a/docs/pages/modules/integrity/implementation.md b/docs/pages/modules/integrity/implementation.md index dffafee..dd838a9 100644 --- a/docs/pages/modules/integrity/implementation.md +++ b/docs/pages/modules/integrity/implementation.md @@ -13,7 +13,7 @@ A working example for the integrity module can be found in the github repository ``` java dependencies { - implementation "com.github.kevlar-kt:integrity:1.0.0" + implementation "io.github.kevlar-kt:integrity:1.0.0" } ``` @@ -21,7 +21,7 @@ A working example for the integrity module can be found in the github repository ``` kotlin dependencies { - implementation("com.github.kevlar-kt:integrity:1.0.0") + implementation("io.github.kevlar-kt:integrity:1.0.0") } ``` @@ -29,7 +29,7 @@ A working example for the integrity module can be found in the github repository ``` xml - com.github.kevlar-kt + io.github.kevlar-kt integrity 1.0.0 pom diff --git a/docs/pages/modules/rooting/implementation.md b/docs/pages/modules/rooting/implementation.md index 66f935c..0a14c4a 100644 --- a/docs/pages/modules/rooting/implementation.md +++ b/docs/pages/modules/rooting/implementation.md @@ -8,7 +8,7 @@ A working example for the rooting module can be found in the github repository u ``` java dependencies { - implementation "com.github.kevlar-kt:rooting:1.0.0" + implementation "io.github.kevlar-kt:rooting:1.0.0" } ``` @@ -16,7 +16,7 @@ A working example for the rooting module can be found in the github repository u ``` kotlin dependencies { - implementation("com.github.kevlar-kt:rooting:1.0.0") + implementation("io.github.kevlar-kt:rooting:1.0.0") } ``` @@ -24,7 +24,7 @@ A working example for the rooting module can be found in the github repository u ``` xml - com.github.kevlar-kt + io.github.kevlar-kt rooting 1.0.0 pom diff --git a/docs/pages/overview/dependencies_integration.md b/docs/pages/overview/dependencies_integration.md index 4bb28b9..d1f46b9 100644 --- a/docs/pages/overview/dependencies_integration.md +++ b/docs/pages/overview/dependencies_integration.md @@ -26,7 +26,7 @@ repositories { ``` java dependencies { - implementation "com.github.kevlar-kt:antipiracy:1.0.0" + implementation "io.github.kevlar-kt:antipiracy:1.0.0" } ``` @@ -34,7 +34,7 @@ repositories { ``` kotlin dependencies { - implementation("com.github.kevlar-kt:antipiracy:1.0.0") + implementation("io.github.kevlar-kt:antipiracy:1.0.0") } ``` @@ -42,7 +42,7 @@ repositories { ``` xml - com.github.kevlar-kt + io.github.kevlar-kt antipiracy 1.0.0 pom @@ -55,7 +55,7 @@ repositories { ``` java dependencies { - implementation "com.github.kevlar-kt:rooting:1.0.0" + implementation "io.github.kevlar-kt:rooting:1.0.0" } ``` @@ -63,7 +63,7 @@ repositories { ``` kotlin dependencies { - implementation("com.github.kevlar-kt:rooting:1.0.0") + implementation("io.github.kevlar-kt:rooting:1.0.0") } ``` @@ -71,7 +71,7 @@ repositories { ``` xml - com.github.kevlar-kt + io.github.kevlar-kt rooting 1.0.0 pom @@ -85,7 +85,7 @@ repositories { ``` java dependencies { - implementation "com.github.kevlar-kt:integrity:1.0.0" + implementation "io.github.kevlar-kt:integrity:1.0.0" } ``` @@ -93,7 +93,7 @@ repositories { ``` kotlin dependencies { - implementation("com.github.kevlar-kt:integrity:1.0.0") + implementation("io.github.kevlar-kt:integrity:1.0.0") } ``` @@ -101,7 +101,7 @@ repositories { ``` xml - com.github.kevlar-kt + io.github.kevlar-kt integrity 1.0.0 pom diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5700261..19de3b6 100755 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip diff --git a/integrity/build.gradle b/integrity/build.gradle index c359691..b294394 100755 --- a/integrity/build.gradle +++ b/integrity/build.gradle @@ -36,7 +36,7 @@ ext.module_name = "integrity" project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates( // PUBLISH_GROUP_ID - "com.kevlar", + "io.github.kevlar-kt", // PUBLISH_ARTIFACT_ID "integrity", @@ -45,7 +45,7 @@ project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates( "1.0.0", // PUBLISH_ARTIFACT_DESC - "Integrity", + "Kevlar Integrity", // PUBLISH_ARTIFACT_WEBSITE "https://github.com/kevlar-kt/kevlar" @@ -54,10 +54,6 @@ project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates( // Android library script apply from: rootProject.file("scripts/commons/library_config.gradle") -// MavenCentral publication script -// TODO Turn on and run release script to publish library. Turn off afterward. -// apply from: rootProject.file("scripts/publishing/publish_mavencentral.gradle") - /** * Library versioning @@ -94,6 +90,11 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { freeCompilerArgs += [ //'-progressive', '-Xexplicit-api=strict', + //'-opt-in=kotlin.RequiresOptIn', ] } -} \ No newline at end of file +} + + +// Publishing file +apply from: "${rootDir}/scripts/publishing/publish-module-integrity.gradle" \ No newline at end of file diff --git a/publish_all.sh b/publish_all.sh new file mode 100644 index 0000000..dc37c05 --- /dev/null +++ b/publish_all.sh @@ -0,0 +1,20 @@ +# +# Designed and developed by Kevlar Contributors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# + +./gradlew antipiracy:assembleRelease && ./gradlew antipiracy:publishReleasePublicationToSonatypeRepository +./gradlew rooting:assembleRelease && ./gradlew rooting:publishReleasePublicationToSonatypeRepository +./gradlew integrity:assembleRelease && ./gradlew integrity:publishReleasePublicationToSonatypeRepository \ No newline at end of file diff --git a/rooting/build.gradle b/rooting/build.gradle index ffc94a8..f34415e 100755 --- a/rooting/build.gradle +++ b/rooting/build.gradle @@ -36,7 +36,7 @@ ext.module_name = "rooting" project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates( // PUBLISH_GROUP_ID - "com.kevlar", + "io.github.kevlar-kt", // PUBLISH_ARTIFACT_ID "rooting", @@ -45,7 +45,7 @@ project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates( "1.0.0", // PUBLISH_ARTIFACT_DESC - "Rooting", + "Kevlar Rooting", // PUBLISH_ARTIFACT_WEBSITE "https://github.com/kevlar-kt/kevlar" @@ -54,9 +54,6 @@ project.ext.set("module_${ext.module_name}", new ModuleArtifactCoordinates( // Android library script apply from: rootProject.file("scripts/commons/library_config.gradle") -// TODO Turn on and run release script to publish library. Turn off afterward. -// apply from: rootProject.file("scripts/publishing/publish_mavencentral.gradle") - /** * Library versioning @@ -102,4 +99,8 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { //'-opt-in=kotlin.RequiresOptIn', ] } -} \ No newline at end of file +} + + +// Publishing file +apply from: "${rootDir}/scripts/publishing/publish-module-rooting.gradle" \ No newline at end of file diff --git a/scripts/publishing/publish-module-antipiracy.gradle b/scripts/publishing/publish-module-antipiracy.gradle new file mode 100644 index 0000000..b1d88b1 --- /dev/null +++ b/scripts/publishing/publish-module-antipiracy.gradle @@ -0,0 +1,84 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +def currentDeployModule = project.ext.get("module_antipiracy") + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + if (project.plugins.findPlugin("com.android.library")) { + // For Android libraries + from android.sourceSets.main.java.srcDirs + from android.sourceSets.main.kotlin.srcDirs + } else { + // For pure Kotlin libraries, in case you have them + from sourceSets.main.java.srcDirs + from sourceSets.main.kotlin.srcDirs + } +} + +artifacts { + archives androidSourcesJar +} + +group = currentDeployModule.PUBLISH_GROUP_ID +version = currentDeployModule.PUBLISH_VERSION + +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + // The coordinates of the library, being set from variables that + // we'll set up later + groupId currentDeployModule.PUBLISH_GROUP_ID + artifactId currentDeployModule.PUBLISH_ARTIFACT_ID + version currentDeployModule.PUBLISH_VERSION + + if (project.plugins.findPlugin("com.android.library")) { + artifact("$buildDir/outputs/aar/${project.getName()}-release.aar") + } else { + artifact("$buildDir/libs/${project.getName()}-${version}.jar") + } + + artifact androidSourcesJar + + pom { + name = currentDeployModule.PUBLISH_ARTIFACT_ID + description = currentDeployModule.PUBLISH_ARTIFACT_DESC + url = currentDeployModule.PUBLISH_ARTIFACT_WEBSITE + + licenses { + license { + name = 'APACHE LICENSE' + url = 'https://github.com/kevlar-kt/kevlar/blob/master/LICENSE.md' + } + } + developers { + developer { + id = 'cioccarellia' + name = 'Andrea Cioccarelli' + email = 'andrea.cioccarelli01@gmail.com' + } + // Add all other devs here... + } + + // Version control info - if you're using GitHub, follow the + // format as seen here + scm { + connection = 'scm:git:github.com/kevlar-kt/kevlar.git' + developerConnection = 'scm:git:ssh://github.com/kevlar-kt/kevlar.git' + url = 'https://github.com/kevlar-kt/kevlar/tree/main' + } + } + } + } + } +} + +signing { + useInMemoryPgpKeys( + rootProject.ext["signing.keyId"], + rootProject.ext["signing.key"], + rootProject.ext["signing.password"], + ) + sign publishing.publications +} \ No newline at end of file diff --git a/scripts/publishing/publish-module-integrity.gradle b/scripts/publishing/publish-module-integrity.gradle new file mode 100644 index 0000000..29d6bf9 --- /dev/null +++ b/scripts/publishing/publish-module-integrity.gradle @@ -0,0 +1,84 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +def currentDeployModule = project.ext.get("module_integrity") + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + if (project.plugins.findPlugin("com.android.library")) { + // For Android libraries + from android.sourceSets.main.java.srcDirs + from android.sourceSets.main.kotlin.srcDirs + } else { + // For pure Kotlin libraries, in case you have them + from sourceSets.main.java.srcDirs + from sourceSets.main.kotlin.srcDirs + } +} + +artifacts { + archives androidSourcesJar +} + +group = currentDeployModule.PUBLISH_GROUP_ID +version = currentDeployModule.PUBLISH_VERSION + +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + // The coordinates of the library, being set from variables that + // we'll set up later + groupId currentDeployModule.PUBLISH_GROUP_ID + artifactId currentDeployModule.PUBLISH_ARTIFACT_ID + version currentDeployModule.PUBLISH_VERSION + + if (project.plugins.findPlugin("com.android.library")) { + artifact("$buildDir/outputs/aar/${project.getName()}-release.aar") + } else { + artifact("$buildDir/libs/${project.getName()}-${version}.jar") + } + + artifact androidSourcesJar + + pom { + name = currentDeployModule.PUBLISH_ARTIFACT_ID + description = currentDeployModule.PUBLISH_ARTIFACT_DESC + url = currentDeployModule.PUBLISH_ARTIFACT_WEBSITE + + licenses { + license { + name = 'APACHE LICENSE' + url = 'https://github.com/kevlar-kt/kevlar/blob/master/LICENSE.md' + } + } + developers { + developer { + id = 'cioccarellia' + name = 'Andrea Cioccarelli' + email = 'andrea.cioccarelli01@gmail.com' + } + // Add all other devs here... + } + + // Version control info - if you're using GitHub, follow the + // format as seen here + scm { + connection = 'scm:git:github.com/kevlar-kt/kevlar.git' + developerConnection = 'scm:git:ssh://github.com/kevlar-kt/kevlar.git' + url = 'https://github.com/kevlar-kt/kevlar/tree/main' + } + } + } + } + } +} + +signing { + useInMemoryPgpKeys( + rootProject.ext["signing.keyId"], + rootProject.ext["signing.key"], + rootProject.ext["signing.password"], + ) + sign publishing.publications +} \ No newline at end of file diff --git a/scripts/publishing/publish-module-rooting.gradle b/scripts/publishing/publish-module-rooting.gradle new file mode 100644 index 0000000..6595166 --- /dev/null +++ b/scripts/publishing/publish-module-rooting.gradle @@ -0,0 +1,84 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +def currentDeployModule = project.ext.get("module_rooting") + +task androidSourcesJar(type: Jar) { + archiveClassifier.set('sources') + if (project.plugins.findPlugin("com.android.library")) { + // For Android libraries + from android.sourceSets.main.java.srcDirs + from android.sourceSets.main.kotlin.srcDirs + } else { + // For pure Kotlin libraries, in case you have them + from sourceSets.main.java.srcDirs + from sourceSets.main.kotlin.srcDirs + } +} + +artifacts { + archives androidSourcesJar +} + +group = currentDeployModule.PUBLISH_GROUP_ID +version = currentDeployModule.PUBLISH_VERSION + +afterEvaluate { + publishing { + publications { + release(MavenPublication) { + // The coordinates of the library, being set from variables that + // we'll set up later + groupId currentDeployModule.PUBLISH_GROUP_ID + artifactId currentDeployModule.PUBLISH_ARTIFACT_ID + version currentDeployModule.PUBLISH_VERSION + + if (project.plugins.findPlugin("com.android.library")) { + artifact("$buildDir/outputs/aar/${project.getName()}-release.aar") + } else { + artifact("$buildDir/libs/${project.getName()}-${version}.jar") + } + + artifact androidSourcesJar + + pom { + name = currentDeployModule.PUBLISH_ARTIFACT_ID + description = currentDeployModule.PUBLISH_ARTIFACT_DESC + url = currentDeployModule.PUBLISH_ARTIFACT_WEBSITE + + licenses { + license { + name = 'APACHE LICENSE' + url = 'https://github.com/kevlar-kt/kevlar/blob/master/LICENSE.md' + } + } + developers { + developer { + id = 'cioccarellia' + name = 'Andrea Cioccarelli' + email = 'andrea.cioccarelli01@gmail.com' + } + // Add all other devs here... + } + + // Version control info - if you're using GitHub, follow the + // format as seen here + scm { + connection = 'scm:git:github.com/kevlar-kt/kevlar.git' + developerConnection = 'scm:git:ssh://github.com/kevlar-kt/kevlar.git' + url = 'https://github.com/kevlar-kt/kevlar/tree/main' + } + } + } + } + } +} + +signing { + useInMemoryPgpKeys( + rootProject.ext["signing.keyId"], + rootProject.ext["signing.key"], + rootProject.ext["signing.password"], + ) + sign publishing.publications +} \ No newline at end of file diff --git a/scripts/publishing/publish-root.gradle b/scripts/publishing/publish-root.gradle new file mode 100644 index 0000000..282cf2f --- /dev/null +++ b/scripts/publishing/publish-root.gradle @@ -0,0 +1,52 @@ +/** + * If the local.properties file exists under the root project directory it will + * be read to parse all the defined properties. + * + * Otherwise the system environment variables will be queried. + * + * Github secrets are mapped to env variables, therefore they will be retrieved + * if this script is executed by github actions. + * */ + +// Create variables with empty default values +ext["ossrhUsername"] = '' +ext["ossrhPassword"] = '' +ext["sonatypeStagingProfileId"] = '' +ext["signing.keyId"] = '' +ext["signing.password"] = '' +ext["signing.key"] = '' + + +File secretPropsFile = project.rootProject.file('local.properties') + +if (secretPropsFile.exists()) { + // Read local.properties file first if it exists + Properties p = new Properties() + + new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } + p.each { name, value -> ext[name] = value } +} else { + // Use system environment variables + ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') + ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') + ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') + ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') + ext["signing.password"] = System.getenv('SIGNING_PASSWORD') + ext["signing.key"] = System.getenv('SIGNING_KEY') +} + + +// Set up Sonatype repository +nexusPublishing { + repositories { + sonatype { + stagingProfileId = sonatypeStagingProfileId + username = ossrhUsername + password = ossrhPassword + + // Add these lines if using new Sonatype infra + nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) + snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) + } + } +} \ No newline at end of file diff --git a/scripts/publishing/publish_mavencentral.gradle b/scripts/publishing/publish_mavencentral.gradle deleted file mode 100755 index cc9bf7b..0000000 --- a/scripts/publishing/publish_mavencentral.gradle +++ /dev/null @@ -1,149 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -/** - * Current module coordinate object which is chosen to be deployed. - * */ -// TODO rename `deployModuleName` to the target module for deployment. -def deployModuleName = "antipiracy" - -// Do not edit this -def currentDeployModule = project.ext.get("module_${deployModuleName}") - -task androidSourcesJar(type: Jar) { - archiveClassifier.set('sources') - if (project.plugins.findPlugin("com.android.library")) { - from android.sourceSets.main.java.srcDirs - from android.sourceSets.main.kotlin.srcDirs - } else { - from sourceSets.main.java.srcDirs - from sourceSets.main.kotlin.srcDirs - } -} - -artifacts { - archives androidSourcesJar - //archives javadocJar -} - - -group = currentDeployModule.PUBLISH_GROUP_ID -version = currentDeployModule.PUBLISH_VERSION - - -/** - * If the local.properties file exists under the root project directory it will - * be read to parse all the defined properties. - * - * Otherwise the system environment variables will be queried. - * - * Github secrets are mapped to env variables, therefore they will be retrieved - * if this script is executed by github actions. - * */ - -ext["signing.keyId"] = '' -ext["signing.password"] = '' -ext["signing.secretKeyRingFile"] = '' -ext["ossrhUsername"] = '' -ext["ossrhPassword"] = '' -ext["sonatypeStagingProfileId"] = '' -ext["stagingProfileId"] = '' - -File secretPropsFile = project.rootProject.file('local.properties') -if (secretPropsFile.exists()) { - Properties p = new Properties() - p.load(new FileInputStream(secretPropsFile)) - p.each { name, value -> - ext[name] = value - } -} else { - ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') - ext["signing.password"] = System.getenv('SIGNING_PASSWORD') - ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') - ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') - ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') - ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') - ext["stagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') -} - - -publishing { - publications { - release(MavenPublication) { - groupId currentDeployModule.PUBLISH_GROUP_ID - artifactId currentDeployModule.PUBLISH_ARTIFACT_ID - version currentDeployModule.PUBLISH_VERSION - - if (project.plugins.findPlugin("com.android.library")) { - artifact("$buildDir/outputs/aar/${project.getName()}-release.aar") - } else { - artifact("$buildDir/libs/${project.getName()}-${version}.jar") - } - - artifact androidSourcesJar - - pom { - name = currentDeployModule.PUBLISH_ARTIFACT_ID - description = currentDeployModule.PUBLISH_ARTIFACT_DESC - url = currentDeployModule.PUBLISH_ARTIFACT_WEBSITE - - licenses { - // TODO update license according to your project - license { - name = 'APACHE LICENSE' - url = 'https://github.com/cioccarellia/lib-template-android/blob/master/LICENSE.md' - } - } - - developers { - // TODO update developer(s) data according to your project - developer { - id = 'cioccarellia' - name = 'Andrea Cioccarelli' - email = 'andrea.cioccarelli01@gmail.com' - } - } - - scm { - // TODO update connection parameters according to your project - connection = 'scm:git:github.com/cioccarellia/lib-template-android.git' - developerConnection = 'scm:git:ssh://github.com/cioccarellia/lib-template-android.git' - url = 'https://github.com/cioccarellia/lib-template-android/tree/main' - } - - withXml { - def dependenciesNode = asNode().appendNode('dependencies') - - project.configurations.implementation.allDependencies.each { - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', it.group) - dependencyNode.appendNode('artifactId', it.name) - dependencyNode.appendNode('version', it.version) - } - } - } - } - } - repositories { - maven { - name = "sonatype" - url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - - credentials { - username ossrhUsername - password ossrhPassword - } - } - } -} - -nexusStaging { - packageGroup = currentDeployModule.PUBLISH_GROUP_ID - stagingProfileId = sonatypeStagingProfileId - username = ossrhUsername - password = ossrhPassword -} - -signing { - sign publishing.publications -} \ No newline at end of file diff --git a/showcase/build.gradle b/showcase/build.gradle index 6802b3b..5cbf8fe 100755 --- a/showcase/build.gradle +++ b/showcase/build.gradle @@ -14,20 +14,20 @@ apply from: rootProject.file("scripts/commons/app_config.gradle") android { defaultConfig { versionName "1.0.0-app-showcase" - versionCode 3 + versionCode 1 multiDexEnabled true } buildTypes { debug { - //applicationIdSuffix '.debug' - //versionNameSuffix '-debug' + // applicationIdSuffix '.debug' + // versionNameSuffix '-debug' debuggable true } release { - //applicationIdSuffix '.prod' - //versionNameSuffix '-prod' + // applicationIdSuffix '.prod' + // versionNameSuffix '-prod' debuggable false minifyEnabled true shrinkResources true @@ -52,6 +52,10 @@ android { def local = true dependencies { + /** + * This is used by kevlar developers to check changes between the + * remote versions and the local ones. + * */ if (local) { implementation project(':antipiracy') implementation project(':rooting') @@ -59,9 +63,9 @@ dependencies { } else { def kevlar_version = "1.0.0" - implementation "com.github.kevlar-kt:antipiracy:$kevlar_version" - implementation "com.github.kevlar-kt:rooting:$kevlar_version" - implementation "com.github.kevlar-kt:integrity:$kevlar_version" + implementation "io.github.kevlar-kt:antipiracy:$kevlar_version" + implementation "io.github.kevlar-kt:rooting:$kevlar_version" + implementation "io.github.kevlar-kt:integrity:$kevlar_version" } implementation "androidx.core:core-ktx:1.8.0"