Skip to content

Commit 5028809

Browse files
committed
Fix projects and MainPg to handle release build.
1 parent c36f89e commit 5028809

File tree

19 files changed

+69
-41
lines changed

19 files changed

+69
-41
lines changed

Andl.Client/Andl.Client.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PlatformTarget>AnyCPU</PlatformTarget>
2727
<DebugType>pdbonly</DebugType>
2828
<Optimize>true</Optimize>
29-
<OutputPath>..\bin\</OutputPath>
29+
<OutputPath>..\Release\</OutputPath>
3030
<DefineConstants>TRACE</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>

Andl.Common/Andl.Common.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2626
<DebugType>pdbonly</DebugType>
2727
<Optimize>true</Optimize>
28-
<OutputPath>bin\Release\</OutputPath>
28+
<OutputPath>..\Release\</OutputPath>
2929
<DefineConstants>TRACE</DefineConstants>
3030
<ErrorReport>prompt</ErrorReport>
3131
<WarningLevel>4</WarningLevel>

Andl.Gateway/Andl.Gateway.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2525
<DebugType>pdbonly</DebugType>
2626
<Optimize>true</Optimize>
27-
<OutputPath>..\bin\</OutputPath>
27+
<OutputPath>..\Release\</OutputPath>
2828
<DefineConstants>TRACE</DefineConstants>
2929
<ErrorReport>prompt</ErrorReport>
3030
<WarningLevel>4</WarningLevel>

Andl.Host/Andl.Host.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PlatformTarget>AnyCPU</PlatformTarget>
2727
<DebugType>pdbonly</DebugType>
2828
<Optimize>true</Optimize>
29-
<OutputPath>..\bin\</OutputPath>
29+
<OutputPath>..\Release\</OutputPath>
3030
<DefineConstants>TRACE</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>

Andl.Peg/Andl.Peg.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<PlatformTarget>AnyCPU</PlatformTarget>
4646
<DebugType>pdbonly</DebugType>
4747
<Optimize>true</Optimize>
48-
<OutputPath>..\bin\</OutputPath>
48+
<OutputPath>..\Release\</OutputPath>
4949
<DefineConstants>TRACE</DefineConstants>
5050
<ErrorReport>prompt</ErrorReport>
5151
<WarningLevel>4</WarningLevel>

Andl.Postgres/Andl.Postgres.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2626
<DebugType>pdbonly</DebugType>
2727
<Optimize>true</Optimize>
28-
<OutputPath>bin\Release\</OutputPath>
28+
<OutputPath>..\Release\</OutputPath>
2929
<DefineConstants>TRACE</DefineConstants>
3030
<ErrorReport>prompt</ErrorReport>
3131
<WarningLevel>4</WarningLevel>

Andl.Run/Andl.Run.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PlatformTarget>AnyCPU</PlatformTarget>
2727
<DebugType>pdbonly</DebugType>
2828
<Optimize>true</Optimize>
29-
<OutputPath>..\bin\</OutputPath>
29+
<OutputPath>..\Release\</OutputPath>
3030
<DefineConstants>TRACE</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>

Andl.Runtime/Andl.Runtime.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2525
<DebugType>pdbonly</DebugType>
2626
<Optimize>true</Optimize>
27-
<OutputPath>..\bin\</OutputPath>
27+
<OutputPath>..\Release\</OutputPath>
2828
<DefineConstants>TRACE</DefineConstants>
2929
<ErrorReport>prompt</ErrorReport>
3030
<WarningLevel>4</WarningLevel>

Andl.Sqlite/Andl.Sqlite.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2525
<DebugType>pdbonly</DebugType>
2626
<Optimize>true</Optimize>
27-
<OutputPath>..\bin\</OutputPath>
27+
<OutputPath>..\Release\</OutputPath>
2828
<DefineConstants>TRACE</DefineConstants>
2929
<ErrorReport>prompt</ErrorReport>
3030
<WarningLevel>4</WarningLevel>

Andl.Thrift/Andl.Thrift.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PlatformTarget>AnyCPU</PlatformTarget>
2727
<DebugType>pdbonly</DebugType>
2828
<Optimize>true</Optimize>
29-
<OutputPath>..\bin\</OutputPath>
29+
<OutputPath>..\Release\</OutputPath>
3030
<DefineConstants>TRACE</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>

Andl.Workbench/Andl.Workbench.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<PlatformTarget>AnyCPU</PlatformTarget>
3030
<DebugType>pdbonly</DebugType>
3131
<Optimize>true</Optimize>
32-
<OutputPath>..\bin\</OutputPath>
32+
<OutputPath>..\Release\</OutputPath>
3333
<DefineConstants>TRACE</DefineConstants>
3434
<ErrorReport>prompt</ErrorReport>
3535
<WarningLevel>4</WarningLevel>

Andl/Andl.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PlatformTarget>AnyCPU</PlatformTarget>
2727
<DebugType>pdbonly</DebugType>
2828
<Optimize>true</Optimize>
29-
<OutputPath>..\bin\</OutputPath>
29+
<OutputPath>..\Release\</OutputPath>
3030
<DefineConstants>TRACE</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>

AndlPg/AndlPg.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
<WarningLevel>4</WarningLevel>
2525
</PropertyGroup>
2626
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27-
<PlatformTarget>AnyCPU</PlatformTarget>
27+
<PlatformTarget>x64</PlatformTarget>
2828
<DebugType>pdbonly</DebugType>
2929
<Optimize>true</Optimize>
30-
<OutputPath>bin\Release\</OutputPath>
30+
<OutputPath>..\Release\</OutputPath>
3131
<DefineConstants>TRACE</DefineConstants>
3232
<ErrorReport>prompt</ErrorReport>
3333
<WarningLevel>4</WarningLevel>

AndlPg/MainPg.cs

+47-22
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ class Program {
1616
const string Help = "AndlPg <script.ext> [<database name>] [/options]\n"
1717
+ "\t\tScript extension must be andl, sql, pgsql or pgs.\n"
1818
+ "\t\tDefault script is test.andl, database is 'db'.\n"
19-
+ "\t/d\tAdd #source directive for current directory"
20-
+ "\t/p[o]\tAdd Postgres preamble and postamble (o for preamble only)"
21-
+ "\t/s\tSql (ignored)"
22-
+ "\t/n\tn=1 to 4, set tracing level";
19+
+ "\t\tHardwired for user postgres, password from pgpass.\n"
20+
+ "\t/d\tAdd #source directive for current directory\n"
21+
+ "\t/p[o]\tAdd Postgres preamble and postamble (o for preamble only)\n"
22+
+ "\t/s\tSql (ignored)\n"
23+
+ "\t/n\tn=1 to 4, set tracing level (and add #noisy directive)";
2324
static readonly Dictionary<string, Action<string>> _options = new Dictionary<string, Action<string>> {
2425
{ "p", (a) => { _usepreamble = true; _usepostamble = (a != "o"); } },
2526
{ "d", (a) => { AddSource = true; } },
@@ -47,13 +48,14 @@ static void Main(string[] args) {
4748
if (!File.Exists(path)) throw ProgramError.Fatal($"file does not exist: {path}");
4849
var input = new StreamReader(path).ReadToEnd();
4950

50-
var conn = ConnectionInfo.Create("localhost", "postgres", "zzxx", database);
51+
var conn = ConnectionInfo.Create("localhost", "postgres", database);
5152
var pgw = WrapLibpq.Create(conn, _output);
5253
// use npgsql instead
5354
//var conn = ConnectionInfo.Create("localhost", "admin", "zzxx", "Try1");
5455
//var pgw = WrapNpgsql.Create(conn);
5556

56-
if (_usepreamble) pgw.RunSql(Boilerplate.Preamble, "preamble");
57+
var bp = new Boilerplate();
58+
if (_usepreamble) pgw.RunSql(bp.Preamble(), "preamble");
5759

5860
switch (Path.GetExtension(path)) {
5961
case ".andl":
@@ -68,7 +70,7 @@ static void Main(string[] args) {
6870
throw ProgramError.Fatal($"no action defined for {path}");
6971
}
7072

71-
if (_usepostamble) pgw.RunSql(Boilerplate.Postamble, "postamble");
73+
if (_usepostamble) pgw.RunSql(bp.Postamble(), "postamble");
7274

7375
pgw.Close();
7476
} catch (ProgramException ex) {
@@ -91,17 +93,16 @@ public class ConnectionInfo {
9193
public string Password { get; set; }
9294
public string Database { get; set; }
9395
public string AdoConnectionString {
94-
get { return $"Host={Host};Username={Username};password={Password};Database={Database}"; }
96+
get { return $"Host={Host};Username={Username};Database={Database}"; }
9597
}
9698
public string PgConnectionString {
97-
get { return $"host={Host} user={Username} password={Password} dbname={Database}"; }
99+
get { return $"host={Host} user={Username} dbname={Database}"; }
98100
}
99101

100-
public static ConnectionInfo Create(string host, string username, string password, string database) {
102+
public static ConnectionInfo Create(string host, string username, string database) {
101103
return new ConnectionInfo {
102104
Host = host,
103105
Username = username,
104-
Password = password,
105106
Database = database,
106107
};
107108
}
@@ -151,21 +152,45 @@ public static ScriptLines Create(TextReader reader) {
151152
/// </summary>
152153
public class Boilerplate {
153154
// preamble for loading plandl. note lines end in ';'
154-
static string plandl_path = @"D:/MyDocs/dev/vs14/Andl/x64/Debug/plandl";
155-
static string gateway_path = @"D:\MyDocs\dev\vs14\Andl\Debug\Andl.Gateway.dll";
156-
static int _noisy { get { return Logger.Level; } }
157-
158-
public static string Preamble {
159-
get { return $@"
155+
const string _plandl_filename = @"x64\plandl.dll";
156+
static string _gateway_filename= @"Andl.Gateway.dll";
157+
string _base_path;
158+
//static string plandl_path = @"D:/MyDocs/dev/vs14/Andl/x64/Debug/plandl";
159+
//static string gateway_path = @"D:\MyDocs\dev\vs14\Andl\Debug\Andl.Gateway.dll";
160+
int _noisy { get { return Logger.Level; } }
161+
162+
public string Preamble() {
163+
return $@"
160164
DROP FUNCTION IF EXISTS plandl_call_handler() CASCADE;
161-
CREATE OR REPLACE FUNCTION plandl_call_handler() RETURNS language_handler AS '{plandl_path}' LANGUAGE C;
162-
CREATE OR REPLACE LANGUAGE plandl HANDLER plandl_call_handler;
165+
CREATE OR REPLACE FUNCTION plandl_call_handler() RETURNS language_handler
166+
AS '{PlandlPath()}' LANGUAGE C;
167+
CREATE OR REPLACE LANGUAGE plandl HANDLER plandl_call_handler;
163168
CREATE OR REPLACE FUNCTION plandl_compile(program text, source text) returns text
164-
AS '{gateway_path}|Noisy={_noisy}' LANGUAGE plandl;"; } // '|Debug,Noisy=2'
169+
AS '{GatewayPath()}|Noisy={_noisy}' LANGUAGE plandl;"; // '|Debug,Noisy=2'
170+
}
171+
172+
public string Postamble() {
173+
return @"DROP FUNCTION plandl_call_handler() CASCADE;";
174+
}
175+
176+
string PlandlPath() {
177+
var path = Path.Combine(_base_path, _plandl_filename);
178+
if (!File.Exists(path))
179+
throw ProgramError.Fatal($"File not found: {path}.");
180+
return path;
181+
}
182+
183+
string GatewayPath() {
184+
var path = Path.Combine(_base_path, _gateway_filename);
185+
if (!File.Exists(path))
186+
throw ProgramError.Fatal($"File not found: {path}.");
187+
return path;
165188
}
166189

167-
public static string Postamble {
168-
get { return @"DROP FUNCTION plandl_call_handler() CASCADE;"; }
190+
public Boilerplate() {
191+
var fn = AppDomain.CurrentDomain.BaseDirectory;
192+
_base_path = Path.GetDirectoryName(fn);
193+
//_base_path = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);
169194
}
170195
}
171196

Sample/runsamples.bat

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
: Quick run through of available samples
22
: usage: all, sql, pg
33

4-
:@echo off
4+
@echo off
55
setlocal
66
call ..\setvars.bat
77
set andl=%binpath%\Andl /1 %*
@@ -16,8 +16,9 @@ rm *.sqandl
1616
for /d %%f in (*.sandl) do rd %%f /s /q
1717
copy chinook.sqlite chinook_sqlite.sqandl
1818

19-
@date /t >out.txt
19+
date /t >out.txt
2020

21+
@echo on
2122
: create catalog
2223
%andl% >> out.txt setup.andl
2324
%andl% >> out.txt sample1.andl

ThriftSupplierPart/ThriftSupplierPart.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PlatformTarget>AnyCPU</PlatformTarget>
2727
<DebugType>pdbonly</DebugType>
2828
<Optimize>true</Optimize>
29-
<OutputPath>..\bin\</OutputPath>
29+
<OutputPath>..\Release\</OutputPath>
3030
<DefineConstants>TRACE</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>

ThriftTest/ThriftTest.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<PlatformTarget>AnyCPU</PlatformTarget>
2727
<DebugType>pdbonly</DebugType>
2828
<Optimize>true</Optimize>
29-
<OutputPath>..\bin\</OutputPath>
29+
<OutputPath>..\Release\</OutputPath>
3030
<DefineConstants>TRACE</DefineConstants>
3131
<ErrorReport>prompt</ErrorReport>
3232
<WarningLevel>4</WarningLevel>

plandl/plandl.vcxproj

+2
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,14 @@
7878
</PropertyGroup>
7979
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
8080
<LinkIncremental>true</LinkIncremental>
81+
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
8182
</PropertyGroup>
8283
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
8384
<LinkIncremental>false</LinkIncremental>
8485
</PropertyGroup>
8586
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
8687
<LinkIncremental>false</LinkIncremental>
88+
<OutDir>$(SolutionDir)$(Configuration)\$(Platform)\</OutDir>
8789
</PropertyGroup>
8890
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
8991
<ClCompile>

setvars.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
: set variables for running programs (relative from project folder)
22

3-
set binpath=..\bin
3+
set binpath=..\release
44
if exist ..\debug set binpath=..\debug
55
set andlexe=%binpath%\andl.exe
66
set thriftexe=..\thrift-0.9.3.exe

0 commit comments

Comments
 (0)