changeset 298:95d4eb5bff0f

remove code that was removing the ssdt_ohio dir in maven local. add publish local task if the project is a local repo and publish ivy is available.
author Marc Davis <marc.davis@mcoecn.org>
date Thu, 22 Dec 2022 14:39:22 -0500
parents da59b3f03c2c
children 5e9e2ea82657 69213629de0f
files init70.gradle
diffstat 1 files changed, 11 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/init70.gradle	Wed Dec 21 15:23:12 2022 -0500
+++ b/init70.gradle	Thu Dec 22 14:39:22 2022 -0500
@@ -216,13 +216,6 @@
                 if (localDir.exists()) {
                     throw new org.gradle.api.GradleException("Unable to clean ${localDir}. Files may be locked by another process.")
                 }
-                logger.info "removing local maven repo"
-                def localMaven = new File(System.getProperty('user.home') + "/.m2/repository/org/ssdt_ohio")
-                localMaven.deleteDir()
-                logger.info "verifying removal of local maven repo"
-                if (localMaven.exists()) {
-                    throw new org.gradle.api.GradleException("Unable to clean ${localMaven}. File may be locked by another process.")
-                }
             }
         }
     }
@@ -492,19 +485,17 @@
             }
             logger.info "$thisProject configured repositories:\n" + thisProject.repositories.collect {"\t$it.name ${it.hasProperty('url') ? it.url : '' }" }.join('\n')
 
-            // This will not trigger anymore with the upgrade to grade 7
-//            if (thisProject.repositories.find { it.name == 'local' } && thisProject.getTasksByName('uploadArchives', false)) {
-//                uploadArchives {
-//                    repositories {
-//                        add thisProject.repositories.local
-//                    }
-//                }
-//
-//                thisProject.tasks.create("publishLocal") {
-//                    description = "Publishes this projects artifacts to developer's local repository"
-//                    dependsOn = ["uploadArchives"]
-//                }
-//            }
+            /*
+             * Add a new task for local repos that declare an Ivy publish configuration
+             * This is a workaround for how the older versions handled the publishLocal
+             * task and the updateArchive option that was removed in gradle 7.0
+             */
+            if (thisProject.repositories.find { it.name == 'local' } && thisProject.getTasksByName('publishIvyPublicationToLocalRepository', false)) {
+                thisProject.tasks.create("publishLocal") {
+                    description = "Publishes this projects artifacts to developer's local repository"
+                    dependsOn = ["publishIvyPublicationToLocalRepository"]
+                }
+            }
 
         }