##// END OF EJS Templates
wip migrating on new typescript build plugin
cin -
r174:b00d3153045c default
parent child
Show More
@@ -1,28 +1,28
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <projectDescription>
2 <projectDescription>
3 <name>core</name>
3 <name>core</name>
4 <comment>Project implabjs-core created by Buildship.</comment>
4 <comment>Project implabjs-core created by Buildship.</comment>
5 <projects>
5 <projects>
6 </projects>
6 </projects>
7 <buildSpec>
7 <buildSpec>
8 <buildCommand>
8 <buildCommand>
9 <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
9 <name>org.eclipse.buildship.core.gradleprojectbuilder</name>
10 <arguments>
10 <arguments>
11 </arguments>
11 </arguments>
12 </buildCommand>
12 </buildCommand>
13 </buildSpec>
13 </buildSpec>
14 <natures>
14 <natures>
15 <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
15 <nature>org.eclipse.buildship.core.gradleprojectnature</nature>
16 </natures>
16 </natures>
17 <filteredResources>
17 <filteredResources>
18 <filter>
18 <filter>
19 <id>1599549685358</id>
19 <id>1678653378261</id>
20 <name></name>
20 <name></name>
21 <type>30</type>
21 <type>30</type>
22 <matcher>
22 <matcher>
23 <id>org.eclipse.core.resources.regexFilterMatcher</id>
23 <id>org.eclipse.core.resources.regexFilterMatcher</id>
24 <arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
24 <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
25 </matcher>
25 </matcher>
26 </filter>
26 </filter>
27 </filteredResources>
27 </filteredResources>
28 </projectDescription>
28 </projectDescription>
@@ -1,13 +1,13
1 arguments=
1 arguments=--init-script /home/sergey/.config/Code/User/globalStorage/redhat.java/1.21.0/config_linux/org.eclipse.osgi/51/0/.cp/gradle/init/init.gradle --init-script /home/sergey/.config/Code/User/globalStorage/redhat.java/1.21.0/config_linux/org.eclipse.osgi/51/0/.cp/gradle/protobuf/init.gradle
2 auto.sync=false
2 auto.sync=false
3 build.scans.enabled=false
3 build.scans.enabled=false
4 connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
4 connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER)
5 connection.project.dir=
5 connection.project.dir=
6 eclipse.preferences.version=1
6 eclipse.preferences.version=1
7 gradle.user.home=
7 gradle.user.home=
8 java.home=/usr/lib64/jvm/java
8 java.home=/usr/lib64/jvm/java-11-openjdk-11
9 jvm.arguments=
9 jvm.arguments=
10 offline.mode=false
10 offline.mode=false
11 override.workspace.settings=true
11 override.workspace.settings=true
12 show.console.view=true
12 show.console.view=true
13 show.executions.view=true
13 show.executions.view=true
@@ -1,238 +1,111
1 plugins {
1 plugins {
2 id "org.implab.gradle-typescript" version "1.3.3"
2 id "org.implab.gradle-typescript"
3 id "org.implab.gradle-hg"
3 id "org.implab.gradle-npm-package"
4 id "ivy-publish"
4 id "ivy-publish"
5 }
5 }
6
6
7 if (!symbols in ['local', 'pack', 'none'])
7 typescript {
8 throw new Exception("The symbols property value is invalid: $symbols");
8 useTsc npm.bin("tsc")
9
10 if (!flavour in ['browser', 'node'])
11 throw new Exception("The flavour property value is invalid: $flavour");
12
13 ext {
14 packageName = flavour == 'browser' ? "@$npmScope/$name-amd" : "@$npmScope/$name"
15 lint = project.hasProperty('lint') ? project.lint ?: true : false
16 }
17
9
18 sources {
10 compilerOptions {
19 amd {
11 incremental = true
20 typings {
21 srcDir main.output.typingsDir
22 }
23 }
24
25 cjs {
26 typings {
27 srcDir main.output.typingsDir
28 }
29 }
30
31 testAmd {
32 typings {
33 srcDir main.output.typingsDir
34 srcDir amd.output.typingsDir
35 srcDir test.output.typingsDir
36 }
12 }
37 }
13 }
38
14
39 testCjs {
15 def typingsFromMain = {
40 typings {
16 sets {
41 srcDir main.output.typingsDir
17 named("compileOnlyTypings") {
42 srcDir cjs.output.typingsDir
18 srcDir main.output("typings")
43 srcDir test.output.typingsDir
44 }
45 }
46 }
47
48 typescript {
49 compilerOptions {
50 types = []
51 declaration = true
52 experimentalDecorators = true
53 strict = true
54 // dojo-typings are sick
55 skipLibCheck = true
56
57 if(symbols != 'none') {
58 sourceMap = true
59 sourceRoot = "pack:${packageName}"
60 }
61
62 if (flavour == 'node') {
63 module = "commonjs"
64 target = "es2017"
65 lib = ["es2017", "dom", "scripthost"]
66 } else if (flavour == 'browser') {
67 module = "amd"
68 target = "es5"
69 lib = ["es5", "dom", "scripthost", "es2015.promise", "es2015.symbol", "es2015.iterable" ]
70 }
71 }
72 tscCmd = "$projectDir/node_modules/.bin/tsc"
73 tsLintCmd = "$projectDir/node_modules/.bin/tslint"
74 esLintCmd = "$projectDir/node_modules/.bin/eslint"
75 }
76
77 tasks.matching{ it.name =~ /^lint/ }.configureEach {
78 onlyIf { lint }
79 }
80
81 if (symbols == 'local') {
82 tasks.matching{ it.name =~ /^configureTs/ }.configureEach {
83 compilerOptions {
84 sourceRoot = "file://" + it.rootDir
85 }
19 }
86 }
20 }
87 }
21 }
88
22
89 task printVersion {
23 variants {
90 doLast {
24 configureEach { variant ->
91 println "packageName: $packageName";
25 def sourceSetLocation = { setName, self ->
92 println "version: $version";
26 self.sourceSetDir = layout.projectDirectory.dir("src/${setName}")
93 println "flavour: $flavour";
27 self.outputsDir = layout.buildDirectory.dir("${variant.name}/${setName}")
94 println "target: $typescript.compilerOptions.target";
95 println "module: $typescript.compilerOptions.module";
96 println "lint: $lint";
97 println "symbols: $symbols";
98 }
99 }
28 }
100
29
101 npmPackMeta {
30 def main = sources.register("${variant.name}Main", sourceSetLocation.curry("main"))
102 meta {
31 def test = sources.register("${variant.name}Test", sourceSetLocation.curry("test"))
103 name = packageName
32
104 }
33 sourceSets {
34 add(main) {
35 role "main"
105 }
36 }
106
37 add(test) {
107 configureTsCjs {
38 role "test"
108 dependsOn sources.main.output
109 compilerOptions {
110 types += [ "node" ]
111 }
39 }
112 }
40 }
41 }
42 register("browser") {
43 def srcAmd = sources.register("amd", typingsFromMain)
44 def srcTestAmd = sources.register("testAmd", typingsFromMain)
113
45
114 configureTsAmd {
46 // advice to all TypescriptCompile tasks
115 dependsOn sources.main.output
47 typescriptCompile {
116 compilerOptions {
48 baseTsConfig = file("src/tsconfig.browser.json")
117 types += [ "requirejs", "dojo-typings" ]
118 }
119 }
49 }
120
50
121 test {
51 // creates npmPackBrowser, npmPublishBrowser
122 workingDir layout.buildDirectory.dir("test");
52 npmPackage {
123 commandLine "node", "tests/index.js"
53 usePackageJson()
54 metadata {
55 name = "@implab/core-amd"
124 }
56 }
125
57 content {
126 assemble {
58 from sourceSets.byRoles("main").allOutputs()
127 if (flavour == 'browser') {
128 dependsOn sources.amd.output
129 from sources.amd.output.compiledDir
130 from sources.amd.resources
131 }
132 if (flavour == 'node') {
133 dependsOn sources.cjs.output
134 from sources.cjs.output.compiledDir
135 from sources.cjs.resources
136 }
59 }
137 }
60 }
138
61
139 assembleTest {
62 sourceSets {
140 if (flavour == 'browser') {
63 add(srcAmd) {
141 dependsOn sources.amd.output, sources.testAmd.output
64 role "main"
142
143 from sources.amd.output.compiledDir
144 from sources.testAmd.output.compiledDir
145 from sources.amd.resources
146 from sources.testAmd.resources
147 }
65 }
148 if (flavour == 'node') {
66 add(srcTestAmd) {
149 dependsOn sources.cjs.output, sources.testCjs.output
67 role "test"
150
68 }
151 from sources.cjs.output.compiledDir
152 from sources.testCjs.output.compiledDir
153 from sources.cjs.resources
154 from sources.testCjs.resources
155 }
69 }
156 }
70 }
71 register("node") {
72 def srcCjs = sources.register("cjs", typingsFromMain)
73 def srcTestCjs = sources.register("testCjs", typingsFromMain)
157
74
158 typings {
75 compileTasks {
159 if (flavour == 'browser') {
76 baseTsConfig = file("src/tsconfig.node.json")
160 dependsOn sources.amd.output
161 from sources.amd.output.typingsDir
162 }
77 }
163 if (flavour == 'node') {
78
164 dependsOn sources.cjs.output
79 npmPackage {
165 from sources.cjs.output.typingsDir
80 name = "@implab/core"
81 }
82
83 sourceSets {
84 add srcAmd
85 add srcTestAmd
166 }
86 }
167 }
87 }
168
88
169 task npmPackTypings(type: Copy) {
89 npmPackage {
170 npmPackContents.dependsOn it
90 usePackageJson()
171 dependsOn sources.main.output
91 metadata {
172
92 name = "@implab/core"
173 from sources.main.output.typingsDir
93 version = project.provider { project.version.toString() }
174
175 if (flavour == 'browser') {
176 dependsOn sources.amd.output
177 from sources.amd.output.typingsDir
178 }
179 if (flavour == 'node') {
180 dependsOn sources.cjs.output
181 from sources.cjs.output.typingsDir
182 }
183
184 into npm.packageDir
185 }
186
187 task npmPackSources(type: Copy) {
188 from sources.main.ts
189 if (symbols == 'pack') {
190 npmPackContents.dependsOn npmPackSources
191 }
192
193 if (flavour == 'browser') {
194 from sources.amd.ts
195 }
94 }
196 if (flavour == 'node') {
197 from sources.cjs.ts
198 }
199
200 into npm.packageDir.dir("_src")
201 }
202
203
204
205 task packJsTar(type: Tar) {
206 dependsOn assemble;
207
208 archiveBaseName = provider { packageName }
209
210 destinationDirectory = buildDir
211 archiveClassifier = provider { typescript.compilerOptions.module }
212 compression = Compression.GZIP
213
214 from(assemble.outputs)
215
216 doLast {
217 println archiveName;
218 }
219 }
220
221 task packTypingsTar(type: Tar) {
222 }
95 }
223
96
224 publishing {
97 publishing {
225 publications {
98 publications {
226 local(IvyPublication) {
99 local(IvyPublication) {
227 artifact(packJsTar) {
100 artifact(packJsTar) {
228 type = "js"
101 type = "js"
229 }
102 }
230 }
103 }
231 }
104 }
232
105
233 repositories {
106 repositories {
234 ivy {
107 ivy {
235 url "ivy-repo"
108 url "ivy-repo"
236 }
109 }
237 }
110 }
238 } No newline at end of file
111 }
@@ -1,9 +1,6
1 group=org.implab
1 group=org.implab
2 version=
2 version=
3 author=Implab team
3
4 description=Dependency injection, logging, simple and fast text processing tools
4 org.gradle.parallel=true
5 license=BSD-2-Clause
5 org.gradle.configuration-cache.parallel=true
6 repository=https://bitbucket.org/implab/implabjs-core
6 org.gradle.configuration-cache=true No newline at end of file
7 npmScope=implab
8 flavour=browser
9 symbols=pack No newline at end of file
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,5 +1,7
1 distributionBase=GRADLE_USER_HOME
1 distributionBase=GRADLE_USER_HOME
2 distributionPath=wrapper/dists
2 distributionPath=wrapper/dists
3 distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip
3 distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-bin.zip
4 networkTimeout=10000
5 validateDistributionUrl=true
4 zipStoreBase=GRADLE_USER_HOME
6 zipStoreBase=GRADLE_USER_HOME
5 zipStorePath=wrapper/dists
7 zipStorePath=wrapper/dists
@@ -1,188 +1,248
1 #!/usr/bin/env sh
1 #!/bin/sh
2
2
3 #
3 #
4 # Copyright 2015 the original author or authors.
4 # Copyright Β© 2015 the original authors.
5 #
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
8 # You may obtain a copy of the License at
9 #
9 #
10 # https://www.apache.org/licenses/LICENSE-2.0
10 # https://www.apache.org/licenses/LICENSE-2.0
11 #
11 #
12 # Unless required by applicable law or agreed to in writing, software
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
16 # limitations under the License.
17 #
17 #
18 # SPDX-License-Identifier: Apache-2.0
19 #
18
20
19 ##############################################################################
21 ##############################################################################
20 ##
22 #
21 ## Gradle start up script for UN*X
23 # Gradle start up script for POSIX generated by Gradle.
22 ##
24 #
25 # Important for running:
26 #
27 # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 # noncompliant, but you have some other compliant shell such as ksh or
29 # bash, then to run this script, type that shell name before the whole
30 # command line, like:
31 #
32 # ksh Gradle
33 #
34 # Busybox and similar reduced shells will NOT work, because this script
35 # requires all of these POSIX shell features:
36 # * functions;
37 # * expansions Β«$varΒ», Β«${var}Β», Β«${var:-default}Β», Β«${var+SET}Β»,
38 # Β«${var#prefix}Β», Β«${var%suffix}Β», and Β«$( cmd )Β»;
39 # * compound commands having a testable exit status, especially Β«caseΒ»;
40 # * various built-in commands including Β«commandΒ», Β«setΒ», and Β«ulimitΒ».
41 #
42 # Important for patching:
43 #
44 # (2) This script targets any POSIX shell, so it avoids extensions provided
45 # by Bash, Ksh, etc; in particular arrays are avoided.
46 #
47 # The "traditional" practice of packing multiple parameters into a
48 # space-separated string is a well documented source of bugs and security
49 # problems, so this is (mostly) avoided, by progressively accumulating
50 # options in "$@", and eventually passing that to Java.
51 #
52 # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 # see the in-line comments for details.
55 #
56 # There are tweaks for specific operating systems such as AIX, CygWin,
57 # Darwin, MinGW, and NonStop.
58 #
59 # (3) This script is generated from the Groovy template
60 # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 # within the Gradle project.
62 #
63 # You can find Gradle at https://github.com/gradle/gradle/.
64 #
23 ##############################################################################
65 ##############################################################################
24
66
25 # Attempt to set APP_HOME
67 # Attempt to set APP_HOME
68
26 # Resolve links: $0 may be a link
69 # Resolve links: $0 may be a link
27 PRG="$0"
70 app_path=$0
28 # Need this for relative symlinks.
71
29 while [ -h "$PRG" ] ; do
72 # Need this for daisy-chained symlinks.
30 ls=`ls -ld "$PRG"`
73 while
31 link=`expr "$ls" : '.*-> \(.*\)$'`
74 APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
32 if expr "$link" : '/.*' > /dev/null; then
75 [ -h "$app_path" ]
33 PRG="$link"
76 do
34 else
77 ls=$( ls -ld "$app_path" )
35 PRG=`dirname "$PRG"`"/$link"
78 link=${ls#*' -> '}
36 fi
79 case $link in #(
80 /*) app_path=$link ;; #(
81 *) app_path=$APP_HOME$link ;;
82 esac
37 done
83 done
38 SAVED="`pwd`"
39 cd "`dirname \"$PRG\"`/" >/dev/null
40 APP_HOME="`pwd -P`"
41 cd "$SAVED" >/dev/null
42
84
43 APP_NAME="Gradle"
85 # This is normally unused
44 APP_BASE_NAME=`basename "$0"`
86 # shellcheck disable=SC2034
45
87 APP_BASE_NAME=${0##*/}
46 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
88 # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
47 DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
89 APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
48
90
49 # Use the maximum available, or set MAX_FD != -1 to use that value.
91 # Use the maximum available, or set MAX_FD != -1 to use that value.
50 MAX_FD="maximum"
92 MAX_FD=maximum
51
93
52 warn () {
94 warn () {
53 echo "$*"
95 echo "$*"
54 }
96 } >&2
55
97
56 die () {
98 die () {
57 echo
99 echo
58 echo "$*"
100 echo "$*"
59 echo
101 echo
60 exit 1
102 exit 1
61 }
103 } >&2
62
104
63 # OS specific support (must be 'true' or 'false').
105 # OS specific support (must be 'true' or 'false').
64 cygwin=false
106 cygwin=false
65 msys=false
107 msys=false
66 darwin=false
108 darwin=false
67 nonstop=false
109 nonstop=false
68 case "`uname`" in
110 case "$( uname )" in #(
69 CYGWIN* )
111 CYGWIN* ) cygwin=true ;; #(
70 cygwin=true
112 Darwin* ) darwin=true ;; #(
71 ;;
113 MSYS* | MINGW* ) msys=true ;; #(
72 Darwin* )
114 NONSTOP* ) nonstop=true ;;
73 darwin=true
74 ;;
75 MINGW* )
76 msys=true
77 ;;
78 NONSTOP* )
79 nonstop=true
80 ;;
81 esac
115 esac
82
116
83 CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
117
84
118
85 # Determine the Java command to use to start the JVM.
119 # Determine the Java command to use to start the JVM.
86 if [ -n "$JAVA_HOME" ] ; then
120 if [ -n "$JAVA_HOME" ] ; then
87 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
121 if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
88 # IBM's JDK on AIX uses strange locations for the executables
122 # IBM's JDK on AIX uses strange locations for the executables
89 JAVACMD="$JAVA_HOME/jre/sh/java"
123 JAVACMD=$JAVA_HOME/jre/sh/java
90 else
124 else
91 JAVACMD="$JAVA_HOME/bin/java"
125 JAVACMD=$JAVA_HOME/bin/java
92 fi
126 fi
93 if [ ! -x "$JAVACMD" ] ; then
127 if [ ! -x "$JAVACMD" ] ; then
94 die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
128 die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
95
129
96 Please set the JAVA_HOME variable in your environment to match the
130 Please set the JAVA_HOME variable in your environment to match the
97 location of your Java installation."
131 location of your Java installation."
98 fi
132 fi
99 else
133 else
100 JAVACMD="java"
134 JAVACMD=java
101 which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
135 if ! command -v java >/dev/null 2>&1
136 then
137 die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
102
138
103 Please set the JAVA_HOME variable in your environment to match the
139 Please set the JAVA_HOME variable in your environment to match the
104 location of your Java installation."
140 location of your Java installation."
105 fi
141 fi
106
107 # Increase the maximum file descriptors if we can.
108 if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
109 MAX_FD_LIMIT=`ulimit -H -n`
110 if [ $? -eq 0 ] ; then
111 if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
112 MAX_FD="$MAX_FD_LIMIT"
113 fi
114 ulimit -n $MAX_FD
115 if [ $? -ne 0 ] ; then
116 warn "Could not set maximum file descriptor limit: $MAX_FD"
117 fi
118 else
119 warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
120 fi
121 fi
122
123 # For Darwin, add options to specify how the application appears in the dock
124 if $darwin; then
125 GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
126 fi
142 fi
127
143
128 # For Cygwin or MSYS, switch paths to Windows format before running java
144 # Increase the maximum file descriptors if we can.
129 if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
145 if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
130 APP_HOME=`cygpath --path --mixed "$APP_HOME"`
146 case $MAX_FD in #(
131 CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
147 max*)
132 JAVACMD=`cygpath --unix "$JAVACMD"`
148 # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
133
149 # shellcheck disable=SC2039,SC3045
134 # We build the pattern for arguments to be converted via cygpath
150 MAX_FD=$( ulimit -H -n ) ||
135 ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
151 warn "Could not query maximum file descriptor limit"
136 SEP=""
152 esac
137 for dir in $ROOTDIRSRAW ; do
153 case $MAX_FD in #(
138 ROOTDIRS="$ROOTDIRS$SEP$dir"
154 '' | soft) :;; #(
139 SEP="|"
155 *)
140 done
156 # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
141 OURCYGPATTERN="(^($ROOTDIRS))"
157 # shellcheck disable=SC2039,SC3045
142 # Add a user-defined pattern to the cygpath arguments
158 ulimit -n "$MAX_FD" ||
143 if [ "$GRADLE_CYGPATTERN" != "" ] ; then
159 warn "Could not set maximum file descriptor limit to $MAX_FD"
144 OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
145 fi
146 # Now convert the arguments - kludge to limit ourselves to /bin/sh
147 i=0
148 for arg in "$@" ; do
149 CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
150 CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
151
152 if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
153 eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
154 else
155 eval `echo args$i`="\"$arg\""
156 fi
157 i=$((i+1))
158 done
159 case $i in
160 (0) set -- ;;
161 (1) set -- "$args0" ;;
162 (2) set -- "$args0" "$args1" ;;
163 (3) set -- "$args0" "$args1" "$args2" ;;
164 (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
165 (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
166 (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
167 (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
168 (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
169 (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
170 esac
160 esac
171 fi
161 fi
172
162
173 # Escape application args
163 # Collect all arguments for the java command, stacking in reverse order:
174 save () {
164 # * args from the command line
175 for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
165 # * the main class name
176 echo " "
166 # * -classpath
177 }
167 # * -D...appname settings
178 APP_ARGS=$(save "$@")
168 # * --module-path (only if needed)
169 # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
170
171 # For Cygwin or MSYS, switch paths to Windows format before running java
172 if "$cygwin" || "$msys" ; then
173 APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
174
175 JAVACMD=$( cygpath --unix "$JAVACMD" )
179
176
180 # Collect all arguments for the java command, following the shell quoting and substitution rules
177 # Now convert the arguments - kludge to limit ourselves to /bin/sh
181 eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
178 for arg do
182
179 if
183 # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
180 case $arg in #(
184 if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
181 -*) false ;; # don't mess with options #(
185 cd "$(dirname "$0")"
182 /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183 [ -e "$t" ] ;; #(
184 *) false ;;
185 esac
186 then
187 arg=$( cygpath --path --ignore --mixed "$arg" )
188 fi
189 # Roll the args list around exactly as many times as the number of
190 # args, so each arg winds up back in the position where it started, but
191 # possibly modified.
192 #
193 # NB: a `for` loop captures its iteration list before it begins, so
194 # changing the positional parameters here affects neither the number of
195 # iterations, nor the values presented in `arg`.
196 shift # remove old arg
197 set -- "$@" "$arg" # push replacement arg
198 done
186 fi
199 fi
187
200
201
202 # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203 DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204
205 # Collect all arguments for the java command:
206 # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207 # and any embedded shellness will be escaped.
208 # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209 # treated as '${Hostname}' itself on the command line.
210
211 set -- \
212 "-Dorg.gradle.appname=$APP_BASE_NAME" \
213 -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
214 "$@"
215
216 # Stop when "xargs" is not available.
217 if ! command -v xargs >/dev/null 2>&1
218 then
219 die "xargs is not available"
220 fi
221
222 # Use "xargs" to parse quoted args.
223 #
224 # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
225 #
226 # In Bash we could simply go:
227 #
228 # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
229 # set -- "${ARGS[@]}" "$@"
230 #
231 # but POSIX shell has neither arrays nor command substitution, so instead we
232 # post-process each arg (as a line of input to sed) to backslash-escape any
233 # character that might be a shell metacharacter, then use eval to reverse
234 # that process (while maintaining the separation between arguments), and wrap
235 # the whole thing up as a single "set" statement.
236 #
237 # This will of course break if any of these variables contains a newline or
238 # an unmatched quote.
239 #
240
241 eval "set -- $(
242 printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
243 xargs -n1 |
244 sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
245 tr '\n' ' '
246 )" '"$@"'
247
188 exec "$JAVACMD" "$@"
248 exec "$JAVACMD" "$@"
@@ -1,100 +1,93
1 @rem
1 @rem
2 @rem Copyright 2015 the original author or authors.
2 @rem Copyright 2015 the original author or authors.
3 @rem
3 @rem
4 @rem Licensed under the Apache License, Version 2.0 (the "License");
4 @rem Licensed under the Apache License, Version 2.0 (the "License");
5 @rem you may not use this file except in compliance with the License.
5 @rem you may not use this file except in compliance with the License.
6 @rem You may obtain a copy of the License at
6 @rem You may obtain a copy of the License at
7 @rem
7 @rem
8 @rem https://www.apache.org/licenses/LICENSE-2.0
8 @rem https://www.apache.org/licenses/LICENSE-2.0
9 @rem
9 @rem
10 @rem Unless required by applicable law or agreed to in writing, software
10 @rem Unless required by applicable law or agreed to in writing, software
11 @rem distributed under the License is distributed on an "AS IS" BASIS,
11 @rem distributed under the License is distributed on an "AS IS" BASIS,
12 @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 @rem See the License for the specific language governing permissions and
13 @rem See the License for the specific language governing permissions and
14 @rem limitations under the License.
14 @rem limitations under the License.
15 @rem
15 @rem
16 @rem SPDX-License-Identifier: Apache-2.0
17 @rem
16
18
17 @if "%DEBUG%" == "" @echo off
19 @if "%DEBUG%"=="" @echo off
18 @rem ##########################################################################
20 @rem ##########################################################################
19 @rem
21 @rem
20 @rem Gradle startup script for Windows
22 @rem Gradle startup script for Windows
21 @rem
23 @rem
22 @rem ##########################################################################
24 @rem ##########################################################################
23
25
24 @rem Set local scope for the variables with windows NT shell
26 @rem Set local scope for the variables with windows NT shell
25 if "%OS%"=="Windows_NT" setlocal
27 if "%OS%"=="Windows_NT" setlocal
26
28
27 set DIRNAME=%~dp0
29 set DIRNAME=%~dp0
28 if "%DIRNAME%" == "" set DIRNAME=.
30 if "%DIRNAME%"=="" set DIRNAME=.
31 @rem This is normally unused
29 set APP_BASE_NAME=%~n0
32 set APP_BASE_NAME=%~n0
30 set APP_HOME=%DIRNAME%
33 set APP_HOME=%DIRNAME%
31
34
35 @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37
32 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
38 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
33 set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
39 set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
34
40
35 @rem Find java.exe
41 @rem Find java.exe
36 if defined JAVA_HOME goto findJavaFromJavaHome
42 if defined JAVA_HOME goto findJavaFromJavaHome
37
43
38 set JAVA_EXE=java.exe
44 set JAVA_EXE=java.exe
39 %JAVA_EXE% -version >NUL 2>&1
45 %JAVA_EXE% -version >NUL 2>&1
40 if "%ERRORLEVEL%" == "0" goto init
46 if %ERRORLEVEL% equ 0 goto execute
41
47
42 echo.
48 echo. 1>&2
43 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
49 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
44 echo.
50 echo. 1>&2
45 echo Please set the JAVA_HOME variable in your environment to match the
51 echo Please set the JAVA_HOME variable in your environment to match the 1>&2
46 echo location of your Java installation.
52 echo location of your Java installation. 1>&2
47
53
48 goto fail
54 goto fail
49
55
50 :findJavaFromJavaHome
56 :findJavaFromJavaHome
51 set JAVA_HOME=%JAVA_HOME:"=%
57 set JAVA_HOME=%JAVA_HOME:"=%
52 set JAVA_EXE=%JAVA_HOME%/bin/java.exe
58 set JAVA_EXE=%JAVA_HOME%/bin/java.exe
53
59
54 if exist "%JAVA_EXE%" goto init
60 if exist "%JAVA_EXE%" goto execute
55
61
56 echo.
62 echo. 1>&2
57 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
63 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
58 echo.
64 echo. 1>&2
59 echo Please set the JAVA_HOME variable in your environment to match the
65 echo Please set the JAVA_HOME variable in your environment to match the 1>&2
60 echo location of your Java installation.
66 echo location of your Java installation. 1>&2
61
67
62 goto fail
68 goto fail
63
69
64 :init
65 @rem Get command-line arguments, handling Windows variants
66
67 if not "%OS%" == "Windows_NT" goto win9xME_args
68
69 :win9xME_args
70 @rem Slurp the command line arguments.
71 set CMD_LINE_ARGS=
72 set _SKIP=2
73
74 :win9xME_args_slurp
75 if "x%~1" == "x" goto execute
76
77 set CMD_LINE_ARGS=%*
78
79 :execute
70 :execute
80 @rem Setup the command line
71 @rem Setup the command line
81
72
82 set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73
83
74
84 @rem Execute Gradle
75 @rem Execute Gradle
85 "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
86
77
87 :end
78 :end
88 @rem End local scope for the variables with windows NT shell
79 @rem End local scope for the variables with windows NT shell
89 if "%ERRORLEVEL%"=="0" goto mainEnd
80 if %ERRORLEVEL% equ 0 goto mainEnd
90
81
91 :fail
82 :fail
92 rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
93 rem the _cmd.exe /c_ return code!
84 rem the _cmd.exe /c_ return code!
94 if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 set EXIT_CODE=%ERRORLEVEL%
95 exit /b 1
86 if %EXIT_CODE% equ 0 set EXIT_CODE=1
87 if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
88 exit /b %EXIT_CODE%
96
89
97 :mainEnd
90 :mainEnd
98 if "%OS%"=="Windows_NT" endlocal
91 if "%OS%"=="Windows_NT" endlocal
99
92
100 :omega
93 :omega
@@ -1,16 +1,15
1 {
1 {
2 "extends": "../tsconfig",
2 "extends": "../tsconfig",
3 "compilerOptions": {
3 "compilerOptions": {
4 "types": [
4 "types": [
5 "node"
5 "node"
6 ],
6 ],
7 "rootDir": "ts",
8 "rootDirs": [
7 "rootDirs": [
9 "ts",
8 "ts",
10 "../typings/main"
9 "../main/ts"
11 ]
10 ]
12 },
11 },
13 "include": [
12 "include": [
14 "ts/**/*.ts"
13 "ts/**/*.ts"
15 ]
14 ]
16 } No newline at end of file
15 }
@@ -1,164 +1,163
1 export interface Constructor<T = {}> {
1 export interface Constructor<T = {}> {
2 new(...args: any[]): T;
2 new(...args: any[]): T;
3 prototype: T;
3 prototype: T;
4 }
4 }
5
5
6 export type PromiseOrValue<T> = T | PromiseLike<T>;
6 export type PromiseOrValue<T> = T | PromiseLike<T>;
7
7
8 export type Factory<T = {}> = (...args: any[]) => T;
8 export type Factory<T = {}> = (...args: any[]) => T;
9
9
10 export type Predicate<T = any> = (x: T) => boolean;
10 export type Predicate<T = any> = (x: T) => boolean;
11
11
12 export type MatchingMemberKeys<T, U> = { [K in keyof T]: T[K] extends U ? K : never}[keyof T];
12 export type MatchingMemberKeys<T, U> = { [K in keyof T]: T[K] extends U ? K : never}[keyof T];
13
13
14 export type NotMatchingMemberKeys<T, U> = { [K in keyof T]: T[K] extends U ? never : K}[keyof T];
14 export type NotMatchingMemberKeys<T, U> = { [K in keyof T]: T[K] extends U ? never : K}[keyof T];
15
15
16 export type ExtractMembers<T, U> = Pick<T, MatchingMemberKeys<T, U>>;
16 export type ExtractMembers<T, U> = Pick<T, MatchingMemberKeys<T, U>>;
17
17
18 export type ExcludeMembers<T, U> = Pick<T, NotMatchingMemberKeys<T, U>>;
18 export type ExcludeMembers<T, U> = Pick<T, NotMatchingMemberKeys<T, U>>;
19
19
20 export interface MapOf<T> {
20 export interface MapOf<T> {
21 [key: string]: T;
21 [key: string]: T;
22 }
22 }
23
23
24 export interface IDestroyable {
24 export interface IDestroyable {
25 destroy(): void;
25 destroy(): void;
26 }
26 }
27
27
28 export interface IRemovable {
28 export interface IRemovable {
29 remove(): void;
29 remove(): void;
30 }
30 }
31
31
32 /**
32 /**
33 * Interface for the cancellation token. Cancellation token is
33 * Interface for the cancellation token. Cancellation token is
34 * a marker indicating that the cancellation was requested, it
34 * a marker indicating that the cancellation was requested, it
35 * is up to the operation to decide whether to interrupt or
35 * is up to the operation to decide whether to interrupt or
36 * to complete its execution.
36 * to complete its execution.
37 *
37 *
38 * This interface defines several methods of interaction with
38 * This interface defines several methods of interaction with
39 * the cancellation i.e. either to poll its status or to react
39 * the cancellation i.e. either to poll its status or to react
40 * through the callback.
40 * through the callback.
41 */
41 */
42 export interface ICancellation {
42 export interface ICancellation {
43 /**
43 /**
44 * Throws an exception if the cancellation has been requested,
44 * Throws an exception if the cancellation has been requested,
45 * otherwise does nothing.
45 * otherwise does nothing.
46 */
46 */
47 throwIfRequested(): void;
47 throwIfRequested(): void;
48
48
49 /**
49 /**
50 * Checks whether the cancellation is requested.
50 * Checks whether the cancellation is requested.
51 * @returns true is the cancellation has been requested,
51 * @returns true is the cancellation has been requested,
52 * otherwise returns false.
52 * otherwise returns false.
53 */
53 */
54 isRequested(): boolean;
54 isRequested(): boolean;
55
55
56 /**
56 /**
57 * Checks the ability of the token to be signaled.
57 * Checks the ability of the token to be signaled.
58 *
58 *
59 * @returns true if the token is able to request
59 * @returns true if the token is able to request
60 * the cancellation, false otherwise.
60 * the cancellation, false otherwise.
61 */
61 */
62 isSupported(): boolean;
62 isSupported(): boolean;
63
63
64 /**
64 /**
65 * Registers the callback to be called when the cancellation
65 * Registers the callback to be called when the cancellation
66 * is requested.
66 * is requested.
67 *
67 *
68 * @param cb The callback which receives the reason of the
68 * @param cb The callback which receives the reason of the
69 * cancellation.
69 * cancellation.
70 * @returns The subscription, after the operation is completed
70 * @returns The subscription, after the operation is completed
71 * it should unregister the callback to free resources by
71 * it should unregister the callback to free resources by
72 * calling the `destroy()` method of the subscription.
72 * calling the `destroy()` method of the subscription.
73 */
73 */
74 register(cb: (e: any) => void): IDestroyable;
74 register(cb: (e: any) => void): IDestroyable;
75 }
75 }
76
76
77 /**
77 /**
78 * Π˜Π½Ρ‚Π΅Ρ€Ρ„Π΅ΠΉΡ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΠ²Π°ΡŽΡ‰ΠΈΠΉ Π°ΡΠΈΠ½Ρ…Ρ€ΠΎΠ½Π½ΡƒΡŽ Π°ΠΊΡ‚ΠΈΠ²Π°Ρ†ΠΈΡŽ
78 * Π˜Π½Ρ‚Π΅Ρ€Ρ„Π΅ΠΉΡ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΈΠ²Π°ΡŽΡ‰ΠΈΠΉ Π°ΡΠΈΠ½Ρ…Ρ€ΠΎΠ½Π½ΡƒΡŽ Π°ΠΊΡ‚ΠΈΠ²Π°Ρ†ΠΈΡŽ
79 */
79 */
80 export interface IActivatable {
80 export interface IActivatable {
81 /**
81 /**
82 * @returns Boolean indicates the current state
82 * @returns Boolean indicates the current state
83 */
83 */
84 isActive(): boolean;
84 isActive(): boolean;
85
85
86 /**
86 /**
87 * Starts the component activation
87 * Starts the component activation
88 * @param ct cancellation token for this operation
88 * @param ct cancellation token for this operation
89 */
89 */
90 activate(ct?: ICancellation): Promise<void>;
90 activate(ct?: ICancellation): Promise<void>;
91
91
92 /**
92 /**
93 * Starts the component deactivation
93 * Starts the component deactivation
94 * @param ct cancellation token for this operation
94 * @param ct cancellation token for this operation
95 */
95 */
96 deactivate(ct?: ICancellation): Promise<void>;
96 deactivate(ct?: ICancellation): Promise<void>;
97
97
98 /**
98 /**
99 * Sets the activation controller for this component
99 * Sets the activation controller for this component
100 * @param controller The activation controller
100 * @param controller The activation controller
101 *
101 *
102 * Activation controller checks whether this component
102 * Activation controller checks whether this component
103 * can be activated and manages the active state of the
103 * can be activated and manages the active state of it.
104 * component
105 */
104 */
106 setActivationController(controller: IActivationController): void;
105 setActivationController(controller: IActivationController): void;
107
106
108 /** Indicates whether this component has an activation controller */
107 /** Indicates whether this component has an activation controller */
109 hasActivationController(): boolean;
108 hasActivationController(): boolean;
110
109
111 /**
110 /**
112 * Gets the current activation controller for this component
111 * Gets the current activation controller for this component
113 */
112 */
114 getActivationController(): IActivationController;
113 getActivationController(): IActivationController;
115 }
114 }
116
115
117 export interface IActivationController {
116 export interface IActivationController {
118 activating(component: IActivatable, ct?: ICancellation): Promise<void>;
117 activating(component: IActivatable, ct?: ICancellation): Promise<void>;
119
118
120 activated(component: IActivatable, ct?: ICancellation): Promise<void>;
119 activated(component: IActivatable, ct?: ICancellation): Promise<void>;
121
120
122 deactivating(component: IActivatable, ct?: ICancellation): Promise<void>;
121 deactivating(component: IActivatable, ct?: ICancellation): Promise<void>;
123
122
124 deactivated(component: IActivatable, ct?: ICancellation): Promise<void>;
123 deactivated(component: IActivatable, ct?: ICancellation): Promise<void>;
125
124
126 deactivate(ct?: ICancellation): Promise<void>;
125 deactivate(ct?: ICancellation): Promise<void>;
127
126
128 activate(component: IActivatable, ct?: ICancellation): Promise<void>;
127 activate(component: IActivatable, ct?: ICancellation): Promise<void>;
129
128
130 hasActive(): boolean;
129 hasActive(): boolean;
131
130
132 getActive(): IActivatable;
131 getActive(): IActivatable;
133 }
132 }
134
133
135 export interface IAsyncComponent {
134 export interface IAsyncComponent {
136 getCompletion(): Promise<void>;
135 getCompletion(): Promise<void>;
137 }
136 }
138
137
139 export interface ICancellable {
138 export interface ICancellable {
140 cancel(reason?: any): void;
139 cancel(reason?: any): void;
141 }
140 }
142
141
143 export interface IObservable<T> {
142 export interface IObservable<T> {
144 on(next: (x: T) => void, error?: (e: any) => void, complete?: () => void): IDestroyable;
143 on(next: (x: T) => void, error?: (e: any) => void, complete?: () => void): IDestroyable;
145 next(ct?: ICancellation): Promise<T>;
144 next(ct?: ICancellation): Promise<T>;
146 }
145 }
147
146
148 export interface IObserver<T> {
147 export interface IObserver<T> {
149 next(event: T): void;
148 next(event: T): void;
150
149
151 error(e: any): void;
150 error(e: any): void;
152
151
153 complete(): void;
152 complete(): void;
154 }
153 }
155
154
156 export interface TextWriter {
155 export interface TextWriter {
157 write(obj: any): void;
156 write(obj: any): void;
158 write(format: string, ...args: any[]): void;
157 write(format: string, ...args: any[]): void;
159
158
160 writeLine(obj?: any): void;
159 writeLine(obj?: any): void;
161 writeLine(format: string, ...args: any[]): void;
160 writeLine(format: string, ...args: any[]): void;
162
161
163 writeValue(value: any, spec?: string): void;
162 writeValue(value: any, spec?: string): void;
164 }
163 }
General Comments 0
You need to be logged in to leave comments. Login now