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

[build] JavacSourceVersion JavacTargetVersion Harmonization #4771

Merged
merged 1 commit into from
Jun 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
<MingwCommandPrefix32>i686-w64-mingw32</MingwCommandPrefix32>
<MingwCommandPrefix64>x86_64-w64-mingw32</MingwCommandPrefix64>
</PropertyGroup>
<PropertyGroup>
<JavacSourceVersion>1.8</JavacSourceVersion>
<JavacTargetVersion>1.8</JavacTargetVersion>
</PropertyGroup>
<PropertyGroup>
<AndroidMxeFullPath Condition=" '$(AndroidMxeInstallPrefix)' != '' ">$([System.IO.Path]::GetFullPath ('$(AndroidMxeInstallPrefix)'))</AndroidMxeFullPath>
<AndroidNdkFullPath>$([System.IO.Path]::GetFullPath ('$(AndroidNdkDirectory)'))</AndroidNdkFullPath>
Expand Down
6 changes: 1 addition & 5 deletions build-tools/scripts/Jar.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
<Target Name="_GetJavacVersions"
DependsOnTargets="AndroidPrepareForBuild">
<PropertyGroup>
<_JavacSourceVersion Condition="$(_JdkVersion.StartsWith ('9'))">1.8</_JavacSourceVersion>
<_JavacSourceVersion Condition=" '$(_JavacSourceVersion)' == '' ">1.5</_JavacSourceVersion>
<_JavacTargetVersion Condition="$(_JdkVersion.StartsWith ('9'))">1.8</_JavacTargetVersion>
<_JavacTargetVersion Condition=" '$(_JavacTargetVersion)' == '' ">1.6</_JavacTargetVersion>
<JarPath Condition=" '$(JarPath)' == '' ">$(JavaSdkDirectory)\bin\jar</JarPath>
<JavaCPath Condition=" '$(JavaCPath)' == '' ">$(JavaSdkDirectory)\bin\javac</JavaCPath>
</PropertyGroup>
Expand Down Expand Up @@ -35,7 +31,7 @@
<PropertyGroup>
<_Javac>"$(JavaCPath)"</_Javac>
<_Jar>"$(JarPath)"</_Jar>
<_Targets>-source $(_JavacSourceVersion) -target $(_JavacTargetVersion)</_Targets>
<_Targets>-source $(JavacSourceVersion) -target $(JavacTargetVersion)</_Targets>
<_DestDir>$(IntermediateOutputPath)__CreateTestJarFile-bin</_DestDir>
<_AndroidJar>-bootclasspath "$(AndroidSdkDirectory)\platforms\android-$(_AndroidApiLevelName)\android.jar"</_AndroidJar>
<_CP>-cp "$(_JavaInteropJarPath)"</_CP>
Expand Down
2 changes: 1 addition & 1 deletion build-tools/scripts/JavaCallableWrappers.targets
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
Overwrite="True"
/>
<PropertyGroup>
<_Target>-source $(JavacSourceVersion) -target $(JavacSourceVersion)</_Target>
<_Target>-source $(JavacSourceVersion) -target $(JavacTargetVersion)</_Target>
<_D>-d "$(IntermediateOutputPath)jcw\bin"</_D>
<_AndroidJar>"$(AndroidToolchainDirectory)\sdk\platforms\android-$(AndroidPlatformId)\android.jar"</_AndroidJar>
<_MonoAndroidJar>$(OutputPath)mono.android.jar</_MonoAndroidJar>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
<BundleToolVersion Condition="'$(BundleToolVersion)' == ''">@BUNDLETOOL_VERSION@</BundleToolVersion>
<_XamarinAndroidMSBuildDirectory>$(MSBuildThisFileDirectory)</_XamarinAndroidMSBuildDirectory>

<JavacSourceVersion Condition=" '$(JavacSourceVersion)' == '' ">1.8</JavacSourceVersion>
<JavacTargetVersion Condition=" '$(JavacTargetVersion)' == '' ">1.8</JavacTargetVersion>

<!-- Enable nuget package conflict resolution -->
<ResolveAssemblyConflicts>true</ResolveAssemblyConflicts>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/java-runtime/java-runtime.targets
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
Overwrite="True"
/>
<PropertyGroup>
<_Target Condition="'$(JavacSourceVersion)' != ''">-source $(JavacSourceVersion) -target $(JavacSourceVersion)</_Target>
<_Target Condition="'$(JavacSourceVersion)' != ''">-source $(JavacSourceVersion) -target $(JavacTargetVersion)</_Target>
<_AndroidJar>"$(AndroidToolchainDirectory)\sdk\platforms\android-$(AndroidFirstPlatformId)\android.jar"</_AndroidJar>
</PropertyGroup>
<Exec
Expand Down
8 changes: 8 additions & 0 deletions src/manifestmerger/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ plugins {
id 'java-library'
}

java {
ext.javaSourceVer = project.hasProperty('javaSourceVer') ? JavaVersion.toVersion(project.getProperty('javaSourceVer')) : JavaVersion.VERSION_1_8
ext.javaTargetVer = project.hasProperty('javaTargetVer') ? JavaVersion.toVersion(project.getProperty('javaTargetVer')) : JavaVersion.VERSION_1_8

sourceCompatibility = ext.javaSourceVer
targetCompatibility = ext.javaTargetVer
}

repositories {
maven { url 'https://maven.google.com' }
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion src/manifestmerger/manifestmerger.targets
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
Inputs="$(MSBuildThisFile);build.gradle"
Outputs="$(_Destination)">
<Exec
Command="&quot;$(GradleWPath)&quot; build $(GradleArgs)"
Command="&quot;$(GradleWPath)&quot; build $(GradleArgs) -PjavaSourceVer=$(JavacSourceVersion) -PjavaTargetVer=$(JavacTargetVersion)"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
Expand Down
8 changes: 8 additions & 0 deletions src/r8/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
apply plugin: 'java'
apply plugin: 'idea'

java {
ext.javaSourceVer = project.hasProperty('javaSourceVer') ? JavaVersion.toVersion(project.getProperty('javaSourceVer')) : JavaVersion.VERSION_1_8
ext.javaTargetVer = project.hasProperty('javaTargetVer') ? JavaVersion.toVersion(project.getProperty('javaTargetVer')) : JavaVersion.VERSION_1_8

sourceCompatibility = ext.javaSourceVer
targetCompatibility = ext.javaTargetVer
}

// See: https://r8.googlesource.com/r8/+/refs/tags/1.6.82/build.gradle#55
repositories {
maven {
Expand Down
2 changes: 1 addition & 1 deletion src/r8/r8.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
Inputs="$(MSBuildThisFile);build.gradle"
Outputs="$(_Destination)">
<Exec
Command="&quot;$(GradleWPath)&quot; jar $(GradleArgs)"
Command="&quot;$(GradleWPath)&quot; jar $(GradleArgs) -PjavaSourceVer=$(JavacSourceVersion) -PjavaTargetVer=$(JavacTargetVersion)"
EnvironmentVariables="JAVA_HOME=$(JavaSdkDirectory);APP_HOME=$(GradleHome)"
WorkingDirectory="$(MSBuildThisFileDirectory)"
/>
Expand Down