Webpack Custom resolve dependency based on d.ts of compiled bundle - asp.net-mvc

this is the first time i ask a question on stackoverflow, so i apologize in advance if i write something strange and thanks everyone for the help.
I have implemented a modular solution based on Asp.Net MVC 5, TypeScript 2.2.0 and Angular 4.0.0 compiled with Webpack 3.0.0.
It has a Main application (MVC) that must host external Modules that are other MVC applications with own backend Web Apis and own Angular components.
My goal is to compile and deploy single module without having source code of others Modules or Main app source code, but using just compiled bundles and definitely types.
In this way i can deploy only my module (bundle.js and dlls) in append to the main application.
The process should be:
Compile Main App
Deploy on Server
Compile Module1
Copy bin dll on Main App bin
Copy Module1 js bundle on Main App scripts folder
and so on...
I'm just able with webpack to compile single module and resolve same names using last generated "records.json" file.
The problem is when i want to use a component of other module. I have to import class using d.ts generated from other module:
/// <reference path="../../../typings/module1.d.ts" />
import { HttpWrapperService } from "Module1/App/http-wrapper/http-wrapper.service";
But when Webpack encounter import statement it can't resolve module because there is no source code of http-wrapper.service, and return this error:
Module not found: Error: Can't resolve 'Module1/App/http-wrapper/http-wrapper.service' in 'C:\svn\AngularApp\Module2\App\users'
How can i tell to Webpack to resolve the module name imported from d.ts using "records.json" file?
Maybe with a plugin?
Solution has a structure like this:
Root
|--- Main (MVC App)
| |
| |--- Manifest.js
| |--- Vendor.js (bundle of all third party libraries like Angular or jQuery)
| |--- Polyfills.js
| |--- App.js (bundle of main app)
|
|--- typings
| |
| |--- app.d.ts
| |--- module1.d.ts
| |--- module2.d.ts
|
|--- Module1
| |
| |--- App
| |
| |--- http-wrapper
| |
| |--- http-wrapper.service.ts
|
|--- Module2
|
|--- App
|
|--- users
|
|--- users.component.ts
|--- users.service.ts

Related

electron-packager Cannot read property 'info' of undefined

I was trying to create package of legacy electron app using electron-packager but got an error like below. I have search several questions in stackoverflow with no luck.
electron-packager . MyApp --platform=win32 --arch=x64 --no-prune --overwrite --ignore=/node_modules
Packaging app for platform win32 x64 using electron v3.1.13
Cannot read property 'info' of undefined
Below are the installed package in the project:
+-- electron-builder#20.44.4
+-- electron-json-storage#4.1.6
+-- electron-packager#15.5.2
+-- electron-winstaller#3.0.4
+-- electron#3.1.13
+-- history#4.9.0
+-- macaddress#0.2.9
+-- moment#2.29.4
+-- node-sass#4.14.1
+-- rc-tooltip#3.7.3
+-- react-bootstrap#1.6.6
+-- react-dom#16.8.4
+-- react-redux#6.0.1
+-- react-router-dom#4.3.1
+-- react-router#4.3.1
+-- react-scripts#2.1.5
+-- react#16.8.3
`-- redux#4.0.1
electron-packager#15.5.2 caused the same issue for me. A slight downgrade to electron-packager#15.5.1 made it working again!
Same here, electron-packager#15.5.2 caused the same issue for me.
From my side, I upgraded to electron-packager#16.0.0 to made it working again.
I did not find a related issue on GitHub.
In the end I change tools and follow according to electron documentation about application packaging. I change to electron-forge and follow the steps. It works better than packager.

iOS cordova project - Group plugin files in folder under Plugins/

I'm writing a cordova ios plugin, I managed to set the plugin.xml file correctly in order to work and import my plugin inside the project with
cordova plugin add myplugin --searchpath=path/to/my/plugin --save
command. What I'd like to do now is to group all the plugin files inside a folder.
For example, having these 2 files (snippet from plugin.xml)
...
<source-file src="src/ios/MyPlugin.m" />
<source-file src="src/ios/MyPlugin.h" />
...
I'd like to group them under MyPlugin folder, inside the iOS project Plugins folder:
MY_PROJECT
|-- www/
|-- Staging/
|-- Classes/
|-- Plugins/
| |-- MyPlugin/ <!-- HERE -->
| | |-- MyPlugin.m
| | |-- MyPlugin.h
| |-- SomeOtherPlugin.m
| |-- Foo.h
|-- Other Sources/
|-- Resources/
|-- Framework/
|-- Products/
Right now, cordova's CLI plugin manager seems to throw any plugin file inside the Plugins folder, despite the plugin they belong to.
Is there anything equivalent to Android's target-dir attribute for iOS? Any hint?
Thanks in advance
First , based on the official document : ios also support <source-file src="src/ios/MyPlugin.m" target-dir="xxxxx"/> , however cordova just copy the file to "xxxxx" folder in the file system , which could not be reflected to Xcode project structure.
Actually what you want is to specify "Group" for ios source file , while
unfortunately , currently it seems cordova doesn't support it

Resolving transitive dependencies from Artifactory in gradle

My project has two modules, lib and lib-api, with the following responsibilities
lib-api - a pure java module that only contains interface files
lib - an android library
and I'd like to jenkins publish both modules (as jars) to an internal artifactory server for other projects to be able consume.
Using the Jenkins Artifactory Plugin, I was able to publish jars for both modules to artifactory, but my other project that depends on lib fails to build with the following gradle error
Could not find com.mygroup:lib-api:1.0.0-SNAPSHOT
My setup
Build scripts
lib-api/build.gradle
apply plugin: 'java'
apply plugin: 'maven-publish'
group = 'com.mygroup'
version = project.version
publishing {
publications {
api(MavenPublication) {
from components.java
}
}
}
lib/build.gradle
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
android { ... }
dependencies {
compile project(':lib-api')
}
group = 'com.mygroup'
version = project.version
Jenkins Artifactory plugin config
Gradle-Artifactory Integration
Publish artifacts to Artifactory
Publish Maven descriptors
Use Maven compatible patterns
Invoke Gradle script
Use Gradle Wrapper
Tasks: clean assemble -x preDexDebug -x preDexDAT -x preDexRelease
Result in Artifactory repo
+-- libs-snapshot-local
| +-- com
| | +-- mygroup
| | | +-- lib
| | | | +-- 1.0.0-SNAPSHOT
| | | | | `-- lib-1.0.0-20150508-1.jar
| | | | | `-- lib-1.0.0-20150508-1.pom
| | | | | `-- maven-metadata.xml
| | | | `-- maven-metadata.xml
| | | +-- lib-api
| | | | +-- 1.0.0-SNAPSHOT
| | | | | `-- lib-1.0.0-20150508-1.jar
Question
My understanding is that artifactory/gradle should be smart enough to resolve -SNAPSHOT into the latest timestamped snapshot and that seems to be borne out by the fact that it manages to resolve lib whether I specify latest.integration or 1.0.0-SNAPSHOT
How can I get gradle to resolve this transitive snapshot dependency from artifactory? Or get the artifactory plugin to publish the jar in such a way that gradle can resolve it?
Working theory
I noticed that the lib-api folder doesn't have a maven-metadata.xml file and the snapshot version folder doesn't have one either... or pom file. I suspect this might be the issue.
Artifactory's Jenkins plugin uses the gradle artifactory plugin under the hood for jobs that have Gradle-Artifactory integration enabled. According to the gradle artifactory plugin docs the plugin ID changes depending on whether you are using the new (maven-publish) or old (maven) publishing mechanism.
Could this be the issue? Is the Artifactory plugin applying the wrong plugin ID, perhaps because it is making it's decision based on the android library module?
tl;dr Switching to the old maven plugin for gradle fixed it.
My lib-api/build.gradle now looks like this
apply plugin: 'java'
apply plugin: 'maven'
group = 'com.mygroup'
version = project.version
ext.artifactId = project.name.toLowerCase()
project.archivesBaseName = project.artifactId
uploadArchives {
repositories {
mavenDeployer {
pom.artifactId = project.artifactId
}
}
}
Note: According to the gradle docs for the maven plugin, pom.artifactId must be explicitly defined if you've set archivesBaseName. That may have been the underlying issue with my previous configuration, but I did not go back and test it.

Grails V2.3.7 starts up application automatically during test-app functional:

I recently upgraded Grails to V2.3.7 and noticed that when I ran grails test-app functional: the application would be started up automatically like so:
:grails-test-app-functional
| Loading Grails 2.3.7
| Configuring classpath
| Running pre-compiled script
| Running pre-compiled script.
| Environment set to test
| Environment set to test.
| Environment set to test..
| Environment set to test...
| Environment set to test....
| Environment set to test.....
| Compiling 1 source files
| Compiling 1 source files.
| Compiling 1 source files..
| Compiling 1 source files...
| Compiling 1 source files....
| Compiling 1 source files.....
| Running Grails application
Configuring Spring Security Core ...
... finished configuring Spring Security Core
| Server running. Browse to http://localhost:8080/myApplication
This did not happen in V2.3.6. My questions are:
1) Is this new in V2.3.7 or did I configure something unknowingly?
2) How do I disable this auto running of the app?
Thanks.
The app has to be started in order to run your functional tests. The functional tests interact with the running app. This has always been the case.

Why do I get many repeated compiling messages during a grails build in intelliJ

Here's the build console trace when I launch a grails 2.0 app in intellij in debug mode. It didn't used to be so verbose in grails 1.3.4
"C:\Program Files\Java\jdk1.6.0_22\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:57461,suspend=y,server=n -Dgrails.home=C:\grails-2.0.0.M2 -Dbase.dir=C:\apps\myapp "-Dtools.jar=C:\Program Files\Java\jdk1.6.0_22\lib\tools.jar" -Dgroovy.starter.conf=C:\grails-2.0.0.M2/conf/groovy-starter.conf -Xmx1G -Xms356m -XX:MaxPermSize=356m -javaagent:C:\Users\aressler\.IntelliJIdea10\system\groovyHotSwap\gragent.jar -Dfile.encoding=windows-1252 -classpath "C:\grails-2.0.0.M2\lib\org.codehaus.groovy\groovy-all\jars\groovy-all-1.8.2.jar;C:\grails-2.0.0.M2\dist\grails-bootstrap-2.0.0.M2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 10.5.2\lib\idea_rt.jar" org.codehaus.groovy.grails.cli.support.GrailsStarter --main org.codehaus.groovy.grails.cli.GrailsScriptRunner --conf C:\grails-2.0.0.M2/conf/groovy-starter.conf "-Dserver.port=80 run-app"
Connected to the target VM, address: '127.0.0.1:57461', transport: 'socket'
| Loading Grails 2.0.0.M2
| Configuring classpath
| Configuring classpath.
| Environment set to development
| Environment set to development.
| Environment set to development..
| Environment set to development...
| Environment set to development....
| Environment set to development.....
| Packaging Grails application
| Packaging Grails application.
| Packaging Grails application..
| Compiling 3 source files
| Compiling 3 source files.
| Compiling 3 source files..
| Compiling 1 source files
| Compiling 1 source files.
| Compiling 1 source files..
| Compiling 1 source files...
| Compiling 1 source files....
| Compiling 1 source files.....
| Running Grails application
This is on a build where I had made no changes from the last restart. Am I wasting lots of time on each restart with it doing wasted extra packaging and compiling?
Grails 2 is not doing any more work. The reason for the repeated lines is that the new Grails 2 console is telling you that it is still working and progress is being made by adding a new period at the end of the current message.
When working in IntelliJ with Grails 2 I use --verbose and --plain-output to get legacy style logging. The Grails 2 console uses JLine for a more rich command line experience but the IntelliJ console isn't exactly comparable. I throw on --stacktrace for good measure as well when using IntelliJ.
I've created request in IntelliJ tracker to make -plain-output option by default.

Resources