Permalink
Browse files

XCodeSessionKey attribute in PCTRun (#282)

  • Loading branch information...
gquerret committed Jan 9, 2018
1 parent bba4126 commit 2dec80401b659832b9b039f29b34c57847bbb53f
@@ -59,7 +59,6 @@
private boolean requireFullKeywords = false;
private boolean requireFieldQualifiers = false;
private boolean requireFullNames = false;
private String xcodeKey = null;
private String languages = null;
private int growthFactor = -1;
private int progPerc = 0;
@@ -211,7 +210,7 @@ public void setXCode(boolean xcode) {
@Override
public void setXCodeKey(String xcodeKey) {
this.xcodeKey = xcodeKey;
throw new UnsupportedOperationException("Not used anymore");
}
@Override
@@ -364,10 +363,6 @@ public boolean isRequireFullNames() {
return requireFullNames;
}
public String getXcodeKey() {
return xcodeKey;
}
public String getLanguages() {
return languages;
}
@@ -460,8 +455,6 @@ else if (isUseUnderline())
else
bw.write("XREF VALUE(ipXREF) ");
} else if (getXcodeKey() != null) {
bw.write("XCODE \"" + getXcodeKey() + "\" ");
}
bw.write("NO-ERROR.");
bw.newLine();
@@ -240,9 +240,10 @@ public void setXCode(boolean xcode) {
compAttributes.setXCode(xcode);
}
@Deprecated
@Override
public void setXCodeKey(String xcodeKey) {
compAttributes.setXCodeKey(xcodeKey);
setXCodeSessionKey(xcodeKey);
}
@Override
@@ -482,8 +483,8 @@ public void setProcedure(String procedure) {
}
@Override
public void setXCodeInit(boolean xcode) {
throw new BuildException("Can't set XCodeInit attribute here");
public void setXCodeSessionKey(String xCodeSessionKey) {
runAttributes.setXCodeSessionKey(xCodeSessionKey);
}
@Override
@@ -75,7 +75,7 @@
private boolean noErrorOnQuit = false;
private boolean superInit = true;
private File output;
private boolean xCodeInit = false;
private String xCodeSessionKey = null;
public GenericExecuteOptions(Task parent) {
this.parent = parent;
@@ -304,11 +304,6 @@ public void setProcedure(String procedure) {
this.procedure = procedure;
}
@Override
public void setXCodeInit(boolean xcode) {
this.xCodeInit = xcode;
}
@Override
public void setMainCallback(String mainCallback) {
this.mainCallback = mainCallback;
@@ -329,6 +324,11 @@ public void setOutput(File output) {
this.output = output;
}
@Override
public void setXCodeSessionKey(String xCodeSessionKey) {
this.xCodeSessionKey = xCodeSessionKey;
}
// End of IRunAttribute methods
// ****************************
@@ -448,10 +448,6 @@ public String getProcedure() {
return procedure;
}
public boolean getXCodeInit() {
return xCodeInit;
}
public File getAssemblies() {
return assemblies;
}
@@ -472,6 +468,10 @@ public File getOutput() {
return output;
}
public String getXCodeSessionKey() {
return xCodeSessionKey;
}
protected List<String> getCmdLineParameters() {
List<String> list = new ArrayList<>();
@@ -206,9 +206,9 @@
void setProcedure(String procedure);
/**
* XCode init procedure
* XCode session key
*/
void setXCodeInit(boolean xcode);
void setXCodeSessionKey(String xCodeSessionKey);
/**
* Add a database alias
@@ -84,11 +84,6 @@ public void setProcedure(String procedure) {
throw new BuildException("Can't set procedure attribute");
}
@Override
public void setXCodeInit(boolean xcode) {
throw new BuildException("Can't set xCodeInit attribute");
}
/**
* Do the work
*
@@ -297,7 +292,7 @@ private String getOptions() {
sb.append("").append(';'); // Previously min-size
sb.append("").append(';'); // Previously MD5
sb.append(Boolean.toString(compAttrs.isXcode())).append(';');
sb.append(compAttrs.getXcodeKey() == null ? "" : compAttrs.getXcodeKey()).append(';');
sb.append("").append(';');
sb.append(Boolean.toString(compAttrs.isForceCompile())).append(';');
sb.append(Boolean.toString(false /* FIXME noCompile */)).append(';');
sb.append(Boolean.toString(compAttrs.isKeepXref())).append(';');
@@ -167,8 +167,8 @@ public void setDebugPCT(boolean debugPCT) {
}
@Override
public void setXCodeInit(boolean xcode) {
options.setXCodeInit(xcode);
public void setXCodeSessionKey(String xCodeSessionKey) {
options.setXCodeSessionKey(xCodeSessionKey);
}
@Override
@@ -533,6 +533,13 @@ private void createInitProcedure(File f) {
}
}
// XCode session key
if (options.getXCodeSessionKey() != null) {
bw.write(MessageFormat.format(this.getProgressProcedures().getXCodeSessionKey(),
options.getXCodeSessionKey()));
bw.newLine();
}
// Defines parameters
for (RunParameter param : options.getRunParameters()) {
if (param.validate()) {
@@ -39,7 +39,7 @@
/**
* Class for compiling Progress procedures
*
*
* @author <a href="mailto:g.querret+PCT@gmail.com">Gilles QUERRET </a>
*/
public class PCTCompile extends PCTRun {
@@ -158,7 +158,7 @@ private void writeFileList() {
}
} catch (IOException caught) {
throw new BuildException(Messages.getString("PCTCompile.2"), caught); //$NON-NLS-1$
}
}
}
/**
@@ -222,10 +222,6 @@ private void writeParams() {
bw.newLine();
bw.write("RELATIVE=" + (runAttributes.useRelativePaths() ? 1 : 0));
bw.newLine();
if (compAttrs.getXcodeKey() != null) {
bw.write("XCODEKEY=" + compAttrs.getXcodeKey()); //$NON-NLS-1$
bw.newLine();
}
if (compAttrs.getProgPerc() > 0) {
bw.write("PROGPERC=" + compAttrs.getProgPerc()); //$NON-NLS-1$
@@ -250,7 +246,7 @@ private void writeParams() {
private boolean createDir(File dir) {
if (dir.exists() && !dir.isDirectory()) {
return false;
}
}
if (!dir.exists() && !dir.mkdirs()) {
return false;
}
@@ -259,7 +255,7 @@ private boolean createDir(File dir) {
/**
* Do the work
*
*
* @throws BuildException Something went wrong
*/
@Override
@@ -318,7 +314,7 @@ public void execute() {
// Check valid value for ProgPerc
if ((compAttrs.getProgPerc() < 0) || (compAttrs.getProgPerc() > 100)) {
log(MessageFormat.format(Messages.getString("PCTCompile.91"), compAttrs.getProgPerc()), Project.MSG_WARN); //$NON-NLS-1$
log(MessageFormat.format(Messages.getString("PCTCompile.91"), compAttrs.getProgPerc()), Project.MSG_WARN); //$NON-NLS-1$
compAttrs.setProgPerc(0);
}
@@ -247,8 +247,8 @@ public void setProcedure(String procedure) {
}
@Override
public void setXCodeInit(boolean xcode) {
runAttributes.setXCodeInit(xcode);
public void setXCodeSessionKey(String xCodeSessionKey) {
runAttributes.setXCodeSessionKey(xCodeSessionKey);
}
@Override
@@ -374,29 +374,6 @@ public void setOutput(File output) {
// End of IRunAttribute methods
// ****************************
public void xCodeInitProcedure() {
if (!xcodeDir.mkdirs()) {
throw new BuildException("Unable to create temp directory " + xcodeDir.getAbsolutePath());
}
ExecTask task = new ExecTask(this);
Environment.Variable var = new Environment.Variable();
var.setKey("DLC"); //$NON-NLS-1$
var.setValue(getDlcHome().toString());
task.addEnv(var);
task.setExecutable(getExecPath("xcode").getAbsolutePath());
task.setDir(initProc.getParentFile());
task.createArg().setValue("-d");
task.createArg().setValue(xcodeDir.getAbsolutePath());
task.createArg().setValue(initProc.getName());
// Just to redirect output and not display it
task.setOutputproperty("xcodeout" + xcodeID);
log("xcoding init procedure...", Project.MSG_VERBOSE);
task.execute();
}
/**
* Do the work
*
@@ -433,12 +410,7 @@ public void execute() {
// Startup procedure
exec.createArg().setValue("-p"); //$NON-NLS-1$
if (runAttributes.getXCodeInit()) {
xCodeInitProcedure();
exec.createArg().setValue(new File(xcodeDir, initProc.getName()).getAbsolutePath());
} else {
exec.createArg().setValue(initProc.getAbsolutePath());
}
exec.createArg().setValue(initProc.getAbsolutePath());
if (getIncludedPL() && !extractPL(pctLib)) {
throw new BuildException("Unable to extract pct.pl.");
}
@@ -698,6 +670,13 @@ private void createInitProcedure() {
(this.outputStream == null ? null : this.outputStream.getAbsolutePath()),
isVerbose(), runAttributes.useNoErrorOnQuit()));
// XCode session key
if (runAttributes.getXCodeSessionKey() != null) {
bw.write(MessageFormat.format(this.getProgressProcedures().getXCodeSessionKey(),
runAttributes.getXCodeSessionKey()));
bw.newLine();
}
// Defines database connections and aliases
int dbNum = 1;
for (PCTConnection dbc : runAttributes.getAllDbConnections()) {
@@ -46,4 +46,5 @@
String getAfterRun();
String getOutputParameterCall();
String getQuit();
String getXCodeSessionKey();
}
@@ -138,6 +138,11 @@ public String getCallbackString() {
return "";
}
@Override
public String getXCodeSessionKey() {
return getString("ProgressV10.16"); //$NON-NLS-1$
}
public String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
@@ -52,3 +52,4 @@ ProgressV10.12=QUIT.\n
ProgressV10.13=SESSION:ADD-SUPER-PROCEDURE(THIS-PROCEDURE).\n
ProgressV10.15=IF pctVerbose THEN MESSAGE SUBSTITUTE("Creating alias &1 for database &2", "{0}", "{1}").\n\
CREATE ALIAS "{0}" FOR DATABASE "{1}" {2}.\n
ProgressV10.16=SECURITY-POLICY:XCODE-SESSION-KEY = "{0}".\n
@@ -135,7 +135,12 @@ public String getQuit() {
@Override
public String getCallbackString() {
return getString("ProgressV11.14");
return getString("ProgressV11.14"); //$NON-NLS-1$
}
@Override
public String getXCodeSessionKey() {
return getString("ProgressV11.16"); //$NON-NLS-1$
}
public String getString(String key) {
@@ -68,3 +68,4 @@ ProgressV11.14=mainCallback = Progress.Lang.Class:GetClass("{0}"):NEW().\n\
DYNAMIC-INVOKE(mainCallback, "initialize").\n
ProgressV11.15=IF pctVerbose THEN MESSAGE SUBSTITUTE("Creating alias &1 for database &2", "{0}", "{1}").\n\
CREATE ALIAS "{0}" FOR DATABASE "{1}" {2}.\n
ProgressV11.16=SECURITY-POLICY:XCODE-SESSION-KEY = "{0}".\n
@@ -99,7 +99,6 @@ DEFINE VARIABLE keepXref AS LOGICAL NO-UNDO INITIAL FALSE.
DEFINE VARIABLE multiComp AS LOGICAL NO-UNDO INITIAL FALSE.
DEFINE VARIABLE lXmlXref AS LOGICAL NO-UNDO INITIAL FALSE.
DEFINE VARIABLE lXCode AS LOGICAL NO-UNDO.
DEFINE VARIABLE XCodeKey AS CHARACTER NO-UNDO INITIAL ?.
DEFINE VARIABLE lRelative AS LOGICAL NO-UNDO INITIAL FALSE.
DEFINE VARIABLE ProgPerc AS INTEGER NO-UNDO INITIAL 0.
DEFINE VARIABLE lOptFullKw AS LOGICAL NO-UNDO INITIAL FALSE.
@@ -132,7 +131,6 @@ PROCEDURE setOption.
WHEN 'PCTDIR':U THEN ASSIGN PCTDir = ipValue.
WHEN 'FORCECOMPILE':U THEN ASSIGN ForceComp = (ipValue EQ '1':U).
WHEN 'XCODE':U THEN ASSIGN lXCode = (ipValue EQ '1':U).
WHEN 'XCODEKEY':U THEN ASSIGN XCodeKey = ipValue.
WHEN 'RUNLIST':U THEN ASSIGN RunList = (ipValue EQ '1':U).
WHEN 'LISTING':U THEN ASSIGN Lst = (ipValue EQ '1':U).
WHEN 'LISTINGSOURCE':U THEN ASSIGN LstPrepro = (ipValue EQ 'PREPROCESSOR':U).
@@ -34,7 +34,6 @@ PROCEDURE setOptions:
/* runList (LOG), minSize (LOG), md5 (LOG), xcode (LOG), xcodekey (CHAR), forceCompil (LOG), noCompil (LOG), keepXref (LOG), multiComp (LOG), streamIO (LOG), lV6Frame (LOG), outputDir (CHAR), preprocess (LOG), preprocessDir (CHAR), listing (LOG), debugListing (LOG), debugListingDir (CHAR), reqFullKW (LOG), reqFullNames (LOG), reqFldQual (LOG) */
RUN setOption IN hComp ('RUNLIST', IF ENTRY(1, ipPrm, ';') EQ 'true' THEN '1' ELSE '0').
RUN setOption IN hComp ('XCODE', IF ENTRY(4, ipPrm, ';') EQ 'true' THEN '1' ELSE '0').
RUN setOption IN hComp ('XCODEKEY', ENTRY(5, ipPrm, ';')).
RUN setOption IN hComp ('FORCECOMPILE', IF ENTRY(6, ipPrm, ';') EQ 'true' THEN '1' ELSE '0').
RUN setOption IN hComp ('NOCOMPILE', IF ENTRY(7, ipPrm, ';') EQ 'true' THEN '1' ELSE '0').
RUN setOption IN hComp ('KEEPXREF', IF ENTRY(8, ipPrm, ';') EQ 'true' THEN '1' ELSE '0').
Oops, something went wrong.

0 comments on commit 2dec804

Please sign in to comment.