-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
code style fixes package moved
- Loading branch information
Showing
13 changed files
with
244 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright 2019 Intershop Communications AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.intershop.gradle.icm | ||
|
||
import com.intershop.gradle.icm.extension.IntershopExtension | ||
import com.intershop.gradle.icm.utils.OsCheck | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.artifacts.Configuration | ||
import org.gradle.api.tasks.Copy | ||
import java.io.File | ||
|
||
class ICMBasePlugin : Plugin<Project> { | ||
|
||
private lateinit var runtimeLibConfiguration: Configuration | ||
|
||
override fun apply(project: Project) { | ||
with(project) { | ||
if(project.rootProject == this) { | ||
logger.info("ICM base project plugin will be initialized") | ||
|
||
val extension = extensions.findByType( | ||
IntershopExtension::class.java | ||
) ?: extensions.create( | ||
IntershopExtension.INTERSHOP_EXTENSION_NAME, IntershopExtension::class.java, this | ||
) | ||
|
||
addRuntimeDependencies(project, extension) | ||
|
||
|
||
tasks.maybeCreate("installRuntimeLib", Copy::class.java).apply { | ||
from(runtimeLibConfiguration) | ||
|
||
rename("(.*).dll", "ish-runtime.dll") | ||
rename("(.*).so", "libish-runtime.so") | ||
rename("(.*).dylib", "libish-runtime.dylib") | ||
rename("(.*).setpgid", "setpgid") | ||
|
||
into(File(project.buildDir, "runtime-lib")) | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun addRuntimeDependencies(project: Project, extension: IntershopExtension) { | ||
val dependencyBase = "${extension.baseConfig.runtimeModule}:${extension.baseConfig.runtimeVersion}" | ||
val dependencyHandler = project.dependencies | ||
|
||
runtimeLibConfiguration = project.configurations.maybeCreate("runtimeLib") | ||
.setTransitive(false) | ||
.setDescription("Configuration for native runtime library") | ||
.defaultDependencies { | ||
|
||
|
||
if(OsCheck.getDetectedOS() == OsCheck.OSType.MacOS) { | ||
it.add( dependencyHandler.create("${dependencyBase}:darwin@dylib") ) | ||
it.add( dependencyHandler.create("${dependencyBase}:darwin@setpgid") ) | ||
} | ||
if(OsCheck.getDetectedOS() == OsCheck.OSType.Linux) { | ||
it.add( dependencyHandler.create("${dependencyBase}:linux@so") ) | ||
it.add( dependencyHandler.create("${dependencyBase}:linux@setpgid") ) | ||
} | ||
if(OsCheck.getDetectedOS() == OsCheck.OSType.Windows) { | ||
it.add( dependencyHandler.create("${dependencyBase}:win32@dll") ) | ||
} | ||
} | ||
|
||
project.configurations.maybeCreate("dockerRuntimeLib") | ||
.setTransitive(false) | ||
.setDescription("Configuration for native runtime library used with Docker") | ||
.defaultDependencies { | ||
it.add( dependencyHandler.create("${dependencyBase}:darwin@dylib") ) | ||
it.add( dependencyHandler.create("${dependencyBase}:darwin@setpgid") ) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/main/kotlin/com/intershop/gradle/icm/extension/BaseConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2019 Intershop Communications AG. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
package com.intershop.gradle.icm.extension | ||
|
||
import com.intershop.gradle.icm.utils.getValue | ||
import com.intershop.gradle.icm.utils.setValue | ||
import org.gradle.api.Project | ||
import org.gradle.api.provider.Property | ||
import org.gradle.api.provider.Provider | ||
|
||
class BaseConfiguration(project: Project) { | ||
|
||
private val runtimeModuleProperty: Property<String> = project.objects.property(String::class.java) | ||
private val runtimeVersionProperty: Property<String> = project.objects.property(String::class.java) | ||
|
||
init { | ||
runtimeModuleProperty.set("com.intershop.platform.lib:runtime-lib") | ||
runtimeVersionProperty.set("1.0.0") | ||
} | ||
|
||
/** | ||
* Runtime module property provider of ICM base project. | ||
*/ | ||
val runtimeModuleProvider: Provider<String> | ||
get() = runtimeModuleProperty | ||
|
||
/** | ||
* Runtime module of ICM base project. | ||
*/ | ||
var runtimeModule by runtimeModuleProperty | ||
|
||
/** | ||
* Runtime module property provider of ICM base project. | ||
*/ | ||
val runtimeVersionProvider: Provider<String> | ||
get() = runtimeVersionProperty | ||
|
||
/** | ||
* Runtime module of ICM base project. | ||
*/ | ||
var runtimeVersion by runtimeVersionProperty | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.