Gradle Allow duplicate sourceSets - kotlin

So what im trying to do is this:
I have my main resources that should be added first
I then have dev resources that should be able to overwrite the main
resources (to replace files with eg dev configs or dev icons)
Im doing this before building my jar like this:
sourceSets.getByName("main") {
resources.srcDir("src/main/resources-dev")
}
Sadly this fails because by default gradle doesnt want to overwrite files.
> Entry net/snipsniper/resources/img/systray/icon.png is a duplicate but no duplicate handling strategy has been set. Please refer to https://docs.gradle.org/7.5.1/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy for details.
So far ive tried to move the first code snippet into a copy task, where i could define a duplicateStrategy, that didnt change anything though.
I really just want the dev resources to be allowed to overwrite the base resources.

Related

how can I execute a three.js example in my project folder?

How can I execute a three.js example in my project folder? The example I want to execute is this:
https://threejs.org/examples/webgl_animation_keyframes.html
.
After installing three.js through npm, I copied example's source code:
https://github.com/mrdoob/three.js/blob/master/examples/webgl_animation_keyframes.html
in my empty examples folder located at '/node_modules/three/examples'.
I think there's a path direction problem importing some of including library files such as
"import { RoomEnvironment } from './jsm/environments/RoomEnvironment.js';"
"loader.load( 'models/gltf/LittlestTokyo.glb', function ( gltf )"
etc.
Do I have to copy those library files and paste it on the right path by hand? I'm afraid this is not a correct solution. Is there a solution something like, as I wish, downloading all necessary library files in the right places by input some npm command?
The situation is certainly not ideal, but here are some tips:
You can clone the whole repository so you have all the resources used by the examples: git clone --depth=1 https://github.com/mrdoob/three.js.git
You can use a web browser's web page saving feature (Ctrl+S) but be sure to replace the HTML with the example's source HTML, because it will be much cleaner. You'll need to fix up file path references, and it may still miss some resources. Also make sure not to get the iframe containing page, but rather the demo itself.
If Save Webpage As misses some resources, you can use Chrome's dev tools Network tab. Refresh the page to populate it, then right click inside the table > Copy > Copy All as CURL. This will give you a command you can paste in your terminal (in an empty directory, ideally) to download all the resources used by the webpage. This can still miss some resources that are dynamically loaded, such as with 1. the model selector in the LDraw Loader example, in which case you could switch to each model to purposely populate the network requests table, or 2. a fallback for older browsers, in which case you may not be able to get it through this method.
It's much easier to remove features than to add and combine them, so try to find an example that uses as many of the things you want as possible (without being overwhelmingly complex). It's worth looking outside of the official examples to real projects and third party experiments. Just note that they may not be up to date with the latest APIs.
I hope someone writes a script to automate setting up a Three.js project from an example... and posts a better answer than this!

How to execute the "AL:GO!" task as part of a script

Recently, my company started to focus Extension_v2 development for Dynamics NAV BC. We store our code in an internal Git-Server. So far, so good.
But startig a new project is still a very fiddly task. You have to create a repository, clone it, execute the AL Code-Task, move the files to the fitting location push the repository to the correct upstream etc. And all this does not include the first initial Steps (README, CHANGELOG and all other fundamental files...).
So I wanted to write a small PowerShell-Script, to do all these initial steps before being able to start working on the Project.
The Problem: I could not find a way to execute the "AL-GO!" task via script.
I have already searched the Internet and some forums for an answer... but it seems like microsoft did not consider the possibility to execute tasks from the AL-Language-Extension via script.
I also played around with the New-NAVAppManifest and the New-NAVAppManifestFile command for the old Extension_V1 development, but that did not do the trick.
I am looking for a fair and easy way to combine the creation of the app.json file and the launch.json file with other commands to easily initialize a new Project without haveing to write all commands manually. Maybe I did not recognize the easy solution. Or maybe this is just the way we have to do it in Extension_v2.
Anyway, thanks for all your help nevertheless.
Greetings.
Stay away from Ext V1. It's highly deprecated at this point.
First of all, why do you need to execute the "AL-Go!" via script? The "AL-Go!" command should already include all necessary steps to create an empty project including the launch.json and app.json. (minimal adjuments required dependent on your BC environment)
There is an extension/plugin for Git in Visual Studio Code which will handle all the repository stuff for you. You don't need to change file locations if everything is set up for Git. I rarely use it yet, but saw a demo for it on the Directions EMEA last year and I'm pretty sure it works at its current state (someone correct me if I'm wrong)
A way to implement the "AL-GO!" command for a script or for setting up additional steps in your project setup might be to write your own visual studio code extension/plugin which requires some additional know-how for that.
OR
You just change the settings/files of the default project, I bet there is at least a file for creating the initial AL project. Just change that to your requirements

Xcode build parameters

I am looking at compiling building a simple app I have wrote using Objective C. Currently all the application does it print 'hello [dev|production]' on screen.
What I would like to do is able to add a build parameter into xcode so that if I build it with a dev flag then the output would be 'hello dev' else the output would be 'hello production'.
Can someone give me an code example or link to a resource which will allow me to do this.
The idea is not to distingusish between DEBUG and PRODUCTION but rather to be able to add values into the build process which will change the compiled application output.
You can add another value to your preprocessor Macros, here:
If you want to add a another build configuration:
Edit 1:
The idea is not to distingusish between DEBUG and PRODUCTION but
rather to be able to add values into the build process which will
change the compiled application output.
Something you can do is to have two plist files, with all the values you want to use in your application. If you are in debug mode use debug.plist file, otherwise release.plist. This allows you to better control what are you using in your application for each build.
You can find the configurations here:
(I used PlotCreator as an example... It's an open source lib)

iOS, detect ad-hoc from code

I want to use a different API url for my iPhone app when I'm debugging or doing an ad-hoc deployment. Is there any way to detect from code (if adhoc) use this Url rather than the default one?
There are two ways I can think of:
1.) Conditional Compilation
Since you have to "Archive" the product to distribute the adhoc build, you might as well setup a new config for Archive and leverage the preprocessor.
2.) Alternate default .settings files based on Release/Debug/AdHoc.
Same suggestion as above, but using a .settings file instead of compilation. Personally, I'd recommend this over the conditional compilation because it can be changed (and saved) after deployment if you want to test other environments without redeploying.
EDIT
Conditional Compilation refers to using "ifdef" blocks right? I tried this once but couldn't get it to check for AD-HOC, only DEBUG seemed to work
Correct.
There is not an "ADHOC" macro defined by default. But you can easily add one.
Here's how you might go about setting up an additional configuration with a new preprocessor macro for your ADHOC builds:
Step 1: Setup a new Config (optional... you might just use Release... up to you).
Step 2: Add the preprocessor macro for that config. In my screenshot it only shows Debug and Release because I didn't actually add a new config. If you added a new Config (and called it something like "AdHoc", it should show up here as well:
Add ADHOC=1 just like the DEBUG=1 macro for the debug config.
Step 3: Either modify your current Scheme, or duplicate it, such that the "Archive" step uses your new configuration:

How to view results of a WebLogic Deployment Plan

I'm trying to use a weblogic deployment plan to add init-param values to a vendor-provided .war file's web.xml.
While I realize that I can open the .war file and just edit the file inside, I'd prefer to use a deployment plan to accomplish this as I will need to deploy the .war file to multiple servers with different values for the init-param in question.
I have found many examples of how to do this on-line, but my efforts are hit and miss. I think that if I could see the impact of the deployment plan on my deployed war file, I would be able to quickly figure out what I am doing wrong.
Is there a way for me to view the runtime deployment descriptors of a weblogic (10.3.3) application after the deployment plan has been applied?
I spent some time investigating this a while back, and although WL10 unpacks the WAR in a temporary directory, it does not modify the files listed in the deployment plan in that location. I also tried using getResource/getResourceAsStream to read the whole web.xml, and found it to be the original, unmodified file as well.
I never did figure out how WL applies the changes so that they get picked up by the ServletContext without them being visible anywhere else. My guess is that it's using some trickery to override the loading of those files and applying the changes dynamically.
After fighting with it for a while, I eventually settled on something like the following to list out the values of the init parameters on startup:
if (log.isTraceEnabled()) {
final Enumeration<String> names = context.getInitParameterNames();
while (names.hasMoreElements()) {
final String key = names.nextElement();
final String value = context.getInitParameter(key);
log.trace("Init Parameter '{}' = '{}'", key, value);
}
}
(Using slf4j for the logging)
Of course it doesn't help a bit if there's something wrong with the deployment plan and the values aren't being set, but it's the best I could come up with.
In 12.2.1 there is a DebugDeploymentPlan Server debug setting, if on, the server logs something like
<After applying the overrides from the deployment plan, the descriptor "META-INF/ejb-jar.xml" is: