Merge pull request #2891 from aspnet/release/2.2

Port build fixes from release/2.2
This commit is contained in:
Andrew Stanton-Nurse 2018-08-29 14:27:23 -07:00 committed by GitHub
commit 46e377cadd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 24 deletions

View File

@ -10,29 +10,15 @@
</NPMPackage>
</ItemGroup>
<PropertyGroup Condition="'$(JAVA_HOME)' != ''">
<!-- Determine the path we need to search to find javac.exe -->
<JavacPath Condition="'$(OS)' == 'Windows_NT'">$(JAVA_HOME)\bin\javac.exe</JavacPath>
<JavacPath Condition="'$(OS)' != 'Windows_NT'">$(JAVA_HOME)/bin/javac</JavacPath>
<HasJdk Condition="Exists('$(JavacPath)')">true</HasJdk>
<PropertyGroup>
<!-- Pass the Java Package Version down to Gradle -->
<GradleOptions>-PpackageVersion="$(JavaPackageVersion)"</GradleOptions>
<!-- Disable gradle daemon on CI since the CI seems to try to wait for the daemon to shut down, which it doesn't do :) -->
<GradleOptions Condition="'$(CI)' == 'true'">$(GradleOptions) -Dorg.gradle.daemon=false</GradleOptions>
<RequireJava Condition="'$(CI)' == 'true'">true</RequireJava>
</PropertyGroup>
<Target Name="EnsureJdkInstalled" BeforeTargets="GetToolsets" Condition=" '$(SkipJavaClient)' != 'true' ">
<Error Text="The JDK is required to build the SignalR repo on CI. Set the JAVA_HOME environment variable to the installation of the JDK"
Condition="'$(HasJdk)' != 'true' AND '$(CI)' == 'true' " />
<Warning Text="The JDK is required to build the SignalR Java client. No JDK could be found so this will be skipped. Set the JAVA_HOME environment variable to the installation of the JDK"
Condition="'$(HasJdk)' != 'true' AND '$(CI)' != 'true' " />
<Message Text="Using Java from $(JavacPath)" Importance="high" />
</Target>
<PropertyGroup>
<RestoreDependsOn>$(RestoreDependsOn);RestoreNpm</RestoreDependsOn>
</PropertyGroup>
@ -58,7 +44,7 @@
<Exec Command="npm run test:inner -- --no-color --configuration $(Configuration)" WorkingDirectory="$(RepositoryRoot)clients/ts/FunctionalTests" IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="RunJavaTests" Condition="'$(HasJdk)' == 'true' AND '$(SkipJavaClient)' != 'true' ">
<Target Name="RunJavaTests" Condition="'$(HaveJava)' == 'true' AND '$(SkipJavaClient)' != 'true' ">
<Message Text="Running Java client tests" Importance="high" />
<Message Text="> gradlew $(GradleOptions) test" Importance="high" />
<Exec Command="./gradlew $(GradleOptions) test" WorkingDirectory="$(RepositoryRoot)clients/java/signalr" IgnoreStandardErrorWarningFormat="true" />
@ -66,7 +52,6 @@
<PropertyGroup>
<GetArtifactInfoDependsOn>$(GetArtifactInfoDependsOn);GetNpmArtifactInfo;GetJavaArtifactInfo</GetArtifactInfoDependsOn>
<PrepareDependsOn>$(PrepareDependsOn);GetNpmArtifactInfo;GetJavaArtifactInfo</PrepareDependsOn>
</PropertyGroup>
<Target Name="GetNpmArtifactInfo">
@ -91,7 +76,7 @@
</Target>
<Target Name="GetJavaArtifactInfo">
<ItemGroup Condition=" '$(SkipJavaClient)' != 'true' ">
<ItemGroup Condition="'$(SkipJavaClient)' != 'true'">
<ArtifactInfo Include="$(BuildDir)\%(Jars.Identity)">
<ArtifactType>JavaJar</ArtifactType>
<Version>$(JavaClientVersion)</Version>
@ -108,6 +93,24 @@
</ItemGroup>
</Target>
<PropertyGroup>
<PrepareDependsOn>DetectJava;$(PrepareDependsOn)</PrepareDependsOn>
</PropertyGroup>
<Target Name="DetectJava">
<Exec Command="./gradlew $(GradleOptions)" WorkingDirectory="$(RepositoryRoot)clients/java/signalr" IgnoreExitCode="true" IgnoreStandardErrorWarningFormat="true">
<Output TaskParameter="ExitCode" PropertyName="JavaDetectExitCode" />
</Exec>
<Error Text="Failed to detect Java Runtime Environment (JRE)" Condition="'$(JavaDetectExitCode)' != 0 And '$(RequireJava)' == 'true'" />
<Message Text="Failed to detect Java Runtime Environment (JRE). Skipping Java client build." Importance="high" Condition="'$(JavaDetectExitCode)' != 0 And '$(RequireJava)' != 'true'" />
<Message Text="Successfully detected Java Runtime Environment (JRE)" Importance="high" Condition="'$(JavaDetectExitCode)' == 0" />
<!-- The build could still fail if the JDK isn't installed, but we can't reliably detect that without a bunch more code -->
<PropertyGroup Condition="'$(JavaDetectExitCode)' == '0'">
<HaveJava>true</HaveJava>
</PropertyGroup>
</Target>
<PropertyGroup>
<CompileDependsOn>Restore;BuildNPMPackages;$(CompileDependsOn);BuildJavaClient</CompileDependsOn>
</PropertyGroup>
@ -118,7 +121,7 @@
<Exec Command="npm run build" WorkingDirectory="$(RepositoryRoot)clients/ts/FunctionalTests" IgnoreStandardErrorWarningFormat="true" />
</Target>
<Target Name="BuildJavaClient" Condition="'$(HasJdk)' == 'true' AND '$(SkipJavaClient)' != 'true' " DependsOnTargets="GetJavaArtifactInfo">
<Target Name="BuildJavaClient" Condition="'$(HaveJava)' == 'true' AND '$(SkipJavaClient)' != 'true' " DependsOnTargets="GetJavaArtifactInfo">
<Message Text="Building Java client" Importance="high" />
<Message Text="> gradlew $(GradleOptions) compileJava" Importance="high" />
<Exec Command="./gradlew $(GradleOptions) compileJava" WorkingDirectory="$(RepositoryRoot)clients/java/signalr" />
@ -143,7 +146,7 @@
<JavaBuildFiles Include="@(Jars);@(PomFile)"/>
</ItemGroup>
<Target Name="PackJavaClient" Condition="'$(HasJdk)' == 'true' AND '$(SkipJavaClient)' != 'true' ">
<Target Name="PackJavaClient" Condition="'$(HaveJava)' == 'true' AND '$(SkipJavaClient)' != 'true' ">
<Message Text="Packing Java client" Importance="high" />
<Message Text="> gradlew $(GradleOptions) createPackage" Importance="high" />
<Exec Command="./gradlew $(GradleOptions) createPackage" WorkingDirectory="$(RepositoryRoot)clients/java/signalr" />

View File

@ -39,7 +39,7 @@
"build:lint": "node ../common/node_modules/tslint/bin/tslint -c ../tslint.json -p ./tsconfig.json",
"build:webpack": "node ../common/node_modules/webpack-cli/bin/cli.js",
"build:parent": "cd .. && npm run build",
"pretest": "npm run build:parent && npm run build && dotnet build",
"pretest": "npm run build:parent && npm run build && dotnet build --no-restore",
"test": "npm run test:local --",
"test:inner": "npm run build && dotnet build && npm run test:local --",
"test:local": "ts-node --project ./scripts/tsconfig.json ./scripts/run-tests.ts",

View File

@ -56,7 +56,9 @@ try {
customLaunchers: {
ChromeHeadlessNoSandbox: {
base: 'ChromeHeadless',
flags: ['--no-sandbox']
// ChromeHeadless runs about 10x slower on Windows 7 machines without the --proxy switches below. Why? ¯\_(ツ)_/¯
flags: ["--no-sandbox", "--proxy-server='direct://'", "--proxy-bypass-list=*"]
}
},
});