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