Project

Profile

Help

Revision 52584944

Added by Norman Tovey-Walsh 6 months ago

Build script tweaks for mirror repositories

View differences:

BUILD.md
1
# Building Saxon HE, PE, and EE
2

  
3
The Saxon family of products  is built with Gradle.
4

  
5
## Prerequisites
6

  
7
* A Java environment suitable for running Gradle.
8

  
9
## Environment variables
10

  
11
Some prerequisites for building and/or testing are outside the scope
12
of the build. Environment variables are used to configure access to
13
these items.
14

  
15
* `SAXON_LICENSE_DIR`: The directory that contains your Saxon EE license.
16
* `W3C_QT3_TEST_SUITE_DIR`: The directory that contains your local
17
  clone of the [W3C QT3 test suite repository](https://github.com/w3c/qt3tests).
18
* `W3C_XSLT30_TEST_SUITE_DIR`: The directory that contains your local
19
  clone of the W3C [XSLT 3.0 test suite repository](https://github.com/w3c/xslt30-test).
20
* `W3C_XSD_TEST_SUITE_DIR`: The directory that contains your local
21
  clone of the W3C [XSD test suite repository](https://github.com/w3c/xsdtests).
22

  
23
## Gradle properties
24

  
25
T.B.D.
26

  
27
## Running the build
28

  
29
This build uses the Gradle wrapper to ensure portability across different systems.
30

  
31
If you run the build scripts with `~/.gradlew`, you will be using the
32
version and configuration of Gradle that is known to work. (Other
33
versions may also work, but then again, they may not.)
34

  
35
These build scripts are shared across the open source HE repository,
36
the commercial EE/PE repository, and an internal repository that is
37
used for both current and future development.
38

  
39
In the open source HE repository, only the HE product can be built.
40
There are build targets for PE and EE artifacts, but they will not,
41
and are not expected to, succeed.
42

  
43
## T.B.D.
44

  
45
## Build outputs
46

  
47
All of the task outputs are written to files and directories under the
48
`build` directory. Although it shouldn’t be necessary, it is always
49
safe to completely delete the build directory before executing a task.
50
This ensures that _everything_ necessary to execute the task will be
51
rebuilt from the current sources.
build-n.gradle
1100 1100
  into "${buildDir}/n/bin/ee"
1101 1101
}
1102 1102

  
1103
task dotNetProducts(
1104
  dependsOn: ["henProduct", "penProduct", "eenProduct"],
1105
  description: "Builds all of the .NET products"
1106
) {
1107
  // nop
1108
}
1103
if (file("${projectDir}/src/main/java/com").exists()) {
1104
  task dotNetProducts(
1105
    dependsOn: ["henProduct", "penProduct", "eenProduct"],
1106
    description: "Builds all of the .NET products"
1107
  ) {
1108
    // nop
1109
  }
1109 1110

  
1110
task dotNetInstallers(
1111
  dependsOn: ["henInstaller", "penInstaller", "eenInstaller"],
1112
  description: "Builds all of the .NET installers"
1113
) {
1114
  // nop
1111
  task dotNetInstallers(
1112
    dependsOn: ["henInstaller", "penInstaller", "eenInstaller"],
1113
    description: "Builds all of the .NET installers"
1114
  ) {
1115
    // nop
1116
  }
1117
} else {
1118
  // Ignore the EEJ and PEJ releases if the sources aren't available
1119
  task dotNetProducts(
1120
    dependsOn: ["henProduct"],
1121
    description: "Builds all of the .NET products"
1122
  ) {
1123
    // nop
1124
  }
1125

  
1126
  task dotNetInstallers(
1127
    dependsOn: ["henInstaller"],
1128
    description: "Builds all of the .NET installers"
1129
  ) {
1130
    // nop
1131
  }
1115 1132
}
1133

  
1134

  
build.gradle
800 800
  commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
801 801
  standardOutput = recordBranch
802 802
  doLast {
803
    def output = new FileWriter(new File("build/built-branch"))
803
    def output = new FileWriter(new File("${buildDir}/built-branch"))
804 804
    output.write(recordBranch.toString("utf-8"))
805 805
    output.close()
806 806
  }
807
  doFirst {
808
    mkdir(buildDir)
809
  }
807 810
}
808 811

  
809 812
task hejCompile(
......
1365 1368
  }
1366 1369
}
1367 1370

  
1368
task javaReleases(
1369
  dependsOn: ["hejRelease", "pejRelease", "eejRelease"],
1370
  description: "Build all of the Java releases"
1371
) {
1372
  // Just a container to hang dependencies on
1373
}
1374

  
1375
// ============================================================
1376

  
1377
task dockerCoreContainer(
1378
  type: Exec,
1379
  description: "Build the CentOS 8 core container"
1380
) {
1381
  inputs.files("${projectDir}/src/docker/centos8-core")
1382
  commandLine "docker", "build",
1383
    "-t", "${dockerCentos8Core}",
1384
    "${projectDir}/src/docker/centos8-core"
1385
}
1386

  
1387
// In order to build this container, you must specify the location
1388
// of the JDK and the Jet software archive. Use
1389
// -PdockerJdk= to specify the location of the JDK RPM. Use
1390
// -PdockerJet= to specify the location of the Jet archive.
1391
task dockerBuilderContainer(
1392
  type: Exec,
1393
  dependsOn: ["docker_setupBuilder", "dockerCoreContainer"],
1394
  description: "Build the Saxonica builder container"
1395
) {
1396
  inputs.files("${buildDir}/docker/builder")
1397
  commandLine "docker", "build",
1398
    "-t", "${dockerBuildContainer}",
1399
    "${buildDir}/docker/builder"
1400
}
1401

  
1402
task docker_setupBuilder(
1403
  type: Copy,
1404
  dependsOn: ["docker_setupJdk", "docker_setupJet"],
1405
  description: "Setup to build the builder container"
1406
) {
1407
  from "src/docker/builder"
1408
  into "${buildDir}/docker/builder"
1409
}
1410

  
1411
task docker_testJdk(
1412
  description: "Test that the dockerJdk property has been specified"
1413
) {
1414
  doLast {
1415
    if (dockerJdk == "none") {
1416
      throw new GradleException("You must specify the JDK with -PdockerJdk=...")
1417
    }
1371
if (file("${projectDir}/src/main/java/com").exists()) {
1372
  task javaReleases(
1373
    dependsOn: ["hejRelease", "pejRelease", "eejRelease"],
1374
    description: "Build all of the Java releases"
1375
  ) {
1376
    // Just a container to hang dependencies on
1418 1377
  }
1419
}
1420

  
1421
task docker_setupJdk(
1422
  type: Copy,
1423
  dependsOn: ["docker_testJdk"],
1424
  description: "Setup the JDK for the builder container"
1425
) {
1426
  from dockerJdk
1427
  into "${buildDir}/docker/builder"
1428
}
1429

  
1430
task docker_testJet(
1431
  description: "Test that the dockerJet property has been specified"
1432
) {
1433
  doLast {
1434
    if (dockerJet == "none") {
1435
      throw new GradleException("You must specify Jet archive with -PdockerJet=...")
1436
    }
1378
} else {
1379
  // Ignore the EEJ and PEJ releases if the sources aren't available
1380
  task javaReleases(
1381
    dependsOn: ["hejRelease"],
1382
    description: "Build all of the Java releases"
1383
  ) {
1384
    // Just a container to hang dependencies on
1437 1385
  }
1438 1386
}
1439 1387

  
1440
task docker_setupJet(
1441
  type: Copy,
1442
  dependsOn: ["docker_testJet"],
1443
  description: "Setup the Jet archive for the builder container"
1444
) {
1445
  from dockerJet
1446
  into "${buildDir}/docker/builder"
1447
}
1448

  
1449 1388
// ============================================================
1450 1389

  
1451 1390
compileTestDrivers.dependsOn "${saxonEdition}j_compileTestDrivers"

Also available in: Unified diff