| @@ -1,126 +1,130 | |||||
| 1 | plugins { |
|
1 | plugins { | |
| 2 | id "org.implab.gradle-typescript" version "1.3.4" |
|
2 | id "org.implab.gradle-typescript" version "1.3.4" | |
| 3 | id "ivy-publish" |
|
3 | id "ivy-publish" | |
| 4 | } |
|
4 | } | |
| 5 |
|
5 | |||
| 6 | def container = "djx-playground" |
|
6 | def container = "djx-playground" | |
| 7 |
|
7 | |||
| 8 | configurations { |
|
8 | configurations { | |
| 9 | npmLocal |
|
9 | npmLocal | |
| 10 | } |
|
10 | } | |
| 11 |
|
11 | |||
| 12 | dependencies { |
|
12 | dependencies { | |
| 13 | npmLocal project(":djx") |
|
13 | npmLocal project(":djx") | |
| 14 | } |
|
14 | } | |
| 15 |
|
15 | |||
| 16 | def bundleDir = fileTree(layout.buildDirectory.dir("bundle")) { |
|
16 | def bundleDir = fileTree(layout.buildDirectory.dir("bundle")) { | |
| 17 | builtBy "bundle" |
|
17 | builtBy "bundle" | |
| 18 | } |
|
18 | } | |
| 19 |
|
19 | |||
| 20 | typescript { |
|
20 | typescript { | |
| 21 | compilerOptions { |
|
21 | compilerOptions { | |
| 22 | lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"] |
|
22 | lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable"] | |
| 23 | // listFiles = true |
|
23 | // listFiles = true | |
| 24 | strict = true |
|
24 | strict = true | |
| 25 | types = ["requirejs", "@implab/dojo-typings", "@implab/djx"] |
|
25 | types = ["requirejs", "@implab/dojo-typings", "@implab/djx"] | |
| 26 | module = "amd" |
|
26 | module = "amd" | |
| 27 | it.target = "es5" |
|
27 | it.target = "es5" | |
| 28 | experimentalDecorators = true |
|
28 | experimentalDecorators = true | |
| 29 | noUnusedLocals = false |
|
29 | noUnusedLocals = false | |
| 30 | jsx = "react" |
|
30 | jsx = "react" | |
| 31 | jsxFactory = "createElement" |
|
31 | jsxFactory = "createElement" | |
| 32 | moduleResolution = "node" |
|
32 | moduleResolution = "node" | |
| 33 | // dojo-typings are sick |
|
33 | // dojo-typings are sick | |
| 34 | skipLibCheck = true |
|
34 | skipLibCheck = true | |
| 35 | // traceResolution = true |
|
35 | // traceResolution = true | |
| 36 | // baseUrl = "./" |
|
36 | // baseUrl = "./" | |
| 37 | // paths = [ "*": [ "$projectDir/src/typings/*" ] ] |
|
37 | // paths = [ "*": [ "$projectDir/src/typings/*" ] ] | |
| 38 | // baseUrl = "$projectDir/src/typings" |
|
38 | // baseUrl = "$projectDir/src/typings" | |
| 39 | // typeRoots = ["$projectDir/src/typings"] |
|
39 | // typeRoots = ["$projectDir/src/typings"] | |
| 40 | } |
|
40 | } | |
| 41 | tscCmd = "$projectDir/node_modules/.bin/tsc" |
|
41 | tscCmd = "$projectDir/node_modules/.bin/tsc" | |
| 42 | tsLintCmd = "$projectDir/node_modules/.bin/tslint" |
|
42 | tsLintCmd = "$projectDir/node_modules/.bin/tslint" | |
| 43 | esLintCmd = "$projectDir/node_modules/.bin/eslint" |
|
43 | esLintCmd = "$projectDir/node_modules/.bin/eslint" | |
| 44 | } |
|
44 | } | |
| 45 |
|
45 | |||
| 46 | tasks.matching{ it.name =~ /^configureTs/ }.configureEach { |
|
46 | tasks.matching{ it.name =~ /^configureTs/ }.configureEach { | |
| 47 | compilerOptions { |
|
47 | compilerOptions { | |
| 48 | if (symbols != 'none') { |
|
48 | if (symbols != 'none') { | |
| 49 | sourceMap = true |
|
49 | sourceMap = true | |
| 50 | switch(symbols) { |
|
50 | switch(symbols) { | |
| 51 | case "local": |
|
51 | case "local": | |
| 52 | sourceRoot = ( isWindows ? "file:///" : "file://" ) + it.rootDir |
|
52 | sourceRoot = ( isWindows ? "file:///" : "file://" ) + it.rootDir | |
| 53 | break; |
|
53 | break; | |
| 54 | } |
|
54 | } | |
| 55 | } |
|
55 | } | |
| 56 | } |
|
56 | } | |
| 57 | } |
|
57 | } | |
| 58 |
|
58 | |||
| 59 | npmInstall { |
|
59 | npmInstall { | |
| 60 | //npmInstall.dependsOn it |
|
60 | //npmInstall.dependsOn it | |
| 61 | dependsOn configurations.npmLocal |
|
61 | dependsOn configurations.npmLocal | |
| 62 |
|
62 | |||
| 63 | doFirst { |
|
63 | doFirst { | |
| 64 | configurations.npmLocal.each { f -> |
|
64 | configurations.npmLocal.each { f -> | |
| 65 | exec { |
|
65 | exec { | |
| 66 | commandLine "npm", "install", f, "--save-dev" |
|
66 | commandLine "npm", "install", f, "--save-dev" | |
| 67 | } |
|
67 | } | |
| 68 | } |
|
68 | } | |
| 69 | } |
|
69 | } | |
| 70 | } |
|
70 | } | |
| 71 |
|
71 | |||
| 72 | clean { |
|
72 | clean { | |
| 73 | doFirst { |
|
73 | doFirst { | |
| 74 | delete "$buildDir/bundle" |
|
74 | delete "$buildDir/bundle" | |
| 75 | } |
|
75 | } | |
| 76 | } |
|
76 | } | |
| 77 |
|
77 | |||
| 78 |
|
78 | |||
| 79 | task processResourcesBundle(type: Copy) { |
|
79 | task processResourcesBundle(type: Copy) { | |
| 80 | from "src/bundle" |
|
80 | from "src/bundle" | |
| 81 | into layout.buildDirectory.dir("bundle") |
|
81 | into layout.buildDirectory.dir("bundle") | |
| 82 | } |
|
82 | } | |
| 83 |
|
83 | |||
| 84 | task copyModules(type: Copy) { |
|
84 | task copyModules(type: Copy) { | |
| 85 | dependsOn npmInstall |
|
85 | dependsOn npmInstall | |
| 86 | into layout.buildDirectory.dir("bundle/js"); |
|
86 | into layout.buildDirectory.dir("bundle/js"); | |
| 87 |
|
87 | |||
| 88 | def pack = { String jsmod -> |
|
88 | def pack = { String jsmod -> | |
| 89 | into(jsmod) { |
|
89 | into(jsmod) { | |
| 90 | from npm.module(jsmod) |
|
90 | from npm.module(jsmod) | |
| 91 | } |
|
91 | } | |
| 92 | } |
|
92 | } | |
| 93 |
|
93 | |||
| 94 |
|
94 | |||
| 95 | pack("@implab/djx") |
|
95 | pack("@implab/djx") | |
| 96 | pack("@implab/core-amd") |
|
96 | pack("@implab/core-amd") | |
| 97 | pack("dojo") |
|
97 | pack("dojo") | |
| 98 | pack("dijit") |
|
98 | pack("dijit") | |
| 99 | into("rxjs") { |
|
99 | into("rxjs") { | |
| 100 | from(npm.module("rxjs/dist/bundles")) |
|
100 | from(npm.module("rxjs/dist/bundles")) | |
| 101 | } |
|
101 | } | |
| 102 | from npm.module("requirejs/require.js") |
|
102 | from npm.module("requirejs/require.js") | |
| 103 | } |
|
103 | } | |
| 104 |
|
104 | |||
|
|
105 | npmPublish { | |||
|
|
106 | enabled = false | |||
|
|
107 | } | |||
|
|
108 | ||||
| 105 | task copyApp(type: Copy) { |
|
109 | task copyApp(type: Copy) { | |
| 106 | dependsOn assemble |
|
110 | dependsOn assemble | |
| 107 | from typescript.assemblyDir |
|
111 | from typescript.assemblyDir | |
| 108 | into layout.buildDirectory.dir("bundle/js/app") |
|
112 | into layout.buildDirectory.dir("bundle/js/app") | |
| 109 | } |
|
113 | } | |
| 110 |
|
114 | |||
| 111 | task bundle { |
|
115 | task bundle { | |
| 112 | dependsOn copyModules, processResourcesBundle, copyApp |
|
116 | dependsOn copyModules, processResourcesBundle, copyApp | |
| 113 | } |
|
117 | } | |
| 114 |
|
118 | |||
| 115 | task up(type: Exec) { |
|
119 | task up(type: Exec) { | |
| 116 | dependsOn bundle |
|
120 | dependsOn bundle | |
| 117 | commandLine "podman", "run", "--rm", "-d", |
|
121 | commandLine "podman", "run", "--rm", "-d", | |
| 118 | "--name", container, |
|
122 | "--name", container, | |
| 119 | "-p", "2078:80", |
|
123 | "-p", "2078:80", | |
| 120 | "-v", "$buildDir/bundle:/srv/www/htdocs", |
|
124 | "-v", "$buildDir/bundle:/srv/www/htdocs", | |
| 121 | "registry.implab.org/implab/apache2:latest" |
|
125 | "registry.implab.org/implab/apache2:latest" | |
| 122 | } |
|
126 | } | |
| 123 |
|
127 | |||
| 124 | task stop(type: Exec) { |
|
128 | task stop(type: Exec) { | |
| 125 | commandLine "podman", "stop", container |
|
129 | commandLine "podman", "stop", container | |
| 126 | } No newline at end of file |
|
130 | } | |
General Comments 0
You need to be logged in to leave comments.
Login now
