检查版本控制中的最新版本

发布于 2024-11-05 13:44:03 字数 1413 浏览 3 评论 0原文

我目前正在编写一个 ANT 脚本,其中包含一些用于检查事物的智能。我使用 True Blue Software 的 SnapshotCM 作为版本控制,并使用 CruiseControl 作为夜间构建的框架。 基本上,我需要始终检查版本控制中找到的最新版本并执行命令。在这种情况下,这里是一个示例:

<project name="nightly_build" default="main" basedir="checkout">
    <target name="init">
        <property file="initial.properties"/>
    </target>
    <target name="main" depends="init">
            <!-- need some code to set variable -->
            <!-- need some code to increment variable -->
        <!-- need some code here to check for the latest version -->
        <exec executable="C:/Program Files/True Blue Software/SnapshotCM/wco.exe">
            <arg line='-f -R "C:/Work/7.10.000_Tip/7.10.000_Tip_GUI_TEST/"'/>
        </exec>
    </target>
</project>

在上面的代码中,我将加载“initial.properties”文件。 算法应如下所示:

  1. 加载初始属性文件

  2. 获取build_number

  3. 将build_number增加1(让这个新变量为X)

  4. 如果找到 X,则将 X 加 1(如果未找到,则跳转到 6。)

  5. 如果找到 X,则重复 4(直到找不到 X)

  6. 否则使用

号initial.properties 文件如下:

Major_Version=7
Minor_Version=10
Project_Number=100
Build_Number=036
Product_Version=${Major_Version}.${Minor_Version}.${Project_Number}.${Build_Number}

任何人都可以指导我吗?

i am currently writing an ANT script which will include some intelligence to check for things. I am using SnapshotCM from True Blue Software as my version control and using CruiseControl as a framework for my nightly build.
Basically, I will need to always check for the latest version found in my version control and execute commands. In this case here is an example:

<project name="nightly_build" default="main" basedir="checkout">
    <target name="init">
        <property file="initial.properties"/>
    </target>
    <target name="main" depends="init">
            <!-- need some code to set variable -->
            <!-- need some code to increment variable -->
        <!-- need some code here to check for the latest version -->
        <exec executable="C:/Program Files/True Blue Software/SnapshotCM/wco.exe">
            <arg line='-f -R "C:/Work/7.10.000_Tip/7.10.000_Tip_GUI_TEST/"'/>
        </exec>
    </target>
</project>

In the code above, I will load the "initial.properties" file.
The algorithm should be as follow:

  1. load the initial properties file

  2. get the build_number

  3. increment build_number by 1 (let this new variable be X)

  4. if X is found, increament X by 1 (if not found jump to 6.)

  5. if X is found, repeat 4 (until X cannot be found)

  6. else use the build number inside the <arg line ='-f -R "C:/..../7.10.100.X..../"'/>

The initial.properties file is as follow:

Major_Version=7
Minor_Version=10
Project_Number=100
Build_Number=036
Product_Version=${Major_Version}.${Minor_Version}.${Project_Number}.${Build_Number}

can anyone guide me on that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

厌倦 2024-11-12 13:44:03

Ant 不是一种编程语言。它是一种依赖矩阵语言。

这意味着您没有在 Ant 中指定执行顺序。 Ant 将计算运行目标所需的顺序。这也意味着 Ant 无法执行循环,甚至无法在设置属性值后更改该值。

有一些基于 Ant 构建的软件包。旧的备用是 Antcontrib。 Antcontrib 有变量的概念,就像可变属性。它还具有各种循环结构。但是,我不确定 任务是否会执行您想要的操作...

按顺序搜索下一个内部版本号是件好事你可以在 shell 脚本中执行。事实上,我强烈推荐这个。

我仅使用 Ant 进行构建,并将 CM 函数保留在 build.xml 文件之外。相反,我依靠我的构建系统来完成与构建本身无关的所有事情。这包括检查代码、保存工件和编译单元测试。这样,如果我改变使用连续构建系统或版本控制系统的方式,我不必修改我的 build.xml 文件。

Ant is not a programming language. It's a dependency matrix language.

That means you don't specify execution order in Ant. Ant will calculate the order it needs to run the targets. It also means Ant doesn't have the ability to do loops, or even change the value of a property once it is set.

There are a few packages that build upon Ant. The old standby is the Antcontrib. Antcontrib has the concept of variables which are like mutable properties. It also has various looping structures. However, I'm not sure if the <foreach> or <for> tasks will do what you want...

Searching sequentially for the next build number is something you can do in a shell script. In fact, I highly recommend this.

I use Ant for builds only and keep my CM functions outside of my build.xml file. Instead, I rely on my build system to do everything that's not related to the build itself. This includes checking out the code, saving the artifacts, and compiling unit tests. This way, if I change the way I use my continuous build system or my version control system, I don't have to modify my build.xml files.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文