logo
Tags down

shadow

How to identify latest application build folder based on folder name


By : user2174545
Date : October 17 2020, 08:10 PM
this one helps.
I would probably solve this task using the following code (see all the explanatory rem remarks):
code :
@echo off
setlocal EnableExtensions DisableDelayedExpansion

rem // Define constants here:
set "_ROOT=C:\Program Files\ABC" & rem // (root directory)
set "_NAME=AppName"              & rem // (folder name prefix)

rem // Initialise variables:
set /A "HIGHEST=0" & set "LATEST="
rem // Loop through potentionally matching folders:
for /F "delims=| eol=|" %%F in ('dir /B /A:D "%_ROOT%\%_NAME% *"') do (
    rem // Split off last space-separated name portion:
    set "FOLDER=%%F" & set "NUMBER="
    setlocal EnableDelayedExpansion
    for %%H in ("!FOLDER: =" "!") do (if not defined NUMBER endlocal) & set "NUMBER=%%~H"
    rem // Filter for name portions consisting of numerals and dots only:
    setlocal EnableDelayedExpansion
    for /F "tokens=* eol= " %%E in ('echo("!NUMBER!" ^| findstr "\"[0-9\.]*\""') do (
        endlocal
        rem // Extract individual version numbers (four at most):
        for /F "tokens=1-4 delims=. eol=." %%A in ("%%E.0.0.0.0") do (
            rem /* Compute a number out of the individual version numbers;
            rem    note that none of them must have more than two digits: */
            setlocal EnableDelayedExpansion
            set /A "CURRENT=((%%A*100+%%B)*100+%%C)*100+%%D"
            rem // Compare the current number with the stored greatest one:
            if !CURRENT! gtr !HIGHEST! (
                rem // Store the current number as the greatest one in case it is such:
                for /F %%H in ("!CURRENT!") do endlocal & set /A "HIGHEST=%%H"
                rem // Store the folder name correlating with the current number:
                set "LATEST=%%F"
            ) else endlocal
        )
    )
)
rem // Return the resulting folder name:
echo Found folder name: %LATEST%
echo Latest version:    %NUMBER%
echo Comparison number: %HIGHEST%

endlocal
exit /B


Share : facebook icon twitter icon

How to build a functionality to download Audio files to local folder or downloads folder from a silverlight application?


By : andyravensable
Date : March 29 2020, 07:55 AM
will be helpful for those in need The solution is- I got the audio files from client bin folder from server then I downloaded it to local folder on client machine by using save file dialog box. as follows-
code :
 Private Sub btn_downloadSound_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
    If streamAudio_download Is Nothing Then
        MessageBox.Show("Audio file does not exists for selected sound feature")
    Else
        saveFileDialog1.Filter = "MP3 Files (*.mp3)|*.mp3|MP4 Files|*.mp4"
        saveFileDialog1.ShowDialog()
        Dim words As String() = soundFileSelected_Name.Split(".")
        Dim fileExtension As String = words(1)
        Using audiofs As System.IO.FileStream = saveFileDialog1.OpenFile()
            If fileExtension = "mp3" Then
                Dim bytes As Byte() = New Byte(40) {}
                Dim bytesToRead As Integer = 0
                bytesToRead = streamAudio_download.Read(bytes, 0, bytes.Length)

                While (bytesToRead = streamAudio_download.Read(bytes, 0, bytes.Length)) <> 0
                    audiofs.Write(bytes, 0, bytesToRead)
                End While
            ElseIf fileExtension = "mp4" Then
                Dim b As New BinaryWriter(audiofs)
                b.Write(byteArray)
                audiofs.Close()
            End If
        End Using
    End If
End Sub

How have a build store using maven (new build timestamped folder and latest folder)?


By : jana-oh
Date : March 29 2020, 07:55 AM
help you fix your problem Here is an example of how to accomplish it:
Use the maven ${maven.build.timestamp} property as directory name suffix to have dynamic directory names with timestamp Redefine the maven.build.timestamp.format, if required, to remove the : default character which may cause issues in some OS. For example, to the value yyyy-MM-dd_HH-mm-ss (the _ replaces :) Configure the maven-clean-plugin to clean up the latest folder before executing this build activity. The official documentation already provides an example of how to delete additional files Configure the maven-resources-plugin to copy your project resources to the latest and the new build store folder, via two different plugin executions. The official documentation already provides an example on how to copy resources Configure the maven-jar-plugin to package project artifacts to the two directories (latest and build), I would recommend with two different maven classifier (the timestamp and latest are perfect candidates). The official documentation alread provides example on how to attach additional jars Configure the maven-dependency-plugin to copy project dependencies to the two folders, via two plugin executions. The official documentation already provides an example on how to copy project dependencies Place this whole build configuration in a Maven profile in order not to have it as default behavior yet able to invoke it on demand
code :
<profile>
    <id>build-store</id>

    <properties>
        <maven.build.timestamp.format>yyyy-MM-dd_HH-mm-ss</maven.build.timestamp.format>
        <build.store.directory>c:\build_${maven.build.timestamp}</build.store.directory>
        <build.store.directory.latest>c:\latest</build.store.directory.latest>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>${build.store.directory.latest}</directory>
                            <includes>
                                <include>**/*</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.0.2</version>
                <executions>
                    <execution>
                        <id>copy-dependencies-to-build-store</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${build.store.directory}</outputDirectory>
                            <classifier>${maven.build.timestamp}</classifier>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-dependencies-to-latest</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${build.store.directory.latest}</outputDirectory>
                            <classifier>latest</classifier>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.10</version>
                <executions>
                    <execution>
                        <id>copy-dependencies-to-build-store</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${build.store.directory}/libs</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-dependencies-to-latest</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${build.store.directory.latest}/libs</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>copy-resources-build-store</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${build.store.directory}/conf</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-resources-latest</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${build.store.directory.latest}/conf</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</profile>
mvn clean package -P build-store

Gulp task to copy folder into build folder give empty folder


By : Alvadhito Hardirahar
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , You're not instructing it to copy the contents of the folder.
try gulp.src(["MyModule", "MyModule/**/*"], base:{'.'}) to copy the folder and everything in it instead of just the folder.

Identify build type of a folder


By : Sushant Sood
Date : March 29 2020, 07:55 AM
it fixes the issue As a rule of thumb:
Gradle projects will have a build.gradle (and often settings.gradle) Maven projects will have a pom.xml Ant projects will have a build.xml

How to create a folder with a timestamp and build id as the folder name and copy some files into that folder?


By : MikeV
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I need to take backup of a few artifacts (.dll files in this case) in a new folder called backup. I want a backup to be taken every time a build happens. I need Jenkins to create a folder with the time stamp and build number as the folder name and then copy the artifacts into that folder. , The simplest solution is to use the java date:
code :
def now = new Date()
def filename = now.format("backup-$BUILD_NUMBER-yyyyMMddHHmm")
shadow
Privacy Policy - Terms - Contact Us © voile276.org