diff --git a/gradle/build.gradle b/gradle/build.gradle index e16df56a0..c60ea9ce1 100644 --- a/gradle/build.gradle +++ b/gradle/build.gradle @@ -37,6 +37,12 @@ plugins { id "com.moowork.node" version "1.2.0" } +apply plugin: google.registry.gradle.plugin.GcsReportUploaderPlugin + +gcsReportUploader { + bucket = 'my-bucket' +} + apply from: 'dependencies.gradle' // Provide defaults for all of the project properties. diff --git a/gradle/buildSrc/build.gradle b/gradle/buildSrc/build.gradle new file mode 100644 index 000000000..e27d22cab --- /dev/null +++ b/gradle/buildSrc/build.gradle @@ -0,0 +1,21 @@ + +repositories { + if (project.ext.properties.repositoryUrl == null) { + println "Plugins: Using Maven central..." + mavenCentral() + } else { + maven { + println "Plugins: Using repo ${repositoryUrl}..." + url repositoryUrl + } + } +} + +apply from: '../dependencies.gradle' + + +dependencies { + def deps = dependencyMap + compile deps['com.google.guava:guava'] + testCompile deps['com.google.truth:truth'] +} diff --git a/gradle/buildSrc/src/main/java/google/registry/gradle/plugin/GcsReportUploader.java b/gradle/buildSrc/src/main/java/google/registry/gradle/plugin/GcsReportUploader.java new file mode 100644 index 000000000..04f3f287f --- /dev/null +++ b/gradle/buildSrc/src/main/java/google/registry/gradle/plugin/GcsReportUploader.java @@ -0,0 +1,56 @@ +// Copyright 2019 The Nomulus Authors. All Rights Reserved. +// +// 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. + +package google.registry.gradle.plugin; + +import java.util.ArrayList; +import org.gradle.api.DefaultTask; +import org.gradle.api.Task; +import org.gradle.api.reporting.Report; +import org.gradle.api.reporting.ReportContainer; +import org.gradle.api.reporting.Reporting; +import org.gradle.api.tasks.TaskAction; + +/** + * A task that uploads the Reports generated by other tasks to GCS. + * + *
TODO:implement it.
+ */
+public class GcsReportUploader extends DefaultTask {
+
+ private final ArrayList It goes over all the tasks in a project and pass them on to the GcsReportUploader task for set
+ * up.
+ *
+ * Note that since we're passing in all the projects' tasks - this includes the GcsReportUploader
+ * itself! It's up to the GcsReportuploader to take care of not having "infinite loops" caused by
+ * waiting for itself to end before finishing.
+ */
+public class GcsReportUploaderPlugin implements Plugin