in WiX .wxs file, we just can do things without 'if' logic.
is there any logic in WiX as:
if (OSLanguage==en-US)
{
copy file1 to dir1
}
else if(OSLanguage==zh-CN)
{
copy file2 to dir2
}
else if(OSLanguage==de-DE)
{
copy file3 to dir3
}
else
{
copy file4 to dir4
}
Put file1 in a component being installed to dir1 and give it a condition of SystemLanguageID=1033.
Similarly with the other files in their own components.
http://msdn.microsoft.com/en-us/library/aa372056(v=vs.85).aspx
In a per user install it could make more sense to use UserLanguageID in case the user is using one language and the OS is another.
http://msdn.microsoft.com/en-us/library/aa372384(v=vs.85).aspx
i got a solution, as following.
we can use Condition when copying files.
<DirectoryRef Id="INSTALLLOCATION">
<Component Id="resources.dll.zh_HANS" Guid="B7F590B2-1F3F-441E-B16F-EEF7AE240502">
<Condition>UserLanguageID=2052</Condition>
<File Id="resources.dll.zh_HANS" Source="E:\share\tmp\res\res\out\zh-Hans\res.dll" KeyPath="yes"/>
</Component>
Related
I wrote a small proc to recursively delete %TEMP% dir on windows which got quite bulky over each execution cycle.
But it seemed to work slow - it was way faster to manually select different folders inside the %TEMP% path and run deletion on it.
Is there a possibility to use threads / pthreads to delete folders in parallel.
Or an alternate solution.
Need help in the following code.
proc DirRecursion {dir args} {
set options(-files) ""
set options(-fileTypesFilter) "ALL"
array set options $args
upvar $options(-files) lf
#Performing action deletion on files for dir $dir ... please be patient as this might take some time
if ![catch { append lf " [glob -directory $dir -type f *]"}] {
} "Found following files to delete in dir $dir"
foreach f [set lf [regsub -all {\\} $lf {/}]] {
catch {file delete -force $f}
}
}
if ![catch { set ld [glob -directory $dir -type d *]}] {
foreach d $ld {
DirRecursion $d -files lf
}
} else {
puts "No directories to delete in dir $dir" debug
}
catch {file delete -force $dir}
}
Well, you could do that (probably by sending requests to file delete -force into a thread pool), it's very unlikely to help at all since the bottleneck will be in the actual reading and writing of the disk, even on systems with an SSD. With an HDD, that's definitely what you'll be waiting on.
You are aware that file delete -force already handles the recursive delete case? It's probably faster than what you've written too. Since I suspect you don't actually want to delete the %TEMP% path itself (as that's a bit special to other programs in your session too), you can instead do something like this:
file delete -force {*}[glob -directory $::env(TEMP) *]
Or delete the contents of the appropriate subdirectory instead. One line instead of a complicated procedure…
Edit
This will try to delete each entry individually and will continue on even if a directory cannot be deleted due to permission errors.
foreach {entry} [glob -directory $::env(TEMP) *] {
catch { file delete -force $entry }
}
Building a Java/Groovy project, various tasks like compileJava, compileGroovy, test, etc requires various jar artifacts which Gradle provides them if you have properly defined what you need for each area of that task.
I'm making those available to the build script (build.gradle) and everything is working fine.
One of my other project that I'm working on, requires not only jar rtifacts but also an .xml file as an artifact for doing JIBX / XSLT transformation/processing.
My simple question:
- Gradle build process know how to fetch artifacts from Artifactory (as I have mentioned those Artifactory repositories in init.d/common.gradle file) and during the build it feeds the compile/test etc tasks with those jars, now if I have this .xml artifact uploaded to Artifactory as well, then:
a. How can I get the .xml artifact available to me in build.gradle so that I can perform some operation on it; for ex: Copy that .xml file to a x/y/z folder in a resultant project's jar/war file. Those jar files I can access via project.configurations.compile.each or .find or something like that but I'm not sure if I can access the .xml file the same way. The following code works fine for unjaring a jar file in build/tmpJibx/ folder i.e. if I need httpunit-1.1.1.jar during my build, then the following function when called, will create/unjar this jar in build/tmpJibx/httpunit folder.
// Unpack jar
def unpackJarItem( jarName ) {
println 'unpacking: ' + jarName
def dirName = "$buildDir/tmpJibx/$jarName"
new File( dirName ).mkdirs()
project.configurations.compile.find {
def nameJar = it.name
def iPos = nameJar.lastIndexOf( '-' )
if( iPos > 0 ) {
nameJar = nameJar.substring( 0, iPos )
if( nameJar == jarName ) {
def srcJar = it.toString()
ant {
unjar( src: "$srcJar", dest: "$dirName" )
}
}
}
}
}
Gradle maintains artifacts in its cache at user's ~(home directory inside ~/.gradle) or C:\Users\.gradle under ...\caches..\artifactory..\filestore.........*
All Im trying to achieve is:
If I can do something like below:
copy {
into "build/war/WEB-INF/conf"
from "......<THIS_PATH_IS_WHAT_Im_LOOKING_FOR>:
include "thatxmlartifactfile.xml"
}
I tried defining the entry under dependencies { ... } section, like below, but I'm not sure if Gradle will automatically have access to it somehow as Gradle is so great.
dependencies {
compile 'groupid:artifactid:x.x.x'
compile group: 'xxxx', artifac...: 'yyyy', version: 'x.x.x'
//for ex:
compile 'httpunit:httpunit:1.1.1'
jibxAnt 'groupidnameofxmlfile:artifactidnameofxmlfile:versionnumberofxml#xml"
...
...
....
}
It seems like I have to first copy that .xml from where ever Gradle know it's available to some location n then from that location to my target folder.
// Add libraries for acceptance tests
project.configurations.acceptanceTestCompile.each { File f ->
if( f.isFile() ) {
def nameJar = f.getName()
def jarName = f.getName()
def fileInc = true
def iPos = nameJar.lastIndexOf( '-' )
if( iPos > -1 ) {
jarName = nameJar.substring( 0, iPos )
// Here I can say that one of the file/entry will be that .xml file
// Now I have that in jarName variable and I can play with it, right?
// i.e. if jarName == name of that xml file, then
copy {
into "some/folder/location"
from jarName
}
}
}
}
The easiest solution is to commit the XML file to source control. If you put it under src/main/webapp/WEB-INF/conf/thatxmlartifactfile.xml, it will get included in the War automatically.
If you need to get the file from Artifactory, you can do so as follows:
configurations {
jibx
}
dependencies {
jibx "some.group:someArtifact:1.0#xml"
war {
from { configurations.jibx.singleFile }
}
PS: It's often possible, and also preferable, to add files directly to the final archive, rather than going through intermediate copy steps.
Assume I have two files
AFile.ts
/// <reference path="ZFile.ts" />
new Z().Foo();
ZFile.ts
class Z
{
Foo() { }
}
Is there a way to generate all scripts in a single js file in the order it requires (need ZFile before AFile to get the definition of Z)?
In post build events I added a call to TypeScript compiler
tsc "..\Content\Scripts\Start.ts" --out "..\Content\Scripts\all.js"
In the bundle configuration I added
bundles.Add(new ScriptBundle("~/scripts/all").Include("~/Content/Scripts/all.js"));
On the _Layout.cshtml file I added
#Scripts.Render("~/Scripts/all")
And with that I got
<script src="/Scripts/all?v=vsTcwLvB3b7F7Kv9GO8..."></script>
Which is all my script in a single file.
The compiler does not minify, you have to use bundles and compile on Release or set
BundleTable.EnableOptimizations = true;
You can also minify using Web Essentials or grabbing the contents and minifing somewhere else.
Now VS Typescript Extension supports merging to one file.
Make sure that you have installed the extension Tools -> Extensions and Updates (VS2015 has it by default)
Go to the project properties and check Combine JavaScript output into file:
Important to have /// <reference /> (as in question), it helps tsc order files by dependencies before the merge.
Then for minimisation bundle can be used as usual:
bundles.Add(new ScriptBundle("~/bundles/finale").Include("~/js/all.js"));
and in view
#Scripts.Render("~/bundles/finale")
Use the --out parameter.
tsc AFile.ts ZFile.ts --out single.js
The typescript compiler will do the dependency navigation for you automatically.
Assuming all of your ts files are directly or indirectly under a folder called say 'ts' you could write a tt script which merged all of .js files(but not min.js) into a file myApp.js and all of your min.js files into myApp.min.js.
To obtain the ordering of files you could process subfolders thus:
string[] FolderOrder =
{
#"libs\utils\",
#"libs\controls\",
#"app\models",
#"app\viewmodels",
#".",
};
I am trying to zip files and directories in Groovy using AntBuilder. I have the following code:
def ant = new AntBuilder()
ant.zip(basedir: "./Testing", destfile:"${file}.zip",includes:file.name)
This zips the file "blah.txt", but not the file "New Text Document.txt". I think the issue is the spaces. I've tried the following:
ant.zip(basedir: "./Testing", destfile:"${file}.zip",includes:"${file.name}")
ant.zip(basedir: "./Testing", destfile:"${file}.zip",includes:"\"${file.name}\"")
Neither of the above resolved the issue. I'm using Ant because it will zip directories, and I don't have access to org.apache.commons.io.compression at work.
If you look at the docs for the ant zip task, the includes parameter is described as:
comma- or space-separated list of patterns of files that must be included
So you're right, that it is the space separator that's breaking it...
You need to use the longer route to get this to work:
new AntBuilder().zip( destFile: "${file}.zip" ) {
fileset( dir: './Testing' ) {
include( name:file.name )
}
}
I know that when using Ant from Groovy, you can do something like the following to copy files:
copy(todir:myDir) {
fileset(dir:"src/test") {
include(name:"**/*.groovy")
}
}
Is there a more efficient, and elegant way to copy a single file?
How about:
new AntBuilder().copy( file:"$sourceFile.canonicalPath",
tofile:"$destFile.canonicalPath")