MSBuild Metadata on joined item groups - collections

I have two item groups that I wish to join:
<ItemGroup>
<ServerTypeA Include="ServerA;ServerB;">
<MetaDataA>A</MetaDataA>
</ServerTypeA>
</ItemGroup>
<ItemGroup>
<ServerTypeB Include="ServerB;ServerC;">
<MetaDataB>B</MetaDataB>
</ServerTypeB>
</ItemGroup>
Using the regular join will give me a collection with 4 items:
ServerA with Metadata A;
ServerB with Metadata A;
ServerB with Metadata B;
ServerC with Metadata B;
How can I create the following collection:
ServerA with Metadata A
ServerB with Metadata A & B
ServerC with Metadata B

It's possible. You have to can manually perform the join.
Here's an example of how to do it (msbuild 3.5 or greater required):
<ItemGroup>
<ServerTypeA Include="ServerA;ServerB;">
<MetaDataA>A</MetaDataA>
</ServerTypeA>
<ServerTypeB Include="ServerB;ServerC;">
<MetaDataB>B</MetaDataB>
</ServerTypeB>
</ItemGroup>
<Target Name="JoinServers" DependsOnTargets="ProcessServerTypeA;ProcessServerTypeB">
<Message Text="%(Joined.Identity) Metadata: %(Joined.MetaDataA)%(Joined.MetaDataB)"/>
</Target>
<!--Create -->
<Target Name="ProcessServerTypeA">
<ItemGroup>
<Joined Include="%(ServerTypeA.Identity)">
<MetaDataA>%(ServerTypeA.MetaDataA)</MetaDataA>
</Joined>
</ItemGroup>
</Target>
<!--Need to batch at the target level for this to work-->
<Target Name="ProcessServerTypeB" Inputs="#(ServerTypeB)" Outputs="%(ServerTypeB.Identity)'">
<PropertyGroup>
<!--Create Temporary Properties for the Item Metadata-->
<TempItemName>%(ServerTypeB.Identity)</TempItemName>
<TempMetaDataB>%(ServerTypeB.MetaDataB)</TempMetaDataB>
<!--Does the current item already exist?-->
<TempIsDuplicate Condition="'%(Joined.Identity)' == '$(TempItemName)'">True</TempIsDuplicate>
</PropertyGroup>
<ItemGroup>
<!--Update the existing item's metadata if this is a duplicate-->
<!--Don't provide the include attribute. This will allow you to update existing items metadata-->
<!--Have to reference %(Joined.Identity) in the condtion to ensure we only update the correct item-->
<!--You cannot directly reference metadata from ServerTypeB here. Hence the need for the temp Properties-->
<Joined Condition="'%(Joined.Identity)' == '$(TempItemName)'">
<MetaDataB>$(TempMetaDataB)</MetaDataB>
</Joined>
<!--Create a new item if current item is not a duplicate-->
<Joined Include="$(TempItemName)" Condition="'$(TempIsDuplicate)' != 'True'">
<MetaDataB>$(TempMetaDataB)</MetaDataB>
</Joined>
</ItemGroup>
</Target>
Running the JoinServers target will produce the following output:
ServerA Metadata: A
ServerB Metadata: AB
ServerC Metadata: B
Update with a better answer
This question pointed me to a much simpler solution.
Basically you use Transform modifiers with %(Identity) to perform the join.
You can replace all 3 targets from above with the following to obtain the same output.
<Target Name="JoinServers">
<ItemGroup>
<Joined Include="%(Identity)">
<MetaDataA>#(ServerTypeA->'%(MetaDataA)')</MetaDataA>
<MetaDataB>#(ServerTypeB->'%(MetaDataB)')</MetaDataB>
</Joined>
</ItemGroup>
<Message Text="%(Joined.Identity) Metadata: %(Joined.MetaDataA)%(Joined.MetaDataB)"/>
</Target>

Related

Docker, all API calls return 404

I'm trying to deploy my application which consists of Angular and ASP.NET. I've managed to successfully publish the app with docker. When I launch application with docker and call any method from swagger I get 404. How can I fix this?
Maybe it is because docker is launched on localhost and tries to make request to localhost, not the container. Nevertheless, I think that if the localhost was launched successfully the requests should also work(?).
One more question is - how do I launch my Angular app with docker? When I run the docker, api is the only project that is launched. You may notice that I've excluded Angular app from csproj because I've added additional steps to build it in dockerfile.
Please feel free to ask me any details.
Additional Information:
[Route("api/[controller]")]
[ApiController]
public class PingController : ControllerBase
{
[HttpGet("ping")]
public int Ping()
{
return 1;
}
}
dockerfile:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
# Setup NodeJs
RUN apt-get update && \
apt-get install -y wget && \
apt-get install -y gnupg2 && \
wget -qO- https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y build-essential nodejs
# End setup
WORKDIR /app
EXPOSE 80
EXPOSE 443
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["SelfWebsiteApi/SelfWebsiteApi.csproj", "SelfWebsiteApi/"]
RUN dotnet restore "SelfWebsiteApi/SelfWebsiteApi.csproj"
COPY . .
WORKDIR "/src/SelfWebsiteApi"
RUN dotnet build "SelfWebsiteApi.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "SelfWebsiteApi.csproj" -c Release -o /app/publish
#Angular build
FROM node as nodebuilder
# set working directory
RUN mkdir /usr/src/app
WORKDIR /usr/src/app
# add `/usr/src/app/node_modules/.bin` to $PATH
ENV PATH /usr/src/app/node_modules/.bin:$PATH
# install and cache app dependencies
COPY SelfWebsiteApi/SelfWebsiteAngular/package.json /usr/src/app/package.json
RUN npm install
RUN npm install -g #angular/cli --unsafe
# add app
COPY SelfWebsiteApi/SelfWebsiteAngular/. /usr/src/app
RUN npm run build --prod
#End Angular build
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
RUN mkdir -p /app/SelfWebsiteAngular/dist
COPY --from=nodebuilder /usr/src/app/dist/. /app/SelfWebsiteAngular/dist/
ENTRYPOINT ["dotnet", "SelfWebsiteApi.dll"]
csproj:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<SpaRoot>SelfWebsiteAngular\</SpaRoot>
<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
<UserSecretsId>57cd274b-65dd-4fa0-938b-cdb4fb135876</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="11.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.15.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.4" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
</ItemGroup>
<ItemGroup>
<Content Remove="$(SpaRoot)**" />
<None Remove="$(SpaRoot)**" />
<None Include="$(SpaRoot)**" Exclude="$(SpaRoot)node_modules\**" />
</ItemGroup>
<!--<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
<Exec WorkingDirectory="$(SpaRoot)" Command="npm run build - -prod" />
<ItemGroup>
<DistFiles Include="$(SpaRoot)dist\**" />
<ResolvedFileToPublish Include="#(DistFiles->'%(FullPath)')" Exclude="#(ResolvedFileToPublish)">
<RelativePath>%(DistFiles.Identity)</RelativePath>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
</ResolvedFileToPublish>
</ItemGroup>
</Target>-->
</Project>
program.cs:
var builder = WebApplication.CreateBuilder(args);
var origin = builder.Configuration.GetValue<string>("SelfWebsiteAngular:Name");
var angularLink = builder.Configuration.GetValue<string>("SelfWebsiteAngular:Link");
builder.Services.AddCors(options =>
{
options.AddPolicy(origin, builder =>
{
builder.WithOrigins(angularLink)
//.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
});
});
builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddDbContext<SelfWebsiteContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("SelfWebsiteDatabase")));
builder.Services
.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
})
.AddJwtBearer(options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = true,
ValidateAudience = true,
ValidateLifetime = true,
ValidateIssuerSigningKey = true,
ValidIssuer = builder.Configuration.GetValue<string>("Settings:ServerLink"),
ValidAudience = builder.Configuration.GetValue<string>("Settings:ServerLink"),
IssuerSigningKey = new SymmetricSecurityKey(
Encoding.UTF8.GetBytes(
builder.Configuration.GetValue<string>("Settings:Authorization:SymmetricSecurityKey"))),
};
});
builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies());
builder.Services.AddTransient<ITokenService, TokenService>();
builder.Services.AddTransient<IAuthService, AuthService>();
builder.Services.AddTransient<IResumeService, ResumeService>();
builder.Services.AddTransient<ILinkService, LinkService>();
builder.Services.AddTransient<ISectionService, SectionService>();
builder.Services.AddSingleton<IMapperProvider, MapperProvider>();
builder.Services.AddSpaStaticFiles(configuration =>
{
configuration.RootPath = "SelfWebsiteAngular/dist";
});
var app = builder.Build();
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseStaticFiles();
//if (!app.Environment.IsDevelopment())
//{
app.UseSpaStaticFiles();
//}
app.UseSpa(spa =>
{
// To learn more about options for serving an Angular SPA from ASP.NET Core,
// see https://go.microsoft.com/fwlink/?linkid=864501
spa.Options.SourcePath = "SelfWebsiteAngular";
//if (app.Environment.IsDevelopment())
//{
spa.UseAngularCliServer(npmScript: "start");
// spa.UseProxyToSpaDevelopmentServer("http://localhost:4200");
//}
});
app.UseHttpsRedirection();
app.UseRouting();
app.UseCors(origin);
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();
Swagger is, by default, only available when the environment is 'Development'. Containers, by default, aren't development.
The code that does that is this in Program.cs
if (app.Environment.IsDevelopment())
{
app.UseSwagger();
app.UseSwaggerUI();
}
There are multiple ways to make Swagger available in a container.
You can permanently make it available by removing the if in the above code so it becomes
app.UseSwagger();
app.UseSwaggerUI();
You can also set the environment in the image to Development by setting ASPNETCORE_ENVIRONMENT like this
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
ENV ASPNETCORE_ENVIRONMENT=Development
# Setup NodeJs
RUN apt-get update && \
apt-get install -y wget && \
apt-get install -y gnupg2 && \
wget -qO- https://deb.nodesource.com/setup_16.x | bash - && \
apt-get install -y build-essential nodejs
# End setup
WORKDIR /app
EXPOSE 80
EXPOSE 443
A third option is to pass the environment variable on your docker run command by adding an -e ASPNETCORE_ENVIRONMENT=Development option to the command.
Which solution you should choose depends on how permanently you want to make Swagger available.
Try
app.UseRouting();
and also then
app.UseAuthorization();
because for me worked normally without this configuration in debug mode but it didn't work in Docker.

Dynamically populate version from version.sbt

I'm trying to take the version from version.sbt and and populate it to logback.xml's log appender's applicationVersion field.
version.sbt
version in ThisBuild := "0.4.63"
logback.xml
<configuration debug="true" scan="true" scanPeriod="60 seconds">
<appender name="ADP-MESSAGING" class="com.agoda.adp.messaging.logging.appenders.LogbackAppender">
<applicationName>MyApp</applicationName>
<applicationAssemblyName>myapp</applicationAssemblyName>
<applicationVersion>0.4.61</applicationVersion>
<!-- <applicationVersion>${application.version}</applicationVersion> -->
<apiKey>s234W##$WFW$#$#</apiKey>
<getCallerData>false</getCallerData>
</appender>
....
<root level="WARN">
<appender-ref ref="ADP-MESSAGING" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
I tried by adding ${application.version}, ${version} but no success.
How can I do this?
Please share your thoughts.
Thanks
The values interpolated in a logback.xml file are simply Java system properties. All you have to do is add a value to your Java commandline defining the value you want:
// NOTE: This will only work when running through sbt. You'll have to
// append the same value to your startup scripts when running elsewhere.
javaOptions += "-Dapplication.version=" + version.value
With this flag, you should be able to interpolate the version in your XML file:
<applicationVersion>${application.version}</applicationVersion>
You can add logback PropertyDefiner implementation:
package org.mypackage
import ch.qos.logback.core.PropertyDefinerBase
class VersionPropertyDefiner extends PropertyDefinerBase {
override def getPropertyValue: String = BuildInfo.version
}
You will get autogenerated (managed) scala code BuildInfo.version if you use BuildInfoPlugin in your project build settings.
Then you can define and use variable in your logback.xml configuration:
<configuration debug="true" scan="true" scanPeriod="60 seconds">
<define name="appVersion" class="org.mypackage.VersionPropertyDefiner"/>
<appender name="ADP-MESSAGING" class="com.agoda.adp.messaging.logging.appenders.LogbackAppender">
<applicationName>MyApp</applicationName>
<applicationAssemblyName>myapp</applicationAssemblyName>
<applicationVersion>${appVersion}</applicationVersion>
<apiKey>s234W##$WFW$#$#</apiKey>
<getCallerData>false</getCallerData>
</appender>
....
<root level="WARN">
<appender-ref ref="ADP-MESSAGING" />
<appender-ref ref="STDOUT" />
</root>
</configuration>

How to config bigbluebutton to work with external Red5 server

From high level architecture overview for bigbluebutton http://docs.bigbluebutton.org/overview/architecture.html I understand that red5 server communicates with client using rtmp or by tunning rtmp via nginx. And then red5 server communicate with FreeSwitch using redis (with fsesl-akka). It mean we are able to desploy red5 in separately server. The result should be 3 servers:
Server for nginx/tomcat7 to run client, bbb-web
Server for Red5 + redis which handle rtmp for module videoconf/sharing/call/audio
Server for Freeswitch
Currently, I am able to config module to use rtmp from separately Red5 server by changing client/conf/config.xml
<config>
<localeversion suppressWarning="false">0.9.0</localeversion>
<version>VERSION</version>
<help url="http://10.0.121.16/help.html"/>
<javaTest url="http://10.0.121.16/testjava.html"/>
<porttest host="10.0.121.16" application="video/portTest" timeout="10000"/>
<bwMon server="10.0.121.16" application="video/bwTest"/>
<application uri="rtmp://10.0.121.16/bigbluebutton" host="http://10.0.121.16/bigbluebutton/api/enter"/>
<language userSelectionEnabled="true" />
<skinning enabled="true" url="http://10.0.121.16/client/branding/css/BBBDefault.css.swf" />
<shortcutKeys showButton="true" />
<browserVersions chrome="CHROME_VERSION" firefox="FIREFOX_VERSION" flash="FLASH_VERSION" java="1.7.0_51" />
<layout showLogButton="false" defaultLayout="bbb.layout.name.defaultlayout"
showToolbar="true" showFooter="true" showMeetingName="true" showHelpButton="true"
showLogoutWindow="true" showLayoutTools="true" confirmLogout="true"
showRecordingNotification="true"/>
<meeting muteOnStart="false" />
<logging enabled="true" target="trace" level="info" format="{dateUTC} {time} :: {name} :: [{logLevel}] {message}" uri="http://10.0.121.16"/>
<lock disableCamForLockedUsers="false" disableMicForLockedUsers="false" disablePrivateChatForLockedUsers="false"
disablePublicChatForLockedUsers="false" lockLayoutForLockedUsers="false" lockOnJoin="true" lockOnJoinConfigurable="false"/>
<modules>
<module name="ChatModule" url="http://10.0.121.16/client/ChatModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
dependsOn="UsersModule"
privateEnabled="true"
fontSize="12"
position="top-right"
baseTabIndex="701"
colorPickerIsVisible="false"
maxMessageLength="1024"
/>
<module name="UsersModule" url="http://10.0.121.16/client/UsersModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
allowKickUser="true"
enableEmojiStatus="true"
enableSettingsButton="true"
baseTabIndex="301"
/>
<module name="DeskShareModule"
url="http://10.0.121.16/client/DeskShareModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/deskShare"
publishURI="10.0.121.16"
useTLS="false"
showButton="true"
autoStart="false"
autoFullScreen="false"
baseTabIndex="201"
/>
<module name="PhoneModule" url="http://10.0.121.16/client/PhoneModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/sip"
autoJoin="true"
listenOnlyMode="true"
presenterShareOnly="false"
skipCheck="false"
showButton="true"
enabledEchoCancel="true"
useWebRTCIfAvailable="true"
showPhoneOption="false"
echoTestApp="9196"
dependsOn="UsersModule"
/>
<module name="VideoconfModule" url="http://10.0.121.16/client/VideoconfModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/video"
dependson = "UsersModule"
baseTabIndex="401"
presenterShareOnly = "false"
controlsForPresenter = "false"
autoStart = "false"
skipCamSettingsCheck="false"
showButton = "true"
showCloseButton = "true"
publishWindowVisible = "true"
viewerWindowMaxed = "false"
viewerWindowLocation = "top"
smoothVideo="false"
applyConvolutionFilter="false"
convolutionFilter="-1, 0, -1, 0, 6, 0, -1, 0, -1"
filterBias="0"
filterDivisor="4"
displayAvatar = "false"
focusTalking = "false"
glowColor = "0x4A931D"
glowBlurSize = "30.0"
priorityRatio = "0.67"
/>
<module name="WhiteboardModule" url="http://10.0.121.16/client/WhiteboardModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
dependsOn="PresentModule"
baseTabIndex="601"
whiteboardAccess="presenter"
keepToolbarVisible="false"
/>
<module name="PollingModule" url="http://10.0.121.16/client/PollingModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
dependsOn="PresentModule"
/>
<module name="PresentModule" url="http://10.0.121.16/client/PresentModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
host="http://10.0.121.16"
showPresentWindow="true"
showWindowControls="true"
openExternalFileUploadDialog="false"
dependsOn="UsersModule"
baseTabIndex="501"
maxFileSize="30"
/>
<module name="LayoutModule" url="http://10.0.121.16/client/LayoutModule.swf?v=VERSION"
uri="rtmp://10.0.121.16/bigbluebutton"
layoutConfig="http://10.0.121.16/client/conf/layout.xml"
enableEdit="false"
/>
</modules>
</config>
Where 10.0.121.14 - run Red5 + redis. 10.0.121.16 run nginx + tomcat7. Any document/help/suggestion from expert for solve this issue?
Seperate Red5 servers can distribute video and deskshare modules, just need to get the archiving scripts to pull the .flv files from stream directory when processing. I would leave the basic red5 on bbb server to handle the rest of messaging with local redis store.
If you want to not have red5 on server all together, then you would need to enable the red5 server to have access to connect to redis. Be careful. downt think and password is set, so you dont want to expose this on public interface without using correct iptable rules.
regards,
Stephen
hostbbb.com

BeforeBuild and AfterBuild events in Visual Studio Tools for Cordova 2015 Update 5

I am trying to use pre and post build in my Visual Studio 2015 (TACO) project. As outlined in PreBuildEvent and PostBuildEvent on Visual Studio 2015 Tools for Apache Cordova I have added <Target> elements to my .jsproj file so that it now ends as shown:
<Import Project="_apacheCordovaProjectSourceItems.Targets" Condition="Exists('_apacheCordovaProjectSourceItems.Targets')" />
<Target Name="BeforeBuild">
<Exec Command="if $(ConfigurationName) == Release (echo ** Before Build **)" />
<Exec Command="attrib -R "$(ProjectDir)\platforms\*.*" /S" IgnoreExitCode="true" />
</Target>
<Target Name="AfterBuild">
<Exec Command="if $(ConfigurationName) == Release (echo ** After Build **)" />
<Exec Command="if $(ConfigurationName) == Release (xcopy "$(TargetDir)*.*" "$(SolutionDir)..\..\Binaries\$(PlatformName)\*.*" /Y /S /E /F /I)" />
</Target>
</Project>
My problem is that both the BeforeBuild and AfterBuild events fire at the beginning of the build
1>------ Build started: Project: MyProject, Configuration: Release Android ------
1> ** Before Build **
1> ** After Build **
1> D:\Workspaces\Products\MyProduct\Projects\Main\Sources\Apps\MyProject\bin\Android\Release\android-release-unsigned.apk -> D:\Workspaces\Products\MyProduct\Projects\Binaries\Android\android-release-unsigned.apk
1> D:\Workspaces\Products\MyProduct\Projects\Main\Sources\Apps\MyProject\bin\Android\Release\manifest-merger-release-report.txt -> D:\Workspaces\Products\MyProduct\Projects\Binaries\Android\manifest-merger-release-report.txt
1> 2 File(s) copied
1> Your environment has been set up for using Node.js 0.12.2 (ia32) and npm.
1> ... [Rest of output omitted] ...
Can anybody shed some light on why this is, or how I can get the post build event to run after the build has completed?
After banging my head against a wall for a while I gave up on the Visual Studio AfterBuild event and used a hook for the Cordova after_build one. It fires a bit earlier in the whole build process, but was good enough for my requirements. I'll post the gist of what it entails in case others need to do a similar thing.
Find the config.xml in Solution Explorer, right click on it and select View Code
In the config.xml add a <hook> section as follows
<platform name="android">
<hook type="after_build" src="scripts/afterbuild-copy-to-drop.js" />
</platform>
Here I am hooking into the after_build event for an Android build only.
Now create a scripts folder at the root of the project, ie the same level as the plugins and www folders.
Create a JavaScript file in here with a name that matches the src attribute in the hook definition, ie 'afterbuild-copy-to-drop.js'.
In this script file write the required code. Here is mine
module.exports = function (ctx) {
console.log('Executing custom "' + ctx.hook + '" hook for ' + ctx.opts.platforms);
var path = ctx.requireCordovaModule('path'),
shell = ctx.requireCordovaModule('shelljs');
// make sure we are in a release build
var isRelease = (ctx.cmdLine.indexOf('--configuration Release') >= 0);
var solutionRoot = path.join(ctx.opts.projectRoot, '../..');
var dropRoot = path.join(solutionRoot, '../../Binaries/Release/Apps');
if (isRelease){
if (ctx.opts.platforms == 'android') {
var platformRoot = path.join(ctx.opts.projectRoot, 'platforms/android');
var apkFileLocation = path.join(platformRoot, 'build/outputs/apk/android-release.apk');
dropRoot = path.join(dropRoot, 'Android');
var dropApkFileLocation = path.join(dropRoot, 'my-app.apk');
console.log('------ Making directory \'' + dropRoot + '\'');
shell.mkdir('-p', dropRoot);
console.log('------ Copying \'' + apkFileLocation + '\' to ' + dropApkFileLocation + '\'');
shell.cp('-f', apkFileLocation, dropApkFileLocation);
}
}
console.log('Finished executing "' + ctx.hook + '" hook for ' + ctx.opts.platforms);
};
Further information on hooks can be found at https://cordova.apache.org/docs/en/dev/guide/appdev/hooks/

ASDOC Ant : error with DEFINE

[Flex4.5 - Windows XP]
I defined all my define (string type) in asdoc target like this :
<target name="build-asdoc" depends="setup-asdoc-dir, manifest">
<exec executable="${FLEX_HOME}/bin/asdoc.exe" failonerror="true">
...
<!-- Defines -->
<arg line="-define+=CONFIG::version,'${env.VERSION}'" />
<arg line="-define+=CONFIG::mode,'${mode.production}'" />
<arg line="-define+=CONFIG::label,'${env.LABEL}'" />
Even these define, when ASDOC.exe runs, there are some errors on all these define in the code; example :
[exec] C:\DATA\Trinity\Dev\trinity-client\src\fr\laposte\trinity\common\GlobalClass.as(44): col: 76 Erreur: Accès à la propriété non définie mode.
[exec] private static var WEBSERVICE_SERVER_LABEL_TOKEN:String = String(CONFIG::mode).toUpperCase();
Thank you very much,
regards,
Anthony

Resources