Skip to content

Conversation

@jpobst
Copy link
Contributor

@jpobst jpobst commented Jan 8, 2025

When running xaprepare on Windows, your local git tree ends up dirty due to line ending changes in THIRD-PARTY-NOTICES.txt.

Update xaprepare to always normalize line endings to Environment.NewLine in THIRD-PARTY-NOTICES.txt to prevent this issue.

Additionally, these scenarios where the build unintentionally modifies git tracked files on some platforms are frustrating, so let's prevent them from happening in the first place.

Add a CI check to fail a build if any git tracked files were modified.

Example:

image

Clicking the error will show the modified file(s):

image

Source: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=10799472&view=results

@jpobst jpobst marked this pull request as ready for review January 8, 2025 23:04
@jpobst jpobst requested a review from jonathanpeppers January 8, 2025 23:04
@dellis1972
Copy link
Contributor

can we add the. fail on dirty tree to Java.Interop also? I constantly get modified tracked files when building there, it prevents me doing submodule updates without having to clean it up first 😄

@jonpryor
Copy link
Contributor

jonpryor commented Jan 9, 2025

@dellis1972 wrote:

can we add the. fail on dirty tree to Java.Interop also? I constantly get modified tracked files when building there

I get that as well, but not because of the build, but because of VSCode! VSCode constantly updates tools/java-source-utils/.project! I guess I should just commit that change, but I have no idea what it's for!

diff --git a/tools/java-source-utils/.classpath b/tools/java-source-utils/.classpath
index 30230c1c..cbded110 100644
--- a/tools/java-source-utils/.classpath
+++ b/tools/java-source-utils/.classpath
@@ -20,6 +20,12 @@
 			<attribute name="test" value="true"/>
 		</attributes>
 	</classpathentry>
+	<classpathentry kind="src" output="bin/main" path="src/main/resources">
+		<attributes>
+			<attribute name="gradle_scope" value="main"/>
+			<attribute name="gradle_used_by_scope" value="main,test"/>
+		</attributes>
+	</classpathentry>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
 	<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
 	<classpathentry kind="output" path="bin/default"/>
diff --git a/tools/java-source-utils/.project b/tools/java-source-utils/.project
index 8337a1c5..dd0d1f07 100644
--- a/tools/java-source-utils/.project
+++ b/tools/java-source-utils/.project
@@ -20,4 +20,15 @@
 		<nature>org.eclipse.jdt.core.javanature</nature>
 		<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
 	</natures>
+	<filteredResources>
+		<filter>
+			<id>1736435235222</id>
+			<name></name>
+			<type>30</type>
+			<matcher>
+				<id>org.eclipse.core.resources.regexFilterMatcher</id>
+				<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
+			</matcher>
+		</filter>
+	</filteredResources>
 </projectDescription>

@jonpryor jonpryor merged commit 208c529 into main Jan 9, 2025
60 checks passed
@jonpryor jonpryor deleted the fail-on-dirty-tree branch January 9, 2025 16:08
grendello added a commit that referenced this pull request Jan 10, 2025
* main:
  [native] Use libc++ (#9558)
  [ci] Fail build if any git tracked files were modified. (#9661)
  Localized file check-in by OneLocBuild Task (#9663)
@github-actions github-actions bot locked and limited conversation to collaborators Feb 9, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants