Skip to content

Commit 9a69b5d

Browse files
committed
Init
1 parent de1e4d4 commit 9a69b5d

File tree

4 files changed

+41
-29
lines changed

4 files changed

+41
-29
lines changed

Directory.Build.targets

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,5 @@
1111
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
1212
</PropertyGroup>
1313

14-
<!-- Run dotnet format before build to ensure code formatting consistency -->
15-
<!-- Only runs for non-test projects to avoid overhead -->
16-
<!-- Note: Overridden (disabled) in LocalTesting, LearningCourse, ObservabilityTesting, BackPressureExample, ReleasePackagesTesting, and FlinkIRRunner folders -->
17-
<Target Name="FormatCode" BeforeTargets="CoreCompile" Condition="'$(IsTestProject)' != 'true' AND '$(DesignTimeBuild)' != 'true' AND '$(BuildingProject)' != 'false'">
18-
<Message Text="Running dotnet format on $(MSBuildProjectName)..." Importance="High" />
19-
<Exec Command="dotnet format --no-restore --verbosity quiet"
20-
WorkingDirectory="$(MSBuildProjectDirectory)"
21-
ContinueOnError="true"
22-
IgnoreExitCode="false" />
23-
</Target>
14+
<!-- dotnet format invocation removed: format now manual only -->
2415
</Project>

FlinkDotNet/FlinkDotNet.JobGateway/FlinkDotNet.JobGateway.csproj

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,40 +97,59 @@
9797
<AutoInstalledJdkExists Condition="Exists('$(JdkInstallDir)\bin\java.exe') OR Exists('$(JdkInstallDir)/bin/java')">true</AutoInstalledJdkExists>
9898
</PropertyGroup>
9999

100-
<!-- Download and install JDK 17 if no compatible Java found (Windows only) -->
100+
<!-- Download and install JDK 17 if no compatible Java found -->
101101
<Message Text="(FlinkDotNet.JobGateway) No compatible Java found. Installing JDK $(JdkVersion) to $(JdkInstallDir)..."
102102
Importance="High"
103-
Condition="'$(IsWindows)' == 'true' AND '$(JavaHomeIsValid)' != 'true' AND '$(DetectedJavaHome)' == '' AND '$(AutoInstalledJdkExists)' != 'true'" />
103+
Condition="('$(IsWindows)' == 'true' OR '$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND '$(AutoInstalledJdkExists)' != 'true'" />
104104

105105
<!-- Create tools directory if it doesn't exist -->
106106
<MakeDir Directories="$(ToolsDir)"
107-
Condition="'$(IsWindows)' == 'true' AND '$(JavaHomeIsValid)' != 'true' AND '$(DetectedJavaHome)' == '' AND '$(AutoInstalledJdkExists)' != 'true'" />
107+
Condition="('$(IsWindows)' == 'true' OR '$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND '$(AutoInstalledJdkExists)' != 'true'" />
108108

109109
<!-- Download JDK ZIP (Windows only - use powershell for Windows PowerShell 5.1 compatibility) -->
110110
<Exec Command="powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;Write-Host 'Downloading JDK $(JdkVersion) from $(JdkDownloadUrl)...'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '$(JdkDownloadUrl)' -OutFile '$(JdkZipPath)' -UseBasicParsing&quot;"
111-
Condition="'$(IsWindows)' == 'true' AND '$(JavaHomeIsValid)' != 'true' AND '$(DetectedJavaHome)' == '' AND '$(AutoInstalledJdkExists)' != 'true' AND !Exists('$(JdkZipPath)')"
111+
Condition="'$(IsWindows)' == 'true' AND '$(AutoInstalledJdkExists)' != 'true' AND !Exists('$(JdkZipPath)')"
112112
StandardOutputImportance="High" />
113113

114114
<!-- Extract JDK ZIP (Windows only) -->
115115
<Message Text="(FlinkDotNet.JobGateway) Extracting JDK to $(ToolsDir)..."
116116
Importance="High"
117-
Condition="'$(IsWindows)' == 'true' AND '$(JavaHomeIsValid)' != 'true' AND '$(DetectedJavaHome)' == '' AND '$(AutoInstalledJdkExists)' != 'true' AND Exists('$(JdkZipPath)')" />
117+
Condition="'$(IsWindows)' == 'true' AND '$(AutoInstalledJdkExists)' != 'true' AND Exists('$(JdkZipPath)')" />
118118

119119
<Exec Command="powershell -NoProfile -ExecutionPolicy Bypass -Command &quot;Expand-Archive -Path '$(JdkZipPath)' -DestinationPath '$(ToolsDir)' -Force&quot;"
120-
Condition="'$(IsWindows)' == 'true' AND '$(JavaHomeIsValid)' != 'true' AND '$(DetectedJavaHome)' == '' AND '$(AutoInstalledJdkExists)' != 'true' AND Exists('$(JdkZipPath)')"
120+
Condition="'$(IsWindows)' == 'true' AND '$(AutoInstalledJdkExists)' != 'true' AND Exists('$(JdkZipPath)')"
121121
StandardOutputImportance="High" />
122122

123123
<!-- Verify JDK was extracted successfully (Windows) -->
124-
<Error Condition="'$(IsWindows)' == 'true' AND '$(JavaHomeIsValid)' != 'true' AND '$(DetectedJavaHome)' == '' AND '$(AutoInstalledJdkExists)' != 'true' AND !Exists('$(JdkInstallDir)\bin\java.exe')"
124+
<Error Condition="'$(IsWindows)' == 'true' AND '$(AutoInstalledJdkExists)' != 'true' AND !Exists('$(JdkInstallDir)\bin\java.exe')"
125125
Text="JDK installation failed. java.exe not found at $(JdkInstallDir)\bin\java.exe" />
126126

127127
<Message Text="(FlinkDotNet.JobGateway) JDK $(JdkVersion) successfully installed to $(JdkInstallDir)"
128128
Importance="High"
129129
Condition="'$(IsWindows)' == 'true' AND Exists('$(JdkInstallDir)\bin\java.exe')" />
130130

131-
<!-- Error if Java not found on Linux/macOS (should be pre-installed in CI) -->
132-
<Error Condition="('$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND '$(JavaHomeIsValid)' != 'true' AND '$(JAVA_HOME)' == ''"
133-
Text="Java not found on Linux/macOS. Please install JDK 17+ or ensure JAVA_HOME is set. On GitHub Actions, Java is installed via actions/setup-java@v4." />
131+
<!-- Download and extract JDK 17 (Linux/macOS) -->
132+
<Exec Command="/bin/bash -c &quot;set -euo pipefail; echo 'Downloading JDK $(JdkVersion) from $(JdkDownloadUrl)...'; curl -fSL -o '$(JdkTarPath)' '$(JdkDownloadUrl)'&quot;"
133+
Condition="('$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND '$(AutoInstalledJdkExists)' != 'true' AND !Exists('$(JdkTarPath)')"
134+
StandardOutputImportance="High"
135+
StandardErrorImportance="High" />
136+
137+
<Message Text="(FlinkDotNet.JobGateway) Extracting JDK to $(ToolsDir)..."
138+
Importance="High"
139+
Condition="('$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND '$(AutoInstalledJdkExists)' != 'true' AND Exists('$(JdkTarPath)')" />
140+
141+
<Exec Command="/bin/bash -c &quot;set -euo pipefail; tar -xzf '$(JdkTarPath)' -C '$(ToolsDir)'&quot;"
142+
Condition="('$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND '$(AutoInstalledJdkExists)' != 'true' AND Exists('$(JdkTarPath)')"
143+
StandardOutputImportance="High"
144+
StandardErrorImportance="High" />
145+
146+
<!-- Verify JDK was extracted successfully (Linux/macOS) -->
147+
<Error Condition="('$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND '$(AutoInstalledJdkExists)' != 'true' AND !Exists('$(JdkInstallDir)/bin/java')"
148+
Text="JDK installation failed. java binary not found at $(JdkInstallDir)/bin/java" />
149+
150+
<Message Text="(FlinkDotNet.JobGateway) JDK $(JdkVersion) successfully installed to $(JdkInstallDir)"
151+
Importance="High"
152+
Condition="('$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND Exists('$(JdkInstallDir)/bin/java')" />
134153

135154
<!-- Re-check if auto-installed JDK exists after installation attempt -->
136155
<PropertyGroup>
@@ -141,10 +160,10 @@
141160
<PropertyGroup>
142161
<!-- Priority 1: Use valid existing JAVA_HOME -->
143162
<EffectiveJavaHome Condition="'$(JavaHomeIsValid)' == 'true'">$(JAVA_HOME)</EffectiveJavaHome>
144-
<!-- Priority 2: Use detected Java installation -->
145-
<EffectiveJavaHome Condition="'$(EffectiveJavaHome)' == '' AND '$(DetectedJavaHome)' != ''">$(DetectedJavaHome)</EffectiveJavaHome>
146-
<!-- Priority 3: Use auto-installed JDK (re-check after installation) -->
163+
<!-- Priority 2: Prefer managed JDK 17 installation -->
147164
<EffectiveJavaHome Condition="'$(EffectiveJavaHome)' == '' AND '$(AutoInstalledJdkExists)' == 'true'">$(JdkInstallDir)</EffectiveJavaHome>
165+
<!-- Priority 3: Use other detected Java installations as fallback -->
166+
<EffectiveJavaHome Condition="'$(EffectiveJavaHome)' == '' AND '$(DetectedJavaHome)' != ''">$(DetectedJavaHome)</EffectiveJavaHome>
148167
<!-- Priority 4: On Linux/macOS, use JAVA_HOME even if validation failed (GitHub Actions sets valid paths) -->
149168
<EffectiveJavaHome Condition="'$(EffectiveJavaHome)' == '' AND ('$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND '$(JAVA_HOME)' != ''">$(JAVA_HOME)</EffectiveJavaHome>
150169
</PropertyGroup>

LocalTesting/LocalTesting.FlinkSqlAppHost/Program.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@
362362

363363
sqlGateway = sqlGateway.WithArgs("/opt/flink/bin/sql-gateway.sh", "start-foreground");
364364

365-
var gateway = builder.AddProject<Projects.FlinkDotNet_JobGateway>("flink-job-gateway")
365+
IResourceBuilder<ProjectResource> gateway = builder.AddProject<Projects.FlinkDotNet_JobGateway>("flink-job-gateway")
366366
.WithEnvironment("FLINK_CONNECTOR_PATH", connectorsDir)
367367
.WithEnvironment("FLINK_RUNNER_JAR_PATH", gatewayJarPath)
368368
.WithEnvironment("LOG_FILE_PATH", testLogsDir)
@@ -374,10 +374,11 @@
374374
bool isTesting = Environment.GetEnvironmentVariable("IS_TESTING") == "true";
375375
if (isTesting)
376376
{
377-
gateway.WithHttpEndpoint(port: 8086, name: "gateway-http");
377+
gateway = gateway
378+
.WithHttpEndpoint(port: 8086, name: "gateway-http")
379+
.WithEnvironment("ASPNETCORE_URLS", "http://localhost:8086");
378380
}
379381

380-
381382
// Temporal PostgreSQL - Database for Temporal server
382383
// CRITICAL: Must configure PostgreSQL WITHOUT password for Temporal auto-setup compatibility
383384
// Temporal's auto-setup expects simple authentication (trust or no password)

LocalTesting/LocalTesting.IntegrationTests/LocalTesting.IntegrationTests.csproj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,12 @@
108108
<AutoInstalledJdkPath>$(ToolsDir)\jdk-17.0.13+11</AutoInstalledJdkPath>
109109
<AutoInstalledJdkExists Condition="Exists('$(AutoInstalledJdkPath)\bin\java.exe') OR Exists('$(AutoInstalledJdkPath)/bin/java')">true</AutoInstalledJdkExists>
110110

111-
<!-- Use detected Java if current JAVA_HOME is invalid -->
111+
<!-- Prioritize explicit JAVA_HOME when already valid -->
112112
<EffectiveJavaHome Condition="'$(JavaHomeIsValid)' == 'true'">$(JAVA_HOME)</EffectiveJavaHome>
113-
<EffectiveJavaHome Condition="'$(EffectiveJavaHome)' == '' AND '$(DetectedJavaHome)' != ''">$(DetectedJavaHome)</EffectiveJavaHome>
114-
<!-- Priority 3: Use auto-installed JDK from Flink.JobGateway -->
113+
<!-- Prefer managed JDK 17 installation provided by the build -->
115114
<EffectiveJavaHome Condition="'$(EffectiveJavaHome)' == '' AND '$(AutoInstalledJdkExists)' == 'true'">$(AutoInstalledJdkPath)</EffectiveJavaHome>
115+
<!-- Fall back to detected Java installations if needed -->
116+
<EffectiveJavaHome Condition="'$(EffectiveJavaHome)' == '' AND '$(DetectedJavaHome)' != ''">$(DetectedJavaHome)</EffectiveJavaHome>
116117
<!-- On Linux/macOS, use JAVA_HOME if set (GitHub Actions sets valid paths) -->
117118
<EffectiveJavaHome Condition="'$(EffectiveJavaHome)' == '' AND ('$(IsLinux)' == 'true' OR '$(IsMacOS)' == 'true') AND '$(JAVA_HOME)' != ''">$(JAVA_HOME)</EffectiveJavaHome>
118119
</PropertyGroup>

0 commit comments

Comments
 (0)