Skip to content

Commit

Permalink
Merge pull request #27 from IntershopCommunicationsAG/adddependencies
Browse files Browse the repository at this point in the history
Adddependencies
  • Loading branch information
m-raab authored Dec 16, 2021
2 parents 828628e + ecedc30 commit b9c9ff8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
24 changes: 12 additions & 12 deletions src/main/kotlin/com/intershop/gradle/isml/IsmlPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ open class IsmlPlugin : Plugin<Project> {
addJSPJasperCompilerConfiguration(this, extension)
addIsmlConfiguration(this, extension)

afterEvaluate {
plugins.withType(JavaBasePlugin::class.java) {
project.extensions.getByType(JavaPluginExtension::class.java).sourceSets.matching {
it.name == SourceSet.MAIN_SOURCE_SET_NAME
}.forEach {
addJavaDependencies(this, it.implementationConfigurationName)
}
}
}

if (extension.sourceSets.findByName(IsmlExtension.ISML_MAIN_SOURCESET) == null) {
val mainIsmlSourceSet = extension.sourceSets.create(IsmlExtension.ISML_MAIN_SOURCESET)
mainIsmlSourceSet.srcDir.set(layout.projectDirectory.dir(IsmlExtension.MAIN_TEMPLATE_PATH))
Expand All @@ -76,14 +86,6 @@ open class IsmlPlugin : Plugin<Project> {
it.group = IsmlExtension.ISML_GROUP_NAME
}

project.plugins.withType(JavaBasePlugin::class.java) {
project.extensions.getByType(JavaPluginExtension::class.java).sourceSets.matching {
it.name == SourceSet.MAIN_SOURCE_SET_NAME
}.forEach {
addJavaDependencies(this, it.implementationConfigurationName)
}
}

extension.sourceSets.all { ismlSourceSet ->

val ismlTask = tasks.register(ismlSourceSet.getIsmlTaskName(), Isml2Jsp::class.java) { ismltask ->
Expand Down Expand Up @@ -172,9 +174,7 @@ open class IsmlPlugin : Plugin<Project> {
private fun addJavaDependencies(project: Project, configName: String) {
val configuration = project.configurations.getByName(configName)
val dependencyHandler = project.dependencies
configuration.defaultDependencies {
dependencyHandler.create("org.apache.tomcat:tomcat-jasper")
dependencyHandler.create("org.slf4j:slf4j-api")
}
configuration.dependencies.add( dependencyHandler.create("org.apache.tomcat:tomcat-jasper") )
configuration.dependencies.add( dependencyHandler.create("org.slf4j:slf4j-api") )
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,9 @@ class IsmlPluginIntSpec extends AbstractIntegrationGroovySpec {
id 'com.intershop.gradle.isml'
}
configurations {
compile
runtime.extendsFrom(compile)
runtimeClasspath.extendsFrom(compile)
dependencies {
implementation platform('org.apache.tomcat:tomcat-jasper:9.0.56')
implementation platform('org.slf4j:slf4j-api:1.7.32')
}
repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,14 @@ class IsmlPluginKtsSpec extends AbstractIntegrationKotlinSpec {

buildFile << """
plugins {
java
id("com.intershop.gradle.isml")
}
configurations.create("implementation")
dependencies {
implementation(platform("org.apache.tomcat:tomcat-jasper:9.0.56"))
implementation(platform("org.slf4j:slf4j-api:1.7.32"))
}
repositories {
mavenCentral()
}
Expand Down

0 comments on commit b9c9ff8

Please sign in to comment.