Skip to content

Commit

Permalink
Merge pull request #69 from nebula-plugins/68/dependency-lock-plugin-…
Browse files Browse the repository at this point in the history
…can-be-disabled

NebulaResponsiblePlugin: Add flag to disable nebula dependency lock plugin.
  • Loading branch information
rpalcolea authored Jul 16, 2021
2 parents 2061844 + a4753bb commit 18df847
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.gradle.api.tasks.testing.Test
*/
@CompileStatic
class NebulaResponsiblePlugin implements Plugin<Project> {
private static final String DEPENDENCY_LOCK_PLUGIN_ENABLED = 'nebula.dependencyLockPluginEnabled'
protected Project project

@Override
Expand All @@ -38,7 +39,10 @@ class NebulaResponsiblePlugin implements Plugin<Project> {
project.plugins.apply(ContactsPlugin)

// Dependency Locking
project.plugins.apply(DependencyLockPlugin)
def nebulaDependencyLockPluginEnabled = project.hasProperty(DEPENDENCY_LOCK_PLUGIN_ENABLED) ? Boolean.valueOf(project.property(DEPENDENCY_LOCK_PLUGIN_ENABLED) as String) : true
if(nebulaDependencyLockPluginEnabled) {
project.plugins.apply(DependencyLockPlugin)
}

// TODO Publish javadoc somehow
project.tasks.withType(Javadoc).configureEach(new Action<Javadoc>() {
Expand All @@ -59,4 +63,4 @@ class NebulaResponsiblePlugin implements Plugin<Project> {
def isParentProject = project.rootProject.subprojects.any { it.parent == project }
return !isParentProject
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package nebula.plugin.responsible

import nebula.test.IntegrationTestKitSpec
import org.gradle.testkit.runner.TaskOutcome

class NebulaResponsiblePluginLauncherSpec extends IntegrationTestKitSpec {

def setup() {
buildFile << """
plugins {
id 'java'
id 'nebula.project'
}
"""
}

def 'should apply nebula dependency lock plugin by default'() {
when:
def result = runTasks('generateLock')

then:
result.task(':generateLock').outcome == TaskOutcome.SUCCESS
}

def 'should allow to disable nebula dependency lock via project property'() {
when:
def result = runTasksAndFail('generateLock', '-Pnebula.dependencyLockPluginEnabled=false')

then:
result.output.contains('Task \'generateLock\' not found in root project')
}
}

0 comments on commit 18df847

Please sign in to comment.