Skip to content

Instantly share code, notes, and snippets.

@cap5lut
Created November 25, 2020 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cap5lut/bd1c6cf340f7d70e82c9a30f674b5fea to your computer and use it in GitHub Desktop.
Save cap5lut/bd1c6cf340f7d70e82c9a30f674b5fea to your computer and use it in GitHub Desktop.
build.gradle
group 'com.github.cap5lut'
version '1.0.0-SNAPSHOT'
repositories {
mavenCentral()
}
configurations {
bundle {
transitive true
}
container {
transitive false
}
}
dependencies {
// console
bundle group: 'org.apache.felix', name: 'org.apache.felix.gogo.command', version: '1.1.0'
bundle group: 'org.apache.felix', name: 'org.apache.felix.gogo.jline', version: '1.1.0'
bundle group: 'org.apache.felix', name: 'org.apache.felix.gogo.runtime', version: '1.1.0'
// logging
bundle group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.14.0'
bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.14.0'
//bundle group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.14.0'
//bundle group: 'com.github.cap5lut', name: 'cap5lut-osgi-log4j-provider', version: '2.14.0'
//bundle group: 'org.apache.logging.log4j', name: 'log4j-slf4j18-impl', version: '2.14.0'
// osgi
container 'org.apache.felix:org.apache.felix.main:6.0.3'
bundle group: 'org.apache.aries.spifly', name: 'org.apache.aries.spifly.dynamic.bundle', version: '1.3.2'
bundle group: 'org.apache.aries.spifly', name: 'org.apache.aries.spifly.dynamic.framework.extension', version: '1.3.2'
// services
bundle group: 'com.github.cap5lut', name: 'cap5lut-service-test', version: '1.0.0-TEST'
}
task clean {
group 'build'
doLast {
delete buildDir
}
}
task collectBundles(type: Sync) {
group 'build'
from configurations.bundle
into "$buildDir/tmp/dist/bundles/bundles/"
}
task collectContainer(type: Sync) {
group 'build'
from configurations.container
into "$buildDir/tmp/dist/bin/bin/"
}
task installDist(type: Sync) {
group 'build'
dependsOn collectBundles, collectContainer
from "$buildDir/tmp/dist/bin/"
from "$buildDir/tmp/dist/bundles/"
from("$projectDir/src/main/dist/") {
rename 'start.bat', "${project.name}.bat"
rename 'start.sh', "${project.name}.sh"
expand([project: project])
}
into "$buildDir/dist/installed/"
}
task prepareEnvironment(type: Sync) {
group 'build'
from installDist
into "$buildDir/run/"
}
task run(type: JavaExec) {
group 'application'
dependsOn prepareEnvironment
classpath = files(configurations.container.files[0])
main = 'org.apache.felix.main.Main'
jvmArgs(
'--add-opens', 'java.base/java.lang=ALL-UNNAMED',
'--add-opens', 'java.base/java.net=ALL-UNNAMED',
'--add-opens', 'java.base/java.security=ALL-UNNAMED',
'--add-opens', 'java.base/jdk.internal.loader=ALL-UNNAMED',
'-Dfelix.config.properties=file:./conf/felix.properties',
)
workingDir prepareEnvironment.destinationDir
standardInput System.in
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment