Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property File Loading Order and Variable Reference Issue #1784

Closed
Maretius opened this issue Jan 26, 2024 · 1 comment
Closed

Property File Loading Order and Variable Reference Issue #1784

Maretius opened this issue Jan 26, 2024 · 1 comment
Milestone

Comments

@Maretius
Copy link

Describe the bug
I have encountered an issue in Phing related to the loading order of property files and variable references. The problem occurs when multiple property files are loaded, and there is a reference to a variable defined in a later file.

I have two property files, one.env and two.env with the following contents:

one.env:

test=foo

two.env:

test=bar
test2=${test}

When loading these property files using the task in Phing, the variable "test2" is not being correctly overridden. The expected behavior is that "test2" should have the value "bar" since it is being overridden in two.env.

Steps To Reproduce

Use the following <property> tasks in the Phing build file:

<property file="one.env" override="true"/>
<property file="two.env" override="true"/>

Use <echoproperties/> to output the property values.

Expected behavior

Buildfile: ./build.xml
 [property] Loading ./one.env
 [property] Loading ./two.env

build-tools > test:
#
#Phing properties
#
test=bar
test2=bar

Screenshots / terminal output

Buildfile: ./build.xml
 [property] Loading ./one.env
 [property] Loading ./two.env

build-tools > test:
#
#Phing properties
#
test=bar
test2=foo

Additional context
Phing Version: Phing 3.0.0-RC6
Operating System: Debian GNU/Linux 12 (bookworm) in WSL2 (Windows 10 Enterprise 22H2)

@mrook
Copy link
Member

mrook commented Jan 26, 2024

Good catch. When resolving newly loaded properties, we first check project properties before we check the new properties. That order should be reversed.

@mrook mrook added this to the 3.0.0 milestone Jan 26, 2024
@mrook mrook closed this as completed in bae7450 Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants