Last active
April 24, 2018 18:09
-
-
Save peterkir/710e1ec7a15a8de34288 to your computer and use it in GitHub Desktop.
bnd - Macro and Instruction examples
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
# replace examples | |
# replace backslash with slash | |
project.unix = ${replace;${project};(\\\\);/} | |
DEBUG_X = ${subst;${basename;${thisfile}};\.bnd$;;1} | |
DEBUG_BASENAME = ${basename;${thisfile}} | |
# replace . with _ | |
Wrapped-Jar-Version=3.12.0 | |
Bundle-SymbolicName: x.y.z.${replace;${Wrapped-Jar-Version};\\.;_} | |
fixuptype: ${if;${is;${gestalt;batch};batch};error;warning} | |
-fixupmessages: \ | |
"Baseline ...";is:=${fixuptype},\ | |
"There is no baseline for ...";is:=ignore,\ | |
"The bundle version ...";is:=${fixuptype} | |
-removeheaders: Bnd-LastModified,Tool,ENGINE_LIB_DIR,TARGET_REPO_DIR,ENGINE_LIB_DIR_MBRDI,TARGET_REPO_DIR_MBRDI | |
DEBUG_currentFileName=${bsn} | |
DEBUG_projectname=${p} | |
DEBUG_substitutedName=${replace;${bsn};${p};${p}5} | |
DEBUG_basedir=${basedir} | |
DEBUG_driver=${driver} | |
-include ${if;${isfile;${workspace}/build.PDE2BND/guid.properties};\ | |
${workspace}/build.PDE2BND/guid.properties;\ | |
} | |
pdePluginsRepo=${replace;${env;TEMP};(\\\\);/}/_pdeRepos/${__guid__}/repo | |
pdePluginsName="pdePlugins ${cat;${pdePluginsRepo}/${findfile;${pdePluginsRepo};*.txt}}" | |
__guid__=${if;${isfile;${basedir}/build.PDE2BND/guid.properties};\ | |
cat ${basedir}/build.PDE2BND/guid.properties;\ | |
;\ | |
} | |
PLUGIN_REPO_CONDITIONAL : aQute.bnd.deployer.repository.FixedIndexedRepo;\ | |
name=${pdePluginsName};\ | |
locations=${if;${isfile;${env;TEMP}/_pdeRepos/${__guid__}/repo/index.xml.gz};\ | |
file:///${env;TEMP}/_pdeRepos/${__guid__}/repo/index.xml.gz;\ | |
};\ | |
# bnd macros | |
NOW : ${now} | |
NOW_AS_LONG : ${now;long} | |
NOW_AS_DATE : ${now;YYYYMMDD-HHmmss} | |
CURRENTTIME : ${currenttime} | |
REGEX_MATCH : ${matches;inputString;.*?tStr.*?} | |
REGEX_MATCH_NOT : ${matches;inputString;.*?X*?} | |
ISFILE_FOUND : ${isfile;${basedir}/bnd.bnd} | |
ISFILE_NOTFOUND : ${isfile;${basedir}/bnd1.bnd} | |
ISFILE_CONDITION_TRUE : ${if;${isfile;${basedir}/bnd.bnd};\ | |
textA;\ | |
textB} | |
ISFILE_CONDITION_FALSE : ${if;${isfile;${basedir}/bnd1.bnd};\ | |
textA;\ | |
textB} | |
ISDIR_TRUE : ${isdir;${workspace}/bnd.macros.test} | |
ISDIR_FALSE : ${isdir;${workspace}/bnd.macros.test1} | |
IF_EQUALS : ${if;${is;A;A};true;false} | |
IF_EQUALS_NOT : ${if;${is;A;B};true;false} | |
FINDFILE_MATCHING : ${findfile;${workspace}/bnd.macros.test;*.bnd} | |
FINDFILE_MATCHING_NOT : ${findfile;${workspace}/bnd.macros.test;*.bndx} | |
ENV_temp1 : ${env;temp} | |
ENV_TEMP2 : ${env;TEMP} | |
ENV_TEMP_UNIX : ${replace;${env;TEMP};(\\\\);/} | |
ENV_USERNAME : ${env;USERNAME} | |
ENV_USERPROFILE : ${env;USERPROFILE} | |
ENV_USERPROFILE_UNIX : ${replace;${env;USERPROFILE};(\\\\);/} | |
DEBUG_currentFileName=${bsn} | |
DEBUG_projectname=${p} | |
DEBUG_substitutedName=${replace;${bsn};${p};${p}5} | |
DEBUG_basedir=${basedir} | |
DEBUG_driver=${driver} | |
DEBUG_WORKSPACE_DIR : ${workspace} | |
DEBUG_WORKSPACE_DIR_UNIX : ${replace;${workspace};(\\\\);/} | |
JAVASCRIPT_GEN_UUID : ${js;\ | |
load("nashorn:mozilla_compat.js");\ | |
importClass( java.util.UUID );\ | |
UUID.randomUUID();\ | |
} | |
SYSTEMCALL1_DIR : ${system;dir /B *.bnd} | |
SYSTEMCALL2_FILECREATE : ${system;echo __guid__=${JAVASCRIPT_GEN_UUID}>${basedir}\_guid.properties} | |
temp_UNIX : ${replace;${env;TEMP};(\\\\);/} | |
cacheDir_UNIX : ${sjoin;/;${temp_UNIX};.bndcache} | |
cacheDir : ${replace;${cacheDir_UNIX};/;\\\\} | |
CreateCachingDir : ${system;mkdir ${cacheDir}} | |
-fixupmessages: \ | |
"System command cmd /c";is:=ignore,\ | |
"No translation found for macro: system;mkdir";is:=ignore | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment