11apply plugin : ' java'
22
33group ' com.codebrig'
4- version ' 0.1.1 '
4+ version ' 0.2.16 '
55
66sourceCompatibility = 1.8
7-
87archivesBaseName = ' journey-browser'
98
109ext {
11- jcefVersion = ' 73.1.11.215'
12- jcefCommit = ' d348788e3347fa4d2a421773463f7dd62da60991'
10+ projectUrl = ' https://github.com/CodeBrig/Journey'
11+
12+ jcefVersion = [
13+ ' 67' : ' 67.0.3396.62' ,
14+ ' 69' : ' 69.0.3497.100' ,
15+ ' 73' : ' 73.1.11.215'
16+ ]
17+ jcefCommit = [
18+ ' 67' : ' 1fda5d8f948670d08ef86bc4e8637b8581995ce9' ,
19+ ' 69' : ' 235e3a844380b72761643324e1d9b7713cae3b63' ,
20+ ' 73' : ' d348788e3347fa4d2a421773463f7dd62da60991'
21+ ]
1322}
1423
1524repositories {
1625 mavenCentral()
26+ repositories {
27+ maven { url ' https://jitpack.io' }
28+ }
1729}
1830
1931dependencies {
@@ -22,21 +34,25 @@ dependencies {
2234 compile fileTree(dir : ' jcef/binary_distrib/linux64/bin/' , include : ' *.jar' )
2335 compile fileTree(dir : ' jcef/binary_distrib/win32/bin/' , include : ' *.jar' )
2436 compile fileTree(dir : ' jcef/binary_distrib/win64/bin/' , include : ' *.jar' )
37+ compile fileTree(dir : ' jcef/jcef_build/native/Release' , include : ' *.jar' )
38+ compileOnly ' com.github.bfergerson:joor:9933e481b0'
2539}
2640
2741task createProperties (dependsOn : processResources) {
2842 doLast {
2943 def mode = " online"
30- if ((System . getenv(" TRAVIS_BRANCH" ) != null && System . getenv(" TRAVIS_BRANCH" ). contains(" offline" )) ||
31- System . getenv(" VERSION" ) != null && System . getenv(" VERSION" ). contains(" offline" )) {
32- mode = " offline"
44+ if (System . getenv(" TRAVIS_BRANCH" ) != null && System . getenv(" TRAVIS_BRANCH" ). split(" -" ). length == 3 ) {
45+ mode = System . getenv(" TRAVIS_BRANCH" ). split(" -" )[2 ]
46+ } else if (System . getenv(" VERSION" ) != null && System . getenv(" VERSION" ). split(" -" ). length == 3 ) {
47+ mode = System . getenv(" VERSION" ). split(" -" )[2 ]
3348 }
49+
3450 new File (" $buildDir /resources/main/journey_build.properties" ). withWriter { w ->
3551 Properties p = new Properties ()
3652 p[' version' ] = project. version. toString()
37- p[' jcef_version' ] = project. jcefVersion. toString()
3853 p[' build_date' ] = new Date (). toInstant(). toString()
3954 p[' mode' ] = mode
55+ p[' project_url' ] = project. projectUrl. toString()
4056 p. store w, null
4157 }
4258 }
@@ -49,18 +65,25 @@ jar {
4965 dependsOn " initEnvironment"
5066
5167 from {
52- configurations. compile . collect { it. isDirectory() ? it : zipTree(it) }
68+ ( configurations. compileOnly) . collect { it. isDirectory() ? it : zipTree(it) }
5369 }
5470}
5571
5672task initEnvironment {
73+ def chromiumMajorVersion = " 73"
74+ if (System . getenv(" TRAVIS_BRANCH" ) != null && System . getenv(" TRAVIS_BRANCH" ). split(" -" ). length == 3 ) {
75+ chromiumMajorVersion = System . getenv(" TRAVIS_BRANCH" ). split(" -" )[1 ]
76+ } else if (System . getenv(" VERSION" ) != null && System . getenv(" VERSION" ). split(" -" ). length == 3 ) {
77+ chromiumMajorVersion = System . getenv(" VERSION" ). split(" -" )[1 ]
78+ }
79+
5780 if (System . getenv(' JITPACK' ) == " true" ||
5881 (((System . getenv(" TRAVIS_BRANCH" ) != null && System . getenv(" TRAVIS_BRANCH" ). contains(" offline" )) ||
5982 (System . getenv(" VERSION" ) != null && System . getenv(" VERSION" ). contains(" offline" ))))) {
6083 println " Downloading JCEF distribution"
6184 def f = new File (" jcef/binary_distrib" , " jcef-distrib-linux64.zip" )
6285 f. getParentFile(). mkdirs()
63- new URL (" https://github.com/CodeBrig/Journey/ releases/download/" + project. version + " -online /jcef-distrib-linux64.zip" )
86+ new URL (project . projectUrl + " / releases/download/" + project. version + " -$c hromiumMajorVersion -assets /jcef-distrib-linux64.zip" )
6487 .withInputStream { i -> f. withOutputStream { it << i } }
6588 println " Successfully downloaded JCEF distribution"
6689
@@ -72,26 +95,31 @@ task initEnvironment {
7295 (System . getenv(" VERSION" ) != null && System . getenv(" VERSION" ). contains(" offline" ))) {
7396 def linuxBuild = new File (' natives/jcef-distrib-linux64.zip' )
7497 linuxBuild. getParentFile(). mkdirs()
98+ def macintoshBuild = new File (' natives/jcef-distrib-macintosh64.zip' )
7599 def windows32Build = new File (' natives/jcef-distrib-windows32.zip' )
76100 def windows64Build = new File (' natives/jcef-distrib-windows64.zip' )
77101
78102 println " Downloading CEF natives files for offline distribution"
79- new URL (" https://github.com/CodeBrig/Journey/ releases/download/" + project. version + " -online /jcef-distrib-linux64.zip" )
103+ new URL (project . projectUrl + " / releases/download/" + project. version + " -$c hromiumMajorVersion -assets /jcef-distrib-linux64.zip" )
80104 .withInputStream { i -> linuxBuild. withOutputStream { it << i } }
81- new URL (" https://github.com/CodeBrig/Journey/releases/download/" + project. version + " -online/jcef-distrib-windows32.zip" )
105+ new URL (project. projectUrl + " /releases/download/" + project. version + " -$chromiumMajorVersion -assets/jcef-distrib-macintosh64.zip" )
106+ .withInputStream { i -> macintoshBuild. withOutputStream { it << i } }
107+ new URL (project. projectUrl + " /releases/download/" + project. version + " -$chromiumMajorVersion -assets/jcef-distrib-windows32.zip" )
82108 .withInputStream { i -> windows32Build. withOutputStream { it << i } }
83- new URL (" https://github.com/CodeBrig/Journey/ releases/download/" + project. version + " -online /jcef-distrib-windows64.zip" )
109+ new URL (project . projectUrl + " / releases/download/" + project. version + " -$c hromiumMajorVersion -assets /jcef-distrib-windows64.zip" )
84110 .withInputStream { i -> windows64Build. withOutputStream { it << i } }
85111 println " Successfully downloaded CEF natives files for offline distribution"
86112
87113 println " Unpacking CEF natives files for offline distribution"
88114 ant. unzip(src : linuxBuild. absolutePath, dest : linuxBuild. getParentFile(). absolutePath, overwrite : " true" )
115+ ant. unzip(src : macintoshBuild. absolutePath, dest : macintoshBuild. getParentFile(). absolutePath, overwrite : " true" )
89116 ant. unzip(src : windows32Build. absolutePath, dest : windows32Build. getParentFile(). absolutePath, overwrite : " true" )
90117 ant. unzip(src : windows64Build. absolutePath, dest : windows64Build. getParentFile(). absolutePath, overwrite : " true" )
91118 println " Successfully unpacked CEF natives files for offline distribution"
92119
93120 def resourcesDir = file(' src/main/resources' )
94121 new File (linuxBuild. getParentFile(), " linux64" ). renameTo(new File (resourcesDir, " linux64" ))
122+ new File (macintoshBuild. getParentFile(), " macosx64" ). renameTo(new File (resourcesDir, " macosx64" ))
95123 new File (windows32Build. getParentFile(), " win32" ). renameTo(new File (resourcesDir, " win32" ))
96124 new File (windows64Build. getParentFile(), " win64" ). renameTo(new File (resourcesDir, " win64" ))
97125 }
@@ -101,7 +129,29 @@ task initEnvironment {
101129task patchJCEF {
102130 doFirst {
103131 // https://bitbucket.org/chromiumembedded/java-cef/issues/317
132+ println " Patching java-cef#317"
104133 def cefAppFile = file(' jcef/java/org/cef/CefApp.java' )
105134 cefAppFile. text = cefAppFile. text. replace(' System.loadLibrary("jawt");' , file(' patches/jcef-317.txt' ). text)
135+
136+ if (System . getenv(" TRAVIS_OS_NAME" ) == " osx" ) {
137+ // https://bitbucket.org/chromiumembedded/java-cef/issues/270
138+ println " Patching java-cef#270"
139+ def cefBrowserWindowMacFile = file(' jcef/java/org/cef/browser/mac/CefBrowserWindowMac.java' )
140+ cefBrowserWindowMacFile. text = file(' patches/jcef-270.txt' ). text
141+ }
106142 }
107- }
143+ }
144+
145+ task checkoutJCEF {
146+ doFirst {
147+ def chromiumMajorVersion = " 73"
148+ if (System . getenv(" TRAVIS_BRANCH" ) != null && System . getenv(" TRAVIS_BRANCH" ). split(" -" ). length == 3 ) {
149+ chromiumMajorVersion = System . getenv(" TRAVIS_BRANCH" ). split(" -" )[1 ]
150+ } else if (System . getenv(" VERSION" ) != null && System . getenv(" VERSION" ). split(" -" ). length == 3 ) {
151+ chromiumMajorVersion = System . getenv(" VERSION" ). split(" -" )[1 ]
152+ }
153+
154+ def p = (" git checkout " + jcefCommit[chromiumMajorVersion]). execute(null , new File (" jcef" ). absoluteFile)
155+ p. waitFor()
156+ }
157+ }
0 commit comments