@@ -20,8 +20,6 @@ tasks.register<WebActionsTabBuildTask>("buildWebActionsTab") {
2020 )
2121
2222 outputFiles.setFrom(projectDir.resolve(" lib" ))
23-
24- dependsOn(" checkInternalRepos" )
2523}
2624
2725@CacheableTask
@@ -84,61 +82,3 @@ abstract class WebActionsTabBuildTask : DefaultTask() {
8482 exec(npm, " run-script" , " test" )
8583 }
8684}
87-
88- abstract class CheckInternalReposTask : DefaultTask () {
89- @get:InputFiles
90- @get:PathSensitive(PathSensitivity .RELATIVE )
91- abstract val packageLockFiles: ConfigurableFileCollection
92-
93- init {
94- packageLockFiles.setFrom(
95- project.projectDir.walk()
96- .filter { it.name == " package-lock.json" }
97- .toList()
98- )
99- }
100-
101- @TaskAction
102- fun check () {
103- val internalRepos = listOf (
104- " global.block-artifacts.com" ,
105- " artifactory.global.square"
106- )
107-
108- val violations = mutableListOf<Pair <File , List <String >>>()
109-
110- packageLockFiles.forEach { file ->
111- try {
112- val content = file.readText()
113- val foundRepos = internalRepos.filter { repo -> repo in content }
114-
115- if (foundRepos.isNotEmpty()) {
116- violations.add(file to foundRepos)
117- }
118- } catch (e: Exception ) {
119- logger.error(" Error processing ${file.relativeTo(project.projectDir)} : ${e.message} " )
120- }
121- }
122-
123- if (violations.isNotEmpty()) {
124- val message = buildString {
125- appendLine(" Found internal repository references:" )
126- violations.forEach { (file, repos) ->
127- appendLine(" - ${file.relativeTo(project.projectDir)} contains references to:" )
128- repos.forEach { repo ->
129- appendLine(" * '$repo '" )
130- }
131- }
132- appendLine(" \n Please remove references to internal npm repositories." )
133- }
134- throw GradleException (message)
135- } else {
136- logger.lifecycle(" No internal repository references found." )
137- }
138- }
139- }
140-
141- tasks.register<CheckInternalReposTask >(" checkInternalRepos" ) {
142- group = " verification"
143- description = " Check for internal repository references in package-lock.json files"
144- }
0 commit comments