Skip to content

Commit b57e40f

Browse files
chetanmehmarkusthoemmes
authored andcommitted
Modify the unix script. (#3059)
Modifies the line containing `CLASSPATH=` in generated unix script file and add entries for 1. $APP_HOME/ext-lib/* - To be used to add extra jars to classpath 2. $APP_HOME/config - To be used to add custom application.conf
1 parent 7bb04c5 commit b57e40f

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

build.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,30 @@ buildscript {
1010
subprojects {
1111
apply plugin: 'scalafmt'
1212
scalafmt.configFilePath = gradle.scalafmt.config
13+
14+
afterEvaluate {
15+
if (project.plugins.hasPlugin('application')
16+
&& project.plugins.hasPlugin('scala')) {
17+
startScripts {
18+
doLast {
19+
unixScript.text = configureUnixClasspath(unixScript)
20+
}
21+
}
22+
}
23+
}
24+
}
25+
26+
def configureUnixClasspath(File script) {
27+
script
28+
.readLines()
29+
.collect { line ->
30+
// Looking for the line that starts with CLASSPATH=
31+
line = line.replaceAll(~/^CLASSPATH=.*$/) { original ->
32+
33+
// Get original line and append it
34+
// with the configuration directory.
35+
original += ':$APP_HOME/ext-lib/*:$APP_HOME/config'
36+
}
37+
}
38+
.join('\n')
1339
}

docs/spi.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,15 @@ Since SPI implementations are loaded from the classpath, and a specific implemen
6262
* Include all implementations, and only use the specified implementations.
6363
* Include some combination of defaults and alternative implementations, and use the specified implementations for the alternatives, and default implementations for the rest.
6464

65+
## Including the implementation
66+
67+
Base openwhisk docker images provide 2 extension points in the classpath for including the implementation.
68+
69+
### Application Jars
70+
71+
The application jars can be added to `$APP_HOME/ext-lib` for e.g. in `openwhisk/controller` image the implementation jars can be added to `/controller/ext-lib` and for `openwhisk/invoker` they can be added to `/invoker/ext-lib`.
72+
73+
### Application Configuration
74+
75+
The configuration files can be added to `$APP_HOME/config`.
76+

0 commit comments

Comments
 (0)