summaryrefslogtreecommitdiff
path: root/packages/gwt-chromium/build.gradle
blob: 3f4a46c74e86d8fad1802b4759a12a47a60f13a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//chrome nightly build, one of the last with npapi
final revision = '242519'
version "34-r${revision}-1"

final downloadChrome = makeDownloadTask(
    url: "http://gsdview.appspot.com/chromium-browser-continuous/Linux_x64/${revision}/chrome-linux.zip",
    sha256: '7269d35b51fb16ebd11af92cdaba933fb73f8984949952888e30fab63dc78df8')

task unpackChrome(type: Copy) {
  from zipTree(downloadChrome.dest)
  into file("${buildDir}/chromeLinuxUnpacked")
  eachFile { FileCopyDetails fcd ->
    // makes out of 06__ (_=don't care) 0655
    // means    rwx______ => rwxr-xr-x
    // or also  r-x______ => r-xr-xr-x
    def mode = fcd.mode >> 6
    fcd.mode = (mode << 6) | ((mode & 5) << 3) | mode & 5
  }
}
unpackChrome.dependsOn(downloadChrome)

final downloadGwtPlugin = makeDownloadTask(
    name: 'gwtPlugin',
    url: 'https://clients2.googleusercontent.com/crx/blobs/QgAAAC6zw0qH2DJtnXe8Z7rUJP3brylTnXsqSLH8EJLp' +
        'Cpq2560pdQWMapnnCQsWYAxwMN2Pa2mZkH4aA9in1i3WTJKG0OUyFhe7lScnMNxhS1yjAMZSmuVxRW6MIEDyZkO8bJcfTSNy6GZA2g/' +
        'extension_1_0_11357.crx',
    sha256: '5716f39ca4dadb47f571f65f631a00854487971f42ad24aa3a36a99e78d33134')

task unpackGwtPlugin() {
  inputs.file(downloadGwtPlugin.dest)
  ext.zip = file("${buildDir}/gwtPlugin.zip")
  ext.unpacked = file("${buildDir}/gwtPlugin")
  outputs.file(zip)
  outputs.dir(unpacked)
}
unpackGwtPlugin {}.dependsOn(downloadGwtPlugin)

unpackGwtPlugin.doLast {
  def fs = new FileOutputStream(zip)
  final bytes = inputs.files.first().readBytes()
  fs.write(bytes, 306, bytes.length - 306)
  fs.close()
  project.copy {
    from zipTree(zip)
    exclude '_metadata/**'
    into unpacked
  }
}

final downloadPdfPlugin = makeDownloadTask(
    name: 'pdfPlugin',
    url: 'https://clients2.googleusercontent.com/crx/blobs/QgAAAC6zw0qH2DJtnXe8Z7rUJP2i3UKpz0eTiopC2Qlk_FXWm-wYwG' +
        'N2MPtjDt7LaoCfAScKzPva1bZi2q-9pYXZOibTl1nwFns1ZGCCvKGnyPQ0AMZSmuVlD6-IvZI2Yaw8Sj800M072EC85w/' +
        'extension_1_1_527.crx',
    sha256: '5716f39ca4dadb47f571f65f631a00854487971f42ad24aa3a36a99e78d33134')


task unpackPdfPlugin() {
  inputs.file(downloadPdfPlugin.dest)
  ext.zip = file("${buildDir}/pdfPlugin.zip")
  ext.unpacked = file("${buildDir}/pdfPlugin")
  outputs.file(zip)
  outputs.dir(unpacked)
}
unpackPdfPlugin.dependsOn(downloadPdfPlugin)

unpackPdfPlugin.doLast {
  def fs = new FileOutputStream(zip)
  final bytes = inputs.files.first().readBytes()
  fs.write(bytes, 306, bytes.length - 306)
  fs.close()
  project.copy {
    from zipTree(zip)
    exclude '_metadata/**'
    into unpacked
  }
}

ospackage {
  into("/opt/${project.name}")
  from(unpackChrome.outputs.files) {
    exclude '**/en-US.pak'
  }
  from(fileTree(dir: 'resources/chrome-profile'))
  from('resources/rewrite-locale/output.pak') {
    into 'chrome-linux/locales'
    eachFile { FileCopyDetails fcd ->
      fcd.name = 'en-US.pak'
    }
  }
  from(unpackGwtPlugin.outputs.files) {
    into 'chrome-profile/Default/Extensions/hnmkfcicjochbbdloamlldphmhbbkenb'
  }
  from(unpackPdfPlugin.outputs.files) {
    into 'chrome-profile/Default/Extensions/oemmndcbldboiebfnladdacbdfmadadm'
  }
}

activator.bin['gwt-chrome-persistent'] = "/opt/${project.name}/bin/gwt-chrome-persistent"
activator.bin['gwt-chrome-volatile'] = "/opt/${project.name}/bin/gwt-chrome-volatile"