From a3df7acfda1d4b011b9002de761451440c3cb5f4 Mon Sep 17 00:00:00 2001 From: Gabriel Luong Date: Mon, 10 Jul 2023 15:10:34 -0700 Subject: [PATCH] Bug 1842694 - Refactor GithubDetailsTask into a plugin using composite build --- build.gradle | 2 - buildSrc/build.gradle | 19 ---------- .../fenix/gradle/tasks/GithubDetailsTask.kt | 38 ------------------- settings.gradle | 2 + 4 files changed, 2 insertions(+), 59 deletions(-) delete mode 100644 buildSrc/build.gradle delete mode 100644 buildSrc/src/main/java/org/mozilla/fenix/gradle/tasks/GithubDetailsTask.kt diff --git a/build.gradle b/build.gradle index 76dfee9e3..4a0b37a79 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,5 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. -import org.mozilla.fenix.gradle.tasks.GithubDetailsTask - buildscript { // This logic is duplicated in the allprojects block: I don't know how to fix that. repositories { diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 93580dab0..000000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,19 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -plugins { - id "org.gradle.kotlin.kotlin-dsl" version "2.4.1" -} - -repositories { - if (project.hasProperty("centralRepo")) { - maven { - name "MavenCentral" - url project.property("centralRepo") - allowInsecureProtocol true // Local Nexus in CI uses HTTP - } - } else { - mavenCentral() - } -} diff --git a/buildSrc/src/main/java/org/mozilla/fenix/gradle/tasks/GithubDetailsTask.kt b/buildSrc/src/main/java/org/mozilla/fenix/gradle/tasks/GithubDetailsTask.kt deleted file mode 100644 index 16dccbcce..000000000 --- a/buildSrc/src/main/java/org/mozilla/fenix/gradle/tasks/GithubDetailsTask.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -package org.mozilla.fenix.gradle.tasks - -import org.gradle.api.DefaultTask -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.TaskAction -import java.io.File - -/** - * Helper to write to the "customCheckRunText.md" file for Taskcluster. - * Taskcluster uses this file to populate the "Details" section in the GitHub Checks panel UI. - */ -open class GithubDetailsTask : DefaultTask() { - - /** - * Text to display in the Github Checks panel under "Details". Any markdown works here. - * The text is written to a markdown file which is used by Taskcluster. - * Links are automatically rewritten to point to the correct Taskcluster URL. - */ - @Input - var text: String = "" - - private val detailsFile = File("/builds/worker/github/customCheckRunText.md") - private val suffix = "\n\n_(404 if compilation failed)_" - - @TaskAction - fun writeFile() { - val taskId = System.getenv("TASK_ID") - val reportsUrl = "https://firefoxci.taskcluster-artifacts.net/$taskId/0/public/reports" - val replaced = text.replace("{reportsUrl}", reportsUrl) - - project.mkdir("/builds/worker/github") - detailsFile.writeText(replaced + suffix) - } -} diff --git a/settings.gradle b/settings.gradle index a29537659..dd6a86e2a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,6 +6,7 @@ pluginManagement { includeBuild("../android-components/plugins/publicsuffixlist") includeBuild("../android-components/plugins/dependencies") includeBuild("../android-components/plugins/config") + includeBuild("../android-components/plugins/github") includeBuild("./plugins/apksize") includeBuild("./plugins/fenixdependencies") } @@ -15,6 +16,7 @@ plugins { id 'FenixDependenciesPlugin' id "mozac.ConfigPlugin" id 'mozac.DependenciesPlugin' + id 'mozac.GitHubPlugin' } apply from: file('../shared-settings.gradle')