From 6c21ccac2401e5e42dcba841da69c0bb905cc239 Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Mon, 18 Mar 2024 18:03:05 +0900 Subject: [PATCH 1/9] feat: Create a few projects for pugins in includedBuild --- plugins/build.gradle.kts | 7 +++++++ plugins/settings.gradle | 25 ++++++++++++++++++++++++ settings.gradle | 41 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 plugins/build.gradle.kts create mode 100644 plugins/settings.gradle diff --git a/plugins/build.gradle.kts b/plugins/build.gradle.kts new file mode 100644 index 0000000..4ccfacd --- /dev/null +++ b/plugins/build.gradle.kts @@ -0,0 +1,7 @@ +plugins { + `kotlin-dsl` apply false +} + +tasks.register("clean", Delete::class) { + delete(rootProject.buildDir) +} diff --git a/plugins/settings.gradle b/plugins/settings.gradle new file mode 100644 index 0000000..172c040 --- /dev/null +++ b/plugins/settings.gradle @@ -0,0 +1,25 @@ +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} + +include(":android") +include(":common") +include(":spotless") diff --git a/settings.gradle b/settings.gradle index b49ce19..d81f580 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,40 @@ -include ':sdk', ':sdkMock', ':sample' +pluginManagement { + repositories { + google() + mavenCentral() + gradlePluginPortal() + } + + pluginManagement { + resolutionStrategy { + eachPlugin { + switch(requested.id.id) { + case "com.google.android.gms.oss-licenses-plugin": + useModule("com.google.android.gms:oss-licenses-plugin:${requested.version}") + break + case "deploygate": + useModule("com.deploygate:gradle:${requested.version}") + break + } + } + } + } + + includeBuild("build-logic") +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { + url 'https://deploygate.github.io/maven/artifacts' + content { includeGroup "com.deploygate" } + } + } +} + +includeBuild('plugins') + +include ':sdk', ':sdkMock', ':sample' \ No newline at end of file From 7102a9729130f7849bb2c34e7c24fd0df943547b Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Sun, 24 Mar 2024 19:46:59 +0900 Subject: [PATCH 2/9] feat: Create a plugin for sdk and publishing it --- build.gradle | 32 +--- gradle.properties | 3 +- plugins/library/build.gradle.kts | 17 ++ .../deploygate/plugins/MavenPublishPlugin.kt | 159 ++++++++++++++++++ .../java/com/deploygate/plugins/SdkPlugin.kt | 129 ++++++++++++++ .../deploygate/plugins/dsl/SdkExtension.kt | 11 ++ .../com/deploygate/plugins/ext/ProjectExt.kt | 8 + plugins/sample/build.gradle.kts | 18 ++ .../com/deploygate/plugins/SampleAppPlugin.kt | 131 +++++++++++++++ plugins/settings.gradle | 10 +- publishing.build.gradle | 103 ------------ sample/build.gradle | 88 +--------- sdk.build.gradle | 89 ---------- sdk/build.gradle | 12 +- sdkMock/build.gradle | 12 +- settings.gradle | 9 +- 16 files changed, 493 insertions(+), 338 deletions(-) create mode 100644 plugins/library/build.gradle.kts create mode 100644 plugins/library/src/main/java/com/deploygate/plugins/MavenPublishPlugin.kt create mode 100644 plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt create mode 100644 plugins/library/src/main/java/com/deploygate/plugins/dsl/SdkExtension.kt create mode 100644 plugins/library/src/main/java/com/deploygate/plugins/ext/ProjectExt.kt create mode 100644 plugins/sample/build.gradle.kts create mode 100644 plugins/sample/src/main/java/com/deploygate/plugins/SampleAppPlugin.kt delete mode 100644 publishing.build.gradle delete mode 100644 sdk.build.gradle diff --git a/build.gradle b/build.gradle index 2af0534..e348f4f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,36 +1,10 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. -ext { - // sdk/java/com/deploygate/sdk/HostAppTest.java needs to be changed for a new release - releaseVersion = '4.7.1' -} - -buildscript { - repositories { - mavenCentral() - google() - gradlePluginPortal() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - classpath 'com.project.starter:easylauncher:5.0.1' - } -} -allprojects { - repositories { - mavenCentral() - google() - } +plugins { + id("com.deploygate.plugins.sdk") apply false + id("com.deploygate.plugins.sample-app") apply false } task clean(type: Delete) { delete rootProject.buildDir } - -task verifyReleaseVersion() { - doLast { - if (project.ext.releaseVersion != System.getenv("RELEASE_VERSION")) { - throw new GradleException("${project.ext.releaseVersion} does not equal to ${System.getenv("RELEASE_VERSION")}") - } - } -} diff --git a/gradle.properties b/gradle.properties index 2d8d1e4..3a20c71 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1,2 @@ -android.useAndroidX=true \ No newline at end of file +android.useAndroidX=true +android.disableAutomaticComponentCreation=true diff --git a/plugins/library/build.gradle.kts b/plugins/library/build.gradle.kts new file mode 100644 index 0000000..3e6d861 --- /dev/null +++ b/plugins/library/build.gradle.kts @@ -0,0 +1,17 @@ +plugins { + `kotlin-dsl` +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22") + implementation("com.android.tools.build:gradle:7.4.2") +} + +gradlePlugin { + plugins { + create("sdk") { + id = "com.deploygate.plugins.sdk" + implementationClass = "com.deploygate.plugins.SdkPlugin" + } + } +} diff --git a/plugins/library/src/main/java/com/deploygate/plugins/MavenPublishPlugin.kt b/plugins/library/src/main/java/com/deploygate/plugins/MavenPublishPlugin.kt new file mode 100644 index 0000000..f686926 --- /dev/null +++ b/plugins/library/src/main/java/com/deploygate/plugins/MavenPublishPlugin.kt @@ -0,0 +1,159 @@ +package com.deploygate.plugins + +import com.deploygate.plugins.ext.sdkExtension +import com.android.build.gradle.LibraryExtension as InternalApiLibraryExtension +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.api.artifacts.repositories.PasswordCredentials +import org.gradle.api.publish.PublicationContainer +import org.gradle.api.publish.PublishingExtension +import org.gradle.api.publish.maven.MavenPublication +import org.gradle.api.tasks.Exec +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.create +import org.gradle.kotlin.dsl.getByType +import org.gradle.kotlin.dsl.named +import org.gradle.kotlin.dsl.register +import org.gradle.plugins.signing.SigningExtension +import java.util.Locale + +class MavenPublishPlugin: Plugin { + companion object { + private val RELEASE_VERSION_REGEX = "^\\d+\\.\\d+\\.\\d+\$".toRegex() + } + + override fun apply(target: Project) { + target.apply(plugin = "maven-publish") + target.apply(plugin = "signing") + + val artifactVersion = target.version as String + + val repositoryUsername = target.findProperty("NEXUS_USERNAME") as? String + val repositoryPassword = target.findProperty("NEXUS_PASSWORD") as? String + val signingKey = target.findProperty("signingKey") as? String + val signingPassword = target.findProperty("signingPassword") as? String + + val isRelease = artifactVersion.matches(RELEASE_VERSION_REGEX) + + target.extensions.getByType().libraryVariants.configureEach { + val variant = this + + target.tasks.register("verifyBytecodeVersion${variant.name.capitalize(Locale.ROOT)}").configure { + dependsOn(variant.assembleProvider) + + commandLine( + target.rootProject.file("scripts/verify-bytecode-version"), + "--aar", + variant.packageLibraryProvider.flatMap { it.archiveFile }.get(), + "--java", + SdkPlugin.JAVA_VERSION.toString() + ) + } + } + + target.extensions.getByType().configurePublishingExtension( + target = target, + artifactVersion = artifactVersion, + isRelease = isRelease, + repositoryUsername = repositoryUsername, + repositoryPassword = repositoryPassword, + ) + target.extensions.getByType().configureSigningExtension( + isSigningRequired = isRelease, + signingKey = signingKey, + signingPassword = signingPassword, + publications = target.extensions.getByType().publications, + ) + + target.gradle.taskGraph.whenReady { + with(target.extensions.getByType()) { + isRequired = isRequired && hasTask("publishReleasePublicationToMavenRepository") + } + } + } + + fun PublishingExtension.configurePublishingExtension( + target: Project, + artifactVersion: String, + isRelease: Boolean, + repositoryUsername: String?, + repositoryPassword: String?, + ) { + repositories { + maven { + setUrl( + if (isRelease) { + "https://oss.sonatype.org/service/local/staging/deploy/maven2/" + } else { + "https://oss.sonatype.org/content/repositories/snapshots/" + } + ) + + credentials(PasswordCredentials::class.java) { + username = repositoryUsername + password = repositoryPassword + } + } + } + + + publications { + create("release") { + // This block would be evaluated before components.getByName("release") was created + + groupId = "com.deploygate" + version = artifactVersion + + pom { + name.set(target.sdkExtension.displayName) + description.set(target.sdkExtension.description) + url.set("https://github.com/DeployGate/deploygate-android-sdk") + + licenses { + license { + name.set("The Apache Software License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + distribution.set("repo") + } + } + + developers { + developer { + id.set("deploygate") + name.set("DeployGate") + } + } + + scm { + url.set("https://github.com/DeployGate/deploygate-android-sdk") + } + } + } + } + + target.afterEvaluate { + publications { + // Configure some values after AGP has been configured + named("release") { + from(components.getByName("release")) + artifactId = sdkExtension.artifactId.get() + } + } + } + } + + + fun SigningExtension.configureSigningExtension( + isSigningRequired: Boolean, + signingKey: String?, + signingPassword: String?, + publications: PublicationContainer, + ) { + isRequired = isSigningRequired + useInMemoryPgpKeys(signingKey, signingPassword) + + publications.configureEach { + sign(this) + } + } +} \ No newline at end of file diff --git a/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt b/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt new file mode 100644 index 0000000..24da83f --- /dev/null +++ b/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt @@ -0,0 +1,129 @@ +package com.deploygate.plugins + +import com.android.build.api.dsl.LibraryExtension +import com.deploygate.plugins.dsl.SdkExtension +import org.gradle.api.GradleException +import org.gradle.api.JavaVersion +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.create +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.getByType + +class SdkPlugin: Plugin { + companion object { + /** + * sdk/java/com/deploygate/sdk/HostAppTest.java needs to be changed for a new release + */ + private const val ARTIFACT_VERSION = "4.7.1" + + val JAVA_VERSION = JavaVersion.VERSION_1_8 + } + + override fun apply(target: Project) { + target.version = ARTIFACT_VERSION + + target.extensions.create("sdk") + + target.apply(plugin = "com.android.library") + target.apply() + + target.extensions.getByType().configureLibraryExtension( + artifactVersion = target.version as String, + ) + + target.tasks.register("verifyReleaseVersion") { + doLast { + if (target.version != System.getenv("RELEASE_VERSION")) { + throw GradleException("${target.version} does not equal to ${System.getenv("RELEASE_VERSION")}") + } + } + } + + target.dependencies { + add("testImplementation", "androidx.test:runner:1.5.2") + add("testImplementation", "androidx.test.ext:junit:1.1.5") + add("testImplementation", "org.robolectric:robolectric:4.10.3") + add("testImplementation", "androidx.test:rules:1.5.0") + add("testImplementation", "com.google.truth:truth:1.0") + } + + } + + fun LibraryExtension.configureLibraryExtension( + artifactVersion: String, + ) { + compileSdk = 33 + + defaultConfig { + minSdk = 14 + + // A map of isSupporting> + val features = linkedMapOf( + "UPDATE_MESSAGE_OF_BUILD" to true, + "SERIALIZED_EXCEPTION" to true, + "LOGCAT_BUNDLE" to true, + "STREAMED_LOGCAT" to true, + "DEVICE_CAPTURE" to true, + ) + + var flags = 0 + + features.entries.forEachIndexed { i, e -> + val (feature, isSupporting) = e + + buildConfigField("int", feature, "1 << $i") + + if (isSupporting) { + flags = flags or 1.shl(i) + } + } + + addManifestPlaceholders( + mapOf( + "featureFlags" to flags, + "sdkVersion" to "4", + "sdkArtifactVersion" to artifactVersion, + ) + ) + } + + buildTypes { + release { + isMinifyEnabled = false + } + } + + compileOptions { + sourceCompatibility(JAVA_VERSION) + targetCompatibility(JAVA_VERSION) + } + + testOptions { + unitTests { + isIncludeAndroidResources = true + } + unitTests.all { + it.jvmArgs( + "-Xmx1g", + ) + } + } + + buildFeatures { + buildConfig = true + } + + lint { + abortOnError = false + } + + publishing { + singleVariant("release") { + withJavadocJar() + withSourcesJar() + } + } + } +} \ No newline at end of file diff --git a/plugins/library/src/main/java/com/deploygate/plugins/dsl/SdkExtension.kt b/plugins/library/src/main/java/com/deploygate/plugins/dsl/SdkExtension.kt new file mode 100644 index 0000000..f8b1040 --- /dev/null +++ b/plugins/library/src/main/java/com/deploygate/plugins/dsl/SdkExtension.kt @@ -0,0 +1,11 @@ +package com.deploygate.plugins.dsl + +import org.gradle.api.provider.Property + +interface SdkExtension { + + val artifactId: Property + + val displayName: Property + val description: Property +} \ No newline at end of file diff --git a/plugins/library/src/main/java/com/deploygate/plugins/ext/ProjectExt.kt b/plugins/library/src/main/java/com/deploygate/plugins/ext/ProjectExt.kt new file mode 100644 index 0000000..135292e --- /dev/null +++ b/plugins/library/src/main/java/com/deploygate/plugins/ext/ProjectExt.kt @@ -0,0 +1,8 @@ +package com.deploygate.plugins.ext + +import com.deploygate.plugins.dsl.SdkExtension +import org.gradle.api.Project +import org.gradle.kotlin.dsl.getByType + +val Project.sdkExtension: SdkExtension + get() = extensions.getByType() \ No newline at end of file diff --git a/plugins/sample/build.gradle.kts b/plugins/sample/build.gradle.kts new file mode 100644 index 0000000..de857d7 --- /dev/null +++ b/plugins/sample/build.gradle.kts @@ -0,0 +1,18 @@ +plugins { + `kotlin-dsl` +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.22") + implementation("com.android.tools.build:gradle:7.4.2") + implementation("com.project.starter:easylauncher:5.0.1") +} + +gradlePlugin { + plugins { + create("sample") { + id = "com.deploygate.plugins.sample-app" + implementationClass = "com.deploygate.plugins.SampleAppPlugin" + } + } +} diff --git a/plugins/sample/src/main/java/com/deploygate/plugins/SampleAppPlugin.kt b/plugins/sample/src/main/java/com/deploygate/plugins/SampleAppPlugin.kt new file mode 100644 index 0000000..c72997f --- /dev/null +++ b/plugins/sample/src/main/java/com/deploygate/plugins/SampleAppPlugin.kt @@ -0,0 +1,131 @@ +package com.deploygate.plugins + +import com.android.build.api.dsl.Lint +import com.android.build.gradle.AppExtension +import com.project.starter.easylauncher.filter.ColorRibbonFilter +import com.project.starter.easylauncher.plugin.EasyLauncherExtension +import org.gradle.api.JavaVersion +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.apply +import org.gradle.kotlin.dsl.findByType +import org.gradle.kotlin.dsl.invoke + +class SampleAppPlugin: Plugin { + override fun apply(target: Project) { + target.apply(plugin = "com.android.application") + target.apply(plugin = "com.starter.easylauncher") + + target.extensions.findByType(AppExtension::class.java)?.configureAppExtension() + target.extensions.findByType(EasyLauncherExtension::class.java)?.configureEasyLauncherExtension() + } + + private fun AppExtension.configureAppExtension() { + compileSdkVersion(33) + + defaultConfig { + applicationId = "com.deploygate.sample" + minSdk = 14 + targetSdk = 33 + } + + buildTypes { + getByName("debug") { + applicationIdSuffix = ".debug" + } + create("distribute") { + debuggable(true) + matchingFallbacks += "release" + } + create("release") { + minifyEnabled(true) + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-project.txt", + ) + } + } + + flavorDimensions("mode") + + productFlavors { + create("devreal") { + dimension("mode") + applicationIdSuffix(".realsdk.dev") + } + create("devmock") { + dimension("mode") + applicationIdSuffix(".mocksdk.dev") + } + create("stablereal") { + dimension("mode") + applicationIdSuffix(".realsdk.stable") + } + create("stablemock") { + dimension("mode") + applicationIdSuffix(".mocksdk.stable") + } + } + + compileOptions { + sourceCompatibility(JavaVersion.VERSION_1_8) + targetCompatibility(JavaVersion.VERSION_1_8) + } + + lintOptions { + isAbortOnError = false + } + } + + private fun EasyLauncherExtension.configureEasyLauncherExtension() { + defaultFlavorNaming(true) + + productFlavors { + create("devreal") { + filters( + customRibbon( + label = "devreal", + ribbonColor = "#55E74C3C", + labelColor = "#FFFFFF", + gravity = ColorRibbonFilter.Gravity.TOPRIGHT, + ), + ) + } + create("devmock") { + filters( + customRibbon( + label = "devmock", + ribbonColor = "#556600CC", + labelColor = "#FFFFFF", + gravity = ColorRibbonFilter.Gravity.TOPRIGHT, + ), + ) + } + create("stablereal") { + enable(false) + } + create("stablemock") { + enable(false) + } + } + + buildTypes { + create("debug") { + filters( + customRibbon( + label = "debug", + ribbonColor = "#5574924", + labelColor = "#FFFFFF", + gravity = ColorRibbonFilter.Gravity.BOTTOM, + ), + ) + } + create("distribute") { + enable(false) + } + create("release") { + enable(false) + } + } + } +} \ No newline at end of file diff --git a/plugins/settings.gradle b/plugins/settings.gradle index 172c040..db68059 100644 --- a/plugins/settings.gradle +++ b/plugins/settings.gradle @@ -13,13 +13,7 @@ dependencyResolutionManagement { mavenCentral() gradlePluginPortal() } - versionCatalogs { - create("libs") { - from(files("../gradle/libs.versions.toml")) - } - } } -include(":android") -include(":common") -include(":spotless") +include(":library") +include(":sample") diff --git a/publishing.build.gradle b/publishing.build.gradle deleted file mode 100644 index 64b53d3..0000000 --- a/publishing.build.gradle +++ /dev/null @@ -1,103 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -def publicationVariants = ["release"] - -def getRepositoryUsername() { - return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" -} - -def getRepositoryPassword() { - return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" -} - -def isRelease() { - return rootProject.ext.releaseVersion =~ /^\d+\.\d+\.\d+$/ -} - -android.libraryVariants.configureEach { variant -> - if (publicationVariants.contains(variant.name)) { - project.task("generateJavadocFor${variant.name.capitalize()}Publication", type: Javadoc) { - source = variant.getJavaCompileProvider().get().source - classpath = variant.getJavaCompileProvider().get().classpath + files(project.android.getBootClasspath()) - options.linkSource true - } - - project.task("generateSourcesJarFor${variant.name.capitalize()}Publication", type: Jar) { - archiveClassifier.set('sources') - from variant.sourceSets.collect { it.javaDirectories }.flatten() - } - - project.task("generateJavadocsJarFor${variant.name.capitalize()}Publication", type: Jar) { - archiveClassifier.set('javadoc') - from files(tasks.getByName("generateJavadocFor${variant.name.capitalize()}Publication")) - } - - project.tasks.findByName("verifyBytecodeVersion${variant.name.capitalize()}").dependsOn( - "generateSourcesJarFor${variant.name.capitalize()}Publication", - "generateJavadocsJarFor${variant.name.capitalize()}Publication", - "generatePomFileFor${variant.name.capitalize()}Publication" - ) - } -} - -afterEvaluate { - publishing { - repositories { - maven { - url = isRelease() ? "https://oss.sonatype.org/service/local/staging/deploy/maven2/" : "https://oss.sonatype.org/content/repositories/snapshots/" - - credentials(PasswordCredentials) { - username = getRepositoryUsername() - password = getRepositoryPassword() - } - } - } - - publications { - release(MavenPublication) { - from components.release - artifact generateSourcesJarForReleasePublication - artifact generateJavadocsJarForReleasePublication - - groupId = 'com.deploygate' - artifactId = project.ext.artifactId - version = project.version - - pom { - name = project.ext.displayName - description = project.ext.desc - url = 'https://github.com/DeployGate/deploygate-android-sdk' - licenses { - license { - name = "The Apache Software License, Version 2.0" - url = "http://www.apache.org/licenses/LICENSE-2.0.txt" - distribution = "repo" - } - } - developers { - developer { - id = "deploygate" - name = "DeployGate" - } - } - scm { - url = 'https://github.com/DeployGate/deploygate-android-sdk' - } - } - } - } - } - - signing { - required { isRelease() && gradle.taskGraph.hasTask("publishReleasePublicationToMavenRepository") } - - def signingKey = findProperty("signingKey") - def signingPassword = findProperty("signingPassword") - useInMemoryPgpKeys(signingKey, signingPassword) - publishing.publications.configureEach { publication -> - sign publication - } - } -} - diff --git a/sample/build.gradle b/sample/build.gradle index 5c82649..e42ac8b 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,90 +1,4 @@ -apply plugin: 'com.android.application' -apply plugin: 'com.starter.easylauncher' - -android { - compileSdkVersion 33 - - defaultConfig { - applicationId "com.deploygate.sample" - minSdkVersion 14 - targetSdkVersion 33 - } - - buildTypes { - debug { - applicationIdSuffix '.debug' - } - distribute { - debuggable true - matchingFallbacks = ['release'] - } - release { - minifyEnabled true - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-project.txt' - } - } - - flavorDimensions "mode" - - productFlavors { - devreal { - dimension "mode" - applicationIdSuffix ".realsdk.dev" - } - devmock { - dimension "mode" - applicationIdSuffix ".mocksdk.dev" - } - stablereal { - dimension "mode" - applicationIdSuffix ".realsdk.stable" - } - stablemock { - dimension "mode" - applicationIdSuffix ".mocksdk.stable" - } - } - - lintOptions { - abortOnError false - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } -} - -easylauncher { - defaultFlavorNaming true - - productFlavors { - devreal { - filters = customColorRibbonFilter("devreal", "#55E74C3C", "#FFFFFF", "topRight") - } - devmock { - filters = customColorRibbonFilter("devmock", "#556600CC", "#FFFFFF", "topRight") - } - stablereal { - enable false - } - stablemock { - enable false - } - } - - buildTypes { - debug { - filters = customColorRibbonFilter("debug", "#5574924", "#FFFFFF", "bottom") - } - distribute { - enable false - } - release { - enable false - } - } -} +apply plugin: 'com.deploygate.plugins.sample-app' dependencies { devrealImplementation project(':sdk') diff --git a/sdk.build.gradle b/sdk.build.gradle deleted file mode 100644 index b15dc8d..0000000 --- a/sdk.build.gradle +++ /dev/null @@ -1,89 +0,0 @@ -apply plugin: 'com.android.library' -apply plugin: 'maven-publish' - -version = rootProject.ext.releaseVersion - -android { - compileSdkVersion 33 - - defaultConfig { - minSdkVersion 14 - targetSdkVersion 33 - versionCode 1 - versionName project.version - - // A map of name to isSupporting - def features = [ - UPDATE_MESSAGE_OF_BUILD: true, - SERIALIZED_EXCEPTION: true, - LOGCAT_BUNDLE: true, - STREAMED_LOGCAT: true, - DEVICE_CAPTURE: true, - ] - - if (!(features instanceof LinkedHashMap)) { - throw new IllegalAccessException("The key order may not be kept") - } - - int flags = 0 - - features.keySet().eachWithIndex { String key, int i -> - buildConfigField("int", key, "1 << $i") - - if (features[key]) { - flags |= 1 << i - } - } - - manifestPlaceholders += [ - featureFlags: flags, - sdkVersion: "4", - sdkArtifactVersion: project.version, - ] - } - - buildTypes { - release { - minifyEnabled false - } - } - - lintOptions { - abortOnError false - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_7 - targetCompatibility JavaVersion.VERSION_1_7 - } - - testOptions { - unitTests { - includeAndroidResources = true - } - unitTests.all { - jvmArgs "-Xmx1g" - } - } - - buildFeatures { - buildConfig = true - } -} - -dependencies { - testImplementation 'androidx.test:runner:1.5.2' - testImplementation 'androidx.test.ext:junit:1.1.5' - testImplementation 'org.robolectric:robolectric:4.10.3' - - testImplementation 'androidx.test:rules:1.5.0' - testImplementation 'com.google.truth:truth:1.0' -} - -android.libraryVariants.configureEach { variant -> - tasks.register("verifyBytecodeVersion${variant.name.capitalize()}", Exec).configure { - dependsOn "assemble${variant.name.capitalize()}" - - commandLine rootProject.file("scripts/verify-bytecode-version").path, "--aar", project.file("build/outputs/aar/${project.name}-${variant.name}.aar"), "--java", project.android.compileOptions.targetCompatibility.toString() - } -} \ No newline at end of file diff --git a/sdk/build.gradle b/sdk/build.gradle index 3bf40f5..0a273f5 100644 --- a/sdk/build.gradle +++ b/sdk/build.gradle @@ -1,4 +1,4 @@ -apply from: rootProject.file('sdk.build.gradle') +apply plugin: 'com.deploygate.plugins.sdk' android { defaultConfig { @@ -11,10 +11,8 @@ dependencies { testImplementation 'org.mockito:mockito-inline:4.4.0' } -ext { - displayName = "DeployGate SDK" - artifactId = 'sdk' - desc = 'DeployGate SDK for Android' +sdk { + displayName.set("DeployGate SDK") + artifactId.set('sdk') + description.set('DeployGate SDK for Android') } - -apply from: rootProject.file('publishing.build.gradle') \ No newline at end of file diff --git a/sdkMock/build.gradle b/sdkMock/build.gradle index f5e61e8..79be5a2 100644 --- a/sdkMock/build.gradle +++ b/sdkMock/build.gradle @@ -1,9 +1,7 @@ -apply from: rootProject.file('sdk.build.gradle') +apply plugin: 'com.deploygate.plugins.sdk' -ext { - displayName = "DeployGate SDK Mock" - artifactId = 'sdk-mock' - desc = 'Mocked dummy DeployGate SDK for Android to reduce footprint of your release version app without code modification' +sdk { + displayName.set("DeployGate SDK Mock") + artifactId.set('sdk-mock') + description.set('Mocked dummy DeployGate SDK for Android to reduce footprint of your release version app without code modification') } - -apply from: rootProject.file('publishing.build.gradle') \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index d81f580..e73d17d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -9,9 +9,6 @@ pluginManagement { resolutionStrategy { eachPlugin { switch(requested.id.id) { - case "com.google.android.gms.oss-licenses-plugin": - useModule("com.google.android.gms:oss-licenses-plugin:${requested.version}") - break case "deploygate": useModule("com.deploygate:gradle:${requested.version}") break @@ -20,7 +17,7 @@ pluginManagement { } } - includeBuild("build-logic") + includeBuild("plugins") } dependencyResolutionManagement { @@ -35,6 +32,4 @@ dependencyResolutionManagement { } } -includeBuild('plugins') - -include ':sdk', ':sdkMock', ':sample' \ No newline at end of file +include ':sdk'//, ':sdkMock', ':sample' \ No newline at end of file From b831946392eb9a5fb8cb1d28340012293bec8d1a Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Sun, 24 Mar 2024 19:58:57 +0900 Subject: [PATCH 3/9] refactor: Reformat code and use some extensions --- .../deploygate/plugins/MavenPublishPlugin.kt | 41 ++++++++++--------- .../java/com/deploygate/plugins/SdkPlugin.kt | 6 +-- .../deploygate/plugins/dsl/SdkExtension.kt | 2 - .../com/deploygate/plugins/ext/ProjectExt.kt | 15 +++++++ .../com/deploygate/plugins/SampleAppPlugin.kt | 19 ++++----- settings.gradle | 2 +- 6 files changed, 50 insertions(+), 35 deletions(-) diff --git a/plugins/library/src/main/java/com/deploygate/plugins/MavenPublishPlugin.kt b/plugins/library/src/main/java/com/deploygate/plugins/MavenPublishPlugin.kt index f686926..aa51c8c 100644 --- a/plugins/library/src/main/java/com/deploygate/plugins/MavenPublishPlugin.kt +++ b/plugins/library/src/main/java/com/deploygate/plugins/MavenPublishPlugin.kt @@ -1,7 +1,9 @@ package com.deploygate.plugins +import com.deploygate.plugins.ext.internalApiLibraryExtension +import com.deploygate.plugins.ext.publishingExtension import com.deploygate.plugins.ext.sdkExtension -import com.android.build.gradle.LibraryExtension as InternalApiLibraryExtension +import com.deploygate.plugins.ext.signingExtension import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.artifacts.repositories.PasswordCredentials @@ -17,7 +19,7 @@ import org.gradle.kotlin.dsl.register import org.gradle.plugins.signing.SigningExtension import java.util.Locale -class MavenPublishPlugin: Plugin { +class MavenPublishPlugin : Plugin { companion object { private val RELEASE_VERSION_REGEX = "^\\d+\\.\\d+\\.\\d+\$".toRegex() } @@ -35,30 +37,31 @@ class MavenPublishPlugin: Plugin { val isRelease = artifactVersion.matches(RELEASE_VERSION_REGEX) - target.extensions.getByType().libraryVariants.configureEach { + target.internalApiLibraryExtension.libraryVariants.configureEach { val variant = this - target.tasks.register("verifyBytecodeVersion${variant.name.capitalize(Locale.ROOT)}").configure { - dependsOn(variant.assembleProvider) - - commandLine( - target.rootProject.file("scripts/verify-bytecode-version"), - "--aar", - variant.packageLibraryProvider.flatMap { it.archiveFile }.get(), - "--java", - SdkPlugin.JAVA_VERSION.toString() - ) - } + target.tasks.register("verifyBytecodeVersion${variant.name.capitalize(Locale.ROOT)}") + .configure { + dependsOn(variant.assembleProvider) + + commandLine( + target.rootProject.file("scripts/verify-bytecode-version"), + "--aar", + variant.packageLibraryProvider.flatMap { it.archiveFile }.get(), + "--java", + SdkPlugin.JAVA_VERSION.toString() + ) + } } - target.extensions.getByType().configurePublishingExtension( + target.publishingExtension.configurePublishingExtension( target = target, artifactVersion = artifactVersion, isRelease = isRelease, repositoryUsername = repositoryUsername, repositoryPassword = repositoryPassword, ) - target.extensions.getByType().configureSigningExtension( + target.signingExtension.configureSigningExtension( isSigningRequired = isRelease, signingKey = signingKey, signingPassword = signingPassword, @@ -66,13 +69,13 @@ class MavenPublishPlugin: Plugin { ) target.gradle.taskGraph.whenReady { - with(target.extensions.getByType()) { + with(target.signingExtension) { isRequired = isRequired && hasTask("publishReleasePublicationToMavenRepository") } } } - fun PublishingExtension.configurePublishingExtension( + private fun PublishingExtension.configurePublishingExtension( target: Project, artifactVersion: String, isRelease: Boolean, @@ -143,7 +146,7 @@ class MavenPublishPlugin: Plugin { } - fun SigningExtension.configureSigningExtension( + private fun SigningExtension.configureSigningExtension( isSigningRequired: Boolean, signingKey: String?, signingPassword: String?, diff --git a/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt b/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt index 24da83f..664169e 100644 --- a/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt +++ b/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt @@ -2,6 +2,7 @@ package com.deploygate.plugins import com.android.build.api.dsl.LibraryExtension import com.deploygate.plugins.dsl.SdkExtension +import com.deploygate.plugins.ext.libraryExtension import org.gradle.api.GradleException import org.gradle.api.JavaVersion import org.gradle.api.Plugin @@ -9,9 +10,8 @@ import org.gradle.api.Project import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.create import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.getByType -class SdkPlugin: Plugin { +class SdkPlugin : Plugin { companion object { /** * sdk/java/com/deploygate/sdk/HostAppTest.java needs to be changed for a new release @@ -29,7 +29,7 @@ class SdkPlugin: Plugin { target.apply(plugin = "com.android.library") target.apply() - target.extensions.getByType().configureLibraryExtension( + target.libraryExtension.configureLibraryExtension( artifactVersion = target.version as String, ) diff --git a/plugins/library/src/main/java/com/deploygate/plugins/dsl/SdkExtension.kt b/plugins/library/src/main/java/com/deploygate/plugins/dsl/SdkExtension.kt index f8b1040..20877ca 100644 --- a/plugins/library/src/main/java/com/deploygate/plugins/dsl/SdkExtension.kt +++ b/plugins/library/src/main/java/com/deploygate/plugins/dsl/SdkExtension.kt @@ -3,9 +3,7 @@ package com.deploygate.plugins.dsl import org.gradle.api.provider.Property interface SdkExtension { - val artifactId: Property - val displayName: Property val description: Property } \ No newline at end of file diff --git a/plugins/library/src/main/java/com/deploygate/plugins/ext/ProjectExt.kt b/plugins/library/src/main/java/com/deploygate/plugins/ext/ProjectExt.kt index 135292e..3d935ae 100644 --- a/plugins/library/src/main/java/com/deploygate/plugins/ext/ProjectExt.kt +++ b/plugins/library/src/main/java/com/deploygate/plugins/ext/ProjectExt.kt @@ -1,8 +1,23 @@ package com.deploygate.plugins.ext +import com.android.build.api.dsl.LibraryExtension import com.deploygate.plugins.dsl.SdkExtension import org.gradle.api.Project +import org.gradle.api.publish.PublishingExtension import org.gradle.kotlin.dsl.getByType +import org.gradle.plugins.signing.SigningExtension val Project.sdkExtension: SdkExtension + get() = extensions.getByType() + +val Project.libraryExtension: LibraryExtension + get() = extensions.getByType() + +val Project.signingExtension: SigningExtension + get() = extensions.getByType() + +val Project.publishingExtension: PublishingExtension + get() = extensions.getByType() + +val Project.internalApiLibraryExtension: com.android.build.gradle.LibraryExtension get() = extensions.getByType() \ No newline at end of file diff --git a/plugins/sample/src/main/java/com/deploygate/plugins/SampleAppPlugin.kt b/plugins/sample/src/main/java/com/deploygate/plugins/SampleAppPlugin.kt index c72997f..f4281ca 100644 --- a/plugins/sample/src/main/java/com/deploygate/plugins/SampleAppPlugin.kt +++ b/plugins/sample/src/main/java/com/deploygate/plugins/SampleAppPlugin.kt @@ -1,6 +1,5 @@ package com.deploygate.plugins -import com.android.build.api.dsl.Lint import com.android.build.gradle.AppExtension import com.project.starter.easylauncher.filter.ColorRibbonFilter import com.project.starter.easylauncher.plugin.EasyLauncherExtension @@ -8,16 +7,16 @@ import org.gradle.api.JavaVersion import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.apply -import org.gradle.kotlin.dsl.findByType import org.gradle.kotlin.dsl.invoke -class SampleAppPlugin: Plugin { +class SampleAppPlugin : Plugin { override fun apply(target: Project) { target.apply(plugin = "com.android.application") target.apply(plugin = "com.starter.easylauncher") target.extensions.findByType(AppExtension::class.java)?.configureAppExtension() - target.extensions.findByType(EasyLauncherExtension::class.java)?.configureEasyLauncherExtension() + target.extensions.findByType(EasyLauncherExtension::class.java) + ?.configureEasyLauncherExtension() } private fun AppExtension.configureAppExtension() { @@ -30,20 +29,20 @@ class SampleAppPlugin: Plugin { } buildTypes { - getByName("debug") { + named("debug") { applicationIdSuffix = ".debug" } - create("distribute") { - debuggable(true) - matchingFallbacks += "release" - } - create("release") { + named("release") { minifyEnabled(true) proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-project.txt", ) } + create("distribute") { + debuggable(true) + matchingFallbacks += "release" + } } flavorDimensions("mode") diff --git a/settings.gradle b/settings.gradle index e73d17d..7578263 100644 --- a/settings.gradle +++ b/settings.gradle @@ -32,4 +32,4 @@ dependencyResolutionManagement { } } -include ':sdk'//, ':sdkMock', ':sample' \ No newline at end of file +include ':sdk', ':sdkMock', ':sample' \ No newline at end of file From 4642a28fa9e1b21c183033fc6716bde309bfe4ba Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Mon, 25 Mar 2024 11:19:03 +0900 Subject: [PATCH 4/9] fix: JDK 1.7 is correct for sdk modules --- .../library/src/main/java/com/deploygate/plugins/SdkPlugin.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt b/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt index 664169e..1cf6b16 100644 --- a/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt +++ b/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt @@ -18,7 +18,7 @@ class SdkPlugin : Plugin { */ private const val ARTIFACT_VERSION = "4.7.1" - val JAVA_VERSION = JavaVersion.VERSION_1_8 + val JAVA_VERSION = JavaVersion.VERSION_1_7 } override fun apply(target: Project) { From 36ccf503eb20ffc5392fa8dea6d74ccfb8fc53e2 Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Mon, 25 Mar 2024 16:58:56 +0900 Subject: [PATCH 5/9] fix: Set target sdk in a library module to use it in unit testing --- .../main/java/com/deploygate/plugins/SdkPlugin.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt b/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt index 1cf6b16..2fb1764 100644 --- a/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt +++ b/plugins/library/src/main/java/com/deploygate/plugins/SdkPlugin.kt @@ -58,6 +58,7 @@ class SdkPlugin : Plugin { defaultConfig { minSdk = 14 + targetSdk = 33 // A map of isSupporting> val features = linkedMapOf( @@ -103,11 +104,12 @@ class SdkPlugin : Plugin { testOptions { unitTests { isIncludeAndroidResources = true - } - unitTests.all { - it.jvmArgs( - "-Xmx1g", - ) + + all { + it.jvmArgs( + "-Xmx1g", + ) + } } } From c0054c84f520231b30c8c437fb6f71a97dd2ccd9 Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Mon, 25 Mar 2024 18:03:51 +0900 Subject: [PATCH 6/9] chore: Add a script to verify publications and run it on PRs --- .github/workflows/test.yml | 21 ++++++++++++++++--- scripts/verify-publications.bash | 35 ++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 3 deletions(-) create mode 100755 scripts/verify-publications.bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 747b9b1..65d902c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Build the sample project and upload artifacts if possible +name: Build and test projects on: push: @@ -12,6 +12,23 @@ on: jobs: + sdk-build: + runs-on: ubuntu-latest + if: > + github.event_name != 'workflow_dispatch' + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + java-version: '17.x' + java-package: jdk + distribution: 'temurin' + cache: 'gradle' + - name: Check sdk publications + run: ./scripts/verify-publications.bash sdk + - name: Check sdk-mock publications + run: ./scripts/verify-publications.bash sdkMock + build-and-upload: runs-on: ubuntu-latest if: > @@ -46,8 +63,6 @@ jobs: --url 'https://deploygate.com/api/users/${{ secrets.SHARED_DEPLOYGATE_APP_OWNER_NAME_FOR_PUBLIC_REPO }}/apps' | \ jq -r '"\(.results.package_name) \(.results.distribution.url)"' done < <(find ./sample/build/outputs/bundle -name "*.aab") - - name: Check javadocs - run: ./gradlew sdk:generateJavadocForReleasePublication sdkMock:generateJavadocForReleasePublication distribute-stable: runs-on: ubuntu-latest diff --git a/scripts/verify-publications.bash b/scripts/verify-publications.bash new file mode 100755 index 0000000..0440ca9 --- /dev/null +++ b/scripts/verify-publications.bash @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +set -euo pipefail + +die() { + echo "$*" >&2 + exit 1 +} + +readonly tmp_dir="$(mktemp -d)" + +readonly module_name="$1" + +./gradlew \ + "${module_name}:verifyBytecodeVersionRelease" \ + "${module_name}:publishReleasePublicationToMavenLocal" \ + --stacktrace + +cat "${module_name}/build/publications/release/module.json" + +readonly artifact_id="$(jq -r '.component.module' "${module_name}/build/publications/release/module.json")" +readonly version="$(jq -r '.component.version' "${module_name}/build/publications/release/module.json")" + +cat< "${tmp_dir}/expected.txt" +${artifact_id}-${version}-javadoc.jar +${artifact_id}-${version}-sources.jar +${artifact_id}-${version}.aar +EOF + +jq -r '[.variants[] | .files[] | .name] | unique | sort | .[]' \ + "${module_name}/build/publications/release/module.json" | tee "${tmp_dir}/actual.txt" + +if ! diff "${tmp_dir}/expected.txt" "${tmp_dir}/actual.txt"; then + die "Publications do or don't contain expected artifacts" +fi From b4f6b462a338bb3eebd8c333c1a92ca3789508bb Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Mon, 25 Mar 2024 18:24:46 +0900 Subject: [PATCH 7/9] chore: Pass --no-daemon when building projects on CI --- .github/workflows/test.yml | 4 ++++ scripts/verify-publications.bash | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 65d902c..232f0b3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -26,8 +26,12 @@ jobs: cache: 'gradle' - name: Check sdk publications run: ./scripts/verify-publications.bash sdk + env: + _GRADLE_ARGS: --no-daemon - name: Check sdk-mock publications run: ./scripts/verify-publications.bash sdkMock + env: + _GRADLE_ARGS: --no-daemon build-and-upload: runs-on: ubuntu-latest diff --git a/scripts/verify-publications.bash b/scripts/verify-publications.bash index 0440ca9..c4fdb2f 100755 --- a/scripts/verify-publications.bash +++ b/scripts/verify-publications.bash @@ -11,10 +11,12 @@ readonly tmp_dir="$(mktemp -d)" readonly module_name="$1" +_GRADLE_ARGS="${_GRADLE_ARGS-} --stacktrace" + ./gradlew \ "${module_name}:verifyBytecodeVersionRelease" \ "${module_name}:publishReleasePublicationToMavenLocal" \ - --stacktrace + $_GRADLE_ARGS cat "${module_name}/build/publications/release/module.json" From f51681d9b73779b0e7680e67d025203ee6b1a917 Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Mon, 25 Mar 2024 18:37:50 +0900 Subject: [PATCH 8/9] chore: stop gradle daemon anyway --- .github/workflows/test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 232f0b3..dc2ab0f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,9 @@ jobs: github.event_name != 'workflow_dispatch' steps: - uses: actions/checkout@v3 + - run: | + mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties + ./gradlew --stop - uses: actions/setup-java@v3 with: java-version: '17.x' From e90c3d158e3ca0124b19895f7d493f129fe19d27 Mon Sep 17 00:00:00 2001 From: Jumpei Matsuda Date: Mon, 25 Mar 2024 18:43:15 +0900 Subject: [PATCH 9/9] chore: Set GRADLE_OPTS to configure jvm args --- .github/workflows/test.yml | 9 ++------- scripts/verify-publications.bash | 4 +--- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dc2ab0f..700b25d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,11 +16,10 @@ jobs: runs-on: ubuntu-latest if: > github.event_name != 'workflow_dispatch' + env: + GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx4g -XX:MaxMetaspaceSize=2g -Dkotlin.daemon.jvm.options=-Xmx1536m" steps: - uses: actions/checkout@v3 - - run: | - mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties - ./gradlew --stop - uses: actions/setup-java@v3 with: java-version: '17.x' @@ -29,12 +28,8 @@ jobs: cache: 'gradle' - name: Check sdk publications run: ./scripts/verify-publications.bash sdk - env: - _GRADLE_ARGS: --no-daemon - name: Check sdk-mock publications run: ./scripts/verify-publications.bash sdkMock - env: - _GRADLE_ARGS: --no-daemon build-and-upload: runs-on: ubuntu-latest diff --git a/scripts/verify-publications.bash b/scripts/verify-publications.bash index c4fdb2f..0440ca9 100755 --- a/scripts/verify-publications.bash +++ b/scripts/verify-publications.bash @@ -11,12 +11,10 @@ readonly tmp_dir="$(mktemp -d)" readonly module_name="$1" -_GRADLE_ARGS="${_GRADLE_ARGS-} --stacktrace" - ./gradlew \ "${module_name}:verifyBytecodeVersionRelease" \ "${module_name}:publishReleasePublicationToMavenLocal" \ - $_GRADLE_ARGS + --stacktrace cat "${module_name}/build/publications/release/module.json"