Project

Profile

Help

Revision 2aae7c21

Added by Norman Tovey-Walsh 9 months ago

Attempt to build the correct API XML when using Mono compiler

View differences:

build-n.gradle
21 21
  }
22 22
}
23 23

  
24
// Only the mono version of the C# compiler produces the correct
25
// documentation XML. ¯\_(ツ)_/¯
26
def monoCSharpCompiler = csharpCompiler
24 27
def ikvmExecutable = ["${ikvmDir}/ikvm-${ikvmVersion}/bin/ikvmc.exe"]
25 28
if (mono != null) {
26 29
  ikvmExecutable = [mono, "${ikvmDir}/ikvm-${ikvmVersion}/bin/ikvmc.exe"]
27 30
  csharpCompiler = [mono, "${monoFramework}/lib/mono/4.5/csc.exe"]
31
  monoCSharpCompiler = [mono, "${monoFramework}/lib/mono/4.5/mcs.exe"]
28 32
}
29 33

  
30 34
def additionalIkvmOptions = []
......
190 194

  
191 195
task hen_preprocess(
192 196
  type: JavaExec,
193
  dependsOn: ["hen_setupPreprocess"],
197
  dependsOn: ["hen_setupPreprocess", "record_branch"],
194 198
  description: "Preprocess HE sources"
195 199
) {
196 200
  inputs.files fileTree(dir: "${buildDir}/filtered/hen")
......
208 212

  
209 213
task pen_preprocess(
210 214
  type: JavaExec,
211
  dependsOn: ["pen_setupPreprocess"],
215
  dependsOn: ["pen_setupPreprocess", "record_branch"],
212 216
  description: "Preprocess PE sources"
213 217
) {
214 218
  inputs.files fileTree(dir: "${buildDir}/filtered/pen")
......
226 230

  
227 231
task een_preprocess(
228 232
  type: JavaExec,
229
  dependsOn: ["een_setupPreprocess"],
233
  dependsOn: ["een_setupPreprocess", "record_branch"],
230 234
  description: "Preprocess EE sources"
231 235
) {
232 236
  inputs.files fileTree(dir: "${buildDir}/filtered/een")
......
531 535
    from "${ikvmDir}/ikvm-${ikvmVersion}/bin"
532 536
    into "${buildDir}/n/bin/${release}"
533 537
    include "IKVM.OpenJDK.Core.dll"
538
    include "IKVM.OpenJDK.Localedata.dll"
534 539
    include "IKVM.OpenJDK.Charsets.dll"
535 540
    include "IKVM.OpenJDK.Text.dll"
536 541
    include "IKVM.OpenJDK.Util.dll"
......
962 967
    }
963 968
  }
964 969

  
965
  task een_csharpApi(
966
    dependsOn: ["eenDll"],
967
    description: "Compile Saxon.Api for EE"
968
  ) {
969
    inputs.files("${buildDir}/n/build/dll/ee")
970
    inputs.files("${buildDir}/n/csharp/api")
971
    outputs.file("${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll")
972

  
973
    doLast {
974
      def args = csharpCompiler \
975
      + ["-out:${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll",
976
         "-target:library",
977
         "-doc:${buildDir}/n/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.xml",
978
         "-keyfile:${ikvmDir}/saxondotnet.snk"]
979
      fileTree(dir: "${buildDir}/n/bin/ee",
980
               include: "*.dll").each { dll ->
981
        args += ["-reference:${dll}"]
970
  if (csharpCompiler == monoCSharpCompiler) {
971
    task een_csharpApi(
972
      dependsOn: ["eenDll"],
973
      description: "Compile Saxon.Api for EE"
974
    ) {
975
      inputs.files("${buildDir}/n/build/dll/ee")
976
      inputs.files("${buildDir}/n/csharp/api")
977
      outputs.file("${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll")
978

  
979
      doFirst {
980
        println("********************************************************************")
981
        println("Warning: this task will not generate useful documentation API XML.")
982
        println("You must use the Mono/mcs compiler to get useful documentation.")
983
        println("********************************************************************")
982 984
      }
983
      fileTree(dir: "${buildDir}/n/csharp/api/Saxon.Api",
984
               include: "**/*.cs").each { cs ->
985
        args += [cs]
985

  
986
      doLast {
987
        def args = csharpCompiler \
988
        + ["-out:${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll",
989
           "-target:library",
990
           "-doc:${buildDir}/n/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.xml",
991
           "-keyfile:${ikvmDir}/saxondotnet.snk"]
992
        fileTree(dir: "${buildDir}/n/bin/ee",
993
                 include: "*.dll").each { dll ->
994
          args += ["-reference:${dll}"]
995
        }
996
        fileTree(dir: "${buildDir}/n/csharp/api/Saxon.Api",
997
                 include: "**/*.cs").each { cs ->
998
          args += [cs]
999
        }
1000
        
1001
        exec {
1002
          commandLine args
1003
        }
986 1004
      }
1005
    }
1006
  } else {
1007
    task een_csharpApi(
1008
      dependsOn: ["eenDll", "hen_ApiAssemblyInfo"],
1009
      description: "Compile Saxon.Api for EE"
1010
    ) {
1011
      inputs.files("${buildDir}/n/build/dll/ee")
1012
      inputs.files("${buildDir}/n/csharp/api")
1013
      outputs.file("${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll")
1014

  
1015
      doLast {
1016
        def args = monoCSharpCompiler \
1017
        + ["/nologo",
1018
           "/debug+",
1019
           "-keyfile:${ikvmDir}/saxondotnet.snk",
1020
           "/optimize-",
1021
           "-out:${buildDir}/n/bin/ee/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.dll",
1022
           "/target:library",
1023
           "/nostdlib-",
1024
           "/warn:3",
1025
           "/doc:${buildDir}/n/saxon-ee-api-${saxonMajorVersion}.${saxonMinorVersion}.xml",
1026
           "/fullpaths"]
1027
        fileTree(dir: "${buildDir}/n/bin/ee",
1028
                 include: "*.dll").each { dll ->
1029
          if (!dll.toString().contains("saxon-ee-api")) {
1030
            args += ["-reference:${dll}"]
1031
          }
1032
        }
1033
        fileTree(dir: "${buildDir}/n/csharp/api/Saxon.Api",
1034
                 include: "**/*.cs").each { cs ->
1035
          args += [cs]
1036
        }
987 1037

  
988
      exec {
989
        commandLine args
1038
        exec {
1039
          commandLine args
1040
        }
990 1041
      }
991 1042
    }
992 1043
  }

Also available in: Unified diff