github.com/jfrog/jfrog-cli-go@v1.22.1-0.20200318093948-4826ef344ffd/artifactory/utils/gradleinitscript.go (about) 1 package utils 2 3 const GradleInitScript = `import org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin 4 import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask 5 6 initscript { 7 dependencies { 8 classpath fileTree('${pluginLibDir}') 9 } 10 } 11 12 addListener(new BuildInfoPluginListener()) 13 class BuildInfoPluginListener extends BuildAdapter { 14 15 def void projectsLoaded(Gradle gradle) { 16 Map<String, String> projectProperties = new HashMap<String, String>(gradle.startParameter.getProjectProperties()) 17 projectProperties.put("build.start", Long.toString(System.currentTimeMillis())) 18 gradle.startParameter.setProjectProperties(projectProperties) 19 20 Project root = gradle.getRootProject() 21 root.logger.debug("Artifactory plugin: projectsEvaluated: ${root.name}") 22 if (!"buildSrc".equals(root.name)) { 23 root.allprojects { 24 apply { 25 apply plugin: ArtifactoryPlugin 26 } 27 } 28 } 29 30 // Set the "mavenJava" and "ivyJava" publications or 31 // "archives" configuration to all Artifactory tasks. 32 for (Project p : root.getAllprojects()) { 33 Task t = p.getTasks().findByName(ArtifactoryTask.ARTIFACTORY_PUBLISH_TASK_NAME) 34 if (t != null) { 35 ArtifactoryTask task = (ArtifactoryTask) t 36 task.setCiServerBuild() 37 } 38 } 39 } 40 } 41 `