summaryrefslogtreecommitdiff
path: root/buildSrc/src/main
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-11-16 00:09:19 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-11-16 00:22:18 +0530
commit40e65e1a8bec914345b3b74040e47e43b15625a0 (patch)
treef3306c06e6c234e23f6739cbbfe3a7e668bfece0 /buildSrc/src/main
parent0fad4d24b5f119bb5ed62c4dda5edd11680c20a2 (diff)
buildSrc: remove code superseded by convention plugins
Diffstat (limited to 'buildSrc/src/main')
-rw-r--r--buildSrc/src/main/java/BaseProjectConfig.kt39
-rw-r--r--buildSrc/src/main/java/BinaryCompatibilityValidator.kt12
-rw-r--r--buildSrc/src/main/java/GitHooks.kt44
-rw-r--r--buildSrc/src/main/java/KotlinCompilerArgs.kt6
-rw-r--r--buildSrc/src/main/java/PasswordStorePlugin.kt9
5 files changed, 0 insertions, 110 deletions
diff --git a/buildSrc/src/main/java/BaseProjectConfig.kt b/buildSrc/src/main/java/BaseProjectConfig.kt
index c789fd5d..f11b9dec 100644
--- a/buildSrc/src/main/java/BaseProjectConfig.kt
+++ b/buildSrc/src/main/java/BaseProjectConfig.kt
@@ -7,47 +7,8 @@ import com.android.build.gradle.TestedExtension
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import org.gradle.api.JavaVersion
import org.gradle.api.Project
-import org.gradle.api.tasks.testing.Test
-import org.gradle.api.tasks.testing.logging.TestLogEvent
-import org.gradle.api.tasks.wrapper.Wrapper
import org.gradle.kotlin.dsl.register
-import org.gradle.kotlin.dsl.withType
import org.gradle.language.nativeplatform.internal.BuildType
-import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
-
-/**
- * Configure root project. Note that classpath dependencies still need to be defined in the
- * `buildscript` block in the top-level build.gradle.kts file.
- */
-internal fun Project.configureForRootProject() {
- tasks.withType<Wrapper> {
- gradleVersion = "7.3"
- distributionSha256Sum = "de8f52ad49bdc759164f72439a3bf56ddb1589c4cde802d3cec7d6ad0e0ee410"
- }
- configureBinaryCompatibilityValidator()
- tasks.register<GitHooks>("installGitHooks") {
- val projectDirectory = layout.projectDirectory
- hookScript.set(projectDirectory.file("scripts/pre-push-hook.sh").asFile.readText())
- hookOutput.set(projectDirectory.file(".git/hooks/pre-push").asFile)
- }
-}
-
-/** Configure all projects including the root project */
-internal fun Project.configureForAllProjects() {
- tasks.withType<KotlinCompile>().configureEach {
- kotlinOptions {
- allWarningsAsErrors = true
- jvmTarget = JavaVersion.VERSION_11.toString()
- freeCompilerArgs = freeCompilerArgs + additionalCompilerArgs
- languageVersion = "1.5"
- }
- }
- tasks.withType<Test>().configureEach {
- maxParallelForks = Runtime.getRuntime().availableProcessors() * 2
- testLogging { events(TestLogEvent.PASSED, TestLogEvent.SKIPPED, TestLogEvent.FAILED) }
- outputs.upToDateWhen { false }
- }
-}
/** Checks if we're building a snapshot */
@Suppress("UnstableApiUsage")
diff --git a/buildSrc/src/main/java/BinaryCompatibilityValidator.kt b/buildSrc/src/main/java/BinaryCompatibilityValidator.kt
deleted file mode 100644
index 6d7c53fb..00000000
--- a/buildSrc/src/main/java/BinaryCompatibilityValidator.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-import kotlinx.validation.ApiValidationExtension
-import org.gradle.api.Project
-import org.gradle.kotlin.dsl.configure
-
-internal fun Project.configureBinaryCompatibilityValidator() {
- extensions.configure<ApiValidationExtension> { ignoredProjects = mutableSetOf("app") }
-}
diff --git a/buildSrc/src/main/java/GitHooks.kt b/buildSrc/src/main/java/GitHooks.kt
deleted file mode 100644
index c7e9066f..00000000
--- a/buildSrc/src/main/java/GitHooks.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-import java.io.File
-import java.nio.file.Files
-import java.nio.file.attribute.PosixFilePermission.GROUP_EXECUTE
-import java.nio.file.attribute.PosixFilePermission.GROUP_READ
-import java.nio.file.attribute.PosixFilePermission.OTHERS_EXECUTE
-import java.nio.file.attribute.PosixFilePermission.OTHERS_READ
-import java.nio.file.attribute.PosixFilePermission.OWNER_EXECUTE
-import java.nio.file.attribute.PosixFilePermission.OWNER_READ
-import java.nio.file.attribute.PosixFilePermission.OWNER_WRITE
-import org.gradle.api.DefaultTask
-import org.gradle.api.provider.Property
-import org.gradle.api.tasks.CacheableTask
-import org.gradle.api.tasks.Input
-import org.gradle.api.tasks.OutputFile
-import org.gradle.api.tasks.TaskAction
-
-@CacheableTask
-abstract class GitHooks : DefaultTask() {
- @get:Input abstract val hookScript: Property<String>
-
- @get:OutputFile abstract val hookOutput: Property<File>
-
- @TaskAction
- fun install() {
- hookOutput.get().writeText(hookScript.get())
- Files.setPosixFilePermissions(
- hookOutput.get().toPath(),
- setOf(
- OWNER_READ,
- OWNER_WRITE,
- OWNER_EXECUTE,
- GROUP_READ,
- GROUP_EXECUTE,
- OTHERS_READ,
- OTHERS_EXECUTE,
- )
- )
- }
-}
diff --git a/buildSrc/src/main/java/KotlinCompilerArgs.kt b/buildSrc/src/main/java/KotlinCompilerArgs.kt
deleted file mode 100644
index fed92c22..00000000
--- a/buildSrc/src/main/java/KotlinCompilerArgs.kt
+++ /dev/null
@@ -1,6 +0,0 @@
-/*
- * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved.
- * SPDX-License-Identifier: GPL-3.0-only
- */
-
-internal val additionalCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn")
diff --git a/buildSrc/src/main/java/PasswordStorePlugin.kt b/buildSrc/src/main/java/PasswordStorePlugin.kt
index 52641526..926cddbb 100644
--- a/buildSrc/src/main/java/PasswordStorePlugin.kt
+++ b/buildSrc/src/main/java/PasswordStorePlugin.kt
@@ -25,12 +25,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
class PasswordStorePlugin : Plugin<Project> {
override fun apply(project: Project) {
- project.configureForAllProjects()
-
- if (project.isRoot) {
- project.configureForRootProject()
- }
-
project.plugins.all {
when (this) {
is JavaPlugin, is JavaLibraryPlugin -> {
@@ -77,6 +71,3 @@ class PasswordStorePlugin : Plugin<Project> {
}
}
}
-
-private val Project.isRoot
- get() = this == this.rootProject