-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add options for Really Executable Capsules
Fixes #3
- Loading branch information
1 parent
56c0926
commit 3871554
Showing
4 changed files
with
208 additions
and
53 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
51 changes: 51 additions & 0 deletions
51
src/main/groovy/us/kirchmeier/capsule/spec/ReallyExecutableSpec.groovy
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,51 @@ | ||
package us.kirchmeier.capsule.spec | ||
|
||
import org.gradle.api.Project | ||
|
||
class ReallyExecutableSpec { | ||
|
||
File script | ||
protected boolean _regular = true | ||
protected boolean _trampoline = false | ||
|
||
ReallyExecutableSpec regular() { | ||
_regular = true | ||
_trampoline = false | ||
script = null | ||
return this | ||
} | ||
|
||
ReallyExecutableSpec trampoline() { | ||
_regular = false | ||
_trampoline = true | ||
script = null | ||
return this | ||
} | ||
|
||
void setScript(File file) { | ||
if (file != null) { | ||
_regular = false | ||
_trampoline = false | ||
script = file | ||
} | ||
} | ||
|
||
ReallyExecutableSpec script(File file) { | ||
script = file | ||
return this | ||
} | ||
|
||
def buildAntResource(Project project, AntBuilder ant) { | ||
if (script != null) { | ||
return ant.file(file: script) | ||
} | ||
|
||
def cap = project.configurations.capsule.files.first() | ||
|
||
if (_trampoline) { | ||
return ant.zipentry(zipfile: cap, name: 'capsule/trampoline-execheader.sh') | ||
} else if (_regular) { | ||
return ant.zipentry(zipfile: cap, name: 'capsule/execheader.sh') | ||
} | ||
} | ||
} |
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